ICU-471 add shaping options & error code

X-SVN-Rev: 3629
This commit is contained in:
Markus Scherer 2001-02-15 02:36:15 +00:00
parent b35e4607a1
commit 33418441e8
5 changed files with 13 additions and 25 deletions

View File

@ -1917,7 +1917,8 @@ _uErrorName[U_ERROR_LIMIT]={
"U_UNSUPPORTED_ERROR",
"U_RESOURCE_TYPE_MISMATCH",
"U_ILLEGAL_ESCAPE_SEQUENCE",
"U_UNSUPPORTED_ESCAPE_SEQUENCE"
"U_UNSUPPORTED_ESCAPE_SEQUENCE",
"U_NO_SPACE_AVAILABLE"
};
U_CAPI const char * U_EXPORT2

View File

@ -123,8 +123,11 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
*/
#define U_SHAPE_LENGTH_FIXED_SPACES_AT_END 2
/** Not a valid option value. */
#define U_SHAPE_LENGTH_RESERVED 3
/**
* Memory option: the result must have the same length as the source.
* If more room is necessary, then try to consume spaces at the beginning of the text.
*/
#define U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING 3
/** Bit mask for memory options. */
#define U_SHAPE_LENGTH_MASK 3
@ -152,8 +155,11 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
/** Letter shaping option: replace "shaped" letter characters by abstract ones. */
#define U_SHAPE_LETTERS_UNSHAPE 0x10
/** Not a valid option value. */
#define U_SHAPE_LETTERS_RESERVED 0x18
/**
* Letter shaping option: replace abstract letter characters by "shaped" ones,
* but do not process Tashkeel characters.
*/
#define U_SHAPE_LETTERS_EXCEPT_TASHKEEL 0x18
/** Bit mask for letter shaping options. */
#define U_SHAPE_LETTERS_MASK 0x18

View File

@ -347,6 +347,7 @@ enum UErrorCode {
U_RESOURCE_TYPE_MISMATCH = 17, /**< an operation is requested over a resource that does not support it */
U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illlegal escape sequence */
U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */
U_NO_SPACE_AVAILABLE = 20, /**< No space available for in-buffer expansion for Arabic shaping */
U_ERROR_LIMIT /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */
};

View File

@ -105,8 +105,6 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
if( source==NULL || sourceLength<-1 ||
(dest==NULL && destSize!=0) || destSize<0 ||
options>=U_SHAPE_DIGIT_TYPE_RESERVED ||
(options&U_SHAPE_LENGTH_MASK)==U_SHAPE_LENGTH_RESERVED ||
(options&U_SHAPE_LETTERS_MASK)==U_SHAPE_LETTERS_RESERVED ||
(options&U_SHAPE_DIGITS_MASK)>=U_SHAPE_DIGITS_RESERVED
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;

View File

@ -729,24 +729,6 @@ doArabicShapingTest() {
log_err("failure in u_shapeArabic(destSize=-1), returned %s instead of U_ILLEGAL_ARGUMENT_ERROR\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=u_shapeArabic(source, LENGTHOF(source),
dest, LENGTHOF(dest),
U_SHAPE_LENGTH_RESERVED|U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
log_err("failure in u_shapeArabic(U_SHAPE_LENGTH_RESERVED), returned %s instead of U_ILLEGAL_ARGUMENT_ERROR\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=u_shapeArabic(source, LENGTHOF(source),
dest, LENGTHOF(dest),
U_SHAPE_LETTERS_RESERVED|U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
log_err("failure in u_shapeArabic(U_SHAPE_LETTERS_RESERVED), returned %s instead of U_ILLEGAL_ARGUMENT_ERROR\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=u_shapeArabic(source, LENGTHOF(source),
dest, LENGTHOF(dest),