Mercurial > hg > xemacs-beta
comparison src/regex.h @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 41ff10fd062f |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
404 regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ | 404 regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ |
405 } regmatch_t; | 405 } regmatch_t; |
406 | 406 |
407 /* Declarations for routines. */ | 407 /* Declarations for routines. */ |
408 | 408 |
409 /* To avoid duplicating every routine declaration -- once with a | |
410 prototype (if we are ANSI), and once without (if we aren't) -- we | |
411 use the following macro to declare argument types. This | |
412 unfortunately clutters up the declarations a bit, but I think it's | |
413 worth it. */ | |
414 | |
415 #ifdef __STDC__ | |
416 | |
417 #define _RE_ARGS(args) args | |
418 | |
419 #else /* not __STDC__ */ | |
420 | |
421 #define _RE_ARGS(args) () | |
422 | |
423 #endif /* not __STDC__ */ | |
424 | |
425 /* Sets the current default syntax to SYNTAX, and return the old syntax. | 409 /* Sets the current default syntax to SYNTAX, and return the old syntax. |
426 You can also simply assign to the `re_syntax_options' variable. */ | 410 You can also simply assign to the `re_syntax_options' variable. */ |
427 extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); | 411 reg_syntax_t re_set_syntax (reg_syntax_t syntax); |
428 | 412 |
429 /* Compile the regular expression PATTERN, with length LENGTH | 413 /* Compile the regular expression PATTERN, with length LENGTH |
430 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 |
431 BUFFER. Return NULL if successful, and an error string if not. */ | 415 BUFFER. Return NULL if successful, and an error string if not. */ |
432 extern CONST char *re_compile_pattern | 416 CONST char *re_compile_pattern (CONST char *pattern, int length, |
433 _RE_ARGS ((CONST char *pattern, int length, | 417 struct re_pattern_buffer *buffer); |
434 struct re_pattern_buffer *buffer)); | |
435 | 418 |
436 | 419 |
437 /* Compile a fastmap for the compiled pattern in BUFFER; used to | 420 /* Compile a fastmap for the compiled pattern in BUFFER; used to |
438 accelerate searches. Return 0 if successful and -2 if was an | 421 accelerate searches. Return 0 if successful and -2 if was an |
439 internal error. */ | 422 internal error. */ |
440 extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); | 423 int re_compile_fastmap (struct re_pattern_buffer *buffer); |
441 | 424 |
442 | 425 |
443 /* Search in the string STRING (with length LENGTH) for the pattern | 426 /* Search in the string STRING (with length LENGTH) for the pattern |
444 compiled into BUFFER. Start searching at position START, for RANGE | 427 compiled into BUFFER. Start searching at position START, for RANGE |
445 characters. Return the starting position of the match, -1 for no | 428 characters. Return the starting position of the match, -1 for no |
446 match, or -2 for an internal error. Also return register | 429 match, or -2 for an internal error. Also return register |
447 information in REGS (if REGS and BUFFER->no_sub are nonzero). */ | 430 information in REGS (if REGS and BUFFER->no_sub are nonzero). */ |
448 extern int re_search | 431 int re_search (struct re_pattern_buffer *buffer, CONST char *string, |
449 _RE_ARGS ((struct re_pattern_buffer *buffer, CONST char *string, | 432 int length, int start, int range, |
450 int length, int start, int range, struct re_registers *regs)); | 433 struct re_registers *regs); |
451 | 434 |
452 | 435 |
453 /* Like `re_search', but search in the concatenation of STRING1 and | 436 /* Like `re_search', but search in the concatenation of STRING1 and |
454 STRING2. Also, stop searching at index START + STOP. */ | 437 STRING2. Also, stop searching at index START + STOP. */ |
455 extern int re_search_2 | 438 int re_search_2 (struct re_pattern_buffer *buffer, CONST char *string1, |
456 _RE_ARGS ((struct re_pattern_buffer *buffer, CONST char *string1, | 439 int length1, CONST char *string2, int length2, int start, |
457 int length1, CONST char *string2, int length2, | 440 int range, struct re_registers *regs, int stop); |
458 int start, int range, struct re_registers *regs, int stop)); | |
459 | 441 |
460 | 442 |
461 /* 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 |
462 in BUFFER matched, starting at position START. */ | 444 in BUFFER matched, starting at position START. */ |
463 extern int re_match | 445 int re_match (struct re_pattern_buffer *buffer, CONST char *string, |
464 _RE_ARGS ((struct re_pattern_buffer *buffer, CONST char *string, | 446 int length, int start, struct re_registers *regs); |
465 int length, int start, struct re_registers *regs)); | |
466 | 447 |
467 | 448 |
468 /* 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'. */ |
469 extern int re_match_2 | 450 int re_match_2 (struct re_pattern_buffer *buffer, CONST char *string1, |
470 _RE_ARGS ((struct re_pattern_buffer *buffer, CONST char *string1, | 451 int length1, CONST char *string2, int length2, |
471 int length1, CONST char *string2, int length2, | 452 int start, struct re_registers *regs, int stop); |
472 int start, struct re_registers *regs, int stop)); | |
473 | 453 |
474 | 454 |
475 /* 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 |
476 ENDS. Subsequent matches using BUFFER and REGS will use this memory | 456 ENDS. Subsequent matches using BUFFER and REGS will use this memory |
477 for recording register information. STARTS and ENDS must be | 457 for recording register information. STARTS and ENDS must be |
482 register data. | 462 register data. |
483 | 463 |
484 Unless this function is called, the first search or match using | 464 Unless this function is called, the first search or match using |
485 PATTERN_BUFFER will allocate its own register data, without | 465 PATTERN_BUFFER will allocate its own register data, without |
486 freeing the old data. */ | 466 freeing the old data. */ |
487 extern void re_set_registers | 467 void re_set_registers (struct re_pattern_buffer *buffer, |
488 _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, | 468 struct re_registers *regs, unsigned num_regs, |
489 unsigned num_regs, regoff_t *starts, regoff_t *ends)); | 469 regoff_t *starts, regoff_t *ends); |
490 | 470 |
491 #ifdef _REGEX_RE_COMP | 471 #ifdef _REGEX_RE_COMP |
492 /* 4.2 bsd compatibility. */ | 472 /* 4.2 bsd compatibility. */ |
493 extern char *re_comp _RE_ARGS ((CONST char *)); | 473 char *re_comp (CONST char *); |
494 extern int re_exec _RE_ARGS ((CONST char *)); | 474 int re_exec (CONST char *); |
495 #endif | 475 #endif |
496 | 476 |
497 /* POSIX compatibility. */ | 477 /* POSIX compatibility. */ |
498 extern int regcomp _RE_ARGS ((regex_t *preg, CONST char *pattern, int cflags)); | 478 int regcomp (regex_t *preg, CONST char *pattern, int cflags); |
499 extern int regexec | 479 int regexec (CONST regex_t *preg, CONST char *string, size_t nmatch, |
500 _RE_ARGS ((CONST regex_t *preg, CONST char *string, size_t nmatch, | 480 regmatch_t pmatch[], int eflags); |
501 regmatch_t pmatch[], int eflags)); | 481 size_t regerror (int errcode, CONST regex_t *preg, char *errbuf, |
502 extern size_t regerror | 482 size_t errbuf_size); |
503 _RE_ARGS ((int errcode, CONST regex_t *preg, char *errbuf, | 483 void regfree (regex_t *preg); |
504 size_t errbuf_size)); | |
505 extern void regfree _RE_ARGS ((regex_t *preg)); | |
506 | 484 |
507 #endif /* not __REGEXP_LIBRARY_H__ */ | 485 #endif /* not __REGEXP_LIBRARY_H__ */ |
508 | |
509 /* | |
510 Local variables: | |
511 make-backup-files: t | |
512 version-control: t | |
513 trim-versions-without-asking: nil | |
514 End: | |
515 */ |