Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rcons Many enchancements to rcons to support ANSI co...



details:   https://anonhg.NetBSD.org/src/rev/3464f712293c
branches:  trunk
changeset: 471856:3464f712293c
user:      ad <ad%NetBSD.org@localhost>
date:      Tue Apr 13 18:43:17 1999 +0000

description:
Many enchancements to rcons to support ANSI color and all attributes
properly. All output now performed using a 'struct wsdisplay_emulops'.

diffstat:

 sys/dev/rcons/Makefile     |    4 +-
 sys/dev/rcons/files.rcons  |   11 +-
 sys/dev/rcons/rcons.h      |   77 +++---
 sys/dev/rcons/rcons_kern.c |  114 ++-------
 sys/dev/rcons/rcons_subr.c |  527 ++++++++++++++++++++++++++------------------
 sys/dev/rcons/rcons_subr.h |    4 +-
 6 files changed, 388 insertions(+), 349 deletions(-)

diffs (truncated from 1108 to 300 lines):

diff -r 55329ce469f6 -r 3464f712293c sys/dev/rcons/Makefile
--- a/sys/dev/rcons/Makefile    Tue Apr 13 18:34:13 1999 +0000
+++ b/sys/dev/rcons/Makefile    Tue Apr 13 18:43:17 1999 +0000
@@ -1,7 +1,7 @@
-#      $NetBSD: Makefile,v 1.1 1998/06/12 23:22:55 cgd Exp $
+#      $NetBSD: Makefile,v 1.2 1999/04/13 18:43:17 ad Exp $
 
 INCSDIR= /usr/include/dev/rcons
 
-INCS=  raster.h rcons.h rcons_subr.h
+INCS=  raster.h rcons.h
 
 .include <bsd.kinc.mk>
diff -r 55329ce469f6 -r 3464f712293c sys/dev/rcons/files.rcons
--- a/sys/dev/rcons/files.rcons Tue Apr 13 18:34:13 1999 +0000
+++ b/sys/dev/rcons/files.rcons Tue Apr 13 18:43:17 1999 +0000
@@ -1,12 +1,11 @@
-# $NetBSD: files.rcons,v 1.3 1999/03/27 00:07:58 dbj Exp $
+# $NetBSD: files.rcons,v 1.4 1999/04/13 18:43:17 ad Exp $
 #
 # Configuration file for RASTER Console.
 #
+file dev/rcons/raster_op.c     raster
+file dev/rcons/raster_text.c   raster
 
-# rcons bit-depth options
-defopt opt_rcons.h RCONS_2BPP RCONS_16BPP
-
-file dev/rcons/raster_op.c     rasterconsole | raster
-file dev/rcons/raster_text.c   rasterconsole | raster
 file dev/rcons/rcons_kern.c    rasterconsole
 file dev/rcons/rcons_subr.c    rasterconsole
+
+defopt opt_rcons.h     RASTERCONS_FGCOL RASTERCONS_BGCOL
diff -r 55329ce469f6 -r 3464f712293c sys/dev/rcons/rcons.h
--- a/sys/dev/rcons/rcons.h     Tue Apr 13 18:34:13 1999 +0000
+++ b/sys/dev/rcons/rcons.h     Tue Apr 13 18:43:17 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcons.h,v 1.4 1996/03/14 19:02:32 christos Exp $ */
+/*     $NetBSD: rcons.h,v 1.5 1999/04/13 18:43:17 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -43,72 +43,74 @@
  *
  *     @(#)fbvar.h     8.1 (Berkeley) 6/11/93
  */
+#ifndef _RCONS_H_
+#define _RCONS_H_ 1
 
-#include <dev/rcons/raster.h>
+/* Default color values */
+#include "opt_rcons.h"
+#ifndef RASTERCONSOLE_FGCOL
+#define RASTERCONSOLE_FGCOL    WSCOL_WHITE
+#endif
+#ifndef RASTERCONSOLE_BGCOL
+#define RASTERCONSOLE_BGCOL    WSCOL_BLACK
+#endif
+
+/* Avoid dragging in dev/wscons/wsdisplayvar.h */
+struct wsdisplay_emulops;
 
 struct rconsole {
-       /* Raster console emulator state */
-
        /* This section must be filled in by the framebugger device */
-       int     rc_width;
-       int     rc_height;
-       int     rc_depth;
-       caddr_t rc_pixels;              /* display RAM */
-       int     rc_linebytes;           /* bytes per display line */
-       int     rc_maxrow;              /* emulator height of screen */
-       int     rc_maxcol;              /* emulator width of screen */
+       u_int   rc_maxrow;              /* emulator height of screen */
+       u_int   rc_maxcol;              /* emulator width of screen */
        void    (*rc_bell)__P((int));   /* ring the bell */
-       /* The following two items may optionally be left zero */
-       int     *rc_row;                /* emulator row */
-       int     *rc_col;                /* emulator column */
+       struct  wsdisplay_emulops *rc_ops;/* output ops */
+       void    *rc_cookie;             /* cookie thereof */
+       u_int   rc_width;               /* width in pixels */
+       u_int   rc_height;              /* height in pixels */
 
        /* Bits maintained by the raster routines */
+       u_int   rc_row;                 /* emulator row */
+       u_int   rc_col;                 /* emulator column */
        u_int   rc_bits;                /* see defines below */
        int     rc_ringing;             /* bell currently ringing */
        int     rc_belldepth;           /* audible bell depth */
        int     rc_scroll;              /* stupid sun scroll mode */
-
        int     rc_p0;                  /* escape sequence parameter 0 */
        int     rc_p1;                  /* escape sequence parameter 1 */
-
-       int     rc_emuwidth;            /* emulator screen width  */
-       int     rc_emuheight;           /* emulator screen height */
-
-       int     rc_xorigin;             /* x origin for first column */
-       int     rc_yorigin;             /* y origin for first row */
-
-       struct  raster *rc_sp;          /* frame buffer raster */
-       struct  raster *rc_cursor;      /* optional cursor */
-       int     rc_ras_blank;           /* current screen blank raster op */
-
-       struct  raster_font *rc_font;   /* font and related info */
+       int     rc_fgcolor;             /* current fg color */
+       int     rc_bgcolor;             /* current bg color */
+       long    rc_attr;                /* wscons text attribute */
+       long    rc_kern_attr;           /* kernel output attribute */
+       u_int   rc_wsflg;               /* wscons attribute flags */
+       u_int   rc_supwsflg;            /* supported attribute flags */
+       u_int   rc_charmap[256];        /* ASCII->emulator char map */
 };
 
 #define FB_INESC       0x001           /* processing an escape sequence */
-#define FB_STANDOUT    0x002           /* standout mode */
-#ifdef notyet
-#define FB_BOLD                0x?             /* boldface mode */
-#endif
-#define FB_INVERT      0x008           /* white on black mode */
-#define FB_VISBELL     0x010           /* visual bell */
-#define FB_CURSOR      0x020           /* cursor is visible */
+#define FB_VISBELL     0x002           /* visual bell */
+#define FB_CURSOR      0x004           /* cursor is visible */
+#define FB_INVERT      0x008           /* framebuffer inverted */
+#define FB_NO_CURSOR   0x010           /* cursor is disabled */
+
 #define FB_P0_DEFAULT  0x100           /* param 0 is defaulted */
 #define FB_P1_DEFAULT  0x200           /* param 1 is defaulted */
 #define FB_P0          0x400           /* working on param 0 */
 #define FB_P1          0x800           /* working on param 1 */
 
-
 /* rcons_kern.c */
 void rcons_cnputc __P((int));
 void rcons_bell __P((struct rconsole *));
 void rcons_init __P((struct rconsole *));
 
 /* rcons_subr.c */
+void rcons_init_ops __P((struct rconsole *rc));
 void rcons_puts __P((struct rconsole *, unsigned char *, int));
-void rcons_text __P((struct rconsole *, unsigned char *, int));
 void rcons_pctrl __P((struct rconsole *, int));
 void rcons_esc __P((struct rconsole *, int));
 void rcons_doesc __P((struct rconsole *, int));
+void rcons_sgresc __P((struct rconsole *, int));
+void rcons_init __P((struct rconsole *));
+void rcons_text __P((struct rconsole *, unsigned char *, int));
 void rcons_cursor __P((struct rconsole *));
 void rcons_invert __P((struct rconsole *, int));
 void rcons_clear2eop __P((struct rconsole *));
@@ -118,3 +120,6 @@
 void rcons_delline __P((struct rconsole *, int));
 void rcons_insertchar __P((struct rconsole *, int));
 void rcons_insertline __P((struct rconsole *, int));
+void rcons_setcolor __P((struct rconsole *, int, int));
+
+#endif /* !defined _RCONS_H_ */
diff -r 55329ce469f6 -r 3464f712293c sys/dev/rcons/rcons_kern.c
--- a/sys/dev/rcons/rcons_kern.c        Tue Apr 13 18:34:13 1999 +0000
+++ b/sys/dev/rcons/rcons_kern.c        Tue Apr 13 18:43:17 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcons_kern.c,v 1.6 1996/10/13 01:38:31 christos Exp $ */
+/*     $NetBSD: rcons_kern.c,v 1.7 1999/04/13 18:43:17 ad Exp $ */
 
 /*
  * Copyright (c) 1991, 1993
@@ -51,6 +51,7 @@
 #include <sys/ioctl.h>
 #include <sys/tty.h>
 #include <sys/proc.h>
+
 #include <dev/rcons/raster.h>
 #include <dev/rcons/rcons.h>
 
@@ -58,9 +59,7 @@
 
 static void rcons_belltmr(void *);
 
-#include "rcons_subr.h"
-
-static struct rconsole *mydevicep;
+static struct rconsole *mydevicep; /* XXX */
 static void rcons_output __P((struct tty *));
 
 void
@@ -68,6 +67,11 @@
        int c;
 {
        char buf[1];
+       long attr;
+       
+       /* Swap in kernel attribute */
+       attr = mydevicep->rc_attr;
+       mydevicep->rc_attr = mydevicep->rc_kern_attr;
 
        if (c == '\n')
                rcons_puts(mydevicep, "\r\n", 2);
@@ -75,13 +79,16 @@
                buf[0] = c;
                rcons_puts(mydevicep, buf, 1);
        }
+
+       /* Swap out kernel attribute */
+       mydevicep->rc_attr = attr;
 }
 
 static void
 rcons_output(tp)
-       register struct tty *tp;
+       struct tty *tp;
 {
-       register int s, n;
+       int s, n;
        char buf[OBUFSIZ];
 
        s = spltty();
@@ -114,16 +121,15 @@
 /* Ring the console bell */
 void
 rcons_bell(rc)
-       register struct rconsole *rc;
+       struct rconsole *rc;
 {
-       register int i, s;
+       int i, s;
 
        if (rc->rc_bits & FB_VISBELL) {
                /* invert the screen twice */
-               for (i = 0; i < 2; ++i)
-                       raster_op(rc->rc_sp, 0, 0,
-                           rc->rc_sp->width, rc->rc_sp->height,
-                           RAS_INVERT, (struct raster *) 0, 0, 0);
+               i = ((rc->rc_bits & FB_INVERT) == 0);
+               rcons_invert(rc, i);
+               rcons_invert(rc, i ^ 1);
        }
 
        s = splhigh();
@@ -145,8 +151,8 @@
 rcons_belltmr(p)
        void *p;
 {
-       register struct rconsole *rc = p;
-       register int s = splhigh(), i;
+       struct rconsole *rc = p;
+       int s = splhigh(), i;
 
        if (rc->rc_ringing) {
                rc->rc_ringing = 0;
@@ -166,39 +172,13 @@
 
 void
 rcons_init(rc)
-       register struct rconsole *rc;
+       struct rconsole *rc;
 {
        /* XXX this should go away */
-       static struct raster xxxraster;
-       register struct raster *rp = rc->rc_sp = &xxxraster;
-       register struct winsize *ws;
-       register int i;
-       static int row, col;
+       struct winsize *ws;
 
        mydevicep = rc;
-
-       /* XXX mostly duplicates of data in other places */
-       rp->width = rc->rc_width;
-       rp->height = rc->rc_height;
-       rp->depth = rc->rc_depth;
-       if (rc->rc_linebytes & 0x3) {
-               printf("rcons_init: linebytes assumption botched (0x%x)\n",
-                   rc->rc_linebytes);
-               return;
-       }
-       rp->linelongs = rc->rc_linebytes >> 2;
-       rp->pixels = (u_int32_t *)rc->rc_pixels;
-
-       rc->rc_ras_blank = RAS_CLEAR;
-
-       /* Impose upper bounds on rc_max{row,col} */
-       i = rc->rc_height / rc->rc_font->height;
-       if (rc->rc_maxrow > i)
-               rc->rc_maxrow = i;
-       i = rc->rc_width / rc->rc_font->width;
-       if (rc->rc_maxcol > i)
-               rc->rc_maxcol = i;
-
+       
        /* Let the system know how big the console is */
        ws = &fbconstty->t_winsize;
        ws->ws_row = rc->rc_maxrow;
@@ -206,47 +186,13 @@
        ws->ws_xpixel = rc->rc_width;
        ws->ws_ypixel = rc->rc_height;
 
-       /* Center emulator screen (but align x origin to 32 bits) */



Home | Main Index | Thread Index | Old Index