1*9508192eSchristos /* Id: dba.h,v 1.2 2016/08/17 20:46:56 schwarze Exp */ 2*9508192eSchristos /* 3*9508192eSchristos * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 4*9508192eSchristos * 5*9508192eSchristos * Permission to use, copy, modify, and distribute this software for any 6*9508192eSchristos * purpose with or without fee is hereby granted, provided that the above 7*9508192eSchristos * copyright notice and this permission notice appear in all copies. 8*9508192eSchristos * 9*9508192eSchristos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10*9508192eSchristos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11*9508192eSchristos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12*9508192eSchristos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13*9508192eSchristos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14*9508192eSchristos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15*9508192eSchristos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16*9508192eSchristos * 17*9508192eSchristos * Public interface of the allocation-based version 18*9508192eSchristos * of the mandoc database, for read-write access. 19*9508192eSchristos * To be used by dba.c, dba_read.c, and makewhatis(8). 20*9508192eSchristos */ 21*9508192eSchristos 22*9508192eSchristos #define DBP_NAME 0 23*9508192eSchristos #define DBP_SECT 1 24*9508192eSchristos #define DBP_ARCH 2 25*9508192eSchristos #define DBP_DESC 3 26*9508192eSchristos #define DBP_FILE 4 27*9508192eSchristos #define DBP_MAX 5 28*9508192eSchristos 29*9508192eSchristos struct dba_array; 30*9508192eSchristos 31*9508192eSchristos struct dba { 32*9508192eSchristos struct dba_array *pages; 33*9508192eSchristos struct dba_array *macros; 34*9508192eSchristos }; 35*9508192eSchristos 36*9508192eSchristos 37*9508192eSchristos struct dba *dba_new(int32_t); 38*9508192eSchristos void dba_free(struct dba *); 39*9508192eSchristos struct dba *dba_read(const char *); 40*9508192eSchristos int dba_write(const char *, struct dba *); 41*9508192eSchristos 42*9508192eSchristos struct dba_array *dba_page_new(struct dba_array *, const char *, 43*9508192eSchristos const char *, const char *, enum form); 44*9508192eSchristos void dba_page_add(struct dba_array *, int32_t, const char *); 45*9508192eSchristos void dba_page_alias(struct dba_array *, const char *, uint64_t); 46*9508192eSchristos 47*9508192eSchristos void dba_macro_new(struct dba *, int32_t, 48*9508192eSchristos const char *, const int32_t *); 49*9508192eSchristos void dba_macro_add(struct dba_array *, int32_t, 50*9508192eSchristos const char *, struct dba_array *); 51