[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: console / vga --glyphs option was:Curses console client weirdness
From: |
David Walter |
Subject: |
Re: console / vga --glyphs option was:Curses console client weirdness |
Date: |
Wed, 06 Nov 2002 16:19:12 -0500 |
User-agent: |
Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.4 (Honest Recruiter, hurd-i386-debian) |
Marcus:
I don't know if this was the type of thing you had in mind for the
glyphs option?
I was digging around in the console code for something else after
reading this thread, I've given it minimal testing. It seems to work
for the application I had seen the 8 colors issue come up.
2002-11-06 David Walter <dwalter@syr.edu>
* vga.c: support for commandline option --glyphs to set the number
of glyphs available,
(PARSE_NUMERIC_OPT): macro to auto assign numeric arguments.
(VGA_DEFAULT_DISPLAY_GLYPHS): default to max 512 glyphs entries.
limits colours to 8. (256 glyphs -> 16 colors)
(vga_display_glyphs): number of glyphs (512/256)
cvs diff --unified -wi ChangeLog vga.c
Index: ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/console-client/ChangeLog,v
retrieving revision 1.6
diff --unified -w -i --unified -w -i -r1.6 ChangeLog
--- ChangeLog 30 Sep 2002 17:13:14 -0000 1.6
+++ ChangeLog 6 Nov 2002 21:18:45 -0000
@@ -1,3 +1,12 @@
+2002-11-06 David Walter <dwalter@syr.edu>
+
+ * vga.c: support for commandline option --glyphs to set the number
+ of glyphs available,
+ (PARSE_NUMERIC_OPT): macro to auto assign numeric arguments.
+ (VGA_DEFAULT_DISPLAY_GLYPHS): default to max 512 glyphs entries.
+ limits colours to 8. (256 glyphs -> 16 colors)
+ (vga_display_glyphs): number of glyphs (512/256)
+
2002-09-30 Marcus Brinkmann <marcus@gnu.org>
* vga-support.c (vga_get_font_width): New function.
Index: vga.c
===================================================================
RCS file: /cvsroot/hurd/hurd/console-client/vga.c,v
retrieving revision 1.1
diff --unified -w -i --unified -w -i -r1.1 vga.c
--- vga.c 17 Sep 2002 12:26:10 -0000 1.1
+++ vga.c 6 Nov 2002 21:18:45 -0000
@@ -45,6 +45,9 @@
#include "unicode.h"
+#define VGA_DEFAULT_DISPLAY_GLYPHS 512
+static int vga_display_glyphs = VGA_DEFAULT_DISPLAY_GLYPHS;
+
#define VGA_DISP_WIDTH 80
#define VGA_DISP_HEIGHT 25
@@ -143,6 +146,25 @@
static error_t
parse_startup_args (int no_exit, int argc, char *argv[], int *next)
{
+#define PARSE_NUMERIC_OPT(x,y) \
+ do { \
+ if (!strcmp (argv[*next], x)) \
+ { \
+ (*next)++; \
+ if (*next == argc) \
+ { \
+ if (no_exit) \
+ return EINVAL; \
+ else \
+ error (1, 0, "option " x \
+ " requires an argument"); \
+ } \
+ vga_display_##y = atoi (argv[*next]); \
+ (*next)++; \
+ continue; \
+ } \
+ } while (0)
+
#define PARSE_FONT_OPT(x,y) \
do { \
if (!strcmp (argv[*next], x)) \
@@ -177,9 +199,15 @@
PARSE_FONT_OPT ("--font-italic", font_italic);
PARSE_FONT_OPT ("--font-bold", font_bold);
PARSE_FONT_OPT ("--font-bold-italic", font_bold_italic);
-
+ PARSE_NUMERIC_OPT("--glyphs", glyphs);
break;
}
+ vga_display_glyphs =
+ vga_display_glyphs == VGA_DEFAULT_DISPLAY_GLYPHS
+ || vga_display_glyphs == 256
+ ? vga_display_glyphs
+ : VGA_DEFAULT_DISPLAY_GLYPHS;
+
return 0;
}
@@ -207,7 +235,7 @@
return ENOMEM;
/* Set this to 256 for full color support. */
- disp->df_size = 512;
+ disp->df_size = vga_display_glyphs;
disp->width = VGA_DISP_WIDTH;
disp->height = VGA_DISP_HEIGHT;
@@ -263,7 +291,7 @@
}
dynafont_activate (disp->df);
- disp->dc = (disp->df_size == 512) ? dynacolor_init_8 : dynacolor_init_16;
+ disp->dc = (disp->df_size == VGA_DEFAULT_DISPLAY_GLYPHS) ? dynacolor_init_8
: dynacolor_init_16;
dynacolor_activate (&disp->dc);
err = driver_add_display (&vga_display_ops, disp);
@@ -530,7 +558,7 @@
*(pos++) = charval & 0xff;
*(pos++) = disp->cur_attr
- | (disp->df_size == 512 ? (charval >> 5) & 0x8 : 0);
+ | (disp->df_size == VGA_DEFAULT_DISPLAY_GLYPHS ? (charval >> 5) & 0x8 :
0);
/* Perform reference counting. */
if (refpos->used)
--
pub 1024D/DC92AE30 2002-02-26 David Walter <dwalter@syr.edu>
fingerprint = 50A0 E513 732D 1D0F BD26 C84E A8DD 9D80 DC92 AE30
sub 2048g/51023582 2002-02-26