From cb7d8653c49acdb89ff2caad25bbcbc6a97ba897 Mon Sep 17 00:00:00 2001 From: Ram Viswanadha Date: Wed, 16 May 2001 01:09:06 +0000 Subject: [PATCH] ICU-954 Move ucbuf to toolutil. X-SVN-Rev: 4682 --- icu4c/source/tools/genrb/Makefile.in | 2 +- icu4c/source/tools/genrb/genrb.dsp | 8 ------- icu4c/source/tools/toolutil/Makefile.in | 2 +- icu4c/source/tools/toolutil/toolutil.dsp | 8 +++++++ .../source/tools/{genrb => toolutil}/ucbuf.c | 21 +++++++++---------- .../source/tools/{genrb => toolutil}/ucbuf.h | 21 ++++++++++--------- 6 files changed, 31 insertions(+), 31 deletions(-) rename icu4c/source/tools/{genrb => toolutil}/ucbuf.c (96%) rename icu4c/source/tools/{genrb => toolutil}/ucbuf.h (83%) diff --git a/icu4c/source/tools/genrb/Makefile.in b/icu4c/source/tools/genrb/Makefile.in index 669f0cc747..ca73322d44 100644 --- a/icu4c/source/tools/genrb/Makefile.in +++ b/icu4c/source/tools/genrb/Makefile.in @@ -50,7 +50,7 @@ LIBS = $(LIBICUI18N) $(LIBICUTOOLUTIL) $(LIBICUUC) @LIBS@ @LIB_M@ ##OBJECTS = error.o genrb.o ustr.o parse.o read.o write.o list.o \ ##rblist.o util.o -OBJECTS = error.o genrb.o parse.o read.o reslist.o ustr.o util.o ucbuf.o +OBJECTS = error.o genrb.o parse.o read.o reslist.o ustr.o util.o DEPS = $(OBJECTS:.o=.d) diff --git a/icu4c/source/tools/genrb/genrb.dsp b/icu4c/source/tools/genrb/genrb.dsp index 47d68afcaa..d43d52e4ce 100644 --- a/icu4c/source/tools/genrb/genrb.dsp +++ b/icu4c/source/tools/genrb/genrb.dsp @@ -125,10 +125,6 @@ SOURCE=.\reslist.c # End Source File # Begin Source File -SOURCE=.\ucbuf.c -# End Source File -# Begin Source File - SOURCE=.\ustr.c # End Source File # Begin Source File @@ -157,10 +153,6 @@ SOURCE=.\reslist.h # End Source File # Begin Source File -SOURCE=.\ucbuf.h -# End Source File -# Begin Source File - SOURCE=.\ustr.h # End Source File # Begin Source File diff --git a/icu4c/source/tools/toolutil/Makefile.in b/icu4c/source/tools/toolutil/Makefile.in index 3271c238f7..fff9b74e9f 100644 --- a/icu4c/source/tools/toolutil/Makefile.in +++ b/icu4c/source/tools/toolutil/Makefile.in @@ -57,7 +57,7 @@ endif LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS) LIBS = $(LIBICUUC) @LIBS@ -OBJECTS = toolutil.o unewdata.o ucmpwrit.o uoptions.o uparse.o +OBJECTS = toolutil.o unewdata.o ucmpwrit.o uoptions.o uparse.o ucbuf.o STATIC_OBJECTS = $(OBJECTS:.o=.$(STATIC_O)) diff --git a/icu4c/source/tools/toolutil/toolutil.dsp b/icu4c/source/tools/toolutil/toolutil.dsp index b1765846bc..fd22798fb6 100644 --- a/icu4c/source/tools/toolutil/toolutil.dsp +++ b/icu4c/source/tools/toolutil/toolutil.dsp @@ -89,6 +89,10 @@ SOURCE=.\toolutil.c # End Source File # Begin Source File +SOURCE=.\ucbuf.c +# End Source File +# Begin Source File + SOURCE=.\ucmpwrit.c # End Source File # Begin Source File @@ -113,6 +117,10 @@ SOURCE=.\toolutil.h # End Source File # Begin Source File +SOURCE=.\ucbuf.h +# End Source File +# Begin Source File + SOURCE=.\ucmpwrit.h # End Source File # Begin Source File diff --git a/icu4c/source/tools/genrb/ucbuf.c b/icu4c/source/tools/toolutil/ucbuf.c similarity index 96% rename from icu4c/source/tools/genrb/ucbuf.c rename to icu4c/source/tools/toolutil/ucbuf.c index ff99bf9e83..8bb2106f72 100644 --- a/icu4c/source/tools/genrb/ucbuf.c +++ b/icu4c/source/tools/toolutil/ucbuf.c @@ -19,12 +19,12 @@ #include "unicode/ucnv.h" #include "filestrm.h" #include "cmemory.h" -#include "unicode/utrans.h" #include "unicode/ustring.h" #include "ucbuf.h" + #define MAX_BUF 1000 -UBool +U_CAPI UBool U_EXPORT2 ucbuf_autodetect(FileStream* in,const char** cp){ UBool autodetect = FALSE; char start[3]; @@ -46,7 +46,7 @@ ucbuf_autodetect(FileStream* in,const char** cp){ return autodetect; } -UCHARBUF* +static UCHARBUF* ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* err){ UChar* pTarget=NULL; UChar* target=NULL; @@ -100,7 +100,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* err){ return buf; } -UChar32 +U_CAPI UChar32 U_EXPORT2 ucbuf_getc(UCHARBUF* buf,UErrorCode* err){ UChar32 c =0; if(buf->currentPosbufLimit){ @@ -130,7 +130,7 @@ _charAt(int32_t offset, void *context) { return ((UCHARBUF*) context)->currentPos[offset]; } -UChar32 +U_CAPI UChar32 U_EXPORT2 ucbuf_getcx(UCHARBUF* buf,UErrorCode* err) { int32_t length; int32_t offset; @@ -177,7 +177,7 @@ ucbuf_getcx(UCHARBUF* buf,UErrorCode* err) { } -UCHARBUF* +U_CAPI UCHARBUF* U_EXPORT2 ucbuf_open(FileStream* in, const char* cp,UErrorCode* err){ UCHARBUF* buf =(UCHARBUF*) uprv_malloc(sizeof(UCHARBUF)); @@ -186,8 +186,7 @@ ucbuf_open(FileStream* in, const char* cp,UErrorCode* err){ } if(buf){ buf->in=in; - buf->fileLen = T_FileStream_size(in); - buf->remaining=buf->fileLen; + buf->remaining=T_FileStream_size(in); buf->buffer=NULL; buf->currentPos=NULL; buf->bufLimit=NULL; @@ -208,12 +207,12 @@ ucbuf_open(FileStream* in, const char* cp,UErrorCode* err){ } } -void +static void ucbuf_closebuf(UCHARBUF* buf){ uprv_free(buf->buffer); } -void +U_CAPI void U_EXPORT2 ucbuf_ungetc(UChar32 c,UCHARBUF* buf){ if(buf->currentPos!=buf->buffer){ buf->currentPos--; @@ -221,7 +220,7 @@ ucbuf_ungetc(UChar32 c,UCHARBUF* buf){ } -void +U_CAPI void U_EXPORT2 ucbuf_close(UCHARBUF* buf){ if(buf->conv){ ucnv_close(buf->conv); diff --git a/icu4c/source/tools/genrb/ucbuf.h b/icu4c/source/tools/toolutil/ucbuf.h similarity index 83% rename from icu4c/source/tools/genrb/ucbuf.h rename to icu4c/source/tools/toolutil/ucbuf.h index dce1422289..899744f67d 100644 --- a/icu4c/source/tools/genrb/ucbuf.h +++ b/icu4c/source/tools/toolutil/ucbuf.h @@ -12,6 +12,8 @@ * * Date Name Description * 05/10/01 Ram Creation. +* +* This API reads in files and returns UChars ******************************************************************************* */ @@ -28,7 +30,6 @@ struct UCHARBUF { UChar* buffer; UChar* currentPos; UChar* bufLimit; - int32_t fileLen; int32_t remaining; FileStream* in; UConverter* conv; @@ -36,29 +37,29 @@ struct UCHARBUF { typedef struct UCHARBUF UCHARBUF; #define U_EOF 0xFFFF - -UChar32 + +U_CAPI UChar32 U_EXPORT2 ucbuf_getc(UCHARBUF* buf,UErrorCode* err); -UChar32 +U_CAPI UChar32 U_EXPORT2 ucbuf_getcx(UCHARBUF* buf,UErrorCode* err); -void +U_CAPI void U_EXPORT2 ucbuf_rewind(UCHARBUF* buf); -UCHARBUF* +U_CAPI UCHARBUF* U_EXPORT2 ucbuf_open(FileStream* in,const char* cp,UErrorCode* err); -void +U_CAPI void U_EXPORT2 ucbuf_close(UCHARBUF* buf); -void +U_CAPI void U_EXPORT2 ucbuf_ungetc(UChar32 ungetChar,UCHARBUF* buf); -void +U_CAPI void U_EXPORT2 ucbuf_closebuf(UCHARBUF* buf); -UBool +U_CAPI UBool U_EXPORT2 ucbuf_autodetect(FileStream* in,const char** cp); #endif