import "all.hff"; extern fn xmalloc(n usize) *void { let p = malloc(n); assert(p != #null, "malloc"); return p; } extern fn xrealloc(p *void, n usize) *void { let p = realloc(p, n); assert(p != #null, "realloc"); return p; } extern fn fnv1a(h u32, d [#]const u8) u32 { foreach(i, x, d, h ^= x; h *= 0x01000193; ) return h; } extern fn fnv1a_s(h u32, str *const u8) u32 { while *str != 0 { h ^= *str++; h *= 0x01000193; } return h; } static filepaths [64]*const u8 = {}; static nfilepaths int = 0; extern fn addfilepath(s *const u8) int { let i0 = fnv1a_s(FNV1A_INI, s) % filepaths.#len; let i int = i0; do { if filepaths[i] == #null { break; } else if streq(filepaths[i], s) { return i; } } while ++i != i0; assert(nfilepaths++ < filepaths.#len, "too many files"); filepaths[i] = s; return i; }