aboutsummaryrefslogtreecommitdiffstats
path: root/src/regex.h
diff options
context:
space:
mode:
authorPaul Eggert2012-05-21 08:36:54 -0700
committerPaul Eggert2012-05-21 08:36:54 -0700
commit261cb4bb750143d8078bb27a343e0d9560b884df (patch)
tree0d295abf946d52c178be2f7b95e85bfcc5fc63cc /src/regex.h
parentff23cd9f452b6d2b5001a67d7b14e0af7f61b194 (diff)
downloademacs-261cb4bb750143d8078bb27a343e0d9560b884df.tar.gz
emacs-261cb4bb750143d8078bb27a343e0d9560b884df.zip
Assume C89 or later.
* configure.in (AC_C_PROTOTYPES, AC_C_VOLATILE, AC_C_CONST) (POINTER_TYPE, PROTOTYPES): Remove. * admin/CPP-DEFINES: Remove NULL, const. * lib-src/etags.c (static, const): Remove macros. (PTR): Remove; all uses replaced with void *. Omit needless casts. * src/alloc.c, src/buffer.c, lisp.h: Replace POINTER_TYPE with void. * alloc.c (overrun_check_malloc, overrun_check_realloc, xmalloc) (xrealloc): * buffer.c (mmap_free_1, mmap_enlarge): Omit needless casts. * editfns.c, fns.c, gmalloc.c, insdel.c, sysdep.c, termcap.c (NULL): * textprop.c, tparam.c (NULL): Remove. * ralloc.c, vm-limit.c (POINTER): Assume void * works. * regex.c (SIGN_EXTEND_CHAR): Assume signed char works. * regex.h (_RE_ARGS): Remove. All uses rewritten to use prototypes. * unexelf.c (ElfBitsW): Assume c89 preprocessor or better. * xterm.c (input_signal_count): Assume volatile works.
Diffstat (limited to 'src/regex.h')
-rw-r--r--src/regex.h91
1 files changed, 38 insertions, 53 deletions
diff --git a/src/regex.h b/src/regex.h
index 643d0b7b5ab..e0ede012b20 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -451,38 +451,21 @@ typedef struct
451 451
452/* Declarations for routines. */ 452/* Declarations for routines. */
453 453
454/* To avoid duplicating every routine declaration -- once with a
455 prototype (if we are ANSI), and once without (if we aren't) -- we
456 use the following macro to declare argument types. This
457 unfortunately clutters up the declarations a bit, but I think it's
458 worth it. */
459
460#if defined __STDC__ || defined PROTOTYPES
461
462# define _RE_ARGS(args) args
463
464#else /* not __STDC__ || PROTOTYPES */
465
466# define _RE_ARGS(args) ()
467
468#endif /* not __STDC__ || PROTOTYPES */
469
470/* Sets the current default syntax to SYNTAX, and return the old syntax. 454/* Sets the current default syntax to SYNTAX, and return the old syntax.
471 You can also simply assign to the `re_syntax_options' variable. */ 455 You can also simply assign to the `re_syntax_options' variable. */
472extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); 456extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
473 457
474/* Compile the regular expression PATTERN, with length LENGTH 458/* Compile the regular expression PATTERN, with length LENGTH
475 and syntax given by the global `re_syntax_options', into the buffer 459 and syntax given by the global `re_syntax_options', into the buffer
476 BUFFER. Return NULL if successful, and an error string if not. */ 460 BUFFER. Return NULL if successful, and an error string if not. */
477extern const char *re_compile_pattern 461extern const char *re_compile_pattern (const char *__pattern, size_t __length,
478 _RE_ARGS ((const char *pattern, size_t length, 462 struct re_pattern_buffer *__buffer);
479 struct re_pattern_buffer *buffer));
480 463
481 464
482/* Compile a fastmap for the compiled pattern in BUFFER; used to 465/* Compile a fastmap for the compiled pattern in BUFFER; used to
483 accelerate searches. Return 0 if successful and -2 if was an 466 accelerate searches. Return 0 if successful and -2 if was an
484 internal error. */ 467 internal error. */
485extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); 468extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
486 469
487 470
488/* Search in the string STRING (with length LENGTH) for the pattern 471/* Search in the string STRING (with length LENGTH) for the pattern
@@ -490,33 +473,35 @@ extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
490 characters. Return the starting position of the match, -1 for no 473 characters. Return the starting position of the match, -1 for no
491 match, or -2 for an internal error. Also return register 474 match, or -2 for an internal error. Also return register
492 information in REGS (if REGS and BUFFER->no_sub are nonzero). */ 475 information in REGS (if REGS and BUFFER->no_sub are nonzero). */
493extern regoff_t re_search 476extern regoff_t re_search (struct re_pattern_buffer *__buffer,
494 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, 477 const char *__string, size_t __length,
495 size_t length, ssize_t start, ssize_t range, 478 ssize_t __start, ssize_t __range,
496 struct re_registers *regs)); 479 struct re_registers *__regs);
497 480
498 481
499/* Like `re_search', but search in the concatenation of STRING1 and 482/* Like `re_search', but search in the concatenation of STRING1 and
500 STRING2. Also, stop searching at index START + STOP. */ 483 STRING2. Also, stop searching at index START + STOP. */
501extern regoff_t re_search_2 484extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
502 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, 485 const char *__string1, size_t __length1,
503 size_t length1, const char *string2, size_t length2, 486 const char *__string2, size_t __length2,
504 ssize_t start, ssize_t range, struct re_registers *regs, 487 ssize_t __start, ssize_t __range,
505 ssize_t stop)); 488 struct re_registers *__regs,
489 ssize_t __stop);
506 490
507 491
508/* Like `re_search', but return how many characters in STRING the regexp 492/* Like `re_search', but return how many characters in STRING the regexp
509 in BUFFER matched, starting at position START. */ 493 in BUFFER matched, starting at position START. */
510extern regoff_t re_match 494extern regoff_t re_match (struct re_pattern_buffer *__buffer,
511 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, 495 const char *__string, size_t __length,
512 size_t length, ssize_t start, struct re_registers *regs)); 496 ssize_t __start, struct re_registers *__regs);
513 497
514 498
515/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ 499/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
516extern regoff_t re_match_2 500extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
517 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, 501 const char *__string1, size_t __length1,
518 size_t length1, const char *string2, size_t length2, 502 const char *__string2, size_t __length2,
519 ssize_t start, struct re_registers *regs, ssize_t stop)); 503 ssize_t __start, struct re_registers *__regs,
504 ssize_t __stop);
520 505
521 506
522/* Set REGS to hold NUM_REGS registers, storing them in STARTS and 507/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
@@ -531,15 +516,16 @@ extern regoff_t re_match_2
531 Unless this function is called, the first search or match using 516 Unless this function is called, the first search or match using
532 PATTERN_BUFFER will allocate its own register data, without 517 PATTERN_BUFFER will allocate its own register data, without
533 freeing the old data. */ 518 freeing the old data. */
534extern void re_set_registers 519extern void re_set_registers (struct re_pattern_buffer *__buffer,
535 _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, 520 struct re_registers *__regs,
536 unsigned num_regs, regoff_t *starts, regoff_t *ends)); 521 unsigned __num_regs,
522 regoff_t *__starts, regoff_t *__ends);
537 523
538#if defined _REGEX_RE_COMP || defined _LIBC 524#if defined _REGEX_RE_COMP || defined _LIBC
539# ifndef _CRAY 525# ifndef _CRAY
540/* 4.2 bsd compatibility. */ 526/* 4.2 bsd compatibility. */
541extern char *re_comp _RE_ARGS ((const char *)); 527extern char *re_comp (const char *);
542extern int re_exec _RE_ARGS ((const char *)); 528extern int re_exec (const char *);
543# endif 529# endif
544#endif 530#endif
545 531
@@ -562,20 +548,19 @@ extern int re_exec _RE_ARGS ((const char *));
562#endif 548#endif
563 549
564/* POSIX compatibility. */ 550/* POSIX compatibility. */
565extern reg_errcode_t regcomp _RE_ARGS ((regex_t *__restrict __preg, 551extern reg_errcode_t regcomp (regex_t *__restrict __preg,
566 const char *__restrict __pattern, 552 const char *__restrict __pattern,
567 int __cflags)); 553 int __cflags);
568 554
569extern reg_errcode_t regexec _RE_ARGS ((const regex_t *__restrict __preg, 555extern reg_errcode_t regexec (const regex_t *__restrict __preg,
570 const char *__restrict __string, 556 const char *__restrict __string, size_t __nmatch,
571 size_t __nmatch, 557 regmatch_t __pmatch[__restrict_arr],
572 regmatch_t __pmatch[__restrict_arr], 558 int __eflags);
573 int __eflags));
574 559
575extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, 560extern size_t regerror (int __errcode, const regex_t * __preg,
576 char *__errbuf, size_t __errbuf_size)); 561 char *__errbuf, size_t __errbuf_size);
577 562
578extern void regfree _RE_ARGS ((regex_t *__preg)); 563extern void regfree (regex_t *__preg);
579 564
580 565
581#ifdef __cplusplus 566#ifdef __cplusplus