changeset 6954:9dabcb305dda

[project @ 2007-10-04 16:32:37 by jwe]
author jwe
date Thu, 04 Oct 2007 16:32:38 +0000
parents 4567a35e0777
children 4aef2ca14cf9
files src/ChangeLog src/ls-mat5.cc src/sysdep.cc
diffstat 3 files changed, 32 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Oct 04 02:54:00 2007 +0000
+++ b/src/ChangeLog	Thu Oct 04 16:32:38 2007 +0000
@@ -1,3 +1,17 @@
+2007-10-04  Jason Riedy  <jason@acm.org>
+
+        * ls-mat5.cc (read_mat5_binary_data): Map miUTF16 to miUINT16,
+        miUTF32 to miUINT32.  The matfile format currently states that
+        wide UTF formats are in the same byte order as the integers.
+        (read_mat5_binary_element): Replace all UTF16 and UTF32
+        characters with the high bit set (value >127) by '?' and warn
+        that we've done so.
+
+2007-10-04  Michael Goffioul <michael.goffioul@gmail.com>
+
+	* sysdep.cc (w32_set_octave_home): Base OCTAVE_HOME location on
+	octinterp, not the main exe.
+
 2007-10-03  John W. Eaton  <jwe@octave.org>
 
 	* data.cc (Fnorm): New function.
--- a/src/ls-mat5.cc	Thu Oct 04 02:54:00 2007 +0000
+++ b/src/ls-mat5.cc	Thu Oct 04 16:32:38 2007 +0000
@@ -140,6 +140,7 @@
       read_doubles (is, data, LS_SHORT, count, swap, flt_fmt);
       break;
 
+    case miUTF16:
     case miUINT16:
       read_doubles (is, data, LS_U_SHORT, count, swap, flt_fmt);
       break;
@@ -148,6 +149,7 @@
       read_doubles (is, data, LS_INT, count, swap, flt_fmt);
       break;
 
+    case miUTF32:
     case miUINT32:
       read_doubles (is, data, LS_U_INT, count, swap, flt_fmt);
       break;
@@ -1251,8 +1253,20 @@
 	      {
 		if (type == miUTF16 || type == miUTF32)
 		  {
-		    error ("load: can not read Unicode UTF16 and UTF32 encoded characters");
-		    goto data_read_error;
+		    bool found_big_char = false;
+		    for (int i = 0; i < n; i++)
+		      {
+			if (re(i) > 127) {
+			  re(i) = '?';
+			  found_big_char = true;
+			}
+		      }
+
+		    if (found_big_char)
+		      {
+			warning ("load: can not read non-ASCII portions of UTF characters.");
+			warning ("      Replacing unreadable characters with '?'.");
+		      }
 		  }
 		else if (type == miUTF8)
 		  {
--- a/src/sysdep.cc	Thu Oct 04 02:54:00 2007 +0000
+++ b/src/sysdep.cc	Thu Oct 04 16:32:38 2007 +0000
@@ -119,7 +119,8 @@
 
   while (true)
     {
-      int status = GetModuleFileName (0, &bin_dir[0], n);
+      HMODULE hMod = GetModuleHandle ("octinterp");
+      int status = GetModuleFileName (hMod, &bin_dir[0], n);
 
       if (status < n)
 	{