zsh-workers
 help / color / mirror / code / Atom feed
* unpatch: rationalise multibyte output
@ 2005-10-28 17:29 Peter Stephenson
  2005-10-28 22:09 ` Wayne Davison
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2005-10-28 17:29 UTC (permalink / raw)
  To: Zsh hackers list

I've patched the shell supposedly to arrange for all the remaining shell
output to recognize multibyte characters.  Most non-multibyte functions are
simply replaced by the corresponding multibyte ones.  However,
nicechar() is retained in case we couldn't identify a wide character in
a multibyte string so need to deal with a byte at a time.

I was too lazy to patch this into my non-multibyte build, but when I
commit this and can get CVS to do it for me I'll do that and fix up any
fallout.

I was going to post this but I forgot to commit the MULTIBYTE_SUPPORT
fix first so I'll just commit both directly.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: unpatch: rationalise multibyte output
  2005-10-28 17:29 unpatch: rationalise multibyte output Peter Stephenson
@ 2005-10-28 22:09 ` Wayne Davison
  0 siblings, 0 replies; 2+ messages in thread
From: Wayne Davison @ 2005-10-28 22:09 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Fri, Oct 28, 2005 at 06:29:28PM +0100, Peter Stephenson wrote:
> I was too lazy to patch this into my non-multibyte build, but when I
> commit this and can get CVS to do it for me I'll do that and fix up
> any fallout.

I also compiled a non-multibyte build, and I finally got around to
looking into some of the compiler warnings that crop up.  Here's one
that's been around for a while, which seems to be an easy fix:

--- Src/Zle/zle_refresh.c	28 Oct 2005 17:34:33 -0000	1.36
+++ Src/Zle/zle_refresh.c	28 Oct 2005 21:57:49 -0000
@@ -1138,8 +1138,10 @@ refreshline(int ln)
 
     /* inserting & deleting chars: we can if there's no right-prompt */
 	if ((ln || !put_rpmpt || !oput_rpmpt) 
-	    && (nl[1] && ol[1] && nl[1] != ol[1])
-	    && *ol != WEOF && *nl != WEOF) { 
+#ifdef MULTIBYTE_SUPPORT
+	    && *ol != WEOF && *nl != WEOF
+#endif
+	    && nl[1] && ol[1] && nl[1] != ol[1]) { 
 
 	/* deleting characters - see if we can find a match series that
 	   makes it cheaper to delete intermediate characters

Those WEOF comparisons were being done w/o MULTIBYTE_SUPPORT being
defined, which I assume is never needed (if it were, REFRESH_STRING
would need to be something larger than an unsigned char, and WEOF
would need to be ZLEEOF).

Another signed/unsigned error concerns the return value of the
WC_REDIR_TYPE() macro (which is unsigned) and the redir_type variables
which are used in the code, which are "int"s.  One simple fix is to just
make the WC_REDIR_* macros return an int, which is what this patch does:

--- Src/zsh.h	28 Oct 2005 17:34:33 -0000	1.80
+++ Src/zsh.h	28 Oct 2005 22:04:25 -0000
@@ -656,8 +656,8 @@ struct eccstr {
 #define WC_PIPE_LINENO(C)   (wc_data(C) >> 1)
 #define WCB_PIPE(T,L)       wc_bld(WC_PIPE, ((T) | ((L) << 1)))
 
-#define WC_REDIR_TYPE(C)    (wc_data(C) & REDIR_TYPE_MASK)
-#define WC_REDIR_VARID(C)   (wc_data(C) & REDIR_VARID_MASK)
+#define WC_REDIR_TYPE(C)    ((int)(wc_data(C) & REDIR_TYPE_MASK))
+#define WC_REDIR_VARID(C)   ((int)(wc_data(C) & REDIR_VARID_MASK))
 #define WCB_REDIR(T)        wc_bld(WC_REDIR, (T))
 /* Size of redir is 4 words if REDIR_VARID_MASK is set, else 3 */
 #define WC_REDIR_WORDS(C)   (WC_REDIR_VARID(C) ? 4 : 3)

That looked better than changing various ints into unsigned ints.

I have another set of potential changes, but those I'll reserve for
another message.

If anyone has any concerns/comments about the above changes, let me
know.

..wayne..


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-28 22:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-28 17:29 unpatch: rationalise multibyte output Peter Stephenson
2005-10-28 22:09 ` Wayne Davison

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).