home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / quot210s.zip / include / quotes.h < prev    next >
C/C++ Source or Header  |  1998-12-03  |  3KB  |  100 lines

  1. /*
  2.  * quotes.h
  3.  *
  4.  * Header file for quotes functions for the Quoteriser.
  5.  *
  6.  *      Created: 18th January, 1997
  7.  * Version 1.00: 20th March, 1997
  8.  * Version 2.00: 24th November, 1997
  9.  * Version 2.10: 1st December, 1998
  10.  *
  11.  * (C) 1997-1998 Nicholas Paul Sheppard
  12.  *
  13.  * This file is distributed under the GNU General Public License. See the
  14.  * file copying.txt for details.
  15.  */
  16.  
  17. #ifndef _QUOTERISER_QUOTES_H
  18. #define _QUOTERISER_QUOTES_H
  19.  
  20. #include <gnu/gdbm.h>
  21. #ifndef GENERIC
  22. # include <gnu/rxall.h>
  23. # include <gnu/rxposix.h>
  24. #endif
  25. #include <sys/types.h>
  26. #include <sys/stat.h>
  27. #include "authors.h"
  28.  
  29. /* limits */
  30. #define QUOTE_MAX_DBNAME    256    /* maximum length of database name */
  31. #define QUOTE_MAX_CODE        19    /* maximum length of quote code */
  32. #define QUOTE_MAX_SOURCE    99    /* maximum length of quote source */
  33. #define QUOTE_MAX_KEYWORD    19    /* maximum length of a keyword */
  34. #define    QUOTE_NUM_KEYWORD    5    /* maximum number of keywords */
  35. #define QUOTE_MAX_SEARCH    199    /* maximum length of search string */
  36.  
  37. /* quote database structure */
  38. typedef struct _QUOTEDB {
  39.     GDBM_FILE    dbfInfo;        /* information database */
  40.     GDBM_FILE    dbfText;        /* text database */
  41. } QUOTEDB;
  42.  
  43. /* quote database information structure */
  44. typedef struct _QDBINFO {
  45.     int        flMode;            /* S_IREAD, S_IWRITE, etc. */
  46.     long        lSize;            /* database size in bytes */
  47.     time_t        tCreation;        /* time of creation */
  48.     time_t        tModification;        /* time of last modification */
  49. } QDBINFO;
  50.  
  51. /* quote information structure */
  52. typedef struct _QUOTEINFO {
  53.     char        szAuthorCode[AUTHOR_MAX_CODE + 1];            /* author's code */
  54.     char        szSource[QUOTE_MAX_SOURCE + 1];                /* source */
  55.     char        aszKeyword[QUOTE_NUM_KEYWORD][QUOTE_MAX_KEYWORD + 1];    /* keywords */
  56. } QUOTEINFO;
  57.  
  58. /* quote search structure */
  59. typedef struct _QUOTESEARCH {
  60.     QUOTEDB        *pqdb;                /* database to search in */
  61.     char        szLastCode[QUOTE_MAX_CODE + 1];    /* last code found */
  62.     char        szSearch[QUOTE_MAX_SEARCH];    /* search string */
  63. #ifndef GENERIC
  64.     regex_t        rxSearch;            /* compiled search string */
  65. #endif
  66. } QUOTESEARCH;
  67.  
  68. extern const char szQuoteExt[];
  69.  
  70. /* functions contained in qdb.c */
  71. void    QuoteNullifyDB(QUOTEDB *);
  72. int    QuoteOpenDB(char *, QUOTEDB *, int);
  73. int    QuoteDBStat(char *, QDBINFO *);
  74. void    QuoteReorganiseDB(QUOTEDB *);
  75. void    QuoteCloseDB(QUOTEDB *);
  76. void    QuoteEmptyDB(QUOTEDB *);
  77.  
  78. /* functions contained in quotes.c */
  79. void    QuoteAddQuote(QUOTEDB *, char *, QUOTEINFO *, char *);
  80. int    QuoteGetQuote(QUOTEDB *, char *, QUOTEINFO **, char **);
  81. void    QuoteDeleteQuote(QUOTEDB *, char *);
  82. void    QuoteFreeQuote(QUOTEINFO **, char **);
  83. int    QuoteExists(QUOTEDB *, char *);
  84.  
  85. /* functions contained in qsearch.c */
  86. int    QuoteFullSearchInit(QUOTEDB *, QUOTESEARCH *);
  87. int    QuoteFullSearchNext(QUOTESEARCH *);
  88. void    QuoteFullSearchEnd(QUOTESEARCH *);
  89. int    QuoteKeySearchInit(QUOTEDB *, char *, QUOTESEARCH *);
  90. int    QuoteKeySearchNext(QUOTESEARCH *);
  91. void    QuoteKeySearchEnd(QUOTESEARCH *);
  92. int    QuoteTextSearchInit(QUOTEDB *, char *, QUOTESEARCH *);
  93. int    QuoteTextSearchNext(QUOTESEARCH *);
  94. void    QuoteTextSearchEnd(QUOTESEARCH *);
  95. int    QuoteAuthorSearchInit(QUOTEDB *, char *, QUOTESEARCH *);
  96. int    QuoteAuthorSearchNext(QUOTESEARCH *);
  97. void    QuoteAuthorSearchEnd(QUOTESEARCH *);
  98.  
  99. #endif
  100.