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

  1. /*
  2.  * quoterc.h
  3.  *
  4.  * Header file for the Quoteriser database compiler.
  5.  *
  6.  *      Created: 12th September 1998
  7.  * Version 1.00: 11th December 1998
  8.  *
  9.  * (C) 1998 Nicholas Paul Sheppard
  10.  *
  11.  * This file is distributed under the GNU General Public License. See the
  12.  * file copying.txt for details.
  13.  */
  14.  
  15. #ifndef _QUOTERISER_QUOTERC_H
  16. #define _QUOTERISER_QUOTERC_H
  17.  
  18. #include <stdio.h>
  19. #include <xtype.h>
  20. #include "authors.h"
  21. #include "quotes.h"
  22.  
  23.  
  24. /* error codes */
  25. #define QC_ENONE    0    /* no error */
  26. #define QC_ENOMEM    1    /* out of memory */
  27. #define QC_EFILE    2    /* file error */
  28. #define QC_EBADCMD    3    /* unrecognised command or keyword */
  29. #define QC_ENODBTYPE    4    /* missing database type */
  30. #define QC_EBADDBTYPE    5    /* unrecognised database type */
  31. #define QC_ENOFILEN    6    /* missing file name */
  32. #define QC_EOPEN    7    /* could not open file */
  33. #define QC_ENOFORMAT    8    /* format string expected */
  34. #define QC_EBADITEM    9    /* illegal input item */
  35. #define QC_EPERM    10    /* permission denied */
  36. #define QC_ENOARG    11    /* missing argument */
  37. #define QC_EBAD1STITEM    12    /* format doesn't start with an input item */
  38. #define QC_ENODELIM    13    /* undelimited input items */
  39. #define QC_EUNKNOWN    14    /* unknown error */
  40.  
  41.  
  42. /* mode flags */
  43. #define QC_FLQUOTE    0x00000001    /* quotes */
  44. #define QC_FLAUTHOR    0x00000002    /* authors */
  45. #define QC_FLCOMPILE    0x00000004    /* compiling */
  46. #define QC_FLDECOMPILE    0x00000008    /* de-compiling */
  47. #define QC_FLCREATE    0x00000010    /* create/overwrite file */
  48. #define QC_FLAPPEND    0x00000020    /* append to file */
  49.  
  50.  
  51. typedef struct _QCERROR {
  52.     int    iError;            /* error code */
  53.     int    iLine;            /* line on which error occurred */
  54. } QCERROR;
  55.  
  56.  
  57. typedef struct _QCBLOCK {
  58.     char        *pszAuthorCode;        /* author code */
  59.     char        *pszQuoteCode;        /* quote code */
  60.     AUTHORINFO    *pai;            /* author information */
  61.     char        *pszAuthorDesc;        /* author description */
  62.     QUOTEINFO    *pqi;            /* quote information */
  63.     char        *pszQuoteText;        /* quote text */
  64. } QCBLOCK;
  65.  
  66.  
  67. /* functions in qccmd.c */
  68. int    QCProcessCommands(FILE *, QCERROR *);                    /* process command file */
  69. int    QCProcessAuthorSection(FILE *, AUTHORDB *, int, QCERROR *, XSTR *);    /* process author section */
  70. int    QCProcessQuoteSection(FILE *, QUOTEDB *, int, QCERROR *, XSTR *);    /* process quote section */
  71. int    QCCompileAuthors(AUTHORDB *, char *, char *, char *, int);        /* compile author database */
  72. int    QCDecompileAuthors(AUTHORDB *, char *, char *, int);            /* de-compile author database */
  73. int    QCCompileQuotes(QUOTEDB *, char *, char *, char *, char *, char *, int);/* compile quote database */
  74. int    QCDecompileQuotes(QUOTEDB *, AUTHORDB *, char *, char *, int);        /* de-compile quote database */
  75. char *    QCErrorString(int);                            /* get error string */
  76.  
  77.  
  78. /* functions in qcdata.c */
  79. void        QCFreeBlock(QCBLOCK *);                        /* de-allocate QCBLOCK structure */
  80. char *        QCMatchString(XSTR *, char *, XSTR *);                /* match a string */
  81. char *        QCMatchSymbol(char *, char);                    /* match a single symbol */
  82. QCBLOCK *    QCReadBlock(FILE *, char *);                    /* read a block of input */
  83. XSTR *        QCReadItem(FILE *, char *, XSTR *);                /* read a unit of input */
  84. int        QCVerifyFormat(char *, int);                    /* test format string legality */
  85. void        QCWriteBlock(FILE *, char *, QCBLOCK *);            /* write an author/quote block */
  86.  
  87. #endif
  88.