Re: [HACKERS] Open 6.4 items

Поиск
Список
Период
Сортировка
От Tatsuo Ishii
Тема Re: [HACKERS] Open 6.4 items
Дата
Msg-id 199810060205.LAA03011@srapc451.sra.co.jp
обсуждение исходный текст
Ответ на Re: [HACKERS] Open 6.4 items  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Ответы Re: [HACKERS] Open 6.4 items
Список pgsql-hackers
>I'm working on the multi-byte support for win32 env. with help from
>Hiroshi Inoue who appears in the discussion on some win32 issues.
>In one or two days, I will post new patches that should make
>the multi-byte support usable on win32.
>Note that only Japanese(Shift-JIS) will be supported in the first
>version.

Here are the patches against the current source tree. I have run the
regression test on a FreeBSD box with both non-MULTIBYTE and
MULTIBYTE-enabled, and confirmed that the results are same.

However I do not tested on PCs(I don't have access to win). Please let
me know if the patches break anything on PCs.

Also please note that the patch for varchar.c is a fix for a nasty bug
of char(n) types that I introduced and I believe at least this should
be applied.

Affected files are:
src/win32.mak
src/bin/psql/win32.mak
src/interfaces/libpq/win32.mak
src/interfaces/libpq/libpqdll.def
src/interfaces/libpq/fe-print.c
src/backend/utils/mb/common.c
src/backend/utils/adt/varchar.c


Index: src/win32.mak
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/win32.mak,v
retrieving revision 1.2
diff -c -r1.2 win32.mak
*** win32.mak    1998/08/27 13:25:11    1.2
--- win32.mak    1998/10/05 06:33:48
***************
*** 10,19 ****
  NULL=nul
  !ENDIF

  ALL:
     cd interfaces\libpq
!    nmake /f win32.mak
     cd ..\..\bin\psql
!    nmake /f win32.mak
     cd ..\..
     echo All Win32 parts have been built!
--- 10,23 ----
  NULL=nul
  !ENDIF

+ !IFDEF    MULTIBYTE
+ MAKEMACRO = "MULTIBYTE=$(MULTIBYTE)"
+ !ENDIF
+
  ALL:
     cd interfaces\libpq
!    nmake /f win32.mak $(MAKEMACRO)
     cd ..\..\bin\psql
!    nmake /f win32.mak $(MAKEMACRO)
     cd ..\..
     echo All Win32 parts have been built!
Index: src/bin/psql/win32.mak
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/bin/psql/win32.mak,v
retrieving revision 1.2
diff -c -r1.2 win32.mak
*** win32.mak    1998/09/03 02:16:27    1.2
--- win32.mak    1998/10/05 06:33:48
***************
*** 29,34 ****
--- 29,42 ----
  CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D\
   "_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
   /I ..\..\include /I ..\..\interfaces\libpq
+
+ !IFDEF    MULTIBYTE
+ !IFNDEF MBFLAGS
+ MBFLAGS="-DMULTIBYTE=$(MULTIBYTE)"
+ !ENDIF
+ CPP_PROJ=$(MBFLAGS) $(CPP_PROJ)
+ !ENDIF
+
  CPP_OBJS=.\Release/
  CPP_SBRS=.

Index: src/interfaces/libpq/win32.mak
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/interfaces/libpq/win32.mak,v
retrieving revision 1.3
diff -c -r1.3 win32.mak
*** win32.mak    1998/09/18 16:46:07    1.3
--- win32.mak    1998/10/05 06:33:48
***************
*** 33,39 ****
      -@erase "$(OUTDIR)\libpq.lib"
      -@erase "$(OUTDIR)\libpq.dll"
      -@erase "$(OUTDIR)\libpq.res"
!     -@erase "$(OUTDIR)\vc*.*"
      -@erase "$(OUTDIR)\libpq.pch"
      -@erase "$(OUTDIR)\libpqdll.exp"
      -@erase "$(OUTDIR)\libpqdll.lib"
--- 33,39 ----
      -@erase "$(OUTDIR)\libpq.lib"
      -@erase "$(OUTDIR)\libpq.dll"
      -@erase "$(OUTDIR)\libpq.res"
!     -@erase "vc50.pch"
      -@erase "$(OUTDIR)\libpq.pch"
      -@erase "$(OUTDIR)\libpqdll.exp"
      -@erase "$(OUTDIR)\libpqdll.lib"
***************
*** 44,49 ****
--- 44,57 ----
  CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D\
   "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" /YX\
   /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+ !IFDEF MULTIBYTE
+ !IFNDEF    MBFLAGS
+ MBFLAGS="-DMULTIBYTE=$(MULTIBYTE)"
+ !ENDIF
+ CPP_PROJ = $(CPP_PROJ) $(MBFLAGS)
+ !ENDIF
+
  CPP_OBJS=.\Release/
  CPP_SBRS=.

***************
*** 57,62 ****
--- 65,74 ----
      "$(INTDIR)\fe-lobj.obj" \
      "$(INTDIR)\fe-misc.obj" \
      "$(INTDIR)\fe-print.obj"
+
+ !IFDEF MULTIBYTE
+ LIB32_OBJS = $(LIB32_OBJS) $(INTDIR)\common.obj $(INTDIR)\wchar.obj $(INTDIR)\conv.obj
+ !ENDIF

  RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"

Index: src/interfaces/libpq/libpqdll.def
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/interfaces/libpq/libpqdll.def,v
retrieving revision 1.4
diff -c -r1.4 libpqdll.def
*** libpqdll.def    1998/10/01 01:40:26    1.4
--- libpqdll.def    1998/10/05 06:33:48
***************
*** 63,66 ****
      lo_unlink        @ 60
      lo_import        @ 61
      lo_export        @ 62
!     PQresultErrorMessage    @ 63
--- 63,67 ----
      lo_unlink        @ 60
      lo_import        @ 61
      lo_export        @ 62
!     pgresStatus        @ 63
!     PQmblen            @ 64
Index: src/interfaces/libpq/fe-print.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v
retrieving revision 1.13
diff -c -r1.13 fe-print.c
*** fe-print.c    1998/10/04 20:46:39    1.13
--- fe-print.c    1998/10/05 06:33:49
***************
*** 513,519 ****
      return (pg_encoding_mblen(encoding, s));
  }

! #endif

  static void
  do_field(PQprintOpt *po, PGresult *res,
--- 513,529 ----
      return (pg_encoding_mblen(encoding, s));
  }

! #else
!
! #ifdef WIN32
! int
! PQmblen(unsigned char *s)
! {
! }
! #endif    /* WIN32 */
!
!
! #endif    /* MULTIBYTE */

  static void
  do_field(PQprintOpt *po, PGresult *res,
Index: src/backend/utils/mb/common.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/utils/mb/common.c,v
retrieving revision 1.2
diff -c -r1.2 common.c
*** common.c    1998/09/01 04:33:19    1.2
--- common.c    1998/10/05 06:33:49
***************
*** 4,10 ****
   * Tatsuo Ishii
   * $Id: common.c,v 1.2 1998/09/01 04:33:19 momjian Exp $ */

! #include <stdio.h>
  #include <string.h>

  #include "mb/pg_wchar.h"
--- 4,19 ----
   * Tatsuo Ishii
   * $Id: common.c,v 1.2 1998/09/01 04:33:19 momjian Exp $ */

! #include <stdlib.h>
!
! #ifdef WIN32
! #include "win32.h"
! #else
! #if !defined(NO_UNISTD_H)
! #include <unistd.h>
! #endif
! #endif
!
  #include <string.h>

  #include "mb/pg_wchar.h"
Index: src/backend/utils/adt/varchar.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/utils/adt/varchar.c,v
retrieving revision 1.41
diff -c -r1.41 varchar.c
*** varchar.c    1998/09/25 15:51:02    1.41
--- varchar.c    1998/10/05 06:33:50
***************
*** 163,169 ****
  #ifdef MULTIBYTE
      /* truncate multi-byte string in a way not to break
         multi-byte boundary */
!     slen = pg_mbcliplen(VARDATA(s), rlen, rlen);
  #else
      slen = VARSIZE(s) - VARHDRSZ;
  #endif
--- 163,173 ----
  #ifdef MULTIBYTE
      /* truncate multi-byte string in a way not to break
         multi-byte boundary */
!     if (VARSIZE(s) > len) {
!         slen = pg_mbcliplen(VARDATA(s), VARSIZE(s)-VARHDRSZ, rlen);
!         } else {
!         slen = VARSIZE(s) - VARHDRSZ;
!         }
  #else
      slen = VARSIZE(s) - VARHDRSZ;
  #endif

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [ADMIN] COPY slows down; is it normal?
Следующее
От: Vadim Mikheev
Дата:
Сообщение: Re: [HACKERS] curso$B#r(Bs in LLL