X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fregex.h;h=ae2c910b80447bffc01e8c4bf84334a03f53fe2d;hb=cd2292bbfe34d2aba639cf019094dcb85802508c;hp=74db8b3997563f602f04596d68678121825d80a0;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910;p=chise%2Fxemacs-chise.git.1 diff --git a/src/regex.h b/src/regex.h index 74db8b3..ae2c910 100644 --- a/src/regex.h +++ b/src/regex.h @@ -20,13 +20,40 @@ /* Synched up with: FSF 19.29. */ -#ifndef __REGEXP_LIBRARY_H__ -#define __REGEXP_LIBRARY_H__ +#ifndef INCLUDED_regex_h_ +#define INCLUDED_regex_h_ + +#ifdef emacs +#define RE_TRANSLATE_TYPE Lisp_Object +#else +#define RE_TRANSLATE_TYPE char * + +/* type definitions copied from lisp.h */ +#ifndef SIZEOF_EMACS_INT +# define SIZEOF_EMACS_INT SIZEOF_VOID_P +#endif + +#ifndef EMACS_INT +# if SIZEOF_EMACS_INT == SIZEOF_LONG +# define EMACS_INT long +# elif SIZEOF_EMACS_INT == SIZEOF_INT +# define EMACS_INT int +# elif SIZEOF_EMACS_INT == SIZEOF_LONG_LONG +# define EMACS_INT long long +# else +# error Unable to determine suitable type for EMACS_INT +# endif +#endif + +/* Counts of bytes or array elements */ +typedef EMACS_INT Memory_count; +typedef EMACS_INT Element_count; + +#endif /* emacs */ /* POSIX says that must be included (by the caller) before . */ - /* The following bits are used to determine the regexp syntax we recognize. The not-set meaning typically corresponds to the syntax used by Emacs (the exception is RE_INTERVAL, made for historical @@ -329,10 +356,15 @@ struct re_pattern_buffer comparing them, or zero for no translation. The translation is applied to a pattern when it is compiled and to a string when it is matched. */ - char *translate; + RE_TRANSLATE_TYPE translate; - /* Number of subexpressions found by the compiler. */ - size_t re_nsub; + /* Number of returnable groups found by the compiler. (This does + not count shy groups.) */ + Element_count re_nsub; + + /* Total number of groups found by the compiler. (Including + shy ones.) */ + Element_count re_ngroups; /* Zero if this pattern cannot match the empty string, one else. Well, in truth it's used only in `re_search_2', to see @@ -368,6 +400,12 @@ struct re_pattern_buffer /* If true, an anchor at a newline matches. */ unsigned newline_anchor : 1; + /* Mapping between back references and groups (may not be + equivalent with shy groups). */ + int *external_to_internal_register; + + int external_to_internal_register_size; + /* [[[end pattern_buffer]]] */ }; @@ -381,7 +419,7 @@ typedef int regoff_t; regex.texinfo for a full description of what registers match. */ struct re_registers { - unsigned num_regs; + int num_regs; regoff_t *start; regoff_t *end; }; @@ -413,7 +451,7 @@ reg_syntax_t re_set_syntax (reg_syntax_t syntax); /* Compile the regular expression PATTERN, with length LENGTH and syntax given by the global `re_syntax_options', into the buffer BUFFER. Return NULL if successful, and an error string if not. */ -CONST char *re_compile_pattern (CONST char *pattern, int length, +const char *re_compile_pattern (const char *pattern, int length, struct re_pattern_buffer *buffer); @@ -428,27 +466,27 @@ int re_compile_fastmap (struct re_pattern_buffer *buffer); characters. Return the starting position of the match, -1 for no match, or -2 for an internal error. Also return register information in REGS (if REGS and BUFFER->no_sub are nonzero). */ -int re_search (struct re_pattern_buffer *buffer, CONST char *string, +int re_search (struct re_pattern_buffer *buffer, const char *string, int length, int start, int range, struct re_registers *regs); /* Like `re_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ -int re_search_2 (struct re_pattern_buffer *buffer, CONST char *string1, - int length1, CONST char *string2, int length2, int start, +int re_search_2 (struct re_pattern_buffer *buffer, const char *string1, + int length1, const char *string2, int length2, int start, int range, struct re_registers *regs, int stop); /* Like `re_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ -int re_match (struct re_pattern_buffer *buffer, CONST char *string, +int re_match (struct re_pattern_buffer *buffer, const char *string, int length, int start, struct re_registers *regs); /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ -int re_match_2 (struct re_pattern_buffer *buffer, CONST char *string1, - int length1, CONST char *string2, int length2, +int re_match_2 (struct re_pattern_buffer *buffer, const char *string1, + int length1, const char *string2, int length2, int start, struct re_registers *regs, int stop); @@ -470,16 +508,18 @@ void re_set_registers (struct re_pattern_buffer *buffer, #ifdef _REGEX_RE_COMP /* 4.2 bsd compatibility. */ -char *re_comp (CONST char *); -int re_exec (CONST char *); +char *re_comp (const char *); +int re_exec (const char *); #endif /* POSIX compatibility. */ -int regcomp (regex_t *preg, CONST char *pattern, int cflags); -int regexec (CONST regex_t *preg, CONST char *string, size_t nmatch, +/* #### Arrgh, not any more. But I don't have time to deal with this + properly, and I don't know if we should care. - sjt */ +int regcomp (regex_t *preg, const char *pattern, int cflags); +int regexec (const regex_t *preg, const char *string, Element_count nmatch, regmatch_t pmatch[], int eflags); -size_t regerror (int errcode, CONST regex_t *preg, char *errbuf, - size_t errbuf_size); +Memory_count regerror (int errcode, const regex_t *preg, char *errbuf, + Memory_count errbuf_size); void regfree (regex_t *preg); -#endif /* not __REGEXP_LIBRARY_H__ */ +#endif /* INCLUDED_regex_h_ */