[前][次][番号順一覧][スレッド一覧]

ruby-changes:9975

From: nobu <ko1@a...>
Date: Thu, 15 Jan 2009 13:10:38 +0900 (JST)
Subject: [ruby-changes:9975] Ruby:r21517 (trunk): * configure.in, win32/Makefile.sub (MISSING): added langinfo on mingw

nobu	2009-01-15 13:10:16 +0900 (Thu, 15 Jan 2009)

  New Revision: 21517

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21517

  Log:
    * configure.in, win32/Makefile.sub (MISSING): added langinfo on mingw
      and mswin.
    * encoding.c (rb_locale_charmap): use environments on mingw and mswin.
    
    * missing/langinfo.c (nl_langinfo_codeset): MS-Windows Japanese
      environment uses Windows-31J derived from Shift_JIS, not EUC-JP.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/encoding.c
    trunk/missing/langinfo.c
    trunk/win32/Makefile.sub

Index: encoding.c
===================================================================
--- encoding.c	(revision 21516)
+++ encoding.c	(revision 21517)
@@ -1218,7 +1218,7 @@
 {
 #if defined NO_LOCALE_CHARMAP
     return rb_usascii_str_new2("ASCII-8BIT");
-#elif defined __CYGWIN__
+#elif defined _WIN32 || defined __CYGWIN__
     const char *nl_langinfo_codeset(void);
     const char *codeset = nl_langinfo_codeset();
     char cp[sizeof(int) * 3 + 4];
@@ -1231,8 +1231,6 @@
     char *codeset;
     codeset = nl_langinfo(CODESET);
     return rb_usascii_str_new2(codeset);
-#elif defined _WIN32
-    return rb_sprintf("CP%d", GetConsoleCP());
 #else
     return Qnil;
 #endif
Index: configure.in
===================================================================
--- configure.in	(revision 21516)
+++ configure.in	(revision 21517)
@@ -599,6 +599,7 @@
 		rb_cv_binary_elf=no
 		rb_cv_negative_time_t=no
 		ac_cv_func_fcntl=yes
+		AC_LIBOBJ([langinfo])
 		;;
 os2-emx*)	LIBS="-lm $LIBS"
 		ac_cv_lib_dir_opendir=no;;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21516)
+++ ChangeLog	(revision 21517)
@@ -1,3 +1,13 @@
+Thu Jan 15 13:10:09 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in, win32/Makefile.sub (MISSING): added langinfo on mingw
+	  and mswin.
+
+	* encoding.c (rb_locale_charmap): use environments on mingw and mswin.
+
+	* missing/langinfo.c (nl_langinfo_codeset): MS-Windows Japanese
+	  environment uses Windows-31J derived from Shift_JIS, not EUC-JP.
+
 Thu Jan 15 12:10:39 2009  NAKAMURA Usaku  <usa@r...>
 
 	* win32/Makefile.sub ($(INSNS), node_name.inc, known_errors.inc,
Index: win32/Makefile.sub
===================================================================
--- win32/Makefile.sub	(revision 21516)
+++ win32/Makefile.sub	(revision 21517)
@@ -177,7 +177,7 @@
 LIBS = oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib $(EXTLIBS)
 !endif
 !if !defined(MISSING)
-MISSING = acosh.obj cbrt.obj crypt.obj erf.obj lgamma_r.obj strlcat.obj strlcpy.obj tgamma.obj win32.obj
+MISSING = acosh.obj cbrt.obj crypt.obj erf.obj lgamma_r.obj strlcat.obj strlcpy.obj tgamma.obj win32.obj langinfo.obj
 !endif
 
 ARFLAGS = -machine:$(MACHINE) -out:
Index: missing/langinfo.c
===================================================================
--- missing/langinfo.c	(revision 21516)
+++ missing/langinfo.c	(revision 21517)
@@ -36,7 +36,6 @@
 #include <string.h>
 #if defined _WIN32 || defined __CYGWIN__
 #include <windows.h>
-int snprintf(char *, size_t, const char *, ...);
 #if defined _WIN32
 #define strncasecmp strnicmp
 #endif
@@ -49,6 +48,12 @@
 				  * C/POSIX locale. Could as well one day
 				  * become "UTF-8". */
 
+#if defined _WIN32 || defined __CYGWIN__
+#define JA_CODESET "Windows-31J"
+#else
+#define JA_CODESET "EUC-JP"
+#endif
+
 #define digit(x) ((x) >= '0' && (x) <= '9')
 #define strstart(s, n) (strncasecmp(s, n, strlen(n)) == 0)
 
@@ -94,7 +99,7 @@
     if (strstart(l, "zh_TW")) return "Big5";
     if (strstart(l, "zh_HK")) return "Big5HKSCS";   /* no MIME charset */
     if (strstart(l, "zh")) return "GB2312";
-    if (strstart(l, "ja")) return "EUC-JP";
+    if (strstart(l, "ja")) return JA_CODESET;
     if (strstart(l, "ko")) return "EUC-KR";
     if (strstart(l, "ru")) return "KOI8-R";
     if (strstart(l, "uk")) return "KOI8-U";

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]