Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libedit Start removing the WIDECHAR ifdefs; building wit...
details: https://anonhg.NetBSD.org/src/rev/bc8f41779e1c
branches: trunk
changeset: 344357:bc8f41779e1c
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 23 22:27:48 2016 +0000
description:
Start removing the WIDECHAR ifdefs; building without it has stopped working
anyway. (Ingo Schwarze)
diffstat:
lib/libedit/Makefile | 6 +-----
lib/libedit/TEST/Makefile | 8 +-------
lib/libedit/chartype.c | 34 ++--------------------------------
lib/libedit/chartype.h | 45 +++------------------------------------------
lib/libedit/config.h | 3 ---
lib/libedit/el.c | 12 ++++--------
lib/libedit/el.h | 4 +---
lib/libedit/eln.c | 6 ++----
lib/libedit/hist.c | 6 ++----
lib/libedit/hist.h | 9 +--------
lib/libedit/history.c | 8 ++++----
lib/libedit/keymacro.c | 6 ++----
lib/libedit/makelist | 3 +--
lib/libedit/read.c | 44 ++------------------------------------------
lib/libedit/readline.c | 6 ++----
lib/libedit/search.c | 6 ++----
lib/libedit/sys.h | 7 +------
lib/libedit/terminal.c | 10 ++--------
18 files changed, 33 insertions(+), 190 deletions(-)
diffs (truncated from 709 to 300 lines):
diff -r 8012e981bb2f -r bc8f41779e1c lib/libedit/Makefile
--- a/lib/libedit/Makefile Wed Mar 23 21:43:33 2016 +0000
+++ b/lib/libedit/Makefile Wed Mar 23 22:27:48 2016 +0000
@@ -1,9 +1,8 @@
-# $NetBSD: Makefile,v 1.56 2016/03/02 19:24:20 christos Exp $
+# $NetBSD: Makefile,v 1.57 2016/03/23 22:27:48 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/4/93
USE_SHLIBDIR= yes
-WIDECHAR ?= yes
WARNS?= 5
LIB= edit
@@ -36,11 +35,8 @@
# For protection
SRCS= editline.c readline.c tokenizer.c history.c
-.if ${WIDECHAR} == "yes"
SRCS += tokenizern.c historyn.c
CLEANFILES+=tokenizern.c.tmp tokenizern.c historyn.c.tmp historyn.c
-CPPFLAGS+=-DWIDECHAR
-.endif
LIBEDITDIR?=${.CURDIR}
diff -r 8012e981bb2f -r bc8f41779e1c lib/libedit/TEST/Makefile
--- a/lib/libedit/TEST/Makefile Wed Mar 23 21:43:33 2016 +0000
+++ b/lib/libedit/TEST/Makefile Wed Mar 23 22:27:48 2016 +0000
@@ -1,6 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2016/02/15 21:38:07 christos Exp $
-
-WIDECHAR ?= yes
+# $NetBSD: Makefile,v 1.7 2016/03/23 22:27:48 christos Exp $
NOMAN=1
PROG=wtc1
@@ -8,10 +6,6 @@
LDADD+=-ledit -ltermlib
DPADD+=${LIBEDIT} ${LIBTERMLIB}
-.if "${WIDECHAR}" == "yes"
-CPPFLAGS+=-DWIDECHAR
-.endif
-
.ifdef DEBUG
CPPFLAGS+=-DDEBUG
.endif
diff -r 8012e981bb2f -r bc8f41779e1c lib/libedit/chartype.c
--- a/lib/libedit/chartype.c Wed Mar 23 21:43:33 2016 +0000
+++ b/lib/libedit/chartype.c Wed Mar 23 22:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $ */
+/* $NetBSD: chartype.c,v 1.24 2016/03/23 22:27:48 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $");
+__RCSID("$NetBSD: chartype.c,v 1.24 2016/03/23 22:27:48 christos Exp $");
#endif /* not lint && not SCCSID */
#include <ctype.h>
@@ -42,7 +42,6 @@
#define CT_BUFSIZ ((size_t)1024)
-#ifdef WIDECHAR
protected int
ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize)
{
@@ -217,20 +216,6 @@
return mbrtowc(wc, s, n, &mbs);
}
-#else
-
-size_t
-ct_mbrtowc(wchar_t *wc, const char *s, size_t n)
- if (s == NULL)
- return 0;
- if (n == 0)
- return (size_t)-2;
- if (wc != NULL)
- *wc = *s;
- return *s != '\0';
-}
-#endif
-
protected const Char *
ct_visual_string(const Char *s)
{
@@ -292,7 +277,6 @@
return 1; /* Hmm, this really need to be handled outside! */
case CHTYPE_NL:
return 0; /* Should this be 1 instead? */
-#ifdef WIDECHAR
case CHTYPE_PRINT:
return wcwidth(c);
case CHTYPE_NONPRINT:
@@ -300,12 +284,6 @@
return 8; /* \U+12345 */
else
return 7; /* \U+1234 */
-#else
- case CHTYPE_PRINT:
- return 1;
- case CHTYPE_NONPRINT:
- return 4; /* \123 */
-#endif
default:
return 0; /* should not happen */
}
@@ -338,7 +316,6 @@
* so this is right */
if ((ssize_t)len < ct_visual_width(c))
return -1; /* insufficient space */
-#ifdef WIDECHAR
*dst++ = '\\';
*dst++ = 'U';
*dst++ = '+';
@@ -350,13 +327,6 @@
*dst++ = tohexdigit(((unsigned int) c >> 4) & 0xf);
*dst = tohexdigit(((unsigned int) c ) & 0xf);
return c > 0xffff ? 8 : 7;
-#else
- *dst++ = '\\';
-#define tooctaldigit(v) (Char)((v) + '0')
- *dst++ = tooctaldigit(((unsigned int) c >> 6) & 0x7);
- *dst++ = tooctaldigit(((unsigned int) c >> 3) & 0x7);
- *dst++ = tooctaldigit(((unsigned int) c ) & 0x7);
-#endif
/*FALLTHROUGH*/
/* these two should be handled outside this function */
default: /* we should never hit the default */
diff -r 8012e981bb2f -r bc8f41779e1c lib/libedit/chartype.h
--- a/lib/libedit/chartype.h Wed Mar 23 21:43:33 2016 +0000
+++ b/lib/libedit/chartype.h Wed Mar 23 22:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chartype.h,v 1.25 2016/03/07 00:05:20 christos Exp $ */
+/* $NetBSD: chartype.h,v 1.26 2016/03/23 22:27:48 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,8 +29,7 @@
#ifndef _h_chartype_f
#define _h_chartype_f
-
-#ifdef WIDECHAR
+#ifndef NARROWCHAR
/* Ideally we should also test the value of the define to see if it
* supports non-BMP code points without requiring UTF-16, but nothing
@@ -105,57 +104,24 @@
#else /* NARROW */
-#define ct_wctob(w) ((int)(w))
-#define ct_wctomb error
-#define ct_wctomb_reset
-#define ct_wcstombs(a, b, c) (strncpy(a, b, c), strlen(a))
-#define ct_mbstowcs(a, b, c) (strncpy(a, b, c), strlen(a))
-
#define Char char
#define FUN(prefix,rest) prefix ## _ ## rest
#define FUNW(type) type
#define TYPE(type) type
-#define FSTR "%s"
-#define FSTARSTR "%.*s"
#define STR(x) x
-#define UC(c) (unsigned char)(c)
-
-#define Isalpha(x) isalpha((unsigned char)x)
-#define Isalnum(x) isalnum((unsigned char)x)
-#define Isgraph(x) isgraph((unsigned char)x)
-#define Isspace(x) isspace((unsigned char)x)
-#define Isdigit(x) isdigit((unsigned char)x)
-#define Iscntrl(x) iscntrl((unsigned char)x)
-#define Isprint(x) isprint((unsigned char)x)
-
-#define Isupper(x) isupper((unsigned char)x)
-#define Islower(x) islower((unsigned char)x)
-#define Toupper(x) toupper((unsigned char)x)
-#define Tolower(x) tolower((unsigned char)x)
-
-#define IsASCII(x) isascii((unsigned char)x)
#define Strlen(x) strlen(x)
#define Strchr(s,c) strchr(s,c)
-#define Strrchr(s,c) strrchr(s,c)
-#define Strstr(s,v) strstr(s,v)
#define Strdup(x) strdup(x)
-#define Strcpy(d,s) strcpy(d,s)
#define Strncpy(d,s,n) strncpy(d,s,n)
#define Strncat(d,s,n) strncat(d,s,n)
#define Strcmp(s,v) strcmp(s,v)
#define Strncmp(s,v,n) strncmp(s,v,n)
-#define Strcspn(s,r) strcspn(s,r)
-
-#define Strtol(p,e,b) strtol(p,e,b)
-
-#define Width(c) 1
-
#endif
-#ifdef WIDECHAR
+#ifndef NARROWCHAR
/*
* Conversion buffer
*/
@@ -189,11 +155,6 @@
#else
#define ct_encode_string(s, b) (s)
#define ct_decode_string(s, b) (s)
-#define ct_decode_argv(l, s, b) (s)
-#define ct_conv_cbuff_resize(b, s) ((s) == (0))
-#define ct_conv_wbuff_resize(b, s) ((s) == (0))
-#define ct_encode_char(d, l, s) (*d = s, 1)
-#define ct_free_argv(s)
#endif
#ifndef NARROWCHAR
diff -r 8012e981bb2f -r bc8f41779e1c lib/libedit/config.h
--- a/lib/libedit/config.h Wed Mar 23 21:43:33 2016 +0000
+++ b/lib/libedit/config.h Wed Mar 23 22:27:48 2016 +0000
@@ -256,9 +256,6 @@
/* Define to 1 if the system provides the SIZE_MAX constant */
#define HAVE_SIZE_MAX 1
-/* Define to 1 if you want wide-character code */
-/* #undef WIDECHAR */
-
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
diff -r 8012e981bb2f -r bc8f41779e1c lib/libedit/el.c
--- a/lib/libedit/el.c Wed Mar 23 21:43:33 2016 +0000
+++ b/lib/libedit/el.c Wed Mar 23 22:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.83 2016/02/24 17:13:22 christos Exp $ */
+/* $NetBSD: el.c,v 1.84 2016/03/23 22:27:48 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
-__RCSID("$NetBSD: el.c,v 1.83 2016/02/24 17:13:22 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.84 2016/03/23 22:27:48 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -47,13 +47,11 @@
#include <sys/types.h>
#include <sys/param.h>
#include <ctype.h>
+#include <langinfo.h>
+#include <locale.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#ifdef WIDECHAR
-#include <locale.h>
-#include <langinfo.h>
-#endif
#include "el.h"
#include "parse.h"
@@ -146,12 +144,10 @@
sig_end(el);
el_free(el->el_prog);
-#ifdef WIDECHAR
el_free(el->el_scratch.cbuff);
el_free(el->el_scratch.wbuff);
el_free(el->el_lgcyconv.cbuff);
el_free(el->el_lgcyconv.wbuff);
-#endif
el_free(el);
}
diff -r 8012e981bb2f -r bc8f41779e1c lib/libedit/el.h
--- a/lib/libedit/el.h Wed Mar 23 21:43:33 2016 +0000
+++ b/lib/libedit/el.h Wed Mar 23 22:27:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: el.h,v 1.34 2016/02/24 17:13:22 christos Exp $ */
+/* $NetBSD: el.h,v 1.35 2016/03/23 22:27:48 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -133,11 +133,9 @@
el_search_t el_search; /* Search stuff */
el_signal_t el_signal; /* Signal handling stuff */
Home |
Main Index |
Thread Index |
Old Index