comparison src/regex.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents c5d627a313b1
children 697ef44129c6
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 /* Synched up with: FSF 19.29. */ 21 /* Synched up with: FSF 19.29. */
22 22
23 #ifndef __REGEXP_LIBRARY_H__ 23 #ifndef INCLUDED_regex_h_
24 #define __REGEXP_LIBRARY_H__ 24 #define INCLUDED_regex_h_
25 25
26 /* POSIX says that <sys/types.h> must be included (by the caller) before 26 /* POSIX says that <sys/types.h> must be included (by the caller) before
27 <regex.h>. */ 27 <regex.h>. */
28 28
29 29
411 reg_syntax_t re_set_syntax (reg_syntax_t syntax); 411 reg_syntax_t re_set_syntax (reg_syntax_t syntax);
412 412
413 /* Compile the regular expression PATTERN, with length LENGTH 413 /* Compile the regular expression PATTERN, with length LENGTH
414 and syntax given by the global `re_syntax_options', into the buffer 414 and syntax given by the global `re_syntax_options', into the buffer
415 BUFFER. Return NULL if successful, and an error string if not. */ 415 BUFFER. Return NULL if successful, and an error string if not. */
416 CONST char *re_compile_pattern (CONST char *pattern, int length, 416 const char *re_compile_pattern (const char *pattern, int length,
417 struct re_pattern_buffer *buffer); 417 struct re_pattern_buffer *buffer);
418 418
419 419
420 /* Compile a fastmap for the compiled pattern in BUFFER; used to 420 /* Compile a fastmap for the compiled pattern in BUFFER; used to
421 accelerate searches. Return 0 if successful and -2 if was an 421 accelerate searches. Return 0 if successful and -2 if was an
426 /* Search in the string STRING (with length LENGTH) for the pattern 426 /* Search in the string STRING (with length LENGTH) for the pattern
427 compiled into BUFFER. Start searching at position START, for RANGE 427 compiled into BUFFER. Start searching at position START, for RANGE
428 characters. Return the starting position of the match, -1 for no 428 characters. Return the starting position of the match, -1 for no
429 match, or -2 for an internal error. Also return register 429 match, or -2 for an internal error. Also return register
430 information in REGS (if REGS and BUFFER->no_sub are nonzero). */ 430 information in REGS (if REGS and BUFFER->no_sub are nonzero). */
431 int re_search (struct re_pattern_buffer *buffer, CONST char *string, 431 int re_search (struct re_pattern_buffer *buffer, const char *string,
432 int length, int start, int range, 432 int length, int start, int range,
433 struct re_registers *regs); 433 struct re_registers *regs);
434 434
435 435
436 /* Like `re_search', but search in the concatenation of STRING1 and 436 /* Like `re_search', but search in the concatenation of STRING1 and
437 STRING2. Also, stop searching at index START + STOP. */ 437 STRING2. Also, stop searching at index START + STOP. */
438 int re_search_2 (struct re_pattern_buffer *buffer, CONST char *string1, 438 int re_search_2 (struct re_pattern_buffer *buffer, const char *string1,
439 int length1, CONST char *string2, int length2, int start, 439 int length1, const char *string2, int length2, int start,
440 int range, struct re_registers *regs, int stop); 440 int range, struct re_registers *regs, int stop);
441 441
442 442
443 /* Like `re_search', but return how many characters in STRING the regexp 443 /* Like `re_search', but return how many characters in STRING the regexp
444 in BUFFER matched, starting at position START. */ 444 in BUFFER matched, starting at position START. */
445 int re_match (struct re_pattern_buffer *buffer, CONST char *string, 445 int re_match (struct re_pattern_buffer *buffer, const char *string,
446 int length, int start, struct re_registers *regs); 446 int length, int start, struct re_registers *regs);
447 447
448 448
449 /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ 449 /* Relates to `re_match' as `re_search_2' relates to `re_search'. */
450 int re_match_2 (struct re_pattern_buffer *buffer, CONST char *string1, 450 int re_match_2 (struct re_pattern_buffer *buffer, const char *string1,
451 int length1, CONST char *string2, int length2, 451 int length1, const char *string2, int length2,
452 int start, struct re_registers *regs, int stop); 452 int start, struct re_registers *regs, int stop);
453 453
454 454
455 /* Set REGS to hold NUM_REGS registers, storing them in STARTS and 455 /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
456 ENDS. Subsequent matches using BUFFER and REGS will use this memory 456 ENDS. Subsequent matches using BUFFER and REGS will use this memory
468 struct re_registers *regs, unsigned num_regs, 468 struct re_registers *regs, unsigned num_regs,
469 regoff_t *starts, regoff_t *ends); 469 regoff_t *starts, regoff_t *ends);
470 470
471 #ifdef _REGEX_RE_COMP 471 #ifdef _REGEX_RE_COMP
472 /* 4.2 bsd compatibility. */ 472 /* 4.2 bsd compatibility. */
473 char *re_comp (CONST char *); 473 char *re_comp (const char *);
474 int re_exec (CONST char *); 474 int re_exec (const char *);
475 #endif 475 #endif
476 476
477 /* POSIX compatibility. */ 477 /* POSIX compatibility. */
478 int regcomp (regex_t *preg, CONST char *pattern, int cflags); 478 int regcomp (regex_t *preg, const char *pattern, int cflags);
479 int regexec (CONST regex_t *preg, CONST char *string, size_t nmatch, 479 int regexec (const regex_t *preg, const char *string, size_t nmatch,
480 regmatch_t pmatch[], int eflags); 480 regmatch_t pmatch[], int eflags);
481 size_t regerror (int errcode, CONST regex_t *preg, char *errbuf, 481 size_t regerror (int errcode, const regex_t *preg, char *errbuf,
482 size_t errbuf_size); 482 size_t errbuf_size);
483 void regfree (regex_t *preg); 483 void regfree (regex_t *preg);
484 484
485 #endif /* not __REGEXP_LIBRARY_H__ */ 485 #endif /* INCLUDED_regex_h_ */