Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/dev Add a minimum box drawing character suppor...



details:   https://anonhg.NetBSD.org/src/rev/e2dbcfb761aa
branches:  trunk
changeset: 368127:e2dbcfb761aa
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 25 03:18:38 2022 +0000

description:
Add a minimum box drawing character support for x68k ite(4).

This is for proper appearance of menus in sysinst(8) with TERM=vt220.
Discussed on port-x68k@ etc.

There was "why not all G0/G1/G2/G3" comment, but terminfo and curses
with TERM=vt220 only require "ESC ( <F>" against G0 for DEC special
graphics (including box drawing characters) by smacs/rmacs/acsc.
I hope other various unimplemented ISO/IEC 2022 specifications will
be motivated per further visible demends.

diffstat:

 sys/arch/x68k/dev/ite.c    |  698 ++++++++++++++++++++++++++++----------------
 sys/arch/x68k/dev/ite_tv.c |  371 ++++++++++++-----------
 sys/arch/x68k/dev/itevar.h |    7 +-
 3 files changed, 633 insertions(+), 443 deletions(-)

diffs (truncated from 2404 to 300 lines):

diff -r a4a4394823c1 -r e2dbcfb761aa sys/arch/x68k/dev/ite.c
--- a/sys/arch/x68k/dev/ite.c   Sat Jun 25 02:46:15 2022 +0000
+++ b/sys/arch/x68k/dev/ite.c   Sat Jun 25 03:18:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ite.c,v 1.68 2022/05/28 10:36:22 andvar Exp $  */
+/*     $NetBSD: ite.c,v 1.69 2022/06/25 03:18:38 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.68 2022/05/28 10:36:22 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.69 2022/06/25 03:18:38 tsutsui Exp $");
 
 #include "ite.h"
 #if NITE > 0
@@ -94,33 +94,33 @@
 
 struct consdev;
 
-inline static void itesendch(int);
-inline static void alignment_display(struct ite_softc *);
-inline static void snap_cury(struct ite_softc *);
-inline static void ite_dnchar(struct ite_softc *, int);
+static inline void itesendch(int);
+static inline void alignment_display(struct ite_softc *);
+static inline void snap_cury(struct ite_softc *);
+static inline void ite_dnchar(struct ite_softc *, int);
 static void ite_inchar(struct ite_softc *,     int);
-inline static void ite_clrtoeol(struct ite_softc *);
-inline static void ite_clrtobol(struct ite_softc *);
-inline static void ite_clrline(struct ite_softc *);
-inline static void ite_clrtoeos(struct ite_softc *);
-inline static void ite_clrtobos(struct ite_softc *);
-inline static void ite_clrscreen(struct ite_softc *);
-inline static void ite_dnline(struct ite_softc *, int);
-inline static void ite_inline(struct ite_softc *, int);
-inline static void ite_index(struct ite_softc *);
-inline static void ite_lf(struct ite_softc *);
-inline static void ite_crlf(struct ite_softc *);
-inline static void ite_cr(struct ite_softc *);
-inline static void ite_rlf(struct ite_softc *);
+static inline void ite_clrtoeol(struct ite_softc *);
+static inline void ite_clrtobol(struct ite_softc *);
+static inline void ite_clrline(struct ite_softc *);
+static inline void ite_clrtoeos(struct ite_softc *);
+static inline void ite_clrtobos(struct ite_softc *);
+static inline void ite_clrscreen(struct ite_softc *);
+static inline void ite_dnline(struct ite_softc *, int);
+static inline void ite_inline(struct ite_softc *, int);
+static inline void ite_index(struct ite_softc *);
+static inline void ite_lf(struct ite_softc *);
+static inline void ite_crlf(struct ite_softc *);
+static inline void ite_cr(struct ite_softc *);
+static inline void ite_rlf(struct ite_softc *);
 static void iteprecheckwrap(struct ite_softc *);
 static void itecheckwrap(struct ite_softc *);
 static int ite_argnum(struct ite_softc *);
 static int ite_zargnum(struct ite_softc *);
 static void ite_sendstr(struct ite_softc *, const char *);
-inline static int atoi(const char *);
-struct ite_softc *getitesp(dev_t);
+static inline int atoi(const char *);
+static struct ite_softc *getitesp(dev_t);
 
-struct itesw itesw[] = {
+static struct itesw itesw[] = {
        {0,     tv_init,        tv_deinit,      0,
         0,     0,              0}
 };
@@ -134,35 +134,38 @@
 #define ITEBURST 64
 
 struct tty *ite_tty[NITE];
-struct ite_softc *kbd_ite = NULL;
-struct  ite_softc con_itesoftc;
-struct device con_itedev;
 
-struct  tty *kbd_tty = NULL;
+static struct ite_softc *kbd_ite = NULL;
+static struct ite_softc con_itesoftc;
+static struct device con_itedev;
 
-int    start_repeat_timeo = 20; /* /100: initial timeout till pressed key repeats */
-int    next_repeat_timeo  = 3;  /* /100: timeout when repeating for next char */
+static struct tty *kbd_tty = NULL;
 
-u_char cons_tabs[MAX_TABS];
+static int start_repeat_timeo = 20;    /* /100: initial timeout till pressed
+                                                key repeats */
+static int next_repeat_timeo  = 3;     /* /100: timeout when repeating for
+                                                next char */
 
-void   itestart(struct tty *);
+static u_char cons_tabs[MAX_TABS];
 
-void iteputchar(int, struct ite_softc *);
-void ite_putstr(const u_char *, int, dev_t);
+static void itestart(struct tty *);
 
-int itematch(device_t, cfdata_t, void *);
-void iteattach(device_t, device_t, void *);
+static void iteputchar(int, struct ite_softc *);
+static void ite_putstr(const u_char *, int, dev_t);
+
+static int itematch(device_t, cfdata_t, void *);
+static void iteattach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(ite, sizeof(struct ite_softc),
     itematch, iteattach, NULL, NULL);
 
-dev_type_open(iteopen);
-dev_type_close(iteclose);
-dev_type_read(iteread);
-dev_type_write(itewrite);
-dev_type_ioctl(iteioctl);
-dev_type_tty(itetty);
-dev_type_poll(itepoll);
+static dev_type_open(iteopen);
+static dev_type_close(iteclose);
+static dev_type_read(iteread);
+static dev_type_write(itewrite);
+static dev_type_ioctl(iteioctl);
+static dev_type_tty(itetty);
+static dev_type_poll(itepoll);
 
 const struct cdevsw ite_cdevsw = {
        .d_open = iteopen,
@@ -179,7 +182,7 @@
        .d_flag = D_TTY
 };
 
-int
+static int
 itematch(device_t parent, cfdata_t cf, void *aux)
 {
        struct grf_softc *gp;
@@ -195,7 +198,7 @@
  * iteinit() is the standard entry point for initialization of
  * an ite device, it is also called from ite_cninit().
  */
-void
+static void
 iteattach(device_t parent, device_t self, void *aux)
 {
        struct ite_softc *ip;
@@ -223,7 +226,7 @@
        aprint_normal("\n");
 }
 
-struct ite_softc *
+static struct ite_softc *
 getitesp(dev_t dev)
 {
 
@@ -232,7 +235,7 @@
 
        if (con_itesoftc.grf == NULL)
                panic("no ite_softc for console");
-       return(&con_itesoftc);
+       return &con_itesoftc;
 }
 
 void
@@ -254,8 +257,9 @@
        ip->isw = &itesw[device_unit(ip->device)]; /* XXX */
        SUBR_INIT(ip);
        SUBR_CURSOR(ip, DRAW_CURSOR);
-       if (!ip->tabs)
-               ip->tabs = malloc(MAX_TABS*sizeof(u_char), M_DEVBUF, M_WAITOK);
+       if (ip->tabs == NULL)
+               ip->tabs = malloc(MAX_TABS * sizeof(u_char),
+                   M_DEVBUF, M_WAITOK);
        ite_reset(ip);
        ip->flags |= ITE_INITED;
 }
@@ -282,29 +286,29 @@
        struct ite_softc *ip;
 
        if (unit < 0 || unit >= ite_cd.cd_ndevs ||
-           (ip = getitesp(dev)) == NULL || (ip->flags&ITE_ALIVE) == 0)
-               return(ENXIO);
+           (ip = getitesp(dev)) == NULL || (ip->flags & ITE_ALIVE) == 0)
+               return ENXIO;
        /* force ite active, overriding graphics mode */
-       if (flag & 1) {
+       if ((flag & 1) != 0) {
                ip->flags |= ITE_ACTIVE;
                ip->flags &= ~(ITE_INGRF|ITE_INITED);
        }
        /* leave graphics mode */
-       if (flag & 2) {
+       if ((flag & 2) != 0) {
                ip->flags &= ~ITE_INGRF;
                if ((ip->flags & ITE_ACTIVE) == 0)
-                       return(0);
+                       return 0;
        }
        ip->flags |= ITE_ACTIVE;
-       if (ip->flags & ITE_INGRF)
-               return(0);
+       if ((ip->flags & ITE_INGRF) != 0)
+               return 0;
        iteinit(dev);
-       if (flag & 2)
+       if ((flag & 2) != 0)
                ite_reset(ip);
 #if NKBD > 0
        mfp_send_usart(0x49);   /* XXX */
 #endif
-       return(0);
+       return 0;
 }
 
 /*
@@ -321,15 +325,15 @@
 
        /* XXX check whether when call from grf.c */
        if (unit < 0 || unit >= ite_cd.cd_ndevs ||
-           (ip = getitesp(dev)) == NULL || (ip->flags&ITE_ALIVE) == 0)
+           (ip = getitesp(dev)) == NULL || (ip->flags & ITE_ALIVE) == 0)
                return;
-       if (flag & 2)
+       if ((flag & 2) != 0)
                ip->flags |= ITE_INGRF;
 
        if ((ip->flags & ITE_ACTIVE) == 0)
                return;
-       if ((flag & 1) ||
-           (ip->flags & (ITE_INGRF|ITE_ISCONS|ITE_INITED)) == ITE_INITED)
+       if ((flag & 1) != 0 ||
+           (ip->flags & (ITE_INGRF | ITE_ISCONS | ITE_INITED)) == ITE_INITED)
                SUBR_DEINIT(ip);
 
        /*
@@ -352,7 +356,7 @@
  */
 
 /* ARGSUSED */
-int
+static int
 iteopen(dev_t dev, int mode, int devtype, struct lwp *l)
 {
        int unit = UNIT(dev);
@@ -362,18 +366,18 @@
        int first = 0;
 
        if (unit >= ite_cd.cd_ndevs || (ip = getitesp(dev)) == NULL)
-               return (ENXIO);
-       if (!ite_tty[unit]) {
+               return ENXIO;
+       if (ite_tty[unit] == NULL) {
                tp = ite_tty[unit] = tty_alloc();
                tty_attach(tp);
        } else
                tp = ite_tty[unit];
        if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
-               return (EBUSY);
+               return EBUSY;
        if ((ip->flags & ITE_ACTIVE) == 0) {
                error = iteon(dev, 0);
                if (error)
-                       return (error);
+                       return error;
                first = 1;
        }
        tp->t_oproc = itestart;
@@ -395,11 +399,11 @@
                tp->t_winsize.ws_col = ip->cols;
        } else if (first)
                iteoff(dev, 0);
-       return (error);
+       return error;
 }
 
 /*ARGSUSED*/
-int
+static int
 iteclose(dev_t dev, int flag, int mode, struct lwp *l)
 {
        struct tty *tp = ite_tty[UNIT(dev)];
@@ -409,43 +413,43 @@
        iteoff(dev, 0);
 #if 0
        tty_free(tp);
-       ite_tty[UNIT(dev)] = (struct tty *)0;
+       ite_tty[UNIT(dev)] = NULL;
 #endif
-       return(0);
+       return 0;
 }
 
-int
+static int
 iteread(dev_t dev, struct uio *uio, int flag)
 {
        struct tty *tp = ite_tty[UNIT(dev)];
 



Home | Main Index | Thread Index | Old Index