Lines Matching refs:domain
103 typedef struct domain { struct
113 struct domain *next; argument
361 destroy_domain(domain_t *domain) { in destroy_domain() argument
366 for (ptr = domain->trans_to_raw[i]; ptr;) { in destroy_domain()
372 domain->trans_to_raw[i] = NULL; in destroy_domain()
376 for (ptr = domain->raw_to_trans[i]; ptr;) { in destroy_domain()
385 domain->raw_to_trans[i] = NULL; in destroy_domain()
387 while (domain->base_classifications) { in destroy_domain()
388 base_classification_t *next = domain->base_classifications->next; in destroy_domain()
389 free(domain->base_classifications->trans); in destroy_domain()
390 ebitmap_destroy(&domain->base_classifications->level->cat); in destroy_domain()
391 free(domain->base_classifications->level); in destroy_domain()
392 free(domain->base_classifications); in destroy_domain()
393 domain->base_classifications = next; in destroy_domain()
395 pcre_free(domain->base_classification_regexp); in destroy_domain()
396 while (domain->groups) in destroy_domain()
397 destroy_group(&domain->groups, domain->groups); in destroy_domain()
398 free(domain->name); in destroy_domain()
399 free(domain); in destroy_domain()
406 domain_t *domain = calloc(1, sizeof(domain_t)); in create_domain() local
407 if (!domain) { in create_domain()
410 domain->name = strdup(name); in create_domain()
411 if (!domain->name) { in create_domain()
418 *d = domain; in create_domain()
420 return domain; in create_domain()
424 destroy_domain(domain); in create_domain()
603 add_base_classification(domain_t *domain, char *raw, char *trans) { in add_base_classification() argument
620 for (i=&domain->base_classifications; *i; i=&(*i)->next) in add_base_classification()
630 add_cache(domain_t *domain, char *raw, char *trans) { in add_cache() argument
644 if (add_to_hashtable(domain->raw_to_trans, map->raw, map) < 0) in add_cache()
647 if (add_to_hashtable(domain->trans_to_raw, map->trans, map) < 0) in add_cache()
722 static domain_t *domain; in process_trans() local
777 domain = create_domain(tok); in process_trans()
782 if (!domain) { in process_trans()
783 domain = create_domain("Default"); in process_trans()
784 if (!domain) in process_trans()
815 group = create_group(&domain->groups, tok); in process_trans()
845 if (add_base_classification(domain, raw, tok) < 0) { in process_trans()
850 if (add_cache(domain, raw, tok) < 0) in process_trans()
933 find_in_hashtable(const char *range, domain_t *domain, context_map_node_t **table) { in find_in_hashtable() argument
937 trans = strdup((table == domain->raw_to_trans) ? map->trans: map->raw); in find_in_hashtable()
984 build_regexps(domain_t *domain) { in build_regexps() argument
993 for (n_el = 0, bc = domain->base_classifications; bc; bc = bc->next) { in build_regexps()
1003 for (i=0, bc = domain->base_classifications; bc; bc = bc->next) { in build_regexps()
1016 log_debug(">>> %s classification regexp=%s\n", domain->name, buffer); in build_regexps()
1017 build_regexp(&domain->base_classification_regexp, buffer); in build_regexps()
1019 for (g = domain->groups; g; g = g->next) { in build_regexps()
1028 log_debug(">>> %s %s prefix regexp=%s\n", domain->name, g->name, buffer); in build_regexps()
1069 log_debug(">>> %s %s modifier regexp=%s\n", domain->name, g->name, buffer); in build_regexps()
1079 log_debug(">>> %s %s suffix regexp=%s\n", domain->name, g->name, buffer); in build_regexps()
1088 compute_raw_from_trans(const char *level, domain_t *domain) { in compute_raw_from_trans() argument
1116 if (!domain->base_classification_regexp) in compute_raw_from_trans()
1117 if (build_regexps(domain) < 0) in compute_raw_from_trans()
1119 if (!domain->base_classification_regexp) in compute_raw_from_trans()
1122 …rc = pcre_exec(domain->base_classification_regexp, 0, work, work_len, 0, PCRE_ANCHORED, ovector, O… in compute_raw_from_trans()
1128 for (bc = domain->base_classifications; bc; bc = bc->next) { in compute_raw_from_trans()
1160 for (g = domain->groups; g && !change && !complete; g = g->next) { in compute_raw_from_trans()
1280 compute_trans_from_raw(const char *level, domain_t *domain) { in compute_trans_from_raw() argument
1319 for (bc = domain->base_classifications; bc && !done; bc = bc->next) { in compute_trans_from_raw()
1334 for (g = domain->groups; g; g = g->next) { in compute_trans_from_raw()
1364 for (g = domain->groups; g && hamming; g = g->next) { in compute_trans_from_raw()
1504 domain_t *domain = domains; in trans_context() local
1505 for (;domain; domain = domain->next) { in trans_context()
1506 trans = find_in_hashtable(range, domain, domain->raw_to_trans); in trans_context()
1518 trans = compute_trans_from_raw(range, domain); in trans_context()
1520 if (add_cache(domain, range, trans) < 0) in trans_context()
1525 ltrans = find_in_hashtable(lrange, domain, domain->raw_to_trans); in trans_context()
1527 ltrans = compute_trans_from_raw(lrange, domain); in trans_context()
1529 if (add_cache(domain, lrange, ltrans) < 0) in trans_context()
1540 utrans = find_in_hashtable(urange, domain, domain->raw_to_trans); in trans_context()
1542 utrans = compute_trans_from_raw(urange, domain); in trans_context()
1544 if (add_cache(domain, urange, utrans) < 0) in trans_context()
1612 domain_t *domain = domains; in untrans_context() local
1613 for (;domain; domain = domain->next) { in untrans_context()
1614 raw = find_in_hashtable(range, domain, domain->trans_to_raw); in untrans_context()
1626 raw = compute_raw_from_trans(range, domain); in untrans_context()
1628 char *canonical = find_in_hashtable(raw, domain, domain->raw_to_trans); in untrans_context()
1630 canonical = compute_trans_from_raw(raw, domain); in untrans_context()
1632 if (add_cache(domain, raw, canonical) < 0) in untrans_context()
1637 if (add_cache(domain, raw, range) < 0) in untrans_context()
1645 lraw = find_in_hashtable(lrange, domain, domain->trans_to_raw); in untrans_context()
1647 lraw = compute_raw_from_trans(lrange, domain); in untrans_context()
1649 char *canonical = find_in_hashtable(lraw, domain, domain->raw_to_trans); in untrans_context()
1651 canonical = compute_trans_from_raw(lraw, domain); in untrans_context()
1653 if (add_cache(domain, lraw, canonical) < 0) in untrans_context()
1658 if (add_cache(domain, lraw, lrange) < 0) in untrans_context()
1669 uraw = find_in_hashtable(urange, domain, domain->trans_to_raw); in untrans_context()
1671 uraw = compute_raw_from_trans(urange, domain); in untrans_context()
1673 char *canonical = find_in_hashtable(uraw, domain, domain->raw_to_trans); in untrans_context()
1675 canonical = compute_trans_from_raw(uraw, domain); in untrans_context()
1677 if (add_cache(domain, uraw, canonical) < 0) in untrans_context()
1682 if (add_cache(domain, uraw, urange) < 0) in untrans_context()