From 1a7da7b56da225d5efc3647e7c669b17a7472d4e Mon Sep 17 00:00:00 2001 From: skimo Date: Sun, 17 Jun 2001 14:16:50 +0000 Subject: [PATCH] more CHAR_T changes --- ex/ex_filter.c | 7 ++----- ex/ex_global.c | 17 ++++++++--------- ex/ex_print.c | 58 +++++++++++++++++++++++++++------------------------------- 3 files changed, 37 insertions(+), 45 deletions(-) diff --git a/ex/ex_filter.c b/ex/ex_filter.c index 530e77d0..64808fd6 100644 --- a/ex/ex_filter.c +++ b/ex/ex_filter.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: ex_filter.c,v 10.41 2001/06/10 10:23:44 skimo Exp $ (Berkeley) $Date: 2001/06/10 10:23:44 $"; +static const char sccsid[] = "$Id: ex_filter.c,v 10.42 2001/06/17 14:16:50 skimo Exp $ (Berkeley) $Date: 2001/06/17 14:16:50 $"; #endif /* not lint */ #include @@ -307,14 +307,11 @@ filter_ldisplay(sp, fp) FILE *fp; { size_t len; - char *np; - size_t nlen; EX_PRIVATE *exp; for (exp = EXP(sp); !ex_getline(sp, fp, &len) && !INTERRUPTED(sp);) { - INT2CHAR(sp, exp->ibp, len, np, nlen); - if (ex_ldisplay(sp, np, nlen, 0, 0)) + if (ex_ldisplay(sp, exp->ibp, len, 0, 0)) break; } if (ferror(fp)) diff --git a/ex/ex_global.c b/ex/ex_global.c index 2da556f0..bce97990 100644 --- a/ex/ex_global.c +++ b/ex/ex_global.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: ex_global.c,v 10.28 2000/07/16 20:49:32 skimo Exp $ (Berkeley) $Date: 2000/07/16 20:49:32 $"; +static const char sccsid[] = "$Id: ex_global.c,v 10.29 2001/06/17 14:16:50 skimo Exp $ (Berkeley) $Date: 2001/06/17 14:16:50 $"; #endif /* not lint */ #include @@ -97,8 +97,8 @@ ex_g_setup(sp, cmdp, cmd) */ if (cmdp->argc == 0) goto usage; - for (p = cmdp->argv[0]->bp; isblank(*p); ++p); - if (*p == '\0' || isalnum(*p) || + for (p = cmdp->argv[0]->bp; ISBLANK(*p); ++p); + if (*p == '\0' || ISALNUM(*p) || *p == '\\' || *p == '|' || *p == '\n') { usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE); return (1); @@ -120,19 +120,19 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE); * Nul terminate the pattern string -- it's passed * to regcomp which doesn't understand anything else. */ - *t = '\0'; + *t = L('\0'); break; } - if (p[0] == '\\') + if (p[0] == L('\\')) if (p[1] == delim) ++p; - else if (p[1] == '\\') + else if (p[1] == L('\\')) *t++ = *p++; *t++ = *p++; } /* If the pattern string is empty, use the last one. */ - if (*ptrn == '\0') { + if (*ptrn == L('\0')) { if (sp->re == NULL) { ex_emsg(sp, NULL, EXM_NOPREVRE); return (1); @@ -175,8 +175,7 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE); * parsing it. */ if ((len = cmdp->argv[0]->len - (p - cmdp->argv[0]->bp)) == 0) { - static CHAR_T pp[] = {'p', 'p', 0}; - p = pp; + p = L("p"); len = 1; } diff --git a/ex/ex_print.c b/ex/ex_print.c index 1de09d79..cd11fc60 100644 --- a/ex/ex_print.c +++ b/ex/ex_print.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: ex_print.c,v 10.21 2000/07/14 14:29:20 skimo Exp $ (Berkeley) $Date: 2000/07/14 14:29:20 $"; +static const char sccsid[] = "$Id: ex_print.c,v 10.22 2001/06/17 14:16:51 skimo Exp $ (Berkeley) $Date: 2001/06/17 14:16:51 $"; #endif /* not lint */ #include @@ -30,7 +30,8 @@ static const char sccsid[] = "$Id: ex_print.c,v 10.21 2000/07/14 14:29:20 skimo #include "../common/common.h" -static int ex_prchars __P((SCR *, const char *, size_t *, size_t, u_int, int)); +static int ex_prchars __P((SCR *, const CHAR_T *, size_t *, size_t, + u_int, int)); /* * ex_list -- :[line [,line]] l[ist] [count] [flags] @@ -107,8 +108,8 @@ ex_print(sp, cmdp, fp, tp, flags) GS *gp; db_recno_t from, to; size_t col, len; - char *p; - char buf[10]; + CHAR_T *p; + CHAR_T buf[10]; CHAR_T *wp; size_t wlen; @@ -125,10 +126,10 @@ ex_print(sp, cmdp, fp, tp, flags) */ if (LF_ISSET(E_C_HASH)) { if (from <= 999999) { - snprintf(buf, sizeof(buf), "%6ld ", from); + SPRINTF(buf, SIZE(buf), L("%6ld "), from); p = buf; } else - p = "TOOBIG "; + p = L("TOOBIG "); if (ex_prchars(sp, p, &col, 8, 0, 0)) return (1); } @@ -138,9 +139,8 @@ ex_print(sp, cmdp, fp, tp, flags) * especially in handling end-of-line tabs, but they're almost * backward compatible. */ - if (db_get(sp, from, DBG_FATAL, &wp, &wlen)) + if (db_get(sp, from, DBG_FATAL, &p, &len)) return (1); - INT2CHAR(sp, wp, wlen, p, len); if (len == 0 && !LF_ISSET(E_C_LIST)) (void)ex_puts(sp, "\n"); @@ -157,19 +157,15 @@ ex_print(sp, cmdp, fp, tp, flags) * ex_ldisplay -- * Display a line without any preceding number. * - * PUBLIC: int ex_ldisplay __P((SCR *, const char *, size_t, size_t, u_int)); + * PUBLIC: int ex_ldisplay __P((SCR *, const CHAR_T *, size_t, size_t, u_int)); */ int -ex_ldisplay(sp, p, len, col, flags) - SCR *sp; - const char *p; - size_t len, col; - u_int flags; +ex_ldisplay(SCR *sp, const CHAR_T *p, size_t len, size_t col, u_int flags) { if (len > 0 && ex_prchars(sp, p, &col, len, LF_ISSET(E_C_LIST), 0)) return (1); if (!INTERRUPTED(sp) && LF_ISSET(E_C_LIST)) { - p = "$"; + p = L("$"); if (ex_prchars(sp, p, &col, 1, LF_ISSET(E_C_LIST), 0)) return (1); } @@ -189,21 +185,18 @@ ex_scprint(sp, fp, tp) SCR *sp; MARK *fp, *tp; { - char *p; + CHAR_T *p; size_t col, len; - CHAR_T *wp; - size_t wlen; col = 0; if (O_ISSET(sp, O_NUMBER)) { - p = " "; + p = L(" "); if (ex_prchars(sp, p, &col, 8, 0, 0)) return (1); } - if (db_get(sp, fp->lno, DBG_FATAL, &wp, &wlen)) + if (db_get(sp, fp->lno, DBG_FATAL, &p, &len)) return (1); - INT2CHAR(sp, wp, wlen, p, len); if (ex_prchars(sp, p, &col, fp->cno, 0, ' ')) return (1); @@ -213,7 +206,7 @@ ex_scprint(sp, fp, tp) return (1); if (INTERRUPTED(sp)) return (1); - p = "[ynq]"; /* XXX: should be msg_cat. */ + p = L("[ynq]"); /* XXX: should be msg_cat. */ if (ex_prchars(sp, p, &col, 5, 0, 0)) return (1); (void)ex_fflush(sp); @@ -225,12 +218,8 @@ ex_scprint(sp, fp, tp) * Local routine to dump characters to the screen. */ static int -ex_prchars(sp, p, colp, len, flags, repeatc) - SCR *sp; - const char *p; - size_t *colp, len; - u_int flags; - int repeatc; +ex_prchars(SCR *sp, const CHAR_T *p, size_t *colp, size_t len, + u_int flags, int repeatc) { CHAR_T ch; char *kp; @@ -242,7 +231,7 @@ ex_prchars(sp, p, colp, len, flags, repeatc) gp = sp->gp; ts = O_VAL(sp, O_TABSTOP); for (col = *colp; len--;) - if ((ch = *p++) == '\t' && !LF_ISSET(E_C_LIST)) + if ((ch = *p++) == L('\t') && !LF_ISSET(E_C_LIST)) for (tlen = ts - col % ts; col < sp->cols && tlen--; ++col) { (void)ex_printf(sp, @@ -251,8 +240,15 @@ ex_prchars(sp, p, colp, len, flags, repeatc) goto intr; } else { - kp = KEY_NAME(sp, ch); - tlen = KEY_LEN(sp, ch); + /* XXXX */ + if (INTISWIDE(ch)) { + CHAR_T str[2] = {0, 0}; + str[0] = ch; + INT2CHAR(sp, str, 2, kp, tlen); + } else { + kp = KEY_NAME(sp, ch); + tlen = KEY_LEN(sp, ch); + } if (!repeatc && col + tlen < sp->cols) { (void)ex_puts(sp, kp); col += tlen; -- 2.11.4.GIT