ICU-954 Move ucbuf to toolutil.

X-SVN-Rev: 4682
This commit is contained in:
Ram Viswanadha 2001-05-16 01:09:06 +00:00
parent a8eaf61cce
commit cb7d8653c4
6 changed files with 31 additions and 31 deletions

View File

@ -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)

View File

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

View File

@ -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))

View File

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

View File

@ -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->currentPos<buf->bufLimit){
@ -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);

View File

@ -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;
@ -37,28 +38,28 @@ 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