Lines Matching +full:im +full:-
17 * Allocation-based version of the mandoc database, for read-write access.
61 /*** top-level functions **********************************************/
68 int32_t im;
71 dba->pages = dba_array_new(npages, DBA_GROW);
72 dba->macros = dba_array_new(MACRO_MAX, 0);
73 for (im = 0; im < MACRO_MAX; im++) {
77 dba_array_set(dba->macros, im, macro);
90 dba_array_FOREACH(dba->macros, macro) {
93 dba_array_free(entry->pages);
99 dba_array_free(dba->macros);
101 dba_array_undel(dba->pages);
102 dba_array_FOREACH(dba->pages, page) {
110 dba_array_free(dba->pages);
117 * - One integer each for magic and version.
118 * - One pointer each to the macros table and to the final magic.
119 * - The pages table.
120 * - The macros table.
121 * - And at the very end, the magic integer again.
129 if (dba_open(fname) == -1)
130 return -1;
134 dba_pages_write(dba->pages);
136 dba_macros_write(dba->macros);
142 if (dba_close() == -1) {
146 return -1;
259 * - One integer containing the number of pages.
260 * - For each page, five pointers to the names, sections,
263 * - One list each for names, sections, architectures, descriptions and
267 * - To assure alignment of following integers,
320 return (diff = *cp2 - *cp1) ? diff :
352 memcpy(&entry->value, value, len);
353 entry->pages = dba_array_new(np, DBA_GROW);
361 * converting them from the on-disk format (byte offsets in the file)
365 dba_macro_new(struct dba *dba, int32_t im, const char *value,
376 entry = get_macro_entry(dba_array_get(dba->macros, im), value, np);
378 dba_array_add(entry->pages, dba_array_get(dba->pages,
379 be32toh(*ip) / 5 / sizeof(*ip) - 1));
384 * directly taking the in-memory page pointer as an argument.
387 dba_macro_add(struct dba_array *macros, int32_t im, const char *value,
394 entry = get_macro_entry(dba_array_get(macros, im), value, 1);
395 dba_array_add(entry->pages, page);
400 * - The number of macro tables (actually, MACRO_MAX).
401 * - That number of pointers to the individual macro tables.
402 * - The individual macro tables.
408 int32_t im, pos_macros, pos_end;
411 im = 0;
413 dba_array_setpos(macros, im++, dba_tell());
424 * - The number of entries in the table.
425 * - For each entry, two pointers, the first one to the value
427 * - A list of values, each ending in a NUL byte.
428 * - To assure alignment of following integers,
430 * - A list of pointers to pages, each list ending in a 0 integer.
449 /* Build a list of non-empty entries and sort it. */
455 dba_array_FOREACH(entry->pages, page)
472 dba_str_write(entries[ie]->value);
480 dba_array_FOREACH(entries[ie]->pages, page)
508 return strcmp(ep1->value, ep2->value);