Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit From Ingo Schwarze:



details:   https://anonhg.NetBSD.org/src/rev/a1e28fef1b22
branches:  trunk
changeset: 344767:a1e28fef1b22
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 18 17:01:19 2016 +0000

description:
>From Ingo Schwarze:
 * Replace fcns.c by a shorter and simpler func.h
   and include it only in the one file needing it, map.c.
 * Combine help.h and help.c into a simplified help.h
   and include it only in the one file needing it, map.c.
 * Check the very simple, static files editline.c, historyn.c, and
   tokenizern.c into CVS rather than needlessly generating them.
 * So we no longer autogenerate any C files.  :-)
 * Shorten and simplify makelist by deleting the options -n, -e, -bc,
   and -m; the latter was unused and useless in the first place.
 * Move the declaration of el_func_t from fcns.h to the header
   actually needing it, map.h.  Since that header is already
   included by el.h for unrelated reasons, that makes el_func_t
   just as globally available as before.
 * No longer include the simplified fcns.h into el.h,
   include it directly into the *.c files needing it.

diffstat:

 lib/libedit/Makefile     |  46 ++++++----------------
 lib/libedit/chared.c     |   5 +-
 lib/libedit/common.c     |   5 +-
 lib/libedit/editline.c   |  21 ++++++++++
 lib/libedit/el.h         |   3 +-
 lib/libedit/emacs.c      |   5 +-
 lib/libedit/historyn.c   |   3 +
 lib/libedit/keymacro.c   |   5 +-
 lib/libedit/makelist     |  98 ++---------------------------------------------
 lib/libedit/map.c        |  13 ++++-
 lib/libedit/map.h        |   5 +-
 lib/libedit/read.c       |   5 +-
 lib/libedit/readline.c   |   5 +-
 lib/libedit/search.c     |   5 +-
 lib/libedit/terminal.c   |   5 +-
 lib/libedit/tokenizern.c |   3 +
 lib/libedit/tty.c        |   5 +-
 lib/libedit/vi.c         |   5 +-
 18 files changed, 88 insertions(+), 154 deletions(-)

diffs (truncated from 657 to 300 lines):

diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/Makefile
--- a/lib/libedit/Makefile      Mon Apr 18 02:27:34 2016 +0000
+++ b/lib/libedit/Makefile      Mon Apr 18 17:01:19 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.57 2016/03/23 22:27:48 christos Exp $
+#      $NetBSD: Makefile,v 1.58 2016/04/18 17:01:19 christos Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=  yes
@@ -14,7 +14,7 @@
 CWARNFLAGS.gcc+=       -Wconversion
 CWARNFLAGS.clang+=     -Wno-cast-qual
 
-OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
+OSRCS= chared.c common.c el.c eln.c emacs.c filecomplete.c \
        hist.c keymacro.c map.c chartype.c \
        parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
 
@@ -31,22 +31,20 @@
        editline.3 tok_line.3 editline.3 tok_str.3
 
 # For speed and debugging
-#SRCS=   ${OSRCS} readline.c tokenizer.c history.c
+#SRCS=   ${OSRCS}
 # For protection
-SRCS=  editline.c readline.c tokenizer.c history.c
+SRCS=  editline.c
 
-SRCS += tokenizern.c historyn.c
-CLEANFILES+=tokenizern.c.tmp tokenizern.c historyn.c.tmp historyn.c
+SRCS += history.c historyn.c tokenizer.c tokenizern.c readline.c
 
 LIBEDITDIR?=${.CURDIR}
 
 INCS= histedit.h
 INCSDIR=/usr/include
 
-CLEANFILES+=editline.c
-CLEANFILES+=common.h.tmp editline.c.tmp emacs.h.tmp fcns.c.tmp fcns.h.tmp
-CLEANFILES+=help.c.tmp help.h.tmp vi.h.tmp tc1.o tc1
-CLEANFILES+=tokenizern.c.tmp tokenizern.c tokenizerw.c.tmp tokenizerw.c
+CLEANFILES+=common.h.tmp emacs.h.tmp fcns.h.tmp func.h.tmp
+CLEANFILES+=help.h.tmp vi.h.tmp tc1.o tc1 .depend
+
 CPPFLAGS+=-I. -I${LIBEDITDIR}
 CPPFLAGS+=-I. -I${.CURDIR}
 #CPPFLAGS+=-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
@@ -55,11 +53,13 @@
 AHDR=vi.h emacs.h common.h
 ASRC=${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c
 
-DPSRCS+=       ${AHDR} fcns.h help.h fcns.c help.c
-CLEANFILES+=   ${AHDR} fcns.h help.h fcns.c help.c
+DPSRCS+=       ${AHDR} fcns.h func.h help.h
+CLEANFILES+=   ${AHDR} fcns.h func.h help.h
 
 SUBDIR=        readline
 
+.depend: ${AHDR} fcns.h func.h help.h
+
 vi.h: vi.c makelist Makefile
        ${_MKTARGET_CREATE}
        ${HOST_SH} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/vi.c \
@@ -83,36 +83,16 @@
        ${HOST_SH} ${LIBEDITDIR}/makelist -fh ${AHDR} > ${.TARGET}.tmp && \
            mv ${.TARGET}.tmp ${.TARGET}
 
-fcns.c: ${AHDR} fcns.h help.h makelist Makefile
+func.h: ${AHDR} makelist Makefile
        ${_MKTARGET_CREATE}
        ${HOST_SH} ${LIBEDITDIR}/makelist -fc ${AHDR} > ${.TARGET}.tmp && \
            mv ${.TARGET}.tmp ${.TARGET}
 
-help.c: ${ASRC} makelist Makefile
-       ${_MKTARGET_CREATE}
-       ${HOST_SH} ${LIBEDITDIR}/makelist -bc ${ASRC} > ${.TARGET}.tmp && \
-           mv ${.TARGET}.tmp ${.TARGET}
-
 help.h: ${ASRC} makelist Makefile
        ${_MKTARGET_CREATE}
        ${HOST_SH} ${LIBEDITDIR}/makelist -bh ${ASRC} > ${.TARGET}.tmp && \
            mv ${.TARGET}.tmp ${.TARGET}
 
-editline.c: ${OSRCS} makelist Makefile
-       ${_MKTARGET_CREATE}
-       ${HOST_SH} ${LIBEDITDIR}/makelist -e ${OSRCS:T} > ${.TARGET}.tmp && \
-           mv ${.TARGET}.tmp ${.TARGET}
-
-tokenizern.c: makelist Makefile
-       ${_MKTARGET_CREATE}
-       ${HOST_SH} ${LIBEDITDIR}/makelist -n tokenizer.c > ${.TARGET}.tmp && \
-           mv ${.TARGET}.tmp ${.TARGET}
-
-historyn.c: makelist Makefile
-       ${_MKTARGET_CREATE}
-       ${HOST_SH} ${LIBEDITDIR}/makelist -n history.c > ${.TARGET}.tmp && \
-           mv ${.TARGET}.tmp ${.TARGET}
-
 tc1.o: ${LIBEDITDIR}/TEST/tc1.c
 
 tc1:   libedit.a tc1.o
diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/chared.c
--- a/lib/libedit/chared.c      Mon Apr 18 02:27:34 2016 +0000
+++ b/lib/libedit/chared.c      Mon Apr 18 17:01:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chared.c,v 1.53 2016/04/11 18:56:31 christos Exp $     */
+/*     $NetBSD: chared.c,v 1.54 2016/04/18 17:01:19 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)chared.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: chared.c,v 1.53 2016/04/11 18:56:31 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.54 2016/04/18 17:01:19 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -50,6 +50,7 @@
 
 #include "el.h"
 #include "common.h"
+#include "fcns.h"
 
 static void ch__clearmacro (EditLine *);
 
diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/common.c
--- a/lib/libedit/common.c      Mon Apr 18 02:27:34 2016 +0000
+++ b/lib/libedit/common.c      Mon Apr 18 17:01:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: common.c,v 1.44 2016/04/17 18:39:14 christos Exp $     */
+/*     $NetBSD: common.c,v 1.45 2016/04/18 17:01:19 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)common.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: common.c,v 1.44 2016/04/17 18:39:14 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.45 2016/04/18 17:01:19 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -49,6 +49,7 @@
 
 #include "el.h"
 #include "common.h"
+#include "fcns.h"
 #include "parse.h"
 #include "vi.h"
 
diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/editline.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libedit/editline.c    Mon Apr 18 17:01:19 2016 +0000
@@ -0,0 +1,21 @@
+#define protected static
+#define SCCSID
+#include "chared.c"
+#include "common.c"
+#include "el.c"
+#include "eln.c"
+#include "emacs.c"
+#include "filecomplete.c"
+#include "hist.c"
+#include "keymacro.c"
+#include "map.c"
+#include "chartype.c"
+#include "parse.c"
+#include "prompt.c"
+#include "read.c"
+#include "refresh.c"
+#include "search.c"
+#include "sig.c"
+#include "terminal.c"
+#include "tty.c"
+#include "vi.c"
diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/el.h
--- a/lib/libedit/el.h  Mon Apr 18 02:27:34 2016 +0000
+++ b/lib/libedit/el.h  Mon Apr 18 17:01:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: el.h,v 1.36 2016/04/11 00:50:13 christos Exp $ */
+/*     $NetBSD: el.h,v 1.37 2016/04/18 17:01:19 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -100,7 +100,6 @@
 #include "chared.h"
 #include "search.h"
 #include "hist.h"
-#include "fcns.h"      /* el_func_t is needed for map.h */
 #include "map.h"
 #include "sig.h"
 #include "read.h"
diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/emacs.c
--- a/lib/libedit/emacs.c       Mon Apr 18 02:27:34 2016 +0000
+++ b/lib/libedit/emacs.c       Mon Apr 18 17:01:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emacs.c,v 1.34 2016/04/11 00:50:13 christos Exp $      */
+/*     $NetBSD: emacs.c,v 1.35 2016/04/18 17:01:19 christos Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)emacs.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: emacs.c,v 1.34 2016/04/11 00:50:13 christos Exp $");
+__RCSID("$NetBSD: emacs.c,v 1.35 2016/04/18 17:01:19 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -48,6 +48,7 @@
 
 #include "el.h"
 #include "emacs.h"
+#include "fcns.h"
 
 /* em_delete_or_list():
  *     Delete character under cursor or list completions if at end of line
diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/historyn.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libedit/historyn.c    Mon Apr 18 17:01:19 2016 +0000
@@ -0,0 +1,3 @@
+#include "config.h"
+#define NARROWCHAR
+#include "history.c"
diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/keymacro.c
--- a/lib/libedit/keymacro.c    Mon Apr 18 02:27:34 2016 +0000
+++ b/lib/libedit/keymacro.c    Mon Apr 18 17:01:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: keymacro.c,v 1.20 2016/04/12 00:16:06 christos Exp $   */
+/*     $NetBSD: keymacro.c,v 1.21 2016/04/18 17:01:19 christos Exp $   */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)key.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: keymacro.c,v 1.20 2016/04/12 00:16:06 christos Exp $");
+__RCSID("$NetBSD: keymacro.c,v 1.21 2016/04/18 17:01:19 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -67,6 +67,7 @@
 #include <string.h>
 
 #include "el.h"
+#include "fcns.h"
 
 /*
  * The Nodes of the el->el_keymacro.map.  The el->el_keymacro.map is a
diff -r 910c243720e3 -r a1e28fef1b22 lib/libedit/makelist
--- a/lib/libedit/makelist      Mon Apr 18 02:27:34 2016 +0000
+++ b/lib/libedit/makelist      Mon Apr 18 17:01:19 2016 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#      $NetBSD: makelist,v 1.27 2016/04/11 18:56:31 christos Exp $
+#      $NetBSD: makelist,v 1.28 2016/04/18 17:01:19 christos Exp $
 #
 # Copyright (c) 1992, 1993
 #      The Regents of the University of California.  All rights reserved.
@@ -36,7 +36,7 @@
 # makelist.sh: Automatically generate header files...
 
 AWK=awk
-USAGE="Usage: $0 -n|-h|-e|-fc|-fh|-bc|-bh|-m <filenames>"
+USAGE="Usage: $0 -h|-fc|-fh|-bh <filenames>"
 
 if [ "x$1" = "x" ]
 then
@@ -51,16 +51,6 @@
 
 case $FLAG in
 
-#      generate foo.h file from foo.c
-#
--n)
-    cat << _EOF
-#include "config.h"
-#define NARROWCHAR
-#include "${FILES}"
-_EOF
-    ;;
-
 -h)
     set - `echo $FILES | sed -e 's/\\./_/g'`
     hdr="_h_`basename $1`"
@@ -86,14 +76,12 @@
        }'
        ;;
 
-#      generate help.c from various .c files
+#      generate help.h from various .c files
 #
--bc)
+-bh)
     cat $FILES | $AWK '



Home | Main Index | Thread Index | Old Index