⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x_regex.h

📁 一套客户/服务器模式的备份系统代码,跨平台,支持linux,AIX, IRIX, FreeBSD, Digital Unix (OSF1), Solaris and HP-UX.
💻 H
📖 第 1 页 / 共 2 页
字号:
#define REG_ECOLLATE    21      /* Invalid collating element */#define REG_EESCAPE     22      /* Last character is \ */#define REG_ERANGE      23      /* Invalid range exp endpoint */#define REG_ECTYPE      24      /* Invalid character class */#define REG_ESUBREG     25      /* Invalid number in \digit */#define REG_BADRPT      26      /* ?*+ not preceded by valid RE */#define REG_EPAREN      42      /* \( \) or () imbalance */#define REG_EBRACE      45      /* \{ \} or { } imbalance */#define REG_EBRACK      49      /* [] imbalance */#define REG_ESPACE      50      /* Out of memory */#endif	/* defined(DECL_POSIX_REGEX) */  /* Error codes we've added.  */#define	REG_NOERROR	0	/* Success.  */#define	REG_EEND	1001	/* Premature end.  */#define	REG_ESIZE	1002	/* Compiled pattern bigger than 2^16 bytes.  */#define	REG_ERPAREN	1003	/* Unmatched ) or \); not returned from regcomp.  */typedef	Uns32	reg_errcode_t;/* This data structure represents a compiled pattern.  Before calling   the pattern compiler, the fields `buffer', `allocated', `fastmap',   `translate', and `no_sub' can be set.  After the pattern has been   compiled, the `re_nsub' field is available.  All other fields are   private to the regex routines.  */struct re_pattern_buffer{/* [[[begin pattern_buffer]]] */	/* Space that holds the compiled pattern.  It is declared as          `unsigned char *' because its elements are           sometimes used as array indexes.  */  UChar *buffer;	/* Number of bytes to which `buffer' points.  */  Uns32 allocated;	/* Number of bytes actually used in `buffer'.  */  Uns32 used;	        /* Syntax setting with which the pattern was compiled.  */  reg_syntax_t syntax;        /* Pointer to a fastmap, if any, otherwise zero.  re_search uses           the fastmap, if there is one, to skip over impossible           starting points for matches.  */  UChar *fastmap;        /* Either a translate table to apply to all characters before           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.  */  UChar *translate;	/* Number of subexpressions found by the compiler.  */  size_t re_nsub;        /* Zero if this pattern cannot match the empty string, one else.           Well, in truth it's used only in `re_search_2', to see           whether or not we should use the fastmap, so we don't set           this absolutely perfectly; see `re_compile_fastmap' (the           `duplicate' case).  */  int can_be_null : 1;        /* If REGS_UNALLOCATED, allocate space in the `regs' structure             for `max (RE_NREGS, re_nsub + 1)' groups.           If REGS_REALLOCATE, reallocate space if necessary.           If REGS_FIXED, use what's there.  */#define REGS_UNALLOCATED 0#define REGS_REALLOCATE 1#define REGS_FIXED 2  int regs_allocated : 2;        /* Set to zero when `regex_compile' compiles a pattern; set to one           by `re_compile_fastmap' if it updates the fastmap.  */  int fastmap_accurate : 1;        /* If set, `re_match_2' does not return information about           subexpressions.  */  int no_sub : 1;        /* If set, a beginning-of-line anchor doesn't match at the           beginning of the string.  */   int not_bol : 1;        /* Similarly for an end-of-line anchor.  */  int not_eol : 1;        /* If true, an anchor at a newline matches.  */  int newline_anchor : 1;/* [[[end pattern_buffer]]] */};#ifdef	DECL_POSIX_REGEXtypedef struct re_pattern_buffer regex_t;/* Type for byte offsets within the string.  POSIX mandates this.  */typedef Int32 regoff_t;#endif/* search.c (search_buffer) in Emacs needs this one opcode value.  It is   defined both in `regex.c' and here.  */#define RE_EXACTN_VALUE 1/* This is the structure we store register match data in.  See   regex.texinfo for a full description of what registers match.  */struct re_registers{  Uns32 num_regs;  regoff_t *start;  regoff_t *end;};/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,   `re_match_2' returns information about at least this many registers   the first time a `regs' structure is passed.  */#ifndef RE_NREGS#define RE_NREGS 30#endif#ifdef	DECL_POSIX_REGEX/* POSIX specification for registers.  Aside from the different names than   `re_registers', POSIX uses an array of structures, instead of a   structure of arrays.  */typedef struct{  regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */  regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */} regmatch_t;#endif/* Declarations for routines.  *//* To avoid duplicating every routine declaration -- once with a   prototype (if we are ANSI), and once without (if we aren't) -- we   use the following macro to declare argument types.  This   unfortunately clutters up the declarations a bit, but I think it's   worth it.  */#if __STDC__#define _RE_ARGS(args) args#else /* not __STDC__ */#define _RE_ARGS(args) ()#endif /* not __STDC__ *//* Sets the current default syntax to SYNTAX, and return the old syntax.   You can also simply assign to the `re_syntax_options' variable.  */extern reg_syntax_t re_set_syntax _RE_ARGS ((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.  */extern UChar *re_compile_pattern  _RE_ARGS ((UChar *pattern, Int32 length,             struct re_pattern_buffer *buffer));/* Compile a fastmap for the compiled pattern in BUFFER; used to   accelerate searches.  Return 0 if successful and -2 if was an   internal error.  */extern Int32 re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));/* Search in the string STRING (with length LENGTH) for the pattern   compiled into BUFFER.  Start searching at position START, for RANGE   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).  */extern Int32 re_search  _RE_ARGS ((struct re_pattern_buffer *buffer, UChar *string,            Int32 length, Int32 start, Int32 range, struct re_registers *regs));/* Like `re_search', but search in the concatenation of STRING1 and   STRING2.  Also, stop searching at index START + STOP.  */extern Int32 re_search_2  _RE_ARGS ((struct re_pattern_buffer *buffer, UChar *string1,             Int32 length1, UChar *string2, Int32 length2,             Int32 start, Int32 range, struct re_registers *regs, Int32 stop));/* Like `re_search', but return how many characters in STRING the regexp   in BUFFER matched, starting at position START.  */extern Int32 re_match  _RE_ARGS ((struct re_pattern_buffer *buffer, UChar *string,             Int32 length, Int32 start, struct re_registers *regs));/* Relates to `re_match' as `re_search_2' relates to `re_search'.  */extern Int32 re_match_2   _RE_ARGS ((struct re_pattern_buffer *buffer, UChar *string1,             Int32 length1, UChar *string2, Int32 length2,             Int32 start, struct re_registers *regs, Int32 stop));/* Set REGS to hold NUM_REGS registers, storing them in STARTS and   ENDS.  Subsequent matches using BUFFER and REGS will use this memory   for recording register information.  STARTS and ENDS must be   allocated with malloc, and must each be at least `NUM_REGS * sizeof   (regoff_t)' bytes long.   If NUM_REGS == 0, then subsequent matches should allocate their own   register data.   Unless this function is called, the first search or match using   PATTERN_BUFFER will allocate its own register data, without   freeing the old data.  */extern void re_set_registers  _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,             Uns32 num_regs, regoff_t *starts, regoff_t *ends));#ifndef	DEF_RE_COMP#include	<unistd.h>#elseextern UChar *re_comp _RE_ARGS ((UChar *));extern Int32 re_exec _RE_ARGS ((UChar *));#endif#ifdef	DECL_POSIX_REGEX/* POSIX compatibility.  */extern Int32 regcomp _RE_ARGS ((regex_t *preg, UChar *pattern, Int32 cflags));extern Int32 regexec  _RE_ARGS ((regex_t *preg, UChar *string, size_t nmatch,             regmatch_t pmatch[], Int32 eflags));extern size_t regerror  _RE_ARGS ((Int32 errcode, regex_t *preg, UChar *errbuf,             size_t errbuf_size));extern void regfree _RE_ARGS ((regex_t *preg));#endif	/* defined(DECL_POSIX_REGEX) */#endif	/* defined(DECL_RE_UTILS) */typedef	struct re_pattern_buffer	RE_cmp_buffer;extern Int32	re_find_match (struct re_pattern_buffer *, UChar *,			Int32 *, Int32 *);extern Int32	re_find_match_once(UChar *, UChar *, Int32 *, Int32 *);extern Int32	args_to_regexarr(RE_cmp_buffer **, UChar *);extern void	re_free(struct re_pattern_buffer *);#endif /* ! __X_REGEXP_LIBRARY_H__ *//*Local variables:make-backup-files: tversion-control: ttrim-versions-without-asking: nilEnd:*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -