ICU-6149 Use traditional ICU C callback declarations.

X-SVN-Rev: 23481
This commit is contained in:
George Rhoten 2008-02-25 21:21:47 +00:00
parent c905bdfa76
commit fe7e42eace
4 changed files with 113 additions and 111 deletions

View File

@ -1207,7 +1207,7 @@ int32_t RegexMatcher::getStackLimit() const {
// setMatchCallback
//
//--------------------------------------------------------------------------------
void RegexMatcher::setMatchCallback(URegexMatchCallback callback,
void RegexMatcher::setMatchCallback(URegexMatchCallback *callback,
const void *context,
UErrorCode &status) {
if (U_FAILURE(status)) {
@ -1223,7 +1223,7 @@ void RegexMatcher::setMatchCallback(URegexMatchCallback callback,
// getMatchCallback
//
//--------------------------------------------------------------------------------
void RegexMatcher::getMatchCallback(URegexMatchCallback &callback,
void RegexMatcher::getMatchCallback(URegexMatchCallback *&callback,
const void *&context,
UErrorCode &status) {
if (U_FAILURE(status)) {

View File

@ -1080,7 +1080,7 @@ public:
* @param status A reference to a UErrorCode to receive any errors.
* @draft ICU 4.0
*/
virtual void setMatchCallback(URegexMatchCallback callback,
virtual void setMatchCallback(URegexMatchCallback *callback,
const void *context,
UErrorCode &status);
@ -1096,7 +1096,7 @@ public:
* @param status A reference to a UErrorCode to receive any errors.
* @draft ICU 4.0
*/
virtual void getMatchCallback(URegexMatchCallback &callback,
virtual void getMatchCallback(URegexMatchCallback *&callback,
const void *&context,
UErrorCode &status);
@ -1213,7 +1213,7 @@ private:
int32_t fStackLimit; // Maximum memory size to use for the backtrack
// stack, in bytes. Zero for unlimited.
URegexMatchCallback fCallbackFn; // Pointer to match progress callback funct.
URegexMatchCallback *fCallbackFn; // Pointer to match progress callback funct.
// NULL if there is no callback.
const void *fCallbackContext; // User Context ptr for callback function.

View File

@ -939,9 +939,11 @@ uregex_getStackLimit(const URegularExpression *regexp,
* FALSE to terminate the matching operation.
* @draft ICU 4.0
*/
typedef UBool (U_EXPORT2 *URegexMatchCallback) (
U_CDECL_BEGIN
typedef UBool U_CALLCONV URegexMatchCallback (
const void *context,
int32_t steps);
U_CDECL_END
/**
* Set a callback function for this URegularExpression.
@ -959,7 +961,7 @@ typedef UBool (U_EXPORT2 *URegexMatchCallback) (
*/
U_DRAFT void U_EXPORT2
uregex_setMatchCallback(URegularExpression *regexp,
URegexMatchCallback callback,
URegexMatchCallback *callback,
const void *context,
UErrorCode *status);
@ -977,7 +979,7 @@ uregex_setMatchCallback(URegularExpression *regexp,
*/
U_DRAFT void U_EXPORT2
uregex_getMatchCallback(const URegularExpression *regexp,
URegexMatchCallback *callback,
URegexMatchCallback **callback,
const void **context,
UErrorCode *status);

View File

@ -2420,7 +2420,7 @@ void RegexTest::Callbacks() {
// The variables that the getter will fill in.
// Init to non-null values so that the action of the getter can be seen.
const void *returnedContext = &returnedContext;
URegexMatchCallback returnedFn = &testCallBackFn;
URegexMatchCallback *returnedFn = &testCallBackFn;
UErrorCode status = U_ZERO_ERROR;
RegexMatcher matcher("x", 0, status);
@ -2435,7 +2435,7 @@ void RegexTest::Callbacks() {
// Set and Get work
callBackContext cbInfo = {this, 0, 0, 0};
const void *returnedContext;
URegexMatchCallback returnedFn;
URegexMatchCallback *returnedFn;
UErrorCode status = U_ZERO_ERROR;
RegexMatcher matcher("((.)+\\2)+x", 0, status); // A pattern that can run long.
REGEX_CHECK_STATUS;
@ -2443,7 +2443,7 @@ void RegexTest::Callbacks() {
REGEX_CHECK_STATUS;
matcher.getMatchCallback(returnedFn, returnedContext, status);
REGEX_CHECK_STATUS;
REGEX_ASSERT(returnedFn == &testCallBackFn);
REGEX_ASSERT(returnedFn == testCallBackFn);
REGEX_ASSERT(returnedContext == &cbInfo);
// A short-running match shouldn't invoke the callback