home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 32 / hot34.iso / ficheros / LPAS / YG604W95.ZIP / YGREPINT.PAS < prev    next >
Pascal/Delphi Source File  |  1997-08-04  |  11KB  |  253 lines

  1. {******************************************************************}
  2. { Description:                                                     }
  3. {   This is an interface file to the YGREP32.DLL. To use it,       }
  4. {   simply place 'YGrepInt' in the USES clause of your program     }
  5. {   and call the functions as they are defined below. See          }
  6. {   YGrepTst.pas for some sample code.                             }
  7. {                                                                  }
  8. { Author:                                                          }
  9. {   Damien Lewis (louie@melbpc.org.au) - 6th August 1996           }
  10. { Modified:                                                        }
  11. {   96/08/28 - Yves Roumazeilles                                   }
  12. {              Added BLIST definitions                             }
  13. {   96/09/15 - Yves Roumazeilles (5.03)                            }
  14. {              Added YGrepMessages/YGrepOptions and changed       }
  15. {              RGERR_EMPTY_ENCL to RGERR_EMPTY_CL                  }
  16. {   96/11/17 - Yves Roumazeilles (6.00)                            }
  17. {              Added Soundex routines                              }
  18. {   97/05/05 - Yves Roumazeilles (6.02)                            }
  19. {              Corrected some ugly typos in declarations           }
  20. {              Added missing declarations                          }
  21. {   97/05/16 - Yves Roumazeilles (6.02)                            }
  22. {              Removed that still ugly circf false declaration.    }
  23. {   97/06/08 - Yves Roumazeilles (6.02b)                           }
  24. {              Added the new parameter to SFileSetFlags.           }
  25. {   97/06/11 - Yves Roumazeilles (6.02b)                           }
  26. {              Added the optimizations members of RGREPINFO.       }
  27. {   97/06/11 - Yves Roumazeilles (6.02b)                           }
  28. {              Added the interface for the SFileBinaryXGrep().     }
  29. {   97/08/03 - Yves Roumazeilles (6.03)                            }
  30. {              General update for v6.03                            }
  31. {   97/08/04 - Yves Roumazeilles (6.03)                            }
  32. {              Correction of a bug in implementation, test         }
  33. {******************************************************************}
  34.  
  35. unit YGrepInt;
  36.  
  37. interface
  38.  
  39. const
  40.   { YGrep Search Engine Error Codes }
  41.   AGERR_UNKNOWN_TYPE  = -1;
  42.   AGERR_NO_ERROR      = 0;
  43.   AGERR_STATE         = 1;
  44.   AGERR_ALLOC_MEM     = 2;
  45.   AGERR_TOO_SHORT     = 3;
  46.   AGERR_TOO_LONG      = 4;
  47.   AGERR_NO_PREVIOUS   = 5;
  48.   AGERR_NO_PATTERN    = 6;
  49.   RGERR_MUNGED_AUTO   = 20;
  50.   RGERR_MISS_BRACKET  = 25;
  51.   RGERR_EMPTY_CL      = 26;
  52.   RGERR_ILLEGAL_CL    = 27;
  53.   RGERR_TOO_MANY_PAR  = 28;
  54.   RGERR_NULL_IN_PAR   = 29;
  55.   RGERR_UNMATCHED     = 30;
  56.   RGERR_NULL_IN_CRO   = 31;
  57.   RGERR_CYCLICAL_REF  = 32;
  58.   RGERR_UNDETERM_REF  = 33;
  59.   RGERR_UNMATCHED_PAR = 34;
  60.   RGERR_TOO_MANY_BRA  = 35;
  61.  
  62.   { YGrep Search Engine Error Codes }
  63.   YO_EOLCR    = 1;
  64.   YO_EOLLF    = 2;
  65.   YO_EOLCRLF  = 3;
  66.   YO_ERRMSG   = 8;
  67.  
  68.  
  69.   { Misc Constants }
  70.   MATCH       = 0;
  71.   MISMATCH    = 1;
  72.   EXACTMATCH  = 2;
  73.   MAXSYM      = 256;
  74.   WORD_SIZE   = 512;
  75.   MAXTAG      = 10;
  76.   MAXDFA      = 2 * WORD_SIZE + 32;
  77.  
  78.  
  79. type
  80.   { AGrep Structure }
  81.     PtagAGrepInfo = ^tagAGrepInfo;
  82.     tagAGrepInfo = record
  83.     iErrorCode: Integer;
  84.     cPat: array[0..WORD_SIZE - 1] of char;
  85.     TagStart: array[0..MAXTAG - 1] of PChar;
  86.     TagEnd: array[0..MAXTAG - 1] of PChar;
  87.     bMatchCase: Integer;
  88.     uMask: array[0..19] of char;
  89.     uOvMask: array[0..19] of char;
  90.     uLimit: array[0..19] of char;
  91.     blState: array[0..19] of char;
  92.     blOverflow: array[0..19] of char;
  93.     blTemp: array[0..19] of char;
  94.     uTable: array[0..MAXSYM - 1] of array[0..19] of char;
  95.     iBitsPerState: Integer;
  96.     iWordSize: Integer;
  97.     iType: Integer;
  98.     cUPat: array[0..WORD_SIZE - 1] of char;
  99.   end;
  100.  
  101.   { RGrep Structure }
  102.     PtagRGrepInfo = ^tagRGrepInfo;
  103.     tagRGrepInfo = record
  104.     iErrorCode: Integer;
  105.     cPat: array[0..WORD_SIZE - 1] of char;
  106.     TagStart: array[0..MAXTAG - 1] of PChar;
  107.     TagEnd: array[0..MAXTAG - 1] of PChar;
  108.     bMatchCase: Integer;
  109.     cDFA: array[0..MAXDFA - 1] of char;
  110.     iBranches: Integer;
  111.     iMinLength: Integer;
  112.     ap: array[0..MAXTAG - 1] of PChar;
  113.   end;
  114.  
  115.   { SGrep Structure }
  116.     PtagSGrepInfo = ^tagSGrepInfo;
  117.     tagSGrepInfo = record
  118.     iErrorCode: Integer;
  119.     cPat: array[0..WORD_SIZE - 1] of char;
  120.     TagStart: array[0..MAXTAG - 1] of PChar;
  121.     TagEnd: array[0..MAXTAG - 1] of PChar;
  122.     bMatchCase: Integer;
  123.     cDFA: array[0..MAXDFA - 1] of char;
  124.     end;
  125.  
  126.  
  127. { Misc Function Declarations }
  128. function YGrepVersion: Word; stdcall;
  129. procedure YGrepMessages(bMessages: Integer); stdcall;
  130. procedure YGrepOptions(lOptions: LongInt); stdcall;
  131.  
  132. { AGrep Function Declarations }
  133. function CompileAGrep(GrepString: PChar; k: Integer; MatchCase: Integer; pGI: PtagAGrepInfo): Integer; stdcall;
  134. function AGrep(StringToSearch: PChar; pGI: PtagAGrepInfo): Integer; stdcall;
  135. function AGrepInit(pGI: PtagAGrepInfo): Integer; stdcall;
  136. function AGrepEmpty(pGI: PtagAGrepInfo): Integer; stdcall;
  137. function AGrepSubsBuild(lpszPattern: PChar; lpszDest: PChar; iSize:Integer; pGI: PtagAGrepInfo): Integer; stdcall;
  138. function AGrepSubstitute(SearchedString: PChar; lpszPattern: PChar; lpszDest: PChar; iSize:Integer; pGI: PtagAGrepInfo): Integer; stdcall;
  139. function SCompileAGrep(GrepString: PChar; k: Integer; bMatchCase: Integer): Integer; stdcall;
  140. function SAGrep(StringToSearch: PChar): Integer; stdcall;
  141. procedure SAGrepInit; stdcall;
  142. procedure SAGrepEmpty; stdcall;
  143. function SAGrepSubsBuild(lpszPattern: PChar; lpszDest: PChar; iSize:Integer): Integer; stdcall;
  144. function SAGrepSubstitute(SearchedString: PChar; lpszPattern: PChar; lpszDest: PChar; iSize:Integer): Integer; stdcall;
  145.  
  146. { RGrep Function Declarations }
  147. function CompileRGrep(GrepString: PChar; MatchCase: Integer; pGI: PtagRGrepInfo): Integer; stdcall;
  148. function RGrep(StringToSearch: PChar; pGI: PtagRGrepInfo): Integer; stdcall;
  149. function RGrepSubsBuild(lpszPattern: PChar; lpszDest: PChar; iSize:Integer; pGI:PtagRGrepInfo): Integer; stdcall;
  150. function RGrepSubstitute(SearchedString: PChar; lpszPattern: PChar; lpszDest: PChar; iSize:Integer; pGI: PtagRGrepInfo): Integer; stdcall;
  151. procedure InitWordCharTable; stdcall;
  152. procedure AddWordCharTable(s: PChar); stdcall;
  153. procedure RemoveWordCharTable(s: PChar); stdcall;
  154. function SCompileRGrep(GrepString: PChar; MatchCase: Integer): Integer; stdcall;
  155. function SRGrep(StringToSearch: PChar): Integer; stdcall;
  156. function SRGrepSubsBuild(lpszPattern: PChar; lpszDest: PChar; iSize:Integer): Integer; stdcall;
  157. function SRGrepSubstitute(SearchedString: PChar; lpszPattern: PChar; lpszDest: PChar; iSize:Integer): Integer; stdcall;
  158.  
  159. { SGrep Function Declarations }
  160. function CompileSGrep(GrepString: PChar; MatchCase: Integer; pGI: PtagSGrepInfo): Integer; stdcall;
  161. function SGrep(StringToSearch: PChar; pGI: PtagSGrepInfo): Integer; stdcall;
  162. function SGrepSubsBuild(lpszPattern: PChar; lpszDest: PChar; iSize:Integer; pGI:PtagSGrepInfo): Integer; stdcall;
  163. function SGrepSubstitute(SearchedString: PChar; lpszPattern: PChar; lpszDest: PChar; iSize:Integer; pGI: PtagSGrepInfo): Integer; stdcall;
  164. function SCompileSGrep(GrepString: PChar; MatchCase: Integer): Integer; stdcall;
  165. function SSGrep(StringToSearch: PChar): Integer; stdcall;
  166. function SSGrepSubsBuild(lpszPattern: PChar; lpszDest: PChar; iSize:Integer): Integer; stdcall;
  167. function SSGrepSubstitute(SearchedString: PChar; lpszPattern: PChar; lpszDest: PChar; iSize:Integer): Integer; stdcall;
  168.  
  169. { SFile Function Declarations }
  170. procedure SFileSetFlags(bPrintFileName: Integer; bPrintBlockNumber: Integer; bPrintLineNumber: Integer; bCountsOnly: Integer; bNonMatching: Integer; bFileModeText: Integer); stdcall;
  171. function SFileOpen(strFileName: PChar): Integer; stdcall;
  172. function SFileAGrep: PChar; stdcall;
  173. function SFileRGrep: PChar; stdcall;
  174. function SFileSGrep: PChar; stdcall;
  175. function SFileTextAGrep: PChar; stdcall;
  176. function SFileTextRGrep: PChar; stdcall;
  177. function SFileTextSGrep: PChar; stdcall;
  178. function SFileBinaryAGrep: PChar; stdcall;
  179. function SFileBinaryRGrep: PChar; stdcall;
  180. function SFileBinarySGrep: PChar; stdcall;
  181. function SFileClose: LongInt; stdcall;
  182.  
  183. { YGrepError Function Declarations }
  184. function YGrepGetError: Integer; stdcall;
  185. function YGrepSetError(iError: Integer): Integer; stdcall;
  186. function YGrepResetError(iError: Integer): Integer; stdcall;
  187.  
  188.  
  189. implementation
  190.  
  191. { Misc Functions }
  192. function YGrepVersion; external 'YGREP32.DLL';
  193. procedure YGrepMessages; external 'YGREP32.DLL';
  194. procedure YGrepOptions; external 'YGREP32.DLL';
  195.  
  196. { AGrep Functions }
  197. function CompileAGrep; external 'YGREP32.DLL';
  198. function AGrep; external 'YGREP32.DLL';
  199. function AGrepInit; external 'YGREP32.DLL';
  200. function AGrepEmpty; external 'YGREP32.DLL';
  201. function AGrepSubsBuild; external 'YGREP32.DLL';
  202. function AGrepSubstitute; external 'YGREP32.DLL';
  203. function SCompileAGrep; external 'YGREP32.DLL';
  204. function SAGrep; external 'YGREP32.DLL';
  205. procedure SAGrepInit; external 'YGREP32.DLL';
  206. procedure SAGrepEmpty; external 'YGREP32.DLL';
  207. function SAGrepSubsBuild; external 'YGREP32.DLL';
  208. function SAGrepSubstitute; external 'YGREP32.DLL';
  209.  
  210. { RGrep Functions }
  211. function CompileRGrep; external 'YGREP32.DLL';
  212. function RGrep; external 'YGREP32.DLL';
  213. function RGrepSubsBuild; external 'YGREP32.DLL';
  214. function RGrepSubstitute; external 'YGREP32.DLL';
  215. procedure InitWordCharTable; external 'YGREP32.DLL';
  216. procedure AddWordCharTable; external 'YGREP32.DLL';
  217. procedure RemoveWordCharTable; external 'YGREP32.DLL';
  218. function SCompileRGrep; external 'YGREP32.DLL';
  219. function SRGrep; external 'YGREP32.DLL';
  220. function SRGrepSubsBuild; external 'YGREP32.DLL';
  221. function SRGrepSubstitute; external 'YGREP32.DLL';
  222.  
  223. { SGrep Functions }
  224. function CompileSGrep; external 'YGREP32.DLL';
  225. function SGrep; external 'YGREP32.DLL';
  226. function SGrepSubsBuild; external 'YGREP32.DLL';
  227. function SGrepSubstitute; external 'YGREP32.DLL';
  228. function SCompileSGrep; external 'YGREP32.DLL';
  229. function SSGrep; external 'YGREP32.DLL';
  230. function SSGrepSubsBuild; external 'YGREP32.DLL';
  231. function SSGrepSubstitute; external 'YGREP32.DLL';
  232.  
  233. { SFile Function Declarations }
  234. procedure SFileSetFlags; external 'YGREP32.DLL';
  235. function SFileOpen; external 'YGREP32.DLL';
  236. function SFileAGrep; external 'YGREP32.DLL';
  237. function SFileRGrep; external 'YGREP32.DLL';
  238. function SFileSGrep; external 'YGREP32.DLL';
  239. function SFileTextAGrep; external 'YGREP32.DLL';
  240. function SFileTextRGrep; external 'YGREP32.DLL';
  241. function SFileTextSGrep; external 'YGREP32.DLL';
  242. function SFileBinaryAGrep; external 'YGREP32.DLL';
  243. function SFileBinaryRGrep; external 'YGREP32.DLL';
  244. function SFileBinarySGrep; external 'YGREP32.DLL';
  245. function SFileClose; external 'YGREP32.DLL';
  246.  
  247. { YGrepError Function Declarations }
  248. function YGrepGetError; external 'YGREP32.DLL';
  249. function YGrepSetError; external 'YGREP32.DLL';
  250. function YGrepResetError; external 'YGREP32.DLL';
  251.  
  252. end.
  253.