109 lines · c
1/*-2 * This code is derived from OpenBSD's libc/regex, original license follows:3 *4 * Copyright (c) 1992 Henry Spencer.5 * Copyright (c) 1992, 19936 * The Regents of the University of California. All rights reserved.7 *8 * This code is derived from software contributed to Berkeley by9 * Henry Spencer of the University of Toronto.10 *11 * Redistribution and use in source and binary forms, with or without12 * modification, are permitted provided that the following conditions13 * are met:14 * 1. Redistributions of source code must retain the above copyright15 * notice, this list of conditions and the following disclaimer.16 * 2. Redistributions in binary form must reproduce the above copyright17 * notice, this list of conditions and the following disclaimer in the18 * documentation and/or other materials provided with the distribution.19 * 3. Neither the name of the University nor the names of its contributors20 * may be used to endorse or promote products derived from this software21 * without specific prior written permission.22 *23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF33 * SUCH DAMAGE.34 *35 * @(#)regex.h 8.1 (Berkeley) 6/2/9336 */37 38#ifndef LLVM_SUPPORT_REGEX_IMPL_H39#define LLVM_SUPPORT_REGEX_IMPL_H40 41#include <sys/types.h>42typedef off_t llvm_regoff_t;43typedef struct {44 llvm_regoff_t rm_so; /* start of match */45 llvm_regoff_t rm_eo; /* end of match */46} llvm_regmatch_t;47 48typedef struct llvm_regex {49 int re_magic;50 size_t re_nsub; /* number of parenthesized subexpressions */51 const char *re_endp; /* end pointer for REG_PEND */52 struct re_guts *re_g; /* none of your business :-) */53} llvm_regex_t;54 55/* llvm_regcomp() flags */56#define REG_BASIC 000057#define REG_EXTENDED 000158#define REG_ICASE 000259#define REG_NOSUB 000460#define REG_NEWLINE 001061#define REG_NOSPEC 002062#define REG_PEND 004063#define REG_DUMP 020064 65/* llvm_regerror() flags */66#define REG_NOMATCH 167#define REG_BADPAT 268#define REG_ECOLLATE 369#define REG_ECTYPE 470#define REG_EESCAPE 571#define REG_ESUBREG 672#define REG_EBRACK 773#define REG_EPAREN 874#define REG_EBRACE 975#define REG_BADBR 1076#define REG_ERANGE 1177#define REG_ESPACE 1278#define REG_BADRPT 1379#define REG_EMPTY 1480#define REG_ASSERT 1581#define REG_INVARG 1682#define REG_ATOI 255 /* convert name to number (!) */83#define REG_ITOA 0400 /* convert number to name (!) */84 85/* llvm_regexec() flags */86#define REG_NOTBOL 0000187#define REG_NOTEOL 0000288#define REG_STARTEND 0000489#define REG_TRACE 00400 /* tracing of execution */90#define REG_LARGE 01000 /* force large representation */91#define REG_BACKR 02000 /* force use of backref code */92 93#ifdef __cplusplus94extern "C" {95#endif96 97int llvm_regcomp(llvm_regex_t *, const char *, int);98size_t llvm_regerror(int, const llvm_regex_t *, char *, size_t);99int llvm_regexec(const llvm_regex_t *, const char *, size_t,100 llvm_regmatch_t [], int);101void llvm_regfree(llvm_regex_t *);102size_t llvm_strlcpy(char *dst, const char *src, size_t siz);103 104#ifdef __cplusplus105}106#endif107 108#endif /* LLVM_SUPPORT_REGEX_IMPL_H */109