Annotation of mandoc/apropos_db.h, Revision 1.1
1.1 ! schwarze 1: /* $Id: apropos.h,v 1.2 2011/11/09 22:05:56 kristaps Exp $ */
! 2: /*
! 3: * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
! 4: *
! 5: * Permission to use, copy, modify, and distribute this software for any
! 6: * purpose with or without fee is hereby granted, provided that the above
! 7: * copyright notice and this permission notice appear in all copies.
! 8: *
! 9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
! 10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
! 11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
! 12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
! 13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
! 14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
! 15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
! 16: */
! 17: #ifndef APROPOS_H
! 18: #define APROPOS_H
! 19:
! 20: #define TYPE_NAME 0x01
! 21: #define TYPE_FUNCTION 0x02
! 22: #define TYPE_UTILITY 0x04
! 23: #define TYPE_INCLUDES 0x08
! 24: #define TYPE_VARIABLE 0x10
! 25: #define TYPE_STANDARD 0x20
! 26: #define TYPE_AUTHOR 0x40
! 27: #define TYPE_CONFIG 0x80
! 28: #define TYPE_DESC 0x100
! 29: #define TYPE_XREF 0x200
! 30: #define TYPE_PATH 0x400
! 31: #define TYPE_ENV 0x800
! 32: #define TYPE_ERR 0x1000
! 33:
! 34: struct rec {
! 35: char *file; /* file in file-system */
! 36: char *cat; /* category (3p, 3, etc.) */
! 37: char *title; /* title (FOO, etc.) */
! 38: char *arch; /* arch (or empty string) */
! 39: char *desc; /* description (from Nd) */
! 40: unsigned int rec; /* record in index */
! 41: /*
! 42: * By the time the apropos_search() callback is called, these
! 43: * are superfluous.
! 44: * Maintain a binary tree for checking the uniqueness of `rec'
! 45: * when adding elements to the results array.
! 46: * Since the results array is dynamic, use offset in the array
! 47: * instead of a pointer to the structure.
! 48: */
! 49: int lhs;
! 50: int rhs;
! 51: };
! 52:
! 53: struct opts {
! 54: const char *arch; /* restrict to architecture */
! 55: const char *cat; /* restrict to manual section */
! 56: };
! 57:
! 58: __BEGIN_DECLS
! 59:
! 60: struct expr;
! 61:
! 62: void apropos_search(const struct opts *,
! 63: const struct expr *, void *,
! 64: void (*)(struct rec *, size_t, void *));
! 65:
! 66: struct expr *exprcomp(int, char *[], int);
! 67: void exprfree(struct expr *);
! 68:
! 69: __END_DECLS
! 70:
! 71: #endif /*!APROPOS_H*/
CVSweb