Lines Matching +defs:table +defs:list

75 scratch, we can precompute the prioritized list of database levels once, then
76 search for each resource starting at the beginning of the list.
84 same database level occurring multiple times on the search list. The code below
103 The next pointer of the top-level node table points to the top-level leaf
104 table, if any.
166 * so that resizing can be done without invalidating a search list.
172 NTableRec table;
176 #define LeafHash(le,q) (le)->buckets[(q) & (le)->table.mask]
178 /* An XrmDatabase just holds a pointer to the first top-level table.
185 NTable table;
199 /* closure used in get search list */
201 LTable *list; /* search list */
206 /* placed in XrmSearchList to indicate next table is loose only */
214 XrmBindingList bindings; /* binding list */
215 XrmQuarkList quarks; /* quark list */
221 NTable table,
226 NTable table,
231 NTable table,
237 /* predicate to determine when to resize a hash table */
252 entry = NodeHash(table, q); \
501 db->table = (NTable)NULL;
523 for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) {
564 /* grow the table, based on current number of entries */
568 register NTable table;
571 table = *prev;
572 i = table->mask;
575 while (i < 255 && GrowthPred(table->entries, i))
578 if (table->leaf) {
582 ltable = (LTable)table;
590 ltable->table.mask = i - 1;
598 *ntable = *table;
601 MoveTables(table, ntable);
619 if (ftable->table.hasloose)
620 ttable->table.hasloose = 1;
621 for (i = ftable->table.mask, bucket = ftable->buckets;
644 ttable->table.entries++;
675 ttable->table.entries++;
771 if ((ftable = from->table)) {
772 prev = &(*into)->table;
779 /* bump to into's leaf table, if any */
782 /* into has no node table, link from's in */
786 /* bump to from's leaf table, if any */
789 /* bump to into's leaf table, if any */
824 register NTable table;
831 table = Xmalloc(sizeof(LTableRec)); \
832 if (!table) \
834 table->name = q; \
835 table->hasloose = 0; \
836 table->hasany = 0; \
837 table->mask = 0; \
838 table->entries = 0; \
840 table->leaf = 0; \
841 nprev = NodeBuckets(table); \
843 table->leaf = 1; \
845 Xfree(table); \
848 ((LTable)table)->buckets = (VEntry *)nprev; \
851 table->next = *prev; \
852 *prev = table
856 table = *(prev = &db->table);
857 /* if already at leaf, bump to the leaf table */
858 if (!quarks[1] && table && !table->leaf)
859 table = *(prev = &table->next);
861 if (!table || (quarks[1] && table->leaf)) {
862 /* no top-level node table, create one and chain it in */
864 table->tight = 1; /* arbitrary */
870 table = *(prev = &NodeHash(table, q));
871 while (table && table->name != q)
872 table = *(prev = &table->next);
873 if (!table)
876 if (table->leaf)
879 if (!table->leaf) {
880 /* bump to leaf table, if any */
881 table = *(prev = &table->next);
882 if (!table || table->name != q)
884 if (!table->leaf) {
885 /* bump to leaf table, if any */
886 table = *(prev = &table->next);
887 if (!table || table->name != q)
893 if (!table->tight)
896 if (table->tight) {
897 /* bump to loose table, if any */
898 table = *(prev = &table->next);
899 if (!table || table->name != q ||
900 !quarks[2] != table->leaf)
912 entry = *(vprev = &LeafHash((LTable)table, q));
939 /* keep the top table, because we may have to grow it */
943 /* build a new table and chain it in */
948 table->tight = 1;
950 table->tight = 0;
1328 * I now have a quark and binding list for the entire left hand
1697 /* call the user proc for every value in the table, arbitrary order.
1702 LTable table,
1715 closure->bindings[level] = (table->table.tight ?
1717 closure->quarks[level] = table->table.name;
1721 for (i = table->table.mask, bucket = table->buckets;
1748 NTable table,
1759 for (i = table->mask, bucket = NodeBuckets(table);
1778 /* recurse on every table in the table, arbitrary order.
1782 NTable table,
1792 NTable table,
1844 closure->bindings[level] = (table->tight ?
1846 closure->quarks[level] = table->name;
1849 if (EnumAllNTable(table, level, closure))
1861 if (table->hasloose && closure->mode == XrmEnumAllLevels) {
1866 for (i = table->mask, bucket = NodeBuckets(table);
1890 if (table->hasany) {
1893 if (table->hasloose) {
1905 if (table->hasany) {
1914 entry = table->next;
1918 if (entry->tight && !table->tight)
1925 if (!entry || entry->name != table->name)
1932 if (entry->tight && entry == table->next && (entry = entry->next) &&
1933 entry->name == table->name && (!*names || entry->hasloose))
1954 register NTable table;
1967 table = db->table;
1968 if (table && !table->leaf && !*names && mode == XrmEnumOneLevel)
1969 table = table->next;
1970 if (table) {
1971 if (!table->leaf)
1972 retval = EnumNTable(table, names, classes, 0, &eclosure);
1974 retval = EnumLTable((LTable)table, names, classes, 0, &eclosure);
2049 NTable table,
2063 if (table->leaf)
2064 EnumLTable((LTable)table, &empty, &empty, 0, &closure);
2066 EnumNTable(table, &empty, &empty, 0, &closure);
2131 /* add tight/loose entry to the search list, return True if list is full */
2134 LTable table,
2140 if (closure->idx >= 0 && closure->list[closure->idx] == table)
2146 closure->list[closure->idx] = table;
2150 /* add loose entry to the search list, return True if list is full */
2153 LTable table,
2159 if (closure->idx >= 0 && closure->list[closure->idx] == table)
2165 closure->list[closure->idx] = LOOSESEARCH;
2167 closure->list[closure->idx] = table;
2171 /* search for a leaf table */
2173 NTable table,
2182 NTable table,
2196 if (table->hasany) {
2199 if (table->hasloose) {
2211 if (table->hasany) {
2217 entry = table->next;
2221 if (entry->tight && !table->tight)
2228 if (!entry || entry->name != table->name)
2234 if (entry->tight && entry == table->next && (entry = entry->next) &&
2235 entry->name == table->name && entry->hasloose)
2247 register NTable table;
2252 closure.list = (LTable *)searchList;
2257 table = db->table;
2259 if (table && !table->leaf) {
2260 if (SearchNEntry(table, names, classes, &closure)) {
2264 } else if (table && table->hasloose &&
2265 AppendLooseLEntry((LTable)table, names, classes,
2271 if (table && !table->leaf)
2272 table = table->next;
2273 if (table &&
2274 AppendLEntry((LTable)table, names, classes, &closure)) {
2281 closure.list[closure.idx + 1] = (LTable)NULL;
2292 register LTable *list;
2293 register LTable table;
2299 entry = LeafHash(table, q); \
2307 entry = LeafHash(table, q); \
2317 list = (LTable *)searchList;
2326 table = (LTable)NULL;
2329 while ((table = *list++)) {
2330 if (table != LOOSESEARCH) {
2334 table = *list++;
2343 while ((table = *list++)) {
2344 if (table != LOOSESEARCH) {
2347 table = *list++;
2352 if (table) {
2375 LTable table,
2385 entry = LeafHash(table, q);
2391 entry = LeafHash(table, q);
2410 LTable table,
2420 entry = LeafHash(table, q); \
2452 NTable table,
2461 NTable table,
2476 if (table->hasany) {
2479 if (table->hasloose) {
2491 if (table->hasany) {
2497 otable = table;
2498 table = table->next;
2499 if (!table)
2501 if (table->leaf) {
2502 if (table->tight && !otable->tight)
2503 table = table->next;
2505 table = table->next;
2506 if (!table || !table->tight)
2509 if (!table || table->name != otable->name)
2512 if (table->hasloose &&
2513 GetLooseVEntry((LTable)table, names, classes, closure))
2515 if (table->tight && table == otable->next) {
2516 table = table->next;
2517 if (table && table->name == otable->name && table->hasloose)
2518 return GetLooseVEntry((LTable)table, names, classes, closure);
2530 register NTable table;
2537 table = db->table;
2539 if (table && !table->leaf) {
2540 if (GetNEntry(table, names, classes, &closure)) {
2544 } else if (table && table->hasloose &&
2545 GetLooseVEntry((LTable)table, names, classes, &closure)) {
2550 if (table && !table->leaf)
2551 table = table->next;
2552 if (table && GetVEntry((LTable)table, names, classes, &closure)) {
2581 /* destroy all values, plus table itself */
2583 LTable table)
2589 buckets = table->buckets;
2590 for (i = table->table.mask; i >= 0; i--, buckets++) {
2596 Xfree(table->buckets);
2597 Xfree(table);
2600 /* destroy all contained tables, plus table itself */
2602 NTable table)
2608 buckets = NodeBuckets(table);
2609 for (i = table->mask; i >= 0; i--, buckets++) {
2618 Xfree(table);
2635 register NTable table, next;
2639 for (next = db->table; (table = next); ) {
2640 next = table->next;
2641 if (table->leaf)
2642 DestroyLTable((LTable)table);
2644 DestroyNTable(table);