From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: struct.el -- a package to encode/decode binary data Date: Thu, 21 Mar 2002 20:27:47 -0500 Sender: emacs-devel-admin@gnu.org Message-ID: <200203220127.g2M1RmM20142@rum.cs.yale.edu> References: <200203220125.KAA09137@etlken.m17n.org> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1016760626 15397 127.0.0.1 (22 Mar 2002 01:30:26 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 22 Mar 2002 01:30:26 +0000 (UTC) Cc: monnier+gnu/emacs@RUM.cs.yale.edu, eliz@is.elta.co.il, storm@cua.dk, emacs-devel@gnu.org Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16oDsv-00040E-00 for ; Fri, 22 Mar 2002 02:30:25 +0100 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16oDzO-0004a1-00 for ; Fri, 22 Mar 2002 02:37:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16oDsn-0000sE-00; Thu, 21 Mar 2002 20:30:17 -0500 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16oDqR-0000hS-00 for ; Thu, 21 Mar 2002 20:27:51 -0500 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g2M1RmM20142; Thu, 21 Mar 2002 20:27:48 -0500 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Kenichi Handa Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2112 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2112 > "Stefan Monnier" writes: > > But now that I think about it, if 160-255 can be an eight-bit-graphic > > character, how does the code does with "backward-char" ? > > Looking at DEC_POS in charset.h I see that we do > > > while (p > p_min && !CHAR_HEAD_P (*p)) p--; > > Please don't skip the following four lines: > > len = pend + 1 - p; \ > PARSE_MULTIBYTE_SEQ (p, len, bytes); \ > if (bytes == len) \ > pos_byte -= len - 1; \ > > which handles the above case. When we at last reach a > char-head, PARSE_MULTIBYTE_SEQ checks how long the byte > sequence should be. We update pos_byte only if the length > is the same as what we decreased. Yes, I saw that, so indeed the code is correct. But it seems that going back over the whole buffer (potentially) only to discover that a single byte was needed is kind of silly. Hence my suggestion to set p_min to max (p_min, p - MAX_MULTIBYTE_LENGTH) Stefan _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel