Update from Andrew Zabolotny.

This commit is contained in:
Bruno Haible 2002-03-15 18:21:40 +00:00
parent 81edb4f069
commit 0382ac8736
5 changed files with 99 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2002-03-15 Andrew Zabolotny <zap@cobra.ru>
* os2/README.OS2: Update.
* os2/Makefile: Likewise.
2002-03-12 Bruno Haible <bruno@clisp.org>
* gettext-0.11.1 released.

View File

@ -47,12 +47,14 @@ INST = emx/
# Tools
CC = gcc -c
CFLAGS = -Wall -Zmt $(INCLUDE) $(DEFS)
INCLUDE = -I. -I$(ROOT) -I$(ROOT)intl -I$(ROOT)src -I$(ROOT)lib
INCLUDE = -I. -I$(ROOT) -I$(ROOT)intl -I$(ROOT)src -I$(ROOT)lib -I$(ROOT)libuniname
DEFS = -DHAVE_CONFIG_H -DLIBDIR=\"/usr/lib\" \
-DLOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/share/locale\" \
-DGETTEXTDATADIR=\"/usr/share/gettext\" \
-DPROJECTSDIR=\"/usr/share/gettext/projects\" \
-DGETTEXTJAR=\"/usr/share/gettext/gettext.jar\"
LD = gcc
LDFLAGS = -Zmt -Zcrtdll
LDFLAGS.SHARED = -Zmt -Zcrtdll -Zdll
@ -113,7 +115,15 @@ LIB.SOURCES = $(addprefix $(ROOT)lib/, error.c stpcpy.c stpncpy.c mkdtemp.c getl
$(shell sed $(ROOT)lib/Makefile.am -ne "/^libgettextlib_la_SOURCES =/,/[^\]$$/p"))))))
LIB.OBJECTS = $(addprefix $(OUT),$(subst $(ROOT),,$(LIB.SOURCES:.c=.o)))
OUTDIRS = $(OUT) $(sort $(dir $(INTL.OBJECTS) $(SRC.OBJECTS) $(LIB.OBJECTS) $(INSTALL.FILES)))
LIBUNINAME.SOURCES = $(addprefix $(ROOT)libuniname/, \
$(subst libuniname_a_SOURCES = ,,\
$(subst \,,\
$(patsubst %.h,,\
$(shell sed $(ROOT)libuniname/Makefile.am -ne "/^libuniname_a_SOURCES =/,/^$$/p")))))
LIBUNINAME.OBJECTS = $(addprefix $(OUT),$(subst $(ROOT),,$(LIBUNINAME.SOURCES:.c=.o)))
OUTDIRS = $(OUT) $(sort $(dir $(INTL.OBJECTS) $(SRC.OBJECTS) $(LIB.OBJECTS) \
$(LIBUNINAME.OBJECTS) $(INSTALL.FILES)))
INSTALL.FILES = $(addprefix $(INST)bin/,$(PROGRAMS)) \
$(INST)lib/intl.a $(INST)lib/intl_s.a $(INST)include/libintl.h \
@ -136,7 +146,7 @@ $(OUT)%.o: $(ROOT)%.c
# instead a library containing all the object files from src directory, and
# then link the library against the main program module, so that linker can
# pull all the required functions from there
$(OUT)%.exe: $(OUT)src/%.o $(OUT)util.a $(LINKINTL)
$(OUT)%.exe: $(OUT)src/%.o $(OUT)util.a $(OUT)uniname.a $(LINKINTL)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
ifeq ($(LXLITE),1)
lxlite /b- $@
@ -182,7 +192,7 @@ $(OUT)intl.def: $(INTL.OBJECTS)
@echo DATA MULTIPLE NONSHARED>>$@
@echo EXPORTS>>$@
type backward.def>>$@
emxexp $^ >>$@
emxexp -u $^ >>$@
$(OUT)intl$(INTLDLLVER).dll: $(INTL.OBJECTS) $(OUT)intl.def
@echo *********************************************************
@ -200,6 +210,9 @@ $(OUT)%.a: $(OUT)%.def
$(OUT)util.a: $(SRC.OBJECTS) $(LIB.OBJECTS)
$(AR) $(ARFLAGS) $@ $^
$(OUT)uniname.a: $(LIBUNINAME.OBJECTS)
$(AR) $(ARFLAGS) $@ $^
$(ROOT)src/po-gram-gen2.h: $(ROOT)src/po-gram-gen.h
sed -e "s/[yY][yY]/po_gram_/g" $< > $@

View File

@ -102,6 +102,10 @@ listed in the \language\codepage\ucstbl.lst file but the codepage files
themselves are missing; I believe they are ommited from European OS/2's
due to their large size.
Also I have added "support" for the BIG5 codeset as an alias for IBM-950
codepage. However, I'm not very sure about this; in any case OS/2 does not
support (as far as I know) anything closer to BIG5.
Additional API
==============

64
os2/iconv/Makefile Normal file
View File

@ -0,0 +1,64 @@
#
# OS/2 GNU Makefile for building libiconv with GNU Make and GNU C compiler
#
# This makefile will build iconv.dll, iconv.a (the import library for ICONV.DLL)
# and iconv_s.a (static library).
#
# You will need the Unicode API add-on for EMX, which is included with latest
# distributions of gcc for OS/2 (gcc 3.0 and later).
#
# Use CMD.EXE as shell since its way faster
SHELL = $(COMSPEC)
# Pack the DLL and executables with lxlite
LXLITE = 1
# Tools
CC = gcc -c
CFLAGS = -s -O2 -Wall -Zmt $(INCLUDE) $(DEFS)
INCLUDE = -I.
LD = gcc
LDFLAGS.SHARED = -s -Zmt -Zcrtdll -Zdll
LIBS = -lgcc
AR = ar
ARFLAGS = crs
.SUFFIXES:
.SUFFIXES: .o .a .def .dll
.PHONY: all clean
ICONV.VERSION = 0.0.1
ICONV.OBJECTS = iconv.o
# How to compile a .c file
$(OUT)%.o: %.c
$(CC) $(CFLAGS) -o $@ $<
# How to build an import library from a .DEF file
$(OUT)%.a: $(OUT)%.def
emximp -o $@ $<
all: iconv.dll iconv.a iconv_s.a
clean:
rm -rf *.o iconv.dll iconv*.a iconv.def
iconv_s.a: $(ICONV.OBJECTS)
$(AR) $(ARFLAGS) $@ $^
$(OUT)iconv.def: $(ICONV.OBJECTS)
@echo LIBRARY ICONV INITINSTANCE TERMINSTANCE>$@
@echo DESCRIPTION "iconv API library version $(ICONV.VERSION)">>$@
@echo DATA MULTIPLE NONSHARED>>$@
@echo EXPORTS>>$@
emxexp $^ >>$@
$(OUT)iconv.dll: $(ICONV.OBJECTS) $(OUT)iconv.def
$(LD) $(LDFLAGS.SHARED) -o $@ $^ $(LIBS)
ifeq ($(LXLITE),1)
lxlite $@
endif

View File

@ -32,6 +32,8 @@ typedef struct _iconv_t
#define _ICONV_T
#include "iconv.h"
#include <string.h>
#include <malloc.h>
#include <errno.h>
#include <alloca.h>
@ -41,14 +43,16 @@ cp_convert (const char *cp, UniChar *ucp)
{
size_t sl = 0;
if (!strcasecmp (cp, "EUC-JP"))
if (!stricmp (cp, "EUC-JP"))
memcpy (ucp, L"IBM-954", 8*2);
else if (!strcasecmp (cp, "EUC-KR"))
else if (!stricmp (cp, "EUC-KR"))
memcpy (ucp, L"IBM-970", 8*2);
else if (!strcasecmp (cp, "EUC-TW"))
else if (!stricmp (cp, "EUC-TW"))
memcpy (ucp, L"IBM-964", 8*2);
else if (!strcasecmp (cp, "EUC-CN"))
else if (!stricmp (cp, "EUC-CN"))
memcpy (ucp, L"IBM-1383", 9*2);
else if (!stricmp (cp, "BIG5"))
memcpy (ucp, L"IBM-950", 8*2);
else
{
/* Transform CPXXX naming style to IBM-XXX style */
@ -129,7 +133,7 @@ iconv (iconv_t conv,
goto error;
sl = ucs - orig_ucs;
ucs = orig_ucs;
/* UniUconvFromUcs will stop at first NULL byte
/* UniUconvFromUcs will stop at first nul byte (huh? indeed?)
while we want ALL the bytes converted. */
#if 1
rc = UniUconvFromUcs (conv->to, &ucs, &sl, (void **)out, out_left, &nonid);