removed calls to wprintf: Linux doesn't have that API.

removed calls to assert: MWCW can't cope with it when UNICODE is defined.


[SVN r16392]
This commit is contained in:
John Maddock
2002-11-24 11:48:36 +00:00
parent 0e37a76df0
commit abef9c7249
2 changed files with 40 additions and 10 deletions

View File

@ -44,27 +44,40 @@ int main()
{
regex_t re;
int result;
wchar_t buf[256];
char nbuf[256];
int i;
result = regcomp(&re, expression, REG_AWK);
if(result > REG_NOERROR)
{
wchar_t buf[256];
regerror(result, &re, buf, sizeof(buf));
wprintf(buf);
for(i = 0; i < 256; ++i)
nbuf[i] = buf[i];
printf(nbuf);
return result;
}
assert(re.re_nsub == 0);
if(re.re_nsub != 0)
{
regfree(&re);
exit(-1);
}
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));
wprintf(buf);
for(i = 0; i < 256; ++i)
nbuf[i] = buf[i];
printf(nbuf);
regfree(&re);
return result;
}
assert(matches[0].rm_so == matches[0].rm_eo == 1);
if((matches[0].rm_so != matches[0].rm_eo) || (matches[0].rm_eo != 1))
{
regfree(&re);
exit(-1);
}
regfree(&re);
printf("no errors found\n");
return 0;
@ -74,3 +87,5 @@ int main()
# error "This library has not been configured for wide character support"
#endif

View File

@ -49,10 +49,17 @@ int main()
{
wchar_t buf[256];
regerror(result, &re, buf, sizeof(buf));
wprintf(buf);
char nbuf[256];
for(int i = 0; i < 256; ++i)
nbuf[i] = buf[i];
printf(nbuf);
return result;
}
assert(re.re_nsub == 0);
if(re.re_nsub != 0)
{
regfree(&re);
exit(-1);
}
matches[0].rm_so = 0;
matches[0].rm_eo = wcslen(text);
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
@ -60,11 +67,18 @@ int main()
{
wchar_t buf[256];
regerror(result, &re, buf, sizeof(buf));
wprintf(buf);
char nbuf[256];
for(int i = 0; i < 256; ++i)
nbuf[i] = buf[i];
printf(nbuf);
regfree(&re);
return result;
}
assert(matches[0].rm_so == matches[0].rm_eo == 1);
if((matches[0].rm_so != matches[0].rm_eo) || (matches[0].rm_eo != 1))
{
regfree(&re);
exit(-1);
}
regfree(&re);
printf("no errors found\n");
return 0;
@ -75,3 +89,4 @@ int main()
#endif