LLVM API Documentation

regex_impl.h
Go to the documentation of this file.
00001 /*-
00002  * This code is derived from OpenBSD's libc/regex, original license follows:
00003  *
00004  * Copyright (c) 1992 Henry Spencer.
00005  * Copyright (c) 1992, 1993
00006  *  The Regents of the University of California.  All rights reserved.
00007  *
00008  * This code is derived from software contributed to Berkeley by
00009  * Henry Spencer of the University of Toronto.
00010  *
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions
00013  * are met:
00014  * 1. Redistributions of source code must retain the above copyright
00015  *    notice, this list of conditions and the following disclaimer.
00016  * 2. Redistributions in binary form must reproduce the above copyright
00017  *    notice, this list of conditions and the following disclaimer in the
00018  *    documentation and/or other materials provided with the distribution.
00019  * 3. Neither the name of the University nor the names of its contributors
00020  *    may be used to endorse or promote products derived from this software
00021  *    without specific prior written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00024  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00027  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00029  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00032  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  *  @(#)regex.h 8.1 (Berkeley) 6/2/93
00036  */
00037 
00038 #ifndef _REGEX_H_
00039 #define _REGEX_H_
00040 
00041 #include <sys/types.h>
00042 typedef off_t llvm_regoff_t;
00043 typedef struct {
00044   llvm_regoff_t rm_so;    /* start of match */
00045   llvm_regoff_t rm_eo;    /* end of match */
00046 } llvm_regmatch_t;
00047 
00048 typedef struct llvm_regex {
00049   int re_magic;
00050   size_t re_nsub;   /* number of parenthesized subexpressions */
00051   const char *re_endp;  /* end pointer for REG_PEND */
00052   struct re_guts *re_g; /* none of your business :-) */
00053 } llvm_regex_t;
00054 
00055 /* llvm_regcomp() flags */
00056 #define REG_BASIC 0000
00057 #define REG_EXTENDED  0001
00058 #define REG_ICASE 0002
00059 #define REG_NOSUB 0004
00060 #define REG_NEWLINE 0010
00061 #define REG_NOSPEC  0020
00062 #define REG_PEND  0040
00063 #define REG_DUMP  0200
00064 
00065 /* llvm_regerror() flags */
00066 #define REG_NOMATCH  1
00067 #define REG_BADPAT   2
00068 #define REG_ECOLLATE   3
00069 #define REG_ECTYPE   4
00070 #define REG_EESCAPE  5
00071 #define REG_ESUBREG  6
00072 #define REG_EBRACK   7
00073 #define REG_EPAREN   8
00074 #define REG_EBRACE   9
00075 #define REG_BADBR 10
00076 #define REG_ERANGE  11
00077 #define REG_ESPACE  12
00078 #define REG_BADRPT  13
00079 #define REG_EMPTY 14
00080 #define REG_ASSERT  15
00081 #define REG_INVARG  16
00082 #define REG_ATOI  255 /* convert name to number (!) */
00083 #define REG_ITOA  0400  /* convert number to name (!) */
00084 
00085 /* llvm_regexec() flags */
00086 #define REG_NOTBOL  00001
00087 #define REG_NOTEOL  00002
00088 #define REG_STARTEND  00004
00089 #define REG_TRACE 00400 /* tracing of execution */
00090 #define REG_LARGE 01000 /* force large representation */
00091 #define REG_BACKR 02000 /* force use of backref code */
00092 
00093 #ifdef __cplusplus
00094 extern "C" {
00095 #endif
00096 
00097 int llvm_regcomp(llvm_regex_t *, const char *, int);
00098 size_t  llvm_regerror(int, const llvm_regex_t *, char *, size_t);
00099 int llvm_regexec(const llvm_regex_t *, const char *, size_t, 
00100                      llvm_regmatch_t [], int);
00101 void  llvm_regfree(llvm_regex_t *);
00102 size_t  llvm_strlcpy(char *dst, const char *src, size_t siz);
00103 
00104 #ifdef __cplusplus
00105 }
00106 #endif
00107 
00108 #endif /* !_REGEX_H_ */