Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit Char -> wchar_t from Ingo Schwarze.



details:   https://anonhg.NetBSD.org/src/rev/8bdc22756410
branches:  trunk
changeset: 344672:8bdc22756410
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 11 00:50:13 2016 +0000

description:
Char -> wchar_t from Ingo Schwarze.

diffstat:

 lib/libedit/chared.c       |  51 +++++++++++++++++------------------
 lib/libedit/chared.h       |  37 +++++++++++++------------
 lib/libedit/chartype.c     |  32 +++++++++++-----------
 lib/libedit/chartype.h     |  33 +++++++++--------------
 lib/libedit/common.c       |  26 +++++++++---------
 lib/libedit/el.c           |  26 +++++++++---------
 lib/libedit/el.h           |  20 +++++++-------
 lib/libedit/eln.c          |   6 ++--
 lib/libedit/emacs.c        |  26 +++++++++---------
 lib/libedit/filecomplete.c |  14 ++++-----
 lib/libedit/filecomplete.h |   4 +-
 lib/libedit/hist.c         |  12 ++++----
 lib/libedit/hist.h         |   8 ++--
 lib/libedit/history.c      |   6 ++-
 lib/libedit/keymacro.c     |  57 +++++++++++++++++++++-------------------
 lib/libedit/keymacro.h     |  25 +++++++++--------
 lib/libedit/map.c          |  39 ++++++++++++++-------------
 lib/libedit/map.h          |  15 +++++-----
 lib/libedit/parse.c        |  36 ++++++++++++------------
 lib/libedit/parse.h        |  10 +++---
 lib/libedit/prompt.c       |  22 +++++++-------
 lib/libedit/prompt.h       |  10 +++---
 lib/libedit/read.c         |  24 +++++++---------
 lib/libedit/refresh.c      |  64 +++++++++++++++++++++++-----------------------
 lib/libedit/search.c       |  38 ++++++++++++---------------
 lib/libedit/search.h       |  10 +++---
 lib/libedit/terminal.c     |  64 +++++++++++++++++++++++-----------------------
 lib/libedit/terminal.h     |  21 +++++++-------
 lib/libedit/tokenizer.c    |   6 ++-
 lib/libedit/tty.c          |  17 ++++++-----
 lib/libedit/tty.h          |   4 +-
 lib/libedit/vi.c           |  22 +++++++-------
 32 files changed, 391 insertions(+), 394 deletions(-)

diffs (truncated from 2617 to 300 lines):

diff -r 9ef014bbcab4 -r 8bdc22756410 lib/libedit/chared.c
--- a/lib/libedit/chared.c      Mon Apr 11 00:47:19 2016 +0000
+++ b/lib/libedit/chared.c      Mon Apr 11 00:50:13 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chared.c,v 1.51 2016/04/11 00:22:48 christos Exp $     */
+/*     $NetBSD: chared.c,v 1.52 2016/04/11 00:50:13 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.51 2016/04/11 00:22:48 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.52 2016/04/11 00:50:13 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -84,7 +84,7 @@
  *     Save yank/delete data for paste
  */
 protected void
-cv_yank(EditLine *el, const Char *ptr, int size)
+cv_yank(EditLine *el, const wchar_t *ptr, int size)
 {
        c_kill_t *k = &el->el_chared.c_kill;
 
@@ -99,7 +99,7 @@
 protected void
 c_insert(EditLine *el, int num)
 {
-       Char *cp;
+       wchar_t *cp;
 
        if (el->el_line.lastchar + num >= el->el_line.limit) {
                if (!ch_enlargebufs(el, (size_t)num))
@@ -131,7 +131,7 @@
        }
 
        if (num > 0) {
-               Char *cp;
+               wchar_t *cp;
 
                for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
                        *cp = cp[num];
@@ -147,7 +147,7 @@
 protected void
 c_delafter1(EditLine *el)
 {
-       Char *cp;
+       wchar_t *cp;
 
        for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
                *cp = cp[1];
@@ -172,7 +172,7 @@
        }
 
        if (num > 0) {
-               Char *cp;
+               wchar_t *cp;
 
                for (cp = el->el_line.cursor - num;
                    cp <= el->el_line.lastchar;
@@ -190,7 +190,7 @@
 protected void
 c_delbefore1(EditLine *el)
 {
-       Char *cp;
+       wchar_t *cp;
 
        for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++)
                *cp = cp[1];
@@ -236,8 +236,8 @@
 /* c__prev_word():
  *     Find the previous word
  */
-protected Char *
-c__prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t))
+protected wchar_t *
+c__prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t))
 {
        p--;
 
@@ -260,8 +260,8 @@
 /* c__next_word():
  *     Find the next word
  */
-protected Char *
-c__next_word(Char *p, Char *high, int n, int (*wtest)(wint_t))
+protected wchar_t *
+c__next_word(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t))
 {
        while (n--) {
                while ((p < high) && !(*wtest)(*p))
@@ -278,8 +278,9 @@
 /* cv_next_word():
  *     Find the next word vi style
  */
-protected Char *
-cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(wint_t))
+protected wchar_t *
+cv_next_word(EditLine *el, wchar_t *p, wchar_t *high, int n,
+    int (*wtest)(wint_t))
 {
        int test;
 
@@ -307,8 +308,8 @@
 /* cv_prev_word():
  *     Find the previous word vi style
  */
-protected Char *
-cv_prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t))
+protected wchar_t *
+cv_prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t))
 {
        int test;
 
@@ -371,8 +372,8 @@
 /* cv__endword():
  *     Go to the end of this word according to vi
  */
-protected Char *
-cv__endword(Char *p, Char *high, int n, int (*wtest)(wint_t))
+protected wchar_t *
+cv__endword(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t))
 {
        int test;
 
@@ -504,7 +505,7 @@
 ch_enlargebufs(EditLine *el, size_t addlen)
 {
        size_t sz, newsz;
-       Char *newbuffer, *oldbuf, *oldkbuf;
+       wchar_t *newbuffer, *oldbuf, *oldkbuf;
 
        sz = (size_t)(el->el_line.limit - el->el_line.buffer + EL_LEAVE);
        newsz = sz * 2;
@@ -614,7 +615,7 @@
  *     Insert string at cursorI
  */
 public int
-el_winsertstr(EditLine *el, const Char *s)
+el_winsertstr(EditLine *el, const wchar_t *s)
 {
        size_t len;
 
@@ -673,11 +674,10 @@
  *     Get a string
  */
 protected int
-c_gets(EditLine *el, Char *buf, const Char *prompt)
+c_gets(EditLine *el, wchar_t *buf, const wchar_t *prompt)
 {
-       wchar_t wch;
        ssize_t len;
-       Char *cp = el->el_line.buffer, ch;
+       wchar_t *cp = el->el_line.buffer, ch;
 
        if (prompt) {
                len = (ssize_t)wcslen(prompt);
@@ -692,12 +692,11 @@
                el->el_line.lastchar = cp + 1;
                re_refresh(el);
 
-               if (el_wgetc(el, &wch) != 1) {
+               if (el_wgetc(el, &ch) != 1) {
                        ed_end_of_file(el, 0);
                        len = -1;
                        break;
                }
-               ch = (Char)wch;
 
                switch (ch) {
 
@@ -742,7 +741,7 @@
 protected int
 c_hpos(EditLine *el)
 {
-       Char *ptr;
+       wchar_t *ptr;
 
        /*
         * Find how many characters till the beginning of this line.
diff -r 9ef014bbcab4 -r 8bdc22756410 lib/libedit/chared.h
--- a/lib/libedit/chared.h      Mon Apr 11 00:47:19 2016 +0000
+++ b/lib/libedit/chared.h      Mon Apr 11 00:50:13 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chared.h,v 1.27 2016/02/16 22:53:14 christos Exp $     */
+/*     $NetBSD: chared.h,v 1.28 2016/04/11 00:50:13 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -58,7 +58,7 @@
 typedef struct c_macro_t {
        int       level;
        int       offset;
-       Char    **macro;
+       wchar_t **macro;
 } c_macro_t;
 
 /*
@@ -67,16 +67,16 @@
 typedef struct c_undo_t {
        ssize_t  len;                   /* length of saved line */
        int      cursor;                /* position of saved cursor */
-       Char    *buf;                   /* full saved text */
+       wchar_t *buf;                   /* full saved text */
 } c_undo_t;
 
 /* redo for vi */
 typedef struct c_redo_t {
-       Char    *buf;                   /* redo insert key sequence */
-       Char    *pos;
-       Char    *lim;
+       wchar_t *buf;                   /* redo insert key sequence */
+       wchar_t *pos;
+       wchar_t *lim;
        el_action_t     cmd;            /* command to redo */
-       Char    ch;                     /* char that invoked it */
+       wchar_t ch;                     /* char that invoked it */
        int     count;
        int     action;                 /* from cv_action() */
 } c_redo_t;
@@ -86,16 +86,16 @@
  */
 typedef struct c_vcmd_t {
        int      action;
-       Char    *pos;
+       wchar_t *pos;
 } c_vcmd_t;
 
 /*
  * Kill buffer for emacs
  */
 typedef struct c_kill_t {
-       Char    *buf;
-       Char    *last;
-       Char    *mark;
+       wchar_t *buf;
+       wchar_t *last;
+       wchar_t *mark;
 } c_kill_t;
 
 typedef void (*el_zfunc_t)(EditLine *, void *);
@@ -138,20 +138,21 @@
 protected int   cv__isword(wint_t);
 protected int   cv__isWord(wint_t);
 protected void  cv_delfini(EditLine *);
-protected Char *cv__endword(Char *, Char *, int, int (*)(wint_t));
+protected wchar_t *cv__endword(wchar_t *, wchar_t *, int, int (*)(wint_t));
 protected int   ce__isword(wint_t);
 protected void  cv_undo(EditLine *);
-protected void  cv_yank(EditLine *, const Char *, int);
-protected Char *cv_next_word(EditLine*, Char *, Char *, int, int (*)(wint_t));
-protected Char *cv_prev_word(Char *, Char *, int, int (*)(wint_t));
-protected Char *c__next_word(Char *, Char *, int, int (*)(wint_t));
-protected Char *c__prev_word(Char *, Char *, int, int (*)(wint_t));
+protected void  cv_yank(EditLine *, const wchar_t *, int);
+protected wchar_t *cv_next_word(EditLine*, wchar_t *, wchar_t *, int,
+                       int (*)(wint_t));
+protected wchar_t *cv_prev_word(wchar_t *, wchar_t *, int, int (*)(wint_t));
+protected wchar_t *c__next_word(wchar_t *, wchar_t *, int, int (*)(wint_t));
+protected wchar_t *c__prev_word(wchar_t *, wchar_t *, int, int (*)(wint_t));
 protected void  c_insert(EditLine *, int);
 protected void  c_delbefore(EditLine *, int);
 protected void  c_delbefore1(EditLine *);
 protected void  c_delafter(EditLine *, int);
 protected void  c_delafter1(EditLine *);
-protected int   c_gets(EditLine *, Char *, const Char *);
+protected int   c_gets(EditLine *, wchar_t *, const wchar_t *);
 protected int   c_hpos(EditLine *);
 
 protected int   ch_init(EditLine *);
diff -r 9ef014bbcab4 -r 8bdc22756410 lib/libedit/chartype.c
--- a/lib/libedit/chartype.c    Mon Apr 11 00:47:19 2016 +0000
+++ b/lib/libedit/chartype.c    Mon Apr 11 00:50:13 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chartype.c,v 1.25 2016/04/09 18:43:17 christos Exp $   */
+/*     $NetBSD: chartype.c,v 1.26 2016/04/11 00:50:13 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.25 2016/04/09 18:43:17 christos Exp $");
+__RCSID("$NetBSD: chartype.c,v 1.26 2016/04/11 00:50:13 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <ctype.h>
@@ -86,7 +86,7 @@
 
 
 public char *
-ct_encode_string(const Char *s, ct_buffer_t *conv)
+ct_encode_string(const wchar_t *s, ct_buffer_t *conv)
 {
        char *dst;
        ssize_t used;



Home | Main Index | Thread Index | Old Index