zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: PATCH: zcurses stuff
Date: Wed, 24 Oct 2007 09:45:15 +0100	[thread overview]
Message-ID: <200710240845.l9O8jF8b029976@news01.csr.com> (raw)
In-Reply-To: <20071023211247.GA9492@scowler.net>

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 <ncurses.h>
+#include "curses.mdh"
+#include "curses.pro"
+
+#ifdef HAVE_NCURSES_H
+# include <ncurses.h>
+#else
+# ifdef HAVE_CURSES_H
+#  include <curses.h>
+# endif
+#endif
+
 #ifndef MULTIBYTE_SUPPORT
 # undef HAVE_SETCCHAR
 # undef HAVE_WADDWSTR
@@ -41,9 +51,6 @@
 
 #include <stdio.h>
 
-#include "curses.mdh"
-#include "curses.pro"
-
 typedef struct zc_win {
     WINDOW *win;
     char *name;


-- 
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


  reply	other threads:[~2007-10-24  8:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-23 20:45 Peter Stephenson
2007-10-23 21:12 ` Clint Adams
2007-10-24  8:45   ` Peter Stephenson [this message]
2007-10-24  0:52 ` Bart Schaefer
2007-10-24  1:06   ` Matthew Wozniski
2007-10-24  5:18     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200710240845.l9O8jF8b029976@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).