home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 26 / CD_ASCQ_26_1295.iso / vrac / ygrep403.zip / YGREP.H < prev    next >
C/C++ Source or Header  |  1995-08-24  |  4KB  |  144 lines

  1. /*
  2. //    $Id: YGREP.H 1.6 1995/04/24 05:16:24 Y.Roumazeilles Exp $
  3. //
  4. //    (C) 1992-93-94-95 Yves Roumazeilles
  5. //
  6. //    Version 4.03
  7. */
  8.  
  9. #ifndef    __YGREP_H__
  10. #define    __YGREP_H__    
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14.  
  15.  
  16. #ifdef    WINVER
  17. #define    YGCALL    FAR PASCAL
  18. #else
  19. #define    YGCALL    
  20. #endif
  21.  
  22. WORD    YGCALL    YGrepVersion( void );
  23. BOOL    YGCALL    YGrepIsDebug( void );
  24.  
  25.  
  26. /* YGrep Search Engine Error Codes */
  27. #define AGERR_UNKNOWN_TYPE        -1
  28. #define AGERR_NO_ERROR            0
  29. #define AGERR_STATE            1
  30. #define AGERR_ALLOC_MEM            2
  31. #define AGERR_TOO_SHORT            3
  32. #define AGERR_TOO_LONG            4
  33. #define AGERR_NO_PREVIOUS        5
  34. #define AGERR_NO_PATTERN        6
  35.  
  36. #define RGERR_MUNGED_AUTO        20
  37. #define RGERR_MISS_BRACKET        25
  38. #define RGERR_EMPTY_ENCL        26
  39. #define RGERR_ILLEGAL_ENCL        27
  40. #define RGERR_TOO_MANY_PAR        28
  41. #define RGERR_NULL_IN_PAR        29
  42. #define RGERR_UNMATCHED            30
  43. #define RGERR_NULL_IN_CRO        31
  44. #define RGERR_CYCLICAL_REF        32
  45. #define RGERR_UNDETERM_REF        33
  46. #define RGERR_UNMATCHED_PAR        34
  47.  
  48. #define    MATCH        0
  49. #define    MISMATCH    1
  50. #define    EXACTMATCH    2
  51. #define    MAXSYM        256    /* Size of the alphabet (in chars) */
  52. #define    WORD_SIZE    512    /* (in bits) */
  53. #define MAXTAG        10
  54.  
  55. #include    <bitlist.h>
  56.  
  57. typedef struct tagAGrepInfo {
  58.     int    iErrorCode;
  59.     char    cPat[WORD_SIZE];
  60.     LPSTR    TagStart[MAXTAG];
  61.     LPSTR    TagEnd[MAXTAG];
  62.     int    bMatchCase;
  63.     BLIST    uMask;        /* internal structures */
  64.     BLIST    uOvMask;
  65.     BLIST    uLimit;
  66.     BLIST    blState;    /* temporary AGrep() structures */
  67.     BLIST    blOverflow;
  68.     BLIST    blTemp;
  69.     BLIST    uTable[MAXSYM];    /* characteristic vector table */
  70.     int    iBitsPerState;
  71.     int    iWordSize;    /* actual word size of BLIST's */
  72.     int    iType;        /* MATCH or MISMATCH */
  73.     char    cUPat[WORD_SIZE];
  74. } AGREPINFO;
  75. #ifdef    WINVER
  76. typedef    AGREPINFO*    PAGREPINFO;
  77. typedef    AGREPINFO FAR*    LPAGREPINFO;
  78. #else
  79. typedef    AGREPINFO*    PAGREPINFO;
  80. typedef    AGREPINFO*    LPAGREPINFO;
  81. #endif
  82.  
  83.  
  84. int    YGCALL    CompileAGrep( LPCSTR GrepString, int k, BOOL bMatchCase, LPAGREPINFO pGI );
  85. int    YGCALL    AGrep( LPCSTR StringToSearch, LPAGREPINFO pGI );
  86. int    YGCALL    AGrepInit( LPAGREPINFO pGI );
  87. int    YGCALL    AGrepEmpty( LPAGREPINFO pGI );
  88. int    YGCALL    AGrepSubsBuild( LPSTR lpszPattern, LPSTR lpszDest, int iSize, LPAGREPINFO pGI );
  89. int    YGCALL    SCompileAGrep( LPCSTR GrepString, int k, BOOL bMatchCase );
  90. int    YGCALL    SAGrep( LPCSTR StringToSearch );
  91. int    YGCALL    SAGrepInit( void );
  92. int    YGCALL    SAGrepEmpty( void );
  93. int    YGCALL    SAGrepSubsBuild( LPSTR lpszPattern, LPSTR lpszDest, int iSize );
  94.  
  95.  
  96.  
  97. #define    MAXDFA    2*WORD_SIZE
  98.  
  99. #define CHRBIT    8
  100. #define BITBLK    MAXSYM/CHRBIT
  101.  
  102. typedef struct tagRGrepInfo {
  103.     int    iErrorCode;
  104.     char    cPat[WORD_SIZE];
  105.     LPSTR    TagStart[MAXTAG];
  106.     LPSTR    TagEnd[MAXTAG];
  107.     int    bMatchCase;
  108.     int    iCircf;        /* internal structures */
  109.     char    cDFA[MAXDFA];
  110. } RGREPINFO;
  111. #ifdef    WINVER
  112. typedef    RGREPINFO*    PRGREPINFO;
  113. typedef    RGREPINFO FAR*    LPRGREPINFO;
  114. #else
  115. typedef    RGREPINFO*    PRGREPINFO;
  116. typedef    RGREPINFO*    LPRGREPINFO;
  117. #endif
  118.  
  119. int    YGCALL    CompileRGrep( LPCSTR GrepString, BOOL bMatchCase, LPRGREPINFO pGI );
  120. int    YGCALL    RGrep( LPCSTR StringToSearch, LPRGREPINFO pGI );
  121. int    YGCALL    RGrepSubsBuild( LPSTR lpszPattern, LPSTR lpszDest, int iSize, LPRGREPINFO pGI );
  122. void    YGCALL    InitWordCharTable( void );
  123. void    YGCALL    AddWordChar( LPSTR s );
  124. void    YGCALL    RemoveWordChar( LPSTR s );
  125. int    YGCALL    SCompileRGrep( LPCSTR GrepString, BOOL bMatchCase );
  126. int    YGCALL    SRGrep( LPCSTR StringToSearch );
  127. int    YGCALL    SRGrepSubsBuild( LPSTR lpszPattern, LPSTR lpszDest, int iSize );
  128.  
  129.  
  130.  
  131. typedef    struct tagYGrepInfo {
  132.     union {
  133.         AGREPINFO    aGI;
  134.         RGREPINFO    rGI;
  135.     } y;
  136.     int    iTypeofINFO;    /* 0: empty, 1:AGREP, 2:RGREP */
  137. } YGREPINFO;
  138.  
  139.  
  140. #ifdef __cplusplus
  141. } /* extern "C" */
  142. #endif
  143. #endif    /* __YGREP_H__ */
  144.