From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5558 invoked from network); 24 Oct 2007 08:46:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 24 Oct 2007 08:46:16 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 58799 invoked from network); 24 Oct 2007 08:46:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 24 Oct 2007 08:46:09 -0000 Received: (qmail 3821 invoked by alias); 24 Oct 2007 08:46:07 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24016 Received: (qmail 3801 invoked from network); 24 Oct 2007 08:46:06 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 24 Oct 2007 08:46:06 -0000 Received: (qmail 58492 invoked from network); 24 Oct 2007 08:46:06 -0000 Received: from cluster-g.mailcontrol.com (85.115.41.190) by a.mx.sunsite.dk with SMTP; 24 Oct 2007 08:46:00 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly15g.srv.mailcontrol.com (MailControl) with ESMTP id l9O8inVY021763 for ; Wed, 24 Oct 2007 09:45:55 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Wed, 24 Oct 2007 09:45:15 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.1/8.13.4) with ESMTP id l9O8jFsw029979 for ; Wed, 24 Oct 2007 09:45:15 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.1/8.14.1/Submit) with ESMTP id l9O8jF8b029976 for ; Wed, 24 Oct 2007 09:45:15 +0100 Message-Id: <200710240845.l9O8jF8b029976@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Zsh hackers list Subject: Re: PATCH: zcurses stuff In-reply-to: <20071023211247.GA9492@scowler.net> References: <9462.1193172355@pws-pc.ntlworld.com> <20071023211247.GA9492@scowler.net> Comments: In-reply-to Clint Adams message dated "Tue, 23 Oct 2007 17:12:47 -0400." Date: Wed, 24 Oct 2007 09:45:15 +0100 From: Peter Stephenson X-OriginalArrivalTime: 24 Oct 2007 08:45:15.0576 (UTC) FILETIME=[32B54380:01C8161A] X-Scanned-By: MailControl A-07-08-10 (www.mailcontrol.com) on 10.71.0.125 Clint Adams wrote: > On Tue, Oct 23, 2007 at 09:45:55PM +0100, Peter Stephenson wrote: > > 2. I think I prefer "char" and "string" to "c" and "s", which are > > the names of the subcommands internally anyway. > > I'm still wondering if we should handle both char and string with > a single subcommand. Yes, that occurred to me too; we could call it "text". I'm not sure if we then need to handle single characters differently from strings. If we do, we need to be careful to see if it's a multibyte character first. > We should expose some kind of interface for the caller to determine > which colo[u]rs (if any) and attributes (when/if we start supporting > optional ones) are available before trying to use them then. We probably need other forms of querying, too. It would be sensible to provide a list of windows. These could be special arrays, zcurses_colors, zcurses_attrs, zcurses_windows? We've traditionally had a -l option for listing, but that doesn't seem to make sense here since this is a purely programmatic interface. While I'm here, here's the patch to make things work with just curses.h and not ncurses.h. The .mdd file already tests for the existence of curses.h, so (supposedly) all we have to worry about is whether some ancient versions of curses don't support even all the narrow character features. Index: configure.ac =================================================================== RCS file: /cvsroot/zsh/zsh/configure.ac,v retrieving revision 1.72 diff -u -r1.72 configure.ac --- configure.ac 18 Oct 2007 08:29:33 -0000 1.72 +++ configure.ac 24 Oct 2007 08:42:37 -0000 @@ -557,7 +557,7 @@ unistd.h sys/capability.h \ utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \ netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \ - sys/stropts.h iconv.h) + sys/stropts.h iconv.h ncurses.h) if test x$dynamic = xyes; then AC_CHECK_HEADERS(dlfcn.h) AC_CHECK_HEADERS(dl.h) Index: Src/Modules/curses.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/curses.c,v retrieving revision 1.19 diff -u -r1.19 curses.c --- Src/Modules/curses.c 23 Oct 2007 21:16:03 -0000 1.19 +++ Src/Modules/curses.c 24 Oct 2007 08:42:41 -0000 @@ -29,7 +29,17 @@ #define _XOPEN_SOURCE_EXTENDED 1 -#include +#include "curses.mdh" +#include "curses.pro" + +#ifdef HAVE_NCURSES_H +# include +#else +# ifdef HAVE_CURSES_H +# include +# endif +#endif + #ifndef MULTIBYTE_SUPPORT # undef HAVE_SETCCHAR # undef HAVE_WADDWSTR @@ -41,9 +51,6 @@ #include -#include "curses.mdh" -#include "curses.pro" - typedef struct zc_win { WINDOW *win; char *name; -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070