diff options
Diffstat (limited to 'Build/source/texk/bibtexu/bibtex-3.c')
-rw-r--r-- | Build/source/texk/bibtexu/bibtex-3.c | 90 |
1 files changed, 88 insertions, 2 deletions
diff --git a/Build/source/texk/bibtexu/bibtex-3.c b/Build/source/texk/bibtexu/bibtex-3.c index 74838d5dad6..34b50823f77 100644 --- a/Build/source/texk/bibtexu/bibtex-3.c +++ b/Build/source/texk/bibtexu/bibtex-3.c @@ -140,7 +140,15 @@ #include "utils.h" #include "version.h" +/* +Include the ICU heads. 23/sep/2009 +*/ +#include "unicode/ustdio.h" +#include "unicode/uchar.h" +#include "unicode/ustring.h" +#include "unicode/ucnv.h" +#include "unicode/ucol.h" /*************************************************************************** * WEB section number: 336 * ~~~~~~~~~~~~~~~~~~~ @@ -1907,7 +1915,7 @@ BEGIN } #endif /* TRACE */ - lower_case (buffer, buf_ptr1, TOKEN_LEN); + lower_case (buffer, buf_ptr1, TOKEN_LEN);//printf(" 192 "); fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, BST_FN_ILK, DONT_INSERT); if ( ! hash_found) @@ -3053,6 +3061,11 @@ END * This system-independent procedure is the same as the previous except * that it converts lower- to upper-case letters. ***************************************************************************/ + +/* +This is original code of upper_case. 23/sep/2009 +*/ + void upper_case (BufType_T buf, BufPointer_T bf_ptr, BufPointer_T len) BEGIN @@ -3081,7 +3094,77 @@ END /*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 63 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ +/* +This foction "upper_case_uni" is for prcessing the character UTF-8. +It's like lower_case_uni. 23/sep/2009 +*/ +BufPointer_T upper_case_uni (BufType_T buf, BufPointer_T bf_ptr, + BufPointer_T len) +BEGIN +// printf("O~ lala~~"); + UChar target[BUF_SIZE+1]; + int32_t tarcap=BUF_SIZE+1; + int32_t tarlen = icu_toUChars(buf, bf_ptr, len, target, tarcap); + + UChar tarup[BUF_SIZE+1]; + int32_t tucap=BUF_SIZE+1; + int32_t tulen=icu_strToUpper(tarup, tucap,target, tarlen); + + unsigned char dest[BUF_SIZE+1]; + int32_t destcap= BUF_SIZE-bf_ptr; + + int32_t tblen=icu_fromUChars(dest, destcap, (const UChar *) tarup, tulen); + + BufPointer_T i; + if (tblen > 0) + BEGIN + if (len!=tblen) + BEGIN + unsigned char tmp[BUF_SIZE+1]; + BufPointer_T tmppr=0; + for (i=bf_ptr+len;i<=(BUF_SIZE-tblen+len);i++) + BEGIN + tmp[tmppr]=buf[i]; + tmppr++; + END + i=bf_ptr+tblen; + tmppr=0; + for (tmppr=0;tmppr<=(BUF_SIZE-bf_ptr-tblen);tmppr++) + BEGIN + buf[i]=tmp[tmppr]; + i++; + END + END + for (i = 0; i <= (tblen - 1); i++) + BEGIN + + buf[i+bf_ptr]=dest[i]; + END + END + return tblen; +END + +/* +This fonction is for transform Unicode string to up case. 23/sep/2009 +*/ + +int32_t icu_strToUpper(UChar * tarup, int32_t tucap, UChar * target, int32_t tarlen) +BEGIN + int32_t tulen; + UErrorCode err1 = U_ZERO_ERROR; + if (!U_SUCCESS(err1)) + BEGIN + printf("3there is a error: U_ZERO_ERROR"); + END + tulen=u_strToUpper(tarup,tucap, target,tarlen,NULL,&err1); + if (!U_SUCCESS(err1)) + BEGIN + printf("4there is a error: U_ZERO_ERROR"); + END + + return tulen; +END /*************************************************************************** * WEB section number: 401 @@ -3306,10 +3389,12 @@ BEGIN if (pop_typ1 != STK_STR) BEGIN print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (s_null, STK_STR); END else if (LENGTH (pop_lit1) == 0) BEGIN + push_lit_stk (s_null, STK_STR); END else @@ -3363,7 +3448,8 @@ Loop_Exit_Label: pool_ptr = str_start[pop_lit1 + 1]; STR_ROOM (1); END - APPEND_CHAR (PERIOD); + APPEND_CHAR (PERIOD);; + push_lit_stk (make_string (), STK_STR); break; END |