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

  1. /*
  2.  * authors.h
  3.  *
  4.  * Header file for author functions for the Quoteriser.
  5.  *
  6.  *      Created: 18th January, 1997
  7.  * Version 1.00: 2nd 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_AUTHORS_H
  18. #define _QUOTERISER_AUTHORS_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.  
  28. /* limits */
  29. #define AUTHOR_MAX_DBNAME    256    /* maximum length of database name */
  30. #define AUTHOR_MAX_CODE        19    /* maximum length of author code */
  31. #define AUTHOR_MAX_GNAME    49    /* maximum length of given name */
  32. #define AUTHOR_MAX_SURNAME    49    /* maximum length of surname */
  33. #define AUTHOR_MAX_BIRTH    9    /* maximum length of year of birth */
  34. #define AUTHOR_MAX_DEATH    9    /* maximum length of year of death */
  35. #define AUTHOR_MAX_SEARCH    199    /* maximum length of search string */
  36.  
  37. /* author database structure */
  38. typedef struct _AUTHORDB {
  39.     GDBM_FILE    dbfInfo;        /* information database */
  40.     GDBM_FILE    dbfDesc;        /* description database */
  41. } AUTHORDB;
  42.  
  43. /* quote database information structure */
  44. typedef struct _ADBINFO {
  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. } ADBINFO;
  50.  
  51. /* author information structure */
  52. typedef struct _AUTHORINFO {
  53.     char        szGivenName[AUTHOR_MAX_GNAME + 1];    /* given name */
  54.     char        szSurname[AUTHOR_MAX_SURNAME + 1];    /* surname */
  55.     char        szBirthYear[AUTHOR_MAX_BIRTH + 1];    /* year of birth */
  56.     char        szDeathYear[AUTHOR_MAX_DEATH + 1];    /* year of death */
  57. } AUTHORINFO;
  58.  
  59. /* author search structure */
  60. typedef struct _AUTHORSEARCH {
  61.     AUTHORDB    *padb;                    /* database to search */
  62.     char        szLastCode[AUTHOR_MAX_CODE + 1];    /* last code found */
  63.     char        szSearch[AUTHOR_MAX_SEARCH + 1];    /* search string */
  64. #ifndef GENERIC
  65.     regex_t        rxSearch;                /* compiled search string */
  66. #endif
  67. } AUTHORSEARCH;
  68.  
  69. extern const char szAuthorExt[];
  70.  
  71. /* functions in adb.c */
  72. void    AuthorNullifyDB(AUTHORDB *);
  73. int    AuthorOpenDB(char *, AUTHORDB *, int);
  74. int    AuthorDBStat(char *, ADBINFO *);
  75. void    AuthorReorganiseDB(AUTHORDB *);
  76. void    AuthorCloseDB(AUTHORDB *);
  77. void    AuthorEmptyDB(AUTHORDB *);
  78.  
  79. /* functions in authors.c */
  80. void    AuthorAddAuthor(AUTHORDB *, char *, AUTHORINFO *, char *);
  81. int    AuthorGetAuthor(AUTHORDB *, char *, AUTHORINFO **, char **);
  82. void    AuthorDeleteAuthor(AUTHORDB *, char *);
  83. void    AuthorFreeAuthor(AUTHORINFO **, char **);
  84. int    AuthorExists(AUTHORDB *, char *);
  85.  
  86. /* functions in asearch.c */
  87. int    AuthorFullSearchInit(AUTHORDB *, AUTHORSEARCH *);
  88. int    AuthorFullSearchNext(AUTHORSEARCH *);
  89. void    AuthorFullSearchEnd(AUTHORSEARCH *);
  90. int    AuthorDescSearchInit(AUTHORDB *, char *, AUTHORSEARCH *);
  91. int    AuthorDescSearchNext(AUTHORSEARCH *);
  92. void    AuthorDescSearchEnd(AUTHORSEARCH *);
  93. int    AuthorNameSearchInit(AUTHORDB *, char *, AUTHORSEARCH *);
  94. int    AuthorNameSearchNext(AUTHORSEARCH *);
  95. void    AuthorNameSearchEnd(AUTHORSEARCH *);
  96.  
  97. #endif
  98.