Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Store our generated files in CVS and remove nbperf from the ...



details:   https://anonhg.NetBSD.org/src/rev/d450a878f7c4
branches:  trunk
changeset: 751423:d450a878f7c4
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Feb 03 20:56:54 2010 +0000

description:
Store our generated files in CVS and remove nbperf from the toolchain.
This allows us to build consistent libs without an ever changing hash.

diffstat:

 lib/libterminfo/Makefile       |   34 +-
 lib/libterminfo/genhash        |    4 +-
 lib/libterminfo/genman         |    6 +-
 lib/libterminfo/genthash       |    4 +-
 lib/libterminfo/hash.c         |  702 +++++++++++++++++++++++++++++++++++++++++
 lib/libterminfo/termcap_hash.c |  165 +++++++++
 lib/libterminfo/terminfo.5     |  688 ++++++++++++++++++++++++++++++++++++++++
 tools/Makefile                 |    4 +-
 tools/nbperf/Makefile          |    6 -
 9 files changed, 1579 insertions(+), 34 deletions(-)

diffs (truncated from 1721 to 300 lines):

diff -r 6cb59072b93b -r d450a878f7c4 lib/libterminfo/Makefile
--- a/lib/libterminfo/Makefile  Wed Feb 03 19:32:40 2010 +0000
+++ b/lib/libterminfo/Makefile  Wed Feb 03 20:56:54 2010 +0000
@@ -1,30 +1,18 @@
-#      $NetBSD: Makefile,v 1.2 2010/02/03 16:13:14 roy Exp $
+#      $NetBSD: Makefile,v 1.3 2010/02/03 20:56:54 roy Exp $
 
 USE_SHLIBDIR=  yes
 
 LIB=           terminfo
 WARNS=         4
 
+CPPFLAGS+=     -I${.CURDIR}
+
 SRCS=          term.c ti.c setupterm.c curterm.c tparm.c tputs.c
 SRCS+=         hash.c
 INCS=          term.h
 INCSDIR=       /usr/include
 
-LIBTIDIR?=     ${.CURDIR}
-CPPFLAGS+=     -I${LIBTIDIR}
-
-# Generate our string and hash tables
-hash.c: genhash term.h
-               @echo "Generating terminfo hash"
-               cd ${LIBTIDIR} && ${HOST_SH} ./genhash >${.OBJDIR}/$@
-
-# Update our man page with terminfo long names, short names and termcaps
-terminfo.5: genman terminfo.5.in term.h termcap.c
-               @echo "Generating terminfo man pages"
-               cd ${LIBTIDIR} && ${HOST_SH} ./genman >${.OBJDIR}/$@
-
 MAN=           terminfo.3 terminfo.5
-CLEANFILES+=   terminfo.5 hash.c
 MLINKS=                terminfo.3 setupterm.3 \
                terminfo.3 set_curterm.3 terminfo.3 del_curterm.3 \
                terminfo.3 tigetnum.3 terminfo.3 tigetflag.3 \
@@ -38,19 +26,23 @@
 # Build in termcap emulation
 SRCS+=         termcap.c
 INCS+=         termcap.h
-CPPFLAGS+=     -I${.OBJDIR}
 MAN+=          termcap.3
-CLEANFILES+=   _termcap.c termcap_hash.c
 MLINKS+=       termcap.3 tgetent.3 termcap.3 tgetflag.3 termcap.3 tgetnum.3 \
                termcap.3 tgetstr.3 termcap.3 tgoto.3
 
 # Generate our string and hash tables
-termcap_hash.c:        genthash termcap_map.c
+hash:
+               @echo "Generating terminfo hash"
+               cd ${.CURDIR} && ${HOST_SH} ./genhash >hash.c
                @echo "Generating termcap hash"
-               cd ${LIBTIDIR} && ${HOST_SH} ./genthash >${.OBJDIR}/$@
+               cd ${.CURDIR} && ${HOST_SH} ./genthash >termcap_hash.c
 
-# Depend on our hash table
-termcap.c:     termcap_hash.c
+# Generate our man pages
+man:
+               @echo "Generating terminfo man pages"
+               cd ${.CURDIR} && ${HOST_SH} ./genman >terminfo.5
+
+gen: hash man
 
 .include <bsd.own.mk>
 .include <bsd.shlib.mk>
diff -r 6cb59072b93b -r d450a878f7c4 lib/libterminfo/genhash
--- a/lib/libterminfo/genhash   Wed Feb 03 19:32:40 2010 +0000
+++ b/lib/libterminfo/genhash   Wed Feb 03 20:56:54 2010 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: genhash,v 1.2 2010/02/03 18:49:23 snj Exp $
+# $NetBSD: genhash,v 1.3 2010/02/03 20:56:54 roy Exp $
 
 # Copyright (c) 2009 The NetBSD Foundation, Inc.
 #
@@ -88,7 +88,7 @@
  * Automatically generated from term.h */
 
 #include <sys/cdefs.h>
-__RCSID("\$NetBSD: genhash,v 1.2 2010/02/03 18:49:23 snj Exp $");
+__RCSID("\$NetBSD: genhash,v 1.3 2010/02/03 20:56:54 roy Exp $");
 
 #include <sys/types.h>
 
diff -r 6cb59072b93b -r d450a878f7c4 lib/libterminfo/genman
--- a/lib/libterminfo/genman    Wed Feb 03 19:32:40 2010 +0000
+++ b/lib/libterminfo/genman    Wed Feb 03 20:56:54 2010 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: genman,v 1.1 2010/02/03 15:16:32 roy Exp $
+# $NetBSD: genman,v 1.2 2010/02/03 20:56:54 roy Exp $
 
 # Copyright (c) 2009 The NetBSD Foundation, Inc.
 #
@@ -54,6 +54,10 @@
 numcaps=`gentab $TERMH $TERMC nums`
 strcaps=`gentab $TERMH $TERMC strs`
 
+echo ".\\\"DO NOT EDIT"
+echo ".\\\"Automatically generated from termcap.5.in"
+echo ".\\\""
+
 while read -r line; do
        case "$line" in
        "@BOOLCAPS@")   echo "$boolcaps";;
diff -r 6cb59072b93b -r d450a878f7c4 lib/libterminfo/genthash
--- a/lib/libterminfo/genthash  Wed Feb 03 19:32:40 2010 +0000
+++ b/lib/libterminfo/genthash  Wed Feb 03 20:56:54 2010 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: genthash,v 1.1 2010/02/03 15:16:32 roy Exp $
+# $NetBSD: genthash,v 1.2 2010/02/03 20:56:54 roy Exp $
 
 # Copyright (c) 2009 The NetBSD Foundation, Inc.
 #
@@ -40,7 +40,7 @@
  * Automatically generated from termcap.c */
 
 #include <sys/cdefs.h>
-__RCSID("\$NetBSD: genthash,v 1.1 2010/02/03 15:16:32 roy Exp $");
+__RCSID("\$NetBSD: genthash,v 1.2 2010/02/03 20:56:54 roy Exp $");
 
 #include <sys/types.h>
 
diff -r 6cb59072b93b -r d450a878f7c4 lib/libterminfo/hash.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libterminfo/hash.c    Wed Feb 03 20:56:54 2010 +0000
@@ -0,0 +1,702 @@
+/* $NetBSD: hash.c,v 1.1 2010/02/03 20:56:54 roy Exp $ */
+/* DO NOT EDIT
+ * Automatically generated from term.h */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: hash.c,v 1.1 2010/02/03 20:56:54 roy Exp $");
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <term_private.h>
+#include <term.h>
+
+static const char _ti_flagids[][6] = {
+       "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",
+};
+
+#include <stdlib.h>
+
+static uint32_t
+_ti_flaghash(const void * __restrict key, size_t keylen)
+{
+       static const uint8_t g[75] = {
+           0x00, 0x0e, 0x07, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x0a, 0x04,
+           0x13, 0x00, 0x13, 0x1a, 0x23, 0x00, 0x00, 0x00, 0x11, 0x00,
+           0x14, 0x00, 0x00, 0x07, 0x00, 0x19, 0x00, 0x00, 0x24, 0x00,
+           0x00, 0x0e, 0x0d, 0x00, 0x00, 0x00, 0x1a, 0x05, 0x06, 0x00,
+           0x03, 0x00, 0x18, 0x00, 0x00, 0x19, 0x00, 0x02, 0x00, 0x03,
+           0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00,
+           0x09, 0x14, 0x15, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0f,
+           0x00, 0x0a, 0x1f, 0x00, 0x1b,
+       };
+       uint32_t h[3];
+
+       mi_vector_hash(key, keylen, 0xb8bae7e1U, h);
+       return (g[h[0] % 75] + g[h[1] % 75]) % 37;
+}
+
+const char *
+_ti_flagid(ssize_t idx)
+{
+
+       if ((size_t)idx > __arraycount(_ti_flagids))
+               return NULL;
+       return _ti_flagids[idx];
+}
+
+ssize_t
+_ti_flagindex(const char *key)
+{
+       uint32_t idx;
+
+       idx = _ti_flaghash((const unsigned char *)key, strlen(key));
+       if (idx > __arraycount(_ti_flagids) ||
+           strcmp(key, _ti_flagids[idx]) != 0)
+               return -1;
+       return idx;
+}
+
+static const char _ti_numids[][7] = {
+       "bitwin",
+       "bitype",
+       "bufsz",
+       "btns",
+       "cols",
+       "spinh",
+       "spinv",
+       "it",
+       "lh",
+       "lw",
+       "lines",
+       "lm",
+       "ma",
+       "xmc",
+       "colors",
+       "maddr",
+       "mjump",
+       "pairs",
+       "wnum",
+       "mcs",
+       "mls",
+       "ncv",
+       "nlab",
+       "npins",
+       "orc",
+       "orl",
+       "orhi",
+       "orvi",
+       "pb",
+       "cps",
+       "vt",
+       "widcs",
+       "wsl",
+};
+
+#include <stdlib.h>
+
+static uint32_t
+_ti_numhash(const void * __restrict key, size_t keylen)
+{
+       static const uint8_t g[67] = {
+           0x00, 0x20, 0x00, 0x00, 0x00, 0x05, 0x00, 0x15, 0x08, 0x00,
+           0x1b, 0x1e, 0x0f, 0x00, 0x06, 0x12, 0x1e, 0x00, 0x00, 0x07,
+           0x00, 0x00, 0x10, 0x00, 0x00, 0x09, 0x14, 0x1f, 0x1a, 0x00,
+           0x00, 0x00, 0x08, 0x00, 0x1e, 0x00, 0x0d, 0x20, 0x00, 0x0a,
+           0x0a, 0x05, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x10, 0x06,
+           0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x15,
+           0x14, 0x00, 0x00, 0x00, 0x0b, 0x13, 0x00,
+       };
+       uint32_t h[3];
+
+       mi_vector_hash(key, keylen, 0x9ff9c465U, h);
+       return (g[h[0] % 67] + g[h[1] % 67]) % 33;
+}
+
+const char *
+_ti_numid(ssize_t idx)
+{
+
+       if ((size_t)idx > __arraycount(_ti_numids))
+               return NULL;
+       return _ti_numids[idx];
+}
+
+ssize_t
+_ti_numindex(const char *key)
+{
+       uint32_t idx;
+
+       idx = _ti_numhash((const unsigned char *)key, strlen(key));
+       if (idx > __arraycount(_ti_numids) ||
+           strcmp(key, _ti_numids[idx]) != 0)
+               return -1;



Home | Main Index | Thread Index | Old Index