Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libedit more macro WIDECHAR undoing from Ingo Schwarze.
details: https://anonhg.NetBSD.org/src/rev/30efe5634eb5
branches: trunk
changeset: 344670:30efe5634eb5
user: christos <christos%NetBSD.org@localhost>
date: Mon Apr 11 00:22:48 2016 +0000
description:
more macro WIDECHAR undoing from Ingo Schwarze.
diffstat:
lib/libedit/chared.c | 12 ++++++------
lib/libedit/chartype.h | 29 +----------------------------
lib/libedit/common.c | 14 +++++++-------
lib/libedit/el.c | 30 +++++++++++++++---------------
lib/libedit/eln.c | 16 ++++++++--------
lib/libedit/filecomplete.c | 18 +++++++++---------
lib/libedit/hist.c | 22 +++++++++++-----------
lib/libedit/hist.h | 6 +++---
lib/libedit/history.c | 36 ++++++++++++++++++++++++++++++++++--
lib/libedit/keymacro.c | 6 +++---
lib/libedit/makelist | 8 ++++----
lib/libedit/map.c | 16 ++++++++--------
lib/libedit/parse.c | 42 +++++++++++++++++++++---------------------
lib/libedit/read.c | 14 +++++++-------
lib/libedit/refresh.c | 12 ++++++------
lib/libedit/search.c | 18 +++++++++---------
lib/libedit/terminal.c | 40 ++++++++++++++++++++--------------------
lib/libedit/tokenizer.c | 18 +++++++++++++++---
lib/libedit/tty.c | 6 +++---
lib/libedit/vi.c | 16 ++++++++--------
20 files changed, 198 insertions(+), 181 deletions(-)
diffs (truncated from 1214 to 300 lines):
diff -r 17eb21d6da34 -r 30efe5634eb5 lib/libedit/chared.c
--- a/lib/libedit/chared.c Sun Apr 10 23:37:10 2016 +0000
+++ b/lib/libedit/chared.c Mon Apr 11 00:22:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chared.c,v 1.50 2016/04/09 18:43:17 christos Exp $ */
+/* $NetBSD: chared.c,v 1.51 2016/04/11 00:22:48 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.50 2016/04/09 18:43:17 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.51 2016/04/11 00:22:48 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -205,7 +205,7 @@
protected int
ce__isword(wint_t p)
{
- return iswalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL;
+ return iswalnum(p) || wcschr(L"*?_-.[]~=", p) != NULL;
}
@@ -614,11 +614,11 @@
* Insert string at cursorI
*/
public int
-FUN(el,insertstr)(EditLine *el, const Char *s)
+el_winsertstr(EditLine *el, const Char *s)
{
size_t len;
- if (s == NULL || (len = Strlen(s)) == 0)
+ if (s == NULL || (len = wcslen(s)) == 0)
return -1;
if (el->el_line.lastchar + len >= el->el_line.limit) {
if (!ch_enlargebufs(el, len))
@@ -680,7 +680,7 @@
Char *cp = el->el_line.buffer, ch;
if (prompt) {
- len = (ssize_t)Strlen(prompt);
+ len = (ssize_t)wcslen(prompt);
(void)memcpy(cp, prompt, (size_t)len * sizeof(*cp));
cp += len;
}
diff -r 17eb21d6da34 -r 30efe5634eb5 lib/libedit/chartype.h
--- a/lib/libedit/chartype.h Sun Apr 10 23:37:10 2016 +0000
+++ b/lib/libedit/chartype.h Mon Apr 11 00:22:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chartype.h,v 1.27 2016/04/09 18:43:17 christos Exp $ */
+/* $NetBSD: chartype.h,v 1.28 2016/04/11 00:22:48 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -52,35 +52,8 @@
#endif
#define Char wchar_t
-#define FUN(prefix,rest) prefix ## _w ## rest
-#define FUNW(type) type ## _w
-#define TYPE(type) type ## W
-#define STR(x) L ## x
-
-#define Strlen(x) wcslen(x)
-#define Strchr(s,c) wcschr(s,c)
-#define Strdup(x) wcsdup(x)
-#define Strncpy(d,s,n) wcsncpy(d,s,n)
-#define Strncat(d,s,n) wcsncat(d,s,n)
-#define Strcmp(s,v) wcscmp(s,v)
-#define Strncmp(s,v,n) wcsncmp(s,v,n)
-
#else /* NARROW */
-
#define Char char
-#define FUN(prefix,rest) prefix ## _ ## rest
-#define FUNW(type) type
-#define TYPE(type) type
-#define STR(x) x
-
-#define Strlen(x) strlen(x)
-#define Strchr(s,c) strchr(s,c)
-#define Strdup(x) strdup(x)
-#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)
#endif
diff -r 17eb21d6da34 -r 30efe5634eb5 lib/libedit/common.c
--- a/lib/libedit/common.c Sun Apr 10 23:37:10 2016 +0000
+++ b/lib/libedit/common.c Mon Apr 11 00:22:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.41 2016/04/09 18:43:17 christos Exp $ */
+/* $NetBSD: common.c,v 1.42 2016/04/11 00:22:48 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.41 2016/04/09 18:43:17 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.42 2016/04/11 00:22:48 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -652,7 +652,7 @@
if (el->el_history.eventno == 0) { /* save the current buffer
* away */
- (void) Strncpy(el->el_history.buf, el->el_line.buffer,
+ (void) wcsncpy(el->el_history.buf, el->el_line.buffer,
EL_BUFSIZ);
el->el_history.last = el->el_history.buf +
(el->el_line.lastchar - el->el_line.buffer);
@@ -724,7 +724,7 @@
return CC_ERROR;
}
if (el->el_history.eventno == 0) {
- (void) Strncpy(el->el_history.buf, el->el_line.buffer,
+ (void) wcsncpy(el->el_history.buf, el->el_line.buffer,
EL_BUFSIZ);
el->el_history.last = el->el_history.buf +
(el->el_line.lastchar - el->el_line.buffer);
@@ -745,7 +745,7 @@
#ifdef SDEBUG
(void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
#endif
- if ((Strncmp(hp, el->el_line.buffer, (size_t)
+ if ((wcsncmp(hp, el->el_line.buffer, (size_t)
(el->el_line.lastchar - el->el_line.buffer)) ||
hp[el->el_line.lastchar - el->el_line.buffer]) &&
c_hmatch(el, hp)) {
@@ -800,7 +800,7 @@
#ifdef SDEBUG
(void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
#endif
- if ((Strncmp(hp, el->el_line.buffer, (size_t)
+ if ((wcsncmp(hp, el->el_line.buffer, (size_t)
(el->el_line.lastchar - el->el_line.buffer)) ||
hp[el->el_line.lastchar - el->el_line.buffer]) &&
c_hmatch(el, hp))
@@ -910,7 +910,7 @@
Char tmpbuf[EL_BUFSIZ];
int tmplen;
- tmplen = c_gets(el, tmpbuf, STR("\n: "));
+ tmplen = c_gets(el, tmpbuf, L"\n: ");
terminal__putc(el, '\n');
if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
diff -r 17eb21d6da34 -r 30efe5634eb5 lib/libedit/el.c
--- a/lib/libedit/el.c Sun Apr 10 23:37:10 2016 +0000
+++ b/lib/libedit/el.c Mon Apr 11 00:22:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.85 2016/04/09 18:43:17 christos Exp $ */
+/* $NetBSD: el.c,v 1.86 2016/04/11 00:22: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.85 2016/04/09 18:43:17 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.86 2016/04/11 00:22:48 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -85,7 +85,7 @@
el->el_outfd = fdout;
el->el_errfd = fderr;
- el->el_prog = Strdup(ct_decode_string(prog, &el->el_scratch));
+ el->el_prog = wcsdup(ct_decode_string(prog, &el->el_scratch));
if (el->el_prog == NULL) {
el_free(el);
return NULL;
@@ -168,7 +168,7 @@
* set the editline parameters
*/
public int
-FUN(el,set)(EditLine *el, int op, ...)
+el_wset(EditLine *el, int op, ...)
{
va_list ap;
int rv = 0;
@@ -239,27 +239,27 @@
switch (op) {
case EL_BIND:
- argv[0] = STR("bind");
+ argv[0] = L"bind";
rv = map_bind(el, i, argv);
break;
case EL_TELLTC:
- argv[0] = STR("telltc");
+ argv[0] = L"telltc";
rv = terminal_telltc(el, i, argv);
break;
case EL_SETTC:
- argv[0] = STR("settc");
+ argv[0] = L"settc";
rv = terminal_settc(el, i, argv);
break;
case EL_ECHOTC:
- argv[0] = STR("echotc");
+ argv[0] = L"echotc";
rv = terminal_echotc(el, i, argv);
break;
case EL_SETTY:
- argv[0] = STR("setty");
+ argv[0] = L"setty";
rv = tty_stty(el, i, argv);
break;
@@ -381,7 +381,7 @@
* retrieve the editline parameters
*/
public int
-FUN(el,get)(EditLine *el, int op, ...)
+el_wget(EditLine *el, int op, ...)
{
va_list ap;
int rv;
@@ -493,11 +493,11 @@
/* el_line():
* Return editing info
*/
-public const TYPE(LineInfo) *
-FUN(el,line)(EditLine *el)
+public const LineInfoW *
+el_wline(EditLine *el)
{
- return (const TYPE(LineInfo) *)(void *)&el->el_line;
+ return (const LineInfoW *)(void *)&el->el_line;
}
@@ -618,10 +618,10 @@
return -1;
how = argv[1];
- if (Strcmp(how, STR("on")) == 0) {
+ if (wcscmp(how, L"on") == 0) {
el->el_flags &= ~EDIT_DISABLED;
tty_rawmode(el);
- } else if (Strcmp(how, STR("off")) == 0) {
+ } else if (wcscmp(how, L"off") == 0) {
tty_cookedmode(el);
el->el_flags |= EDIT_DISABLED;
}
diff -r 17eb21d6da34 -r 30efe5634eb5 lib/libedit/eln.c
--- a/lib/libedit/eln.c Sun Apr 10 23:37:10 2016 +0000
+++ b/lib/libedit/eln.c Mon Apr 11 00:22:48 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eln.c,v 1.30 2016/04/09 18:43:17 christos Exp $ */
+/* $NetBSD: eln.c,v 1.31 2016/04/11 00:22:48 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: eln.c,v 1.30 2016/04/09 18:43:17 christos Exp $");
+__RCSID("$NetBSD: eln.c,v 1.31 2016/04/11 00:22:48 christos Exp $");
#endif /* not lint && not SCCSID */
#include <errno.h>
@@ -184,23 +184,23 @@
*/
switch (op) {
case EL_BIND:
- wargv[0] = STR("bind");
+ wargv[0] = L"bind";
ret = map_bind(el, i, wargv);
break;
case EL_TELLTC:
- wargv[0] = STR("telltc");
+ wargv[0] = L"telltc";
ret = terminal_telltc(el, i, wargv);
break;
case EL_SETTC:
- wargv[0] = STR("settc");
+ wargv[0] = L"settc";
ret = terminal_settc(el, i, wargv);
break;
Home |
Main Index |
Thread Index |
Old Index