Aegis  4.25.D505
common/ac/regex.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 1998-2000, 2004-2006, 2008 Peter Miller
00004 //
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 3 of the License, or
00008 //      (at your option) any later version.
00009 //
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program. If not, see
00017 //      <http://www.gnu.org/licenses/>.
00018 //
00019 
00020 #ifndef COMMON_AC_REGEX_H
00021 #define COMMON_AC_REGEX_H
00022 
00023 //
00024 // The rxposix.h and regex.h include files need size_t.  We make this
00025 // file indempotent, so that code which includes *this* file doesn't
00026 // need to worry about the include file ordering.
00027 //
00028 #include <common/ac/stddef.h>
00029 #include <common/ac/sys/types.h>
00030 
00031 #if HAVE_RXPOSIX_H && HAVE_LIBRX
00032 extern "C" {
00033 #include <rxposix.h>
00034 }
00035 #else
00036 #if HAVE_REGEX_H
00037 
00038 //
00039 // The GNU Rx library has a broken usage of __restrict,
00040 // and we need to make sure it doesn't foul the compiler.
00041 //
00042 #undef __restrict_arr
00043 #define __restrict_arr
00044 #include <regex.h>
00045 #undef __restrict_arr
00046 #else
00047 
00048 //
00049 // Fake just enough to get things to compile.
00050 //
00051 #define regex_t int
00052 
00053 struct regmatch_t
00054 {
00055     int rm_so;
00056     int rm_eo;
00057 };
00058 
00059 #define REG_EXTENDED 0
00060 #define REG_NOSUB 0
00061 #define REG_NOMATCH -1
00062 #define REG_NOTBOL 0
00063 
00064 int regcomp(regex_t *preg, const char *regex, int cflags);
00065 int regexec(const regex_t *preg, const char *string, size_t nmatch,
00066     regmatch_t *pmatch, int eflags);
00067 size_t regerror(int errcode, const regex_t *preg, char *errbuf,
00068     size_t errbuf_size);
00069 void regfree(regex_t *preg);
00070 
00071 #endif
00072 #endif
00073 
00074 #endif // COMMON_AC_REGEX_H