/********************************************************************
* COPYRIGHT:
- * Copyright (C) 2008 IBM, Inc. All Rights Reserved.
+ * Copyright (C) 2008-2012 IBM, Inc. All Rights Reserved.
*
********************************************************************/
/**
}
/* Get the Text */
src = getBuffer(srcLen, status);
-
+
+#if 0
/* Get a word to find. Do this by selecting a random word with a word breakiterator. */
UBreakIterator* brk = ubrk_open(UBRK_WORD, locale, src, srcLen, &status);
if(U_FAILURE(status)){
}
pttrn = temp; /* store word in pttrn */
ubrk_close(brk);
+#else
+ /* The first line of the file contains the pattern */
+ start = 0;
+
+ for(end = start; ; end += 1) {
+ UChar ch = src[end];
+
+ if (ch == 0x000A || ch == 0x000D || ch == 0x2028) {
+ break;
+ }
+ }
+
+ pttrnLen = end - start;
+ UChar* temp = (UChar*)malloc(sizeof(UChar)*(pttrnLen));
+ for (int i = 0; i < pttrnLen; i++) {
+ temp[i] = src[start++];
+ }
+ pttrn = temp; /* store word in pttrn */
+#endif
/* Create the StringSearch object to be use in performance test. */
srch = usearch_open(pttrn, pttrnLen, src, srcLen, locale, NULL, &status);
+
if(U_FAILURE(status)){
fprintf(stderr, "FAILED to create UPerfTest object. Error: %s\n", u_errorName(status));
return;