ICU-450 rename UTransPosition fields

X-SVN-Rev: 1660
This commit is contained in:
Alan Liu 2000-06-27 20:07:59 +00:00
parent 4b93945b1a
commit c68b0038be
3 changed files with 37 additions and 31 deletions

View file

@ -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.
*
* <p>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;

View file

@ -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",

View file

@ -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; i<sizeof(Data)/sizeof(Data[0]); i=i+2){
UnicodeString log;
@ -512,7 +512,7 @@ void TransliteratorAPITest::TestKeyboardTransliterator3(){
for(int32_t i=0; i<sizeof(Data)/sizeof(Data[0]); i=i+4){
UnicodeString log;
index.contextStart=getInt(Data[i+0]);
index.contextLimit=getInt(Data[i+1]);
index.contextLimit=index.limit=getInt(Data[i+1]);
index.start=getInt(Data[i+2]);
t->transliterate(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)){