zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: ${(k)terminfo}
@ 2001-04-12  0:30 Clint Adams
  2001-04-12  1:24 ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Clint Adams @ 2001-04-12  0:30 UTC (permalink / raw)
  To: zsh-workers

This rather messily gets ${(k)terminfo} and ${(kv)terminfo} to work.
Should I do the same for termcap?

Index: Src/Modules/terminfo.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.c,v
retrieving revision 1.9
diff -u -r1.9 terminfo.c
--- Src/Modules/terminfo.c	2001/04/09 20:18:40	1.9
+++ Src/Modules/terminfo.c	2001/04/12 00:26:48
@@ -198,6 +198,110 @@
 static void
 scanterminfo(HashTable ht, ScanFunc func, int flags)
 {
+    Param pm = NULL;
+    int num;
+    char **capname, *tistr;
+
+    static char *bools[] = {
+	"bw", "am", "bce", "ccc", "xhp", "xhpa", "cpix", "crxm", "xt", "xenl",
+	"eo", "gn", "hc", "chts", "km", "daisy", "hs", "hls", "in", "lpix",
+	"da", "db", "mir", "msgr", "nxon", "xsb", "npc", "ndscr", "nrrmc",
+	"os", "mc5i", "xvpa", "sam", "eslok", "hz", "ul", "xon", NULL};
+    
+    static char *numerics[] = {
+	"cols", "it", "lh", "lw", "lines", "lm", "xmc", "ma", "colors",
+	"pairs", "wnum", "ncv", "nlab", "pb", "vt", "wsl", "bitwin",
+	"bitype", "bufsz", "btns", "spinh", "spinv", "maddr", "mjump",
+	"mcs", "mls", "npins", "orc", "orhi", "orl", "orvi", "cps", "widcs",
+	NULL};
+
+    static char *strings[] = {
+	"acsc", "cbt", "bel", "cr", "cpi", "lpi", "chr", "cvr", "csr", "rmp",
+	"tbc", "mgc", "clear", "el1", "el", "ed", "hpa", "cmdch", "cwin",
+	"cup", "cud1", "home", "civis", "cub1", "mrcup", "cnorm", "cuf1",
+	"ll", "cuu1", "cvvis", "defc", "dch1", "dl1", "dial", "dsl", "dclk",
+	"hd", "enacs", "smacs", "smam", "blink", "bold", "smcup", "smdc",
+	"dim", "swidm", "sdrfq", "smir", "sitm", "slm", "smicm", "snlq",
+	"snrmq", "prot", "rev", "invis", "sshm", "smso", "ssubm", "ssupm",
+	"smul", "sum", "smxon", "ech", "rmacs", "rmam", "sgr0", "rmcup",
+	"rmdc", "rwidm", "rmir", "ritm", "rlm", "rmicm", "rshm", "rmso",
+	"rsubm", "rsupm", "rmul", "rum", "rmxon", "pause", "hook", "flash",
+	"ff", "fsl", "wingo", "hup", "is1", "is2", "is3", "if", "iprog",
+	"initc", "initp", "ich1", "il1", "ip", "ka1", "ka3", "kb2", "kbs",
+	"kbeg", "kcbt", "kc1", "kc3", "kcan", "ktbc", "kclr", "kclo", "kcmd",
+	"kcpy", "kcrt", "kctab", "kdch1", "kdl1", "kcud1", "krmir", "kend",
+	"kent", "kel", "ked", "kext", "kf0", "kf1", "kf10", "kf11", "kf12",
+	"kf13", "kf14", "kf15", "kf16", "kf17", "kf18", "kf19", "kf2",
+	"kf20", "kf21", "kf22", "kf23", "kf24", "kf25", "kf26", "kf27",
+	"kf28", "kf29", "kf3", "kf30", "kf31", "kf32", "kf33", "kf34",
+	"kf35", "kf36", "kf37", "kf38", "kf39", "kf4", "kf40", "kf41",
+	"kf42", "kf43", "kf44", "kf45", "kf46", "kf47", "kf48", "kf49",
+	"kf5", "kf50", "kf51", "kf52", "kf53", "kf54", "kf55", "kf56",
+	"kf57", "kf58", "kf59", "kf6", "kf60", "kf61", "kf62", "kf63",
+	"kf7", "kf8", "kf9", "kfnd", "khlp", "khome", "kich1", "kil1",
+	"kcub1", "kll", "kmrk", "kmsg", "kmov", "knxt", "knp", "kopn",
+	"kopt", "kpp", "kprv", "kprt", "krdo", "kref", "krfr", "krpl",
+	"krst", "kres", "kcuf1", "ksav", "kBEG", "kCAN", "kCMD", "kCPY",
+	"kCRT", "kDC", "kDL", "kslt", "kEND", "kEOL", "kEXT", "kind",
+	"kFND", "kHLP", "kHOM", "kIC", "kLFT", "kMSG", "kMOV", "kNXT",
+	"kOPT", "kPRV", "kPRT", "kri", "kRDO", "kRPL", "kRIT", "kRES",
+	"kSAV", "kSPD", "khts", "kUND", "kspd", "kund", "kcuu1", "rmkx",
+	"smkx", "lf0", "lf1", "lf10", "lf2", "lf3", "lf4", "lf5", "lf6",
+	"lf7", "lf8", "lf9", "fln", "rmln", "smln", "rmm", "smm", "mhpa",
+	"mcud1", "mcub1", "mcuf1", "mvpa", "mcuu1", "nel", "porder", "oc",
+	"op", "pad", "dch", "dl", "cud", "mcud", "ich", "indn", "il", "cub",
+	"mcub", "cuf", "mcuf", "rin", "cuu", "mcuu", "pfkey", "pfloc",
+	"pfx", "pln", "mc0", "mc5p", "mc4", "mc5", "pulse", "qdial",
+	"rmclk", "rep", "rfi", "rs1", "rs2", "rs3", "rf", "rc", "vpa",
+	"sc", "ind", "ri", "scs", "sgr", "setb", "smgb", "smgbp", "sclk",
+	"scp", "setf", "smgl", "smglp", "smgr", "smgrp", "hts", "smgt",
+	"smgtp", "wind", "sbim", "scsd", "rbim", "rcsd", "subcs",
+	"supcs", "ht", "docr", "tsl", "tone", "uc", "hu", "u0", "u1",
+	"u2", "u3", "u4", "u5", "u6", "u7", "u8", "u9", "wait", "xoffc",
+	"xonc", "zerom", "scesa", "bicr", "binel", "birep", "csnm",
+	"csin", "colornm", "defbi", "devt", "dispc", "endbi", "smpch",
+	"smsc", "rmpch", "rmsc", "getm", "kmous", "minfo", "pctrm",
+	"pfxl", "reqmp", "scesc", "s0ds", "s1ds", "s2ds", "s3ds",
+	"setab", "setaf", "setcolor", "smglr", "slines", "smgtb",
+	"ehhlm", "elhlm", "elohlm", "erhlm", "ethlm", "evhlm", "sgr1",
+	"slength", NULL};
+
+    pm = (Param) zhalloc(sizeof(struct param));
+    pm->sets.cfn = NULL;
+    pm->gets.cfn = strgetfn;
+    pm->unsetfn = NULL;
+    pm->ct = 0;
+    pm->env = NULL;
+    pm->ename = NULL;
+    pm->old = NULL;
+    
+    pm->flags = PM_READONLY | PM_SCALAR;
+    for (capname = bools; *capname; capname++) {
+	if ((num = tigetflag(*capname)) != -1) {
+	    pm->u.str = num ? dupstring("yes") : dupstring("no");
+	    pm->nam = dupstring(*capname);
+	    func((HashNode) pm, flags);
+	}
+    }
+    
+    pm->flags = PM_READONLY | PM_INTEGER;
+    for (capname = numerics; *capname; capname++) {
+	if (((num = tigetnum(*capname)) != -1) && (num != -2)) {
+	    pm->u.val = num;
+	    pm->nam = dupstring(*capname);
+	    func((HashNode) pm, flags);
+	}
+    }
+    
+    pm->flags = PM_READONLY | PM_SCALAR;
+    for (capname = strings; *capname; capname++) {
+	if ((tistr = (char *)tigetstr(*capname)) != NULL &&
+	    tistr != (char *)-1) {
+	    pm->u.str = dupstring(tistr);
+	    pm->nam = dupstring(*capname);
+	    func((HashNode) pm, flags);
+	}
+    }
 }
 
 /**/


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

* Re: PATCH: ${(k)terminfo}
  2001-04-12  0:30 PATCH: ${(k)terminfo} Clint Adams
@ 2001-04-12  1:24 ` Bart Schaefer
  2001-04-12  2:44   ` PATCH: use curses library capability inventory and hope it's terminfo Clint Adams
  2001-04-12  7:31   ` PATCH: ${(k)terminfo} Andrej Borsenkow
  0 siblings, 2 replies; 7+ messages in thread
From: Bart Schaefer @ 2001-04-12  1:24 UTC (permalink / raw)
  To: zsh-workers

On Apr 11,  8:30pm, Clint Adams wrote:
}
} This rather messily gets ${(k)terminfo} and ${(kv)terminfo} to work.

Gaah.  I didn't intend that you should put all those strings into the
module source.  According to "man curs_terminfo" on my system:

       char *boolnames, *boolcodes, *boolfnames

       char *numnames, *numcodes, *numfnames

       char *strnames, *strcodes, *strfnames

       These null-terminated arrays  contain  the  capnames,  the
       termcap  codes, and the full C names, for each of the ter-
       minfo variables.

Could we configure-check for the availability of these variables and use
yours as fallbacks in the event that the above are not found?

} Should I do the same for termcap?

You mean, add a $termcap associative array?  I suppose it wouldn't hurt,
if you're willing to do it.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* PATCH: use curses library capability inventory and hope it's terminfo
  2001-04-12  1:24 ` Bart Schaefer
@ 2001-04-12  2:44   ` Clint Adams
  2001-04-12  3:23     ` Bart Schaefer
  2001-04-12  7:31   ` PATCH: ${(k)terminfo} Andrej Borsenkow
  1 sibling, 1 reply; 7+ messages in thread
From: Clint Adams @ 2001-04-12  2:44 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

>        char *boolnames, *boolcodes, *boolfnames
> 
>        char *numnames, *numcodes, *numfnames
> 
>        char *strnames, *strcodes, *strfnames
> 
>        These null-terminated arrays  contain  the  capnames,  the
>        termcap  codes, and the full C names, for each of the ter-
>        minfo variables.
> 
> Could we configure-check for the availability of these variables and use
> yours as fallbacks in the event that the above are not found?

Note that it says "termcap" codes.  The great thing is that on Solaris,
it will actually contain terminfo capability names (which is what we
want), but under ncurses, it will contain termcap capability names.

So the following patch (which I'll commit anyway) will break on
ncurses.  The best idea I can come up with to solve this is to
have configure check the length of each capability string,
then assume termcap if they're all 2, otherwise assume terminfo.
I'll probably try that tomorrow if no one has other suggestions.

Index: acconfig.h
===================================================================
RCS file: /cvsroot/zsh/zsh/acconfig.h,v
retrieving revision 1.4
diff -u -r1.4 acconfig.h
--- acconfig.h	2000/07/04 08:44:03	1.4
+++ acconfig.h	2001/04/12 02:37:12
@@ -299,3 +299,12 @@
 
 /* Define to 1 if h_errno is not defined by the system */
 #undef USE_LOCAL_H_ERRNO
+
+/* Define if you have the terminfo boolcodes symbol.  */
+#undef HAVE_BOOLCODES
+
+/* Define if you have the terminfo numcodes symbol.  */
+#undef HAVE_NUMCODES
+
+/* Define if you have the terminfo strcodes symbol.  */
+#undef HAVE_STRCODES
Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.41
diff -u -r1.41 configure.in
--- configure.in	2001/03/07 11:40:48	1.41
+++ configure.in	2001/04/12 02:37:12
@@ -439,7 +439,7 @@
 		 limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
 		 locale.h errno.h stdlib.h unistd.h sys/capability.h \
 		 utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
-		 linux/tasks.h netinet/in_systm.h)
+		 linux/tasks.h netinet/in_systm.h curses.h term.h)
 if test $dynamic = yes; then
   AC_CHECK_HEADERS(dlfcn.h)
   AC_CHECK_HEADERS(dl.h)
@@ -515,6 +515,21 @@
 esac
 
 AC_SEARCH_LIBS(tgetent, [$termcap_curses_order])
+AC_MSG_CHECKING(if boolcodes is available)
+AC_TRY_COMPILE([#include <curses.h>
+#include <term.h>], [char **test = boolcodes;],
+AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes, boolcodes=no)
+AC_MSG_RESULT($boolcodes)
+AC_MSG_CHECKING(if numcodes is available)
+AC_TRY_COMPILE([#include <curses.h>
+#include <term.h>], [char **test = numcodes;],
+AC_DEFINE(HAVE_NUMCODES) numcodes=yes, numcodes=no)
+AC_MSG_RESULT($numcodes)
+AC_MSG_CHECKING(if strcodes is available)
+AC_TRY_COMPILE([#include <curses.h>
+#include <term.h>], [char **test = strcodes;],
+AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no)
+AC_MSG_RESULT($strcodes)
 
 dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require
 dnl libnsl (Network Services Library) to find yp_all
Index: Src/Modules/terminfo.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.c,v
retrieving revision 1.10
diff -u -r1.10 terminfo.c
--- Src/Modules/terminfo.c	2001/04/12 00:32:29	1.10
+++ Src/Modules/terminfo.c	2001/04/12 02:37:12
@@ -29,6 +29,12 @@
 
 #include "terminfo.mdh"
 #include "terminfo.pro"
+#ifdef HAVE_CURSES_H
+# include <curses.h>
+#endif
+#ifdef HAVE_TERM_H
+# include <term.h>
+#endif
 
 static char terminfo_nam[] = "terminfo";
 
@@ -202,20 +208,25 @@
     int num;
     char **capname, *tistr;
 
-    static char *bools[] = {
+#ifndef HAVE_BOOLCODES
+    static char *boolcodes[] = {
 	"bw", "am", "bce", "ccc", "xhp", "xhpa", "cpix", "crxm", "xt", "xenl",
 	"eo", "gn", "hc", "chts", "km", "daisy", "hs", "hls", "in", "lpix",
 	"da", "db", "mir", "msgr", "nxon", "xsb", "npc", "ndscr", "nrrmc",
 	"os", "mc5i", "xvpa", "sam", "eslok", "hz", "ul", "xon", NULL};
+#endif
     
-    static char *numerics[] = {
+#ifndef HAVE_NUMCODES
+    static char *numcodes[] = {
 	"cols", "it", "lh", "lw", "lines", "lm", "xmc", "ma", "colors",
 	"pairs", "wnum", "ncv", "nlab", "pb", "vt", "wsl", "bitwin",
 	"bitype", "bufsz", "btns", "spinh", "spinv", "maddr", "mjump",
 	"mcs", "mls", "npins", "orc", "orhi", "orl", "orvi", "cps", "widcs",
 	NULL};
+#endif
 
-    static char *strings[] = {
+#ifndef HAVE_STRCODES
+    static char *strcodes[] = {
 	"acsc", "cbt", "bel", "cr", "cpi", "lpi", "chr", "cvr", "csr", "rmp",
 	"tbc", "mgc", "clear", "el1", "el", "ed", "hpa", "cmdch", "cwin",
 	"cup", "cud1", "home", "civis", "cub1", "mrcup", "cnorm", "cuf1",
@@ -265,6 +276,7 @@
 	"setab", "setaf", "setcolor", "smglr", "slines", "smgtb",
 	"ehhlm", "elhlm", "elohlm", "erhlm", "ethlm", "evhlm", "sgr1",
 	"slength", NULL};
+#endif
 
     pm = (Param) zhalloc(sizeof(struct param));
     pm->sets.cfn = NULL;
@@ -276,7 +288,7 @@
     pm->old = NULL;
     
     pm->flags = PM_READONLY | PM_SCALAR;
-    for (capname = bools; *capname; capname++) {
+    for (capname = (char **)boolcodes; *capname; capname++) {
 	if ((num = tigetflag(*capname)) != -1) {
 	    pm->u.str = num ? dupstring("yes") : dupstring("no");
 	    pm->nam = dupstring(*capname);
@@ -285,7 +297,7 @@
     }
     
     pm->flags = PM_READONLY | PM_INTEGER;
-    for (capname = numerics; *capname; capname++) {
+    for (capname = (char **)numcodes; *capname; capname++) {
 	if (((num = tigetnum(*capname)) != -1) && (num != -2)) {
 	    pm->u.val = num;
 	    pm->nam = dupstring(*capname);
@@ -294,7 +306,7 @@
     }
     
     pm->flags = PM_READONLY | PM_SCALAR;
-    for (capname = strings; *capname; capname++) {
+    for (capname = (char **)strcodes; *capname; capname++) {
 	if ((tistr = (char *)tigetstr(*capname)) != NULL &&
 	    tistr != (char *)-1) {
 	    pm->u.str = dupstring(tistr);


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

* Re: PATCH: use curses library capability inventory and hope it's terminfo
  2001-04-12  2:44   ` PATCH: use curses library capability inventory and hope it's terminfo Clint Adams
@ 2001-04-12  3:23     ` Bart Schaefer
  2001-04-12  4:05       ` PATCH: correct idiocy Clint Adams
  2001-04-12  7:32       ` PATCH: use curses library capability inventory and hope it's terminfo Andrej Borsenkow
  0 siblings, 2 replies; 7+ messages in thread
From: Bart Schaefer @ 2001-04-12  3:23 UTC (permalink / raw)
  To: Clint Adams; +Cc: zsh-workers

On Apr 11, 10:44pm, Clint Adams wrote:
} Subject: PATCH: use curses library capability inventory and hope it's term
}
} >        char *boolnames, *boolcodes, *boolfnames
} > 
} >        char *numnames, *numcodes, *numfnames
} > 
} >        char *strnames, *strcodes, *strfnames
} > 
} >        These null-terminated arrays  contain  the  capnames,  the
} >        termcap  codes, and the full C names, for each of the ter-
} >        minfo variables.
} 
} Note that it says "termcap" codes.  The great thing is that on Solaris,
} it will actually contain terminfo capability names (which is what we
} want), but under ncurses, it will contain termcap capability names.

??  The `names' arrays are supposed to contain the terminfo names, and
the `codes' arrays the termcap codes.  Do you mean that the two will be
the same under ncurses?


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* PATCH: correct idiocy
  2001-04-12  3:23     ` Bart Schaefer
@ 2001-04-12  4:05       ` Clint Adams
  2001-04-12  7:32       ` PATCH: use curses library capability inventory and hope it's terminfo Andrej Borsenkow
  1 sibling, 0 replies; 7+ messages in thread
From: Clint Adams @ 2001-04-12  4:05 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> ??  The `names' arrays are supposed to contain the terminfo names, and
> the `codes' arrays the termcap codes.  Do you mean that the two will be
> the same under ncurses?

No, I appear to be completely delirious.

Index: acconfig.h
===================================================================
RCS file: /cvsroot/zsh/zsh/acconfig.h,v
retrieving revision 1.5
diff -u -r1.5 acconfig.h
--- acconfig.h	2001/04/12 02:49:14	1.5
+++ acconfig.h	2001/04/12 04:03:53
@@ -300,11 +300,20 @@
 /* Define to 1 if h_errno is not defined by the system */
 #undef USE_LOCAL_H_ERRNO
 
-/* Define if you have the terminfo boolcodes symbol.  */
+/* Define if you have the termcap boolcodes symbol.  */
 #undef HAVE_BOOLCODES
 
-/* Define if you have the terminfo numcodes symbol.  */
+/* Define if you have the termcap numcodes symbol.  */
 #undef HAVE_NUMCODES
 
-/* Define if you have the terminfo strcodes symbol.  */
+/* Define if you have the termcap strcodes symbol.  */
 #undef HAVE_STRCODES
+
+/* Define if you have the terminfo boolnames symbol.  */
+#undef HAVE_BOOLNAMES
+
+/* Define if you have the terminfo numnames symbol.  */
+#undef HAVE_NUMNAMES
+
+/* Define if you have the terminfo strnames symbol.  */
+#undef HAVE_STRNAMES
Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.42
diff -u -r1.42 configure.in
--- configure.in	2001/04/12 02:49:14	1.42
+++ configure.in	2001/04/12 04:03:54
@@ -530,6 +530,21 @@
 #include <term.h>], [char **test = strcodes;],
 AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no)
 AC_MSG_RESULT($strcodes)
+AC_MSG_CHECKING(if boolnames is available)
+AC_TRY_COMPILE([#include <curses.h>
+#include <term.h>], [char **test = boolnames;],
+AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes, boolnames=no)
+AC_MSG_RESULT($boolnames)
+AC_MSG_CHECKING(if numnames is available)
+AC_TRY_COMPILE([#include <curses.h>
+#include <term.h>], [char **test = numnames;],
+AC_DEFINE(HAVE_NUMNAMES) numnames=yes, numnames=no)
+AC_MSG_RESULT($numnames)
+AC_MSG_CHECKING(if strnames is available)
+AC_TRY_COMPILE([#include <curses.h>
+#include <term.h>], [char **test = strnames;],
+AC_DEFINE(HAVE_STRNAMES) strnames=yes, strnames=no)
+AC_MSG_RESULT($strnames)
 
 dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require
 dnl libnsl (Network Services Library) to find yp_all
Index: Src/Modules/terminfo.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.c,v
retrieving revision 1.11
diff -u -r1.11 terminfo.c
--- Src/Modules/terminfo.c	2001/04/12 02:49:14	1.11
+++ Src/Modules/terminfo.c	2001/04/12 04:03:54
@@ -208,16 +208,16 @@
     int num;
     char **capname, *tistr;
 
-#ifndef HAVE_BOOLCODES
-    static char *boolcodes[] = {
+#ifndef HAVE_BOOLNAMES
+    static char *boolnames[] = {
 	"bw", "am", "bce", "ccc", "xhp", "xhpa", "cpix", "crxm", "xt", "xenl",
 	"eo", "gn", "hc", "chts", "km", "daisy", "hs", "hls", "in", "lpix",
 	"da", "db", "mir", "msgr", "nxon", "xsb", "npc", "ndscr", "nrrmc",
 	"os", "mc5i", "xvpa", "sam", "eslok", "hz", "ul", "xon", NULL};
 #endif
     
-#ifndef HAVE_NUMCODES
-    static char *numcodes[] = {
+#ifndef HAVE_NUMNAMES
+    static char *numnames[] = {
 	"cols", "it", "lh", "lw", "lines", "lm", "xmc", "ma", "colors",
 	"pairs", "wnum", "ncv", "nlab", "pb", "vt", "wsl", "bitwin",
 	"bitype", "bufsz", "btns", "spinh", "spinv", "maddr", "mjump",
@@ -225,8 +225,8 @@
 	NULL};
 #endif
 
-#ifndef HAVE_STRCODES
-    static char *strcodes[] = {
+#ifndef HAVE_STRNAMES
+    static char *strnames[] = {
 	"acsc", "cbt", "bel", "cr", "cpi", "lpi", "chr", "cvr", "csr", "rmp",
 	"tbc", "mgc", "clear", "el1", "el", "ed", "hpa", "cmdch", "cwin",
 	"cup", "cud1", "home", "civis", "cub1", "mrcup", "cnorm", "cuf1",
@@ -288,7 +288,7 @@
     pm->old = NULL;
     
     pm->flags = PM_READONLY | PM_SCALAR;
-    for (capname = (char **)boolcodes; *capname; capname++) {
+    for (capname = (char **)boolnames; *capname; capname++) {
 	if ((num = tigetflag(*capname)) != -1) {
 	    pm->u.str = num ? dupstring("yes") : dupstring("no");
 	    pm->nam = dupstring(*capname);
@@ -297,7 +297,7 @@
     }
     
     pm->flags = PM_READONLY | PM_INTEGER;
-    for (capname = (char **)numcodes; *capname; capname++) {
+    for (capname = (char **)numnames; *capname; capname++) {
 	if (((num = tigetnum(*capname)) != -1) && (num != -2)) {
 	    pm->u.val = num;
 	    pm->nam = dupstring(*capname);
@@ -306,7 +306,7 @@
     }
     
     pm->flags = PM_READONLY | PM_SCALAR;
-    for (capname = (char **)strcodes; *capname; capname++) {
+    for (capname = (char **)strnames; *capname; capname++) {
 	if ((tistr = (char *)tigetstr(*capname)) != NULL &&
 	    tistr != (char *)-1) {
 	    pm->u.str = dupstring(tistr);


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

* Re: PATCH: ${(k)terminfo}
  2001-04-12  1:24 ` Bart Schaefer
  2001-04-12  2:44   ` PATCH: use curses library capability inventory and hope it's terminfo Clint Adams
@ 2001-04-12  7:31   ` Andrej Borsenkow
  1 sibling, 0 replies; 7+ messages in thread
From: Andrej Borsenkow @ 2001-04-12  7:31 UTC (permalink / raw)
  To: zsh-workers

On Thu, 12 Apr 2001, Bart Schaefer wrote:

> On Apr 11,  8:30pm, Clint Adams wrote:
> }
> } This rather messily gets ${(k)terminfo} and ${(kv)terminfo} to work.
>
> Gaah.  I didn't intend that you should put all those strings into the
> module source.  According to "man curs_terminfo" on my system:
>
>        char *boolnames, *boolcodes, *boolfnames
>
>        char *numnames, *numcodes, *numfnames
>
>        char *strnames, *strcodes, *strfnames
>
>        These null-terminated arrays  contain  the  capnames,  the
>        termcap  codes, and the full C names, for each of the ter-
>        minfo variables.
>
> Could we configure-check for the availability of these variables and use
> yours as fallbacks in the event that the above are not found?
>

As I understand, these variables contain names for *all* possible
capabilities, not just for the ones defined by actual terminal. So far,
there is no advantage in using them (they are missing here, I presume they
are pretty much ncurses specific, curs_terminfo manpage already smells by
ncurses). curses is pretty well documented and standard so we could just
as well take any available documentation and list all capabilities.

-andrej


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

* Re: PATCH: use curses library capability inventory and hope it's terminfo
  2001-04-12  3:23     ` Bart Schaefer
  2001-04-12  4:05       ` PATCH: correct idiocy Clint Adams
@ 2001-04-12  7:32       ` Andrej Borsenkow
  1 sibling, 0 replies; 7+ messages in thread
From: Andrej Borsenkow @ 2001-04-12  7:32 UTC (permalink / raw)
  To: zsh-workers

On Thu, 12 Apr 2001, Bart Schaefer wrote:

> On Apr 11, 10:44pm, Clint Adams wrote:
> } Subject: PATCH: use curses library capability inventory and hope it's term
> }
> } >        char *boolnames, *boolcodes, *boolfnames
> } >
> } >        char *numnames, *numcodes, *numfnames
> } >
> } >        char *strnames, *strcodes, *strfnames
> } >
> } >        These null-terminated arrays  contain  the  capnames,  the
> } >        termcap  codes, and the full C names, for each of the ter-
> } >        minfo variables.
> }
> } Note that it says "termcap" codes.  The great thing is that on Solaris,
> } it will actually contain terminfo capability names (which is what we
> } want), but under ncurses, it will contain termcap capability names.
>
> ??  The `names' arrays are supposed to contain the terminfo names, and
> the `codes' arrays the termcap codes.  Do you mean that the two will be
> the same under ncurses?
>

Yes. Cf. infocmp command that lists short and long terminfo names and
termcap names.

-andrej


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

end of thread, other threads:[~2001-04-12  7:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-12  0:30 PATCH: ${(k)terminfo} Clint Adams
2001-04-12  1:24 ` Bart Schaefer
2001-04-12  2:44   ` PATCH: use curses library capability inventory and hope it's terminfo Clint Adams
2001-04-12  3:23     ` Bart Schaefer
2001-04-12  4:05       ` PATCH: correct idiocy Clint Adams
2001-04-12  7:32       ` PATCH: use curses library capability inventory and hope it's terminfo Andrej Borsenkow
2001-04-12  7:31   ` PATCH: ${(k)terminfo} Andrej Borsenkow

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