From c68b0038be4c9ae357eeb2d6592b78b590bbf7bb Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Tue, 27 Jun 2000 20:07:59 +0000 Subject: [PATCH] ICU-450 rename UTransPosition fields X-SVN-Rev: 1660 --- icu4c/source/i18n/unicode/utrans.h | 56 ++++++++++++++----------- icu4c/source/test/cintltst/utransts.c | 6 +-- icu4c/source/test/intltest/transapi.cpp | 6 +-- 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/icu4c/source/i18n/unicode/utrans.h b/icu4c/source/i18n/unicode/utrans.h index 182221d7339..ee122d5f7e7 100644 --- a/icu4c/source/i18n/unicode/utrans.h +++ b/icu4c/source/i18n/unicode/utrans.h @@ -74,46 +74,52 @@ typedef enum _UTransDirection { /** * Position structure for utrans_transIncremental() incremental - * transliteration. This structure determines what portion of the - * text is transliterated, as well as the overall boundaries of the - * text. There are two sets of indices to accomodate users that wish - * to transliterate a substring but make surrounding text available as - * context. - - * TODO FIX: - * doc that this is input/output - * change names - * contextStart not changed - * others may change (and why) + * transliteration. This structure defines two substrings of the text + * being transliterated. The first region, [contextStart, + * contextLimit), defines what characters the transliterator will read + * as context. The second region, [start, limit), defines what + * characters will actually be transliterated. The second region + * should be a subset of the first. + * + *

After a transliteration operation, some of the indices in this + * structure will be modified. See the field descriptions for + * details. * @draft */ typedef struct _UTransPosition { /** - * Beginning index, inclusive. The transliterator will ignore - * anything before this index. + * Beginning index, inclusive, of the context to be considered for + * a transliteration operation. The transliterator will ignore + * anything before this index. INPUT parameter: This parameter is + * not changed by a transliteration operation. */ - int32_t start; /* contextStart */ + int32_t contextStart; /** - * Ending index, exclusive. The transliterator will ignore - * anything at or after this index. + * Ending index, exclusive, of the context to be considered for a + * transliteration operation. The transliterator will ignore + * anything at or after this index. INPUT/OUTPUT parameter: This + * parameter is updated to reflect changes in the length of the + * text, but points to the same logical position in the text. */ - int32_t limit; /* contextLimit */ + int32_t contextLimit; /** - * The next character to be considered for transliteration, - * inclusive. The transliterator will try to transliterate text - * from cursor to end-1. + * Beginning index, inclusive, of the text to be transliteratd. + * INPUT/OUTPUT parameter: This parameter is advanced past + * characters that have already been transliterated by a + * transliteration operation. */ - int32_t cursor; /* start */ + int32_t start; /** - * The limit character to be considered for transliteration, - * exclusive. The transliterator will not transliterate text at - * or after this index. + * Ending index, exclusive, of the text to be transliteratd. + * INPUT/OUTPUT parameter: This parameter is updated to reflect + * changes in the length of the text, but points to the same + * logical position in the text. */ - int32_t end; /* limit */ + int32_t limit; } UTransPosition; diff --git a/icu4c/source/test/cintltst/utransts.c b/icu4c/source/test/cintltst/utransts.c index 797021d76aa..e4fb9fa02ef 100644 --- a/icu4c/source/test/cintltst/utransts.c +++ b/icu4c/source/test/cintltst/utransts.c @@ -166,10 +166,10 @@ void _expectRules(const char* crules, /* utrans_transIncrementalUChars() */ u_strcpy(buf, from); - pos.start = pos.cursor = 0; - pos.end = pos.limit = u_strlen(buf); + pos.start = pos.contextStart = 0; + pos.limit = pos.contextLimit = u_strlen(buf); utrans_transIncrementalUChars(trans, buf, NULL, CAP, &pos, &status); - utrans_transUChars(trans, buf, NULL, CAP, pos.start, &pos.end, &status); + utrans_transUChars(trans, buf, NULL, CAP, pos.start, &pos.limit, &status); if (U_FAILURE(status)) { utrans_close(trans); log_err("FAIL: utrans_transIncrementalUChars() failed, error=%s\n", diff --git a/icu4c/source/test/intltest/transapi.cpp b/icu4c/source/test/intltest/transapi.cpp index 6a264e0273b..841505909f9 100644 --- a/icu4c/source/test/intltest/transapi.cpp +++ b/icu4c/source/test/intltest/transapi.cpp @@ -427,7 +427,7 @@ void TransliteratorAPITest::TestKeyboardTransliterator1(){ s=""; status=U_ZERO_ERROR; - index.contextStart = index.contextLimit = index.start = 0; + index.contextStart = index.contextLimit = index.start = index.limit = 0; logln("Testing transliterate(Replaceable, int32_t, UChar, UErrorCode)"); for(i=10; itransliterate(s, index, status); if(U_FAILURE(status)){ @@ -671,7 +671,7 @@ void TransliteratorAPITest::keyboardAux(Transliterator *t, UnicodeString DATA[], if (DATA[i+0] != "") { log = s + " + " + DATA[0] + " -> "; index.contextStart=getInt(DATA[i+2]); - index.contextLimit=getInt(DATA[i+3]); + index.contextLimit=index.limit=getInt(DATA[i+3]); index.start=getInt(DATA[i+4]); t->transliterate(s, index, DATA[i+0], status); if(U_FAILURE(status)){