Bidi implementation patch A1 - ICU dependancy

Shachar Shemesh wine-patches at shemesh.biz
Wed May 28 00:52:50 CDT 2003


As promised - the patch for adding ICU to Wine. code that actually uses 
this new library to follow.
The changes to configure.ac and dlls/gdi/Makefile.in can use a bit of 
cleaning up, I guess, but this is beyond my autoconf skills. Anyone who 
is better aquanted with these tools - please give me a hand here. The 
code as is does compile and does detect the existance/non-existance of ICU.

Changelog:
Shachar Shemesh <winecode at shemesh.biz>
config.ac
include/config.h.in

    * Add check for ICU library. Requires custom compile code, as the
      library uses ugly name mangling.
    * Add "HAVE_ICU" definition

dlls/gdi

    * Modify Makefile.in so that if ICU is available, static link it and
      dynamic link stdc++.
    * Add bidi.c and gdibidi.h - framework for BiDi support

objects/gdiobj.c

    * Add call to BidiInit from GDI_Init


-- 
Shachar Shemesh
Open Source integration consultant
Home page & resume - http://www.shemesh.biz/

-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /home/sun/sources/cvs/wine/configure.ac,v
retrieving revision 1.160
diff -u -r1.160 configure.ac
--- configure.ac	21 May 2003 18:50:53 -0000	1.160
+++ configure.ac	23 May 2003 14:36:30 -0000
@@ -409,6 +409,44 @@
 AC_SUBST(SANELIBS)
 AC_SUBST(SANEINCL)
 
+dnl **** Check for the ICU library ****
+AC_LANG_PUSH([C++])
+AC_CHECK_HEADERS(unicode/ubidi.h)
+
+if test "x$ICU_LIB_DIR" = "x"
+then
+    ICU_LIB_DIR="/usr/lib"
+fi
+
+if test "x$ICUUC_LIB" = "x"
+then
+    ICUUC_LIB="$ICU_LIB_DIR/libicuuc.a"
+fi
+
+if test "x$ICUDATA_LIB" = "x"
+then
+    ICUDATA_LIB="$ICU_LIB_DIR/libicudata.a"
+fi
+AC_MSG_CHECKING([static linking with $ICUUC_LIB and $ICUDATA_LIB])
+saved_libs="$LIBS"
+LIBS="$LIBS $ICUUC_LIB $ICUDATA_LIB"
+AC_TRY_LINK(
+        [#include <unicode/ubidi.h>],[ubidi_open()],
+        icu_lib="yes", icu_lib="no")
+if test "$icu_lib" = "yes"
+then
+    AC_DEFINE([HAVE_ICU],1,[Define if ICU is installed])
+    HAVE_ICU=1
+else
+    HAVE_ICU=0
+fi
+AC_MSG_RESULT([$icu_lib])
+LIBS="$saved_libs"
+AC_SUBST([HAVE_ICU])
+AC_SUBST([ICUUC_LIB])
+AC_SUBST([ICUDATA_LIB])
+AC_LANG_POP([C++])
+
 dnl **** Check for FreeType 2 ****
 AC_CHECK_LIB(freetype,FT_Init_FreeType,ft_lib=yes,ft_lib=no,$X_LIBS)
 if test "$ft_lib" = "no"
Index: dlls/gdi/Makefile.in
===================================================================
RCS file: /home/sun/sources/cvs/wine/dlls/gdi/Makefile.in,v
retrieving revision 1.51
diff -u -r1.51 Makefile.in
--- dlls/gdi/Makefile.in	6 May 2003 18:34:53 -0000	1.51
+++ dlls/gdi/Makefile.in	27 May 2003 18:05:32 -0000
@@ -8,6 +8,9 @@
 ALTNAMES  = gdi.exe dispdib.dll wing.dll
 EXTRAINCL = @FREETYPEINCL@
 EXTRALIBS = $(LIBUNICODE)
+ifeq '@HAVE_ICU@' '1'
+EXTRALIBS	 += @ICUUC_LIB@ @ICUDATA_LIB@ -lstdc++ -lgcc_s
+endif
 
 LDDLLFLAGS = @LDDLLFLAGS@
 SYMBOLFILE = $(MODULE).tmp.o
@@ -41,6 +44,7 @@
 	$(TOPOBJDIR)/objects/pen.c \
 	$(TOPOBJDIR)/objects/region.c \
 	$(TOPOBJDIR)/objects/text.c \
+	bidi.c \
 	driver.c \
 	enhmfdrv/bitblt.c \
 	enhmfdrv/dc.c \
Index: include/config.h.in
===================================================================
RCS file: /home/sun/sources/cvs/wine/include/config.h.in,v
retrieving revision 1.155
diff -u -r1.155 config.h.in
--- include/config.h.in	20 May 2003 17:48:40 -0000	1.155
+++ include/config.h.in	23 May 2003 09:06:09 -0000
@@ -77,6 +77,12 @@
 /* Define to 1 if you have the `fpclass' function. */
 #undef HAVE_FPCLASS
 
+/* Define if the ICU library is available for static linking */
+#undef HAVE_ICU
+
+/* Define if the bidi header is available for ICU */
+#undef HAVE_UNICODE_UBIDI_H
+
 /* Define if FreeType 2 is installed */
 #undef HAVE_FREETYPE
 
Index: objects/gdiobj.c
===================================================================
RCS file: /home/sun/sources/cvs/wine/objects/gdiobj.c,v
retrieving revision 1.87
diff -u -r1.87 gdiobj.c
--- objects/gdiobj.c	21 May 2003 18:28:49 -0000	1.87
+++ objects/gdiobj.c	22 May 2003 11:00:17 -0000
@@ -628,6 +628,8 @@
 
     WineEngInit();
 
+    WineBidiInit();
+
     return TRUE;
 }
 
--- /dev/null	2003-01-06 20:21:43.000000000 +0200
+++ dlls/gdi/bidi.c	2003-05-28 08:42:46.000000000 +0300
@@ -0,0 +1,49 @@
+
+/*
+ * GDI BiDirectional handling
+ *
+ * Copyright 2003 Shachar Shemesh
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include <winbase.h>
+#include <wine/debug.h>
+#include <wine/library.h>
+#include <dlfcn.h>
+
+/* As this is not an exported include, it's important not to turn it into a <>
+ * quotes 
+ */
+#include "gdibidi.h"
+
+#if HAVE_BIDI
+
+#include <unicode/ubidi.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(bidi);
+
+BOOL BidiAvail=FALSE;
+
+/*************************************************************
+ *    WineEngInit
+ *
+ * Initialize FreeType library and create a list of available faces
+ */
+BOOL WineBidiInit(void)
+{
+    return TRUE;
+}
+
+#endif /* HAVE_BIDI */
--- /dev/null	2003-01-06 20:21:43.000000000 +0200
+++ dlls/gdi/gdibidi.h	2003-05-28 08:41:53.000000000 +0300
@@ -0,0 +1,42 @@
+/*
+ * GDI BiDi definitions
+ *
+ * Copyright 2003 Shachar Shemesh
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef __WINE_GDI_BIDI_H
+#define __WINE_GDI_BIDI_H
+
+#include <config.h>
+
+#if HAVE_ICU
+
+extern BOOL BidiAvail;
+
+BOOL WineBidiInit(void);
+
+#define HAVE_BIDI 1
+
+#else /* HAVE_ICU */
+
+#define BidiAvail FALSE
+#define WineBidiInit() FALSE
+
+#undef HAVE_BIDI
+
+#endif /* HAVE_ICU */
+
+#endif /* __WINE_GDI_BIDI_H */


More information about the wine-patches mailing list