2000-09-26 11:48:28 +00:00
|
|
|
/*
|
|
|
|
*
|
2002-04-24 10:50:23 +00:00
|
|
|
* Copyright (c) 1998-2002
|
2000-09-26 11:48:28 +00:00
|
|
|
* Dr John Maddock
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Dr John Maddock makes no representations
|
|
|
|
* about the suitability of this software for any purpose.
|
|
|
|
* It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* LOCATION: see http://www.boost.org for most recent version.
|
|
|
|
* FILE wide_posix_api_compiler_check.c
|
2001-09-30 10:30:14 +00:00
|
|
|
* VERSION see <boost/version.hpp>
|
2000-09-26 11:48:28 +00:00
|
|
|
* DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
|
|
|
|
* time check only.
|
|
|
|
*/
|
|
|
|
|
2002-08-02 11:59:22 +00:00
|
|
|
#define UNICODE
|
|
|
|
#define _UNICODE
|
|
|
|
|
2000-09-26 11:48:28 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <wchar.h>
|
|
|
|
#include <boost/regex.h>
|
|
|
|
|
2002-04-24 10:50:23 +00:00
|
|
|
#ifndef BOOST_NO_WREGEX
|
|
|
|
|
2000-09-26 11:48:28 +00:00
|
|
|
const wchar_t* expression = L"^";
|
|
|
|
const wchar_t* text = L"\n ";
|
|
|
|
regmatch_t matches[1];
|
|
|
|
int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
|
|
|
REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
|
|
|
|
REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
regex_t re;
|
|
|
|
int result;
|
|
|
|
result = regcomp(&re, expression, REG_AWK);
|
|
|
|
if(result > REG_NOERROR)
|
|
|
|
{
|
|
|
|
wchar_t buf[256];
|
|
|
|
regerror(result, &re, buf, sizeof(buf));
|
2002-11-24 11:48:36 +00:00
|
|
|
char nbuf[256];
|
|
|
|
for(int i = 0; i < 256; ++i)
|
|
|
|
nbuf[i] = buf[i];
|
|
|
|
printf(nbuf);
|
2000-09-26 11:48:28 +00:00
|
|
|
return result;
|
|
|
|
}
|
2002-11-24 11:48:36 +00:00
|
|
|
if(re.re_nsub != 0)
|
|
|
|
{
|
|
|
|
regfree(&re);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2000-09-26 11:48:28 +00:00
|
|
|
matches[0].rm_so = 0;
|
|
|
|
matches[0].rm_eo = wcslen(text);
|
|
|
|
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
|
|
|
if(result > REG_NOERROR)
|
|
|
|
{
|
|
|
|
wchar_t buf[256];
|
|
|
|
regerror(result, &re, buf, sizeof(buf));
|
2002-11-24 11:48:36 +00:00
|
|
|
char nbuf[256];
|
|
|
|
for(int i = 0; i < 256; ++i)
|
|
|
|
nbuf[i] = buf[i];
|
|
|
|
printf(nbuf);
|
2000-09-26 11:48:28 +00:00
|
|
|
regfree(&re);
|
|
|
|
return result;
|
|
|
|
}
|
2002-11-24 11:48:36 +00:00
|
|
|
if((matches[0].rm_so != matches[0].rm_eo) || (matches[0].rm_eo != 1))
|
|
|
|
{
|
|
|
|
regfree(&re);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2000-09-26 11:48:28 +00:00
|
|
|
regfree(&re);
|
2001-12-09 12:50:46 +00:00
|
|
|
printf("no errors found\n");
|
2000-09-26 11:48:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-04-24 10:50:23 +00:00
|
|
|
#else
|
|
|
|
# error "This library has not been configured for wide character support"
|
|
|
|
#endif
|
|
|
|
|
2001-12-09 12:50:46 +00:00
|
|
|
|
2002-11-24 11:48:36 +00:00
|
|
|
|