Re: [minor style issue] filenames and C++ reserved words in header files

Colten Edwards (edwards@panasync.canuck.ca)
Sat, 23 Mar 1996 16:22:48 -0600 (CST)


On Sat, 23 Mar 1996, Morten Welinder wrote:

>
> Linus Torvalds (torvalds@cs.helsinki.fi) wrote
>
> >On Tue, 19 Mar 1996 rmenon@tisl.ukans.edu wrote:
> >>
> >> Has anyone noticed that emacs bombs while trying to scan etags files

> >Quite frankly, I consider GNU emacs to be just about the most broken
> >program there _is_ in any unix environment, and I refuse to cater to any
> >GNU emacs bugs.
>
> No need to, this one appears to have been fixed in the most recent
> version of Emacs, pretest 19.30.95 from the morning. (Probably

Speaking of editors, has anyone tried the fte editor? It's a text mode
editor but requires a small patch to the console driver. It supports
color syntax highlighting for c, c++, html and alot of others. It looks
almost like a old borland interface, but better. And you don't have to
devote 30megs of HD space to an editor.
www page is at http://ixtas.fer.uni-lj.si/~markom/fte

It probably won't work on anything other than the console after looking
at the patch but I could be mistaken. I've enclosed the patch file for
others to have a look at. It might make other console only programs more
responsive if they are re-written to use the features in the patch.
The patch itself will almost patch cleanly into version 1.3.77 even
though it's actually meant for 1.2 I think.

Colten Edwards

--- drivers/char/orig/console.c Sat Mar 11 15:27:58 1995
+++ drivers/char/console.c Sat Mar 11 15:29:17 1995
@@ -97,6 +97,7 @@
#include <linux/major.h>
#include <linux/mm.h>
#include <linux/ioport.h>
+#include <linux/usercons.h>

#include <asm/io.h>
#include <asm/system.h>
@@ -2172,6 +2173,83 @@
return 0;
}

+int put_cells(int currcons, int xx, int yy, int ww, void *buf) {
+ char *dd;
+ int i;
+
+ if (xx < 0 || yy < 0 ||
+ xx >= video_num_columns || yy >= video_num_lines ||
+ xx + ww > video_num_columns)
+ return -EINVAL;
+
+ i = verify_area(VERIFY_READ, buf, ww << 1);
+ if(i)
+ return i;
+
+ clear_selection();
+ disable_bh(KEYBOARD_BH);
+ dd = (char *) (origin + ((yy * video_size_row) + (xx << 1)));
+ memcpy_fromfs(dd, buf, ww << 1);
+ enable_bh(KEYBOARD_BH);
+ return 0;
+}
+
+int get_cells(int currcons, int xx, int yy, int ww, void *buf) {
+ char *dd;
+ int i;
+
+ if (xx < 0 || yy < 0 ||
+ xx >= video_num_columns || yy >= video_num_lines ||
+ xx + ww > video_num_columns)
+ return -EINVAL;
+
+ i = verify_area(VERIFY_WRITE, buf, ww << 1);
+ if (i)
+ return i;
+
+ clear_selection();
+ disable_bh(KEYBOARD_BH);
+ dd = (char *) (origin + ((yy * video_size_row) + (xx << 1)));
+ memcpy_tofs(buf, dd, ww << 1);
+ enable_bh(KEYBOARD_BH);
+ return 0;
+}
+
+int user_console(int arg, struct tty_struct *tty) {
+ struct usercons_struct *user;
+ struct usercons_struct my;
+ int cmd, xx, yy, ww, hh, nn, i;
+ void *bb;
+ struct vt_struct *vt = (struct vt_struct *) tty->driver_data;
+ int currcons = vt->vc_num;
+
+ if(currcons < 0 || currcons >= MAX_NR_CONSOLES)
+ return -EINVAL;
+ if(!vc_cons_allocated(currcons))
+ return -EINVAL;
+
+ i = verify_area(VERIFY_READ, (void *) arg, sizeof(struct usercons_struct));
+ if(i)
+ return i;
+ user = (struct usercons_struct *) arg;
+ memcpy_fromfs(&my, user, sizeof(struct usercons_struct));
+ cmd = my.cmd;
+ xx = my.xx;
+ yy = my.yy;
+ ww = my.ww;
+ hh = my.hh;
+ nn = my.nn;
+ bb = my.bb;
+
+ switch(cmd) {
+ case USERCONS_PUTCELLS:
+ return put_cells(currcons, xx, yy, ww, bb);
+ case USERCONS_GETCELLS:
+ return get_cells(currcons, xx, yy, ww, bb);
+ default:
+ return -EINVAL;
+ }
+}

/*
* PIO_FONT support.
--- drivers/char/orig/kbd_kern.h Sat Mar 11 15:27:58 1995
+++ drivers/char/kbd_kern.h Sat Mar 11 15:28:09 1995
@@ -45,11 +45,12 @@
#define VC_NUMLOCK 1 /* numeric lock mode */
#define VC_CAPSLOCK 2 /* capslock mode */

- unsigned char kbdmode:2; /* one 2-bit value */
+ unsigned char kbdmode:3; /* one 3-bit value */
#define VC_XLATE 0 /* translate keycodes using keymap */
#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
#define VC_RAW 2 /* raw (scancode) mode */
#define VC_UNICODE 3 /* Unicode mode */
+#define VC_KEYCODE 4

unsigned char modeflags:5;
#define VC_APPLIC 0 /* application key mode */
--- drivers/char/orig/keyboard.c Sat Mar 11 15:27:59 1995
+++ drivers/char/keyboard.c Sat Mar 11 15:28:09 1995
@@ -501,8 +501,26 @@
if (raw_mode)
goto end_kbd_intr;

- if (kbd->kbdmode == VC_MEDIUMRAW) {
+ if (kbd->kbdmode == VC_MEDIUMRAW || kbd->kbdmode == VC_KEYCODE) {
/* soon keycodes will require more than one byte */
+ if(kbd->kbdmode == VC_KEYCODE) {
+ u_short keysym;
+ u_char type;
+ int shift_final = shift_state ^ kbd->lockstate;
+ ushort *key_map = key_maps[shift_final];
+
+ if(key_map) {
+ keysym = key_map[keycode];
+ type = KTYP(keysym);
+ if(type >= 0xf0)
+ type -= 0xf0;
+ if(((type == KT_SPEC) && ((keysym & 0xff) != (K_ENTER & 0xff))) || (type == KT_CONS) || (type == KT_LOCK) || (type == KT_SHIFT))
+ (*key_handler[type])(keysym & 0xff, up_flag);
+ } else {
+ compute_shiftstate();
+ }
+ put_queue(shift_final);
+ }
put_queue(keycode + up_flag);
goto end_kbd_intr;
}
--- drivers/char/orig/tty_io.c Sat Mar 11 15:27:59 1995
+++ drivers/char/tty_io.c Sat Mar 11 15:28:09 1995
@@ -53,6 +53,7 @@
#include <linux/string.h>
#include <linux/malloc.h>
#include <linux/config.h>
+#include <linux/usercons.h>

#include <asm/segment.h>
#include <asm/system.h>
@@ -1484,6 +1485,10 @@
case 10:
set_vesa_blanking(arg);
return 0;
+
+ case LINUX_USERCONS:
+ return user_console(arg, tty);
+
default:
return -EINVAL;
}
--- drivers/char/orig/vt.c Sat Mar 11 15:27:59 1995
+++ drivers/char/vt.c Sat Mar 11 15:28:09 1995
@@ -267,6 +267,10 @@
kbd->kbdmode = VC_UNICODE;
compute_shiftstate();
break;
+ case K_KEYCODE:
+ kbd->kbdmode = VC_KEYCODE;
+ compute_shiftstate();
+ break;
default:
return -EINVAL;
}
@@ -280,6 +284,7 @@
ucval = ((kbd->kbdmode == VC_RAW) ? K_RAW :
(kbd->kbdmode == VC_MEDIUMRAW) ? K_MEDIUMRAW :
(kbd->kbdmode == VC_UNICODE) ? K_UNICODE :
+ (kbd->kbdmode == VC_KEYCODE) ? K_KEYCODE :
K_XLATE);
put_fs_long(ucval, (unsigned long *) arg);
}
--- include/linux/orig/kd.h Sat Mar 11 15:27:16 1995
+++ include/linux/kd.h Sat Mar 11 15:28:08 1995
@@ -62,6 +62,7 @@
#define K_XLATE 0x01
#define K_MEDIUMRAW 0x02
#define K_UNICODE 0x03
+#define K_KEYCODE 0x13
#define KDGKBMODE 0x4B44 /* gets current keyboard mode */
#define KDSKBMODE 0x4B45 /* sets current keyboard mode */

--- include/linux/orig/usercons.h Sat Mar 11 20:19:00 1995
+++ include/linux/usercons.h Sat Mar 11 15:28:08 1995
@@ -0,0 +1,50 @@
+#ifndef __USERCONSOLE_H
+#define __USERCONSOLE_H
+/*
+ * struct used to transfer data between user/kernel in
+ * ioctl(vc_fd, TIOCLINUX, &usercons);
+ *
+ */
+#define LINUX_USERCONS 13
+
+#define USERCONS_PUTCELLS 0
+#define USERCONS_GETCELLS 1
+#define USERCONS_SETCURSOR 2
+#define USERCONS_GETCURSOR 3
+#define USERCONS_GETMOUSE 4
+#define USERCONS_SETMOUSE 5
+
+struct usercons_struct {
+ char c; /* LINUX_USERCONS */
+ int cmd, xx, yy, ww, hh, nn;
+ void *bb;
+};
+
+extern int user_console(int arg, struct tty_struct *tty);
+
+#endif
+#ifndef __USERCONSOLE_H
+#define __USERCONSOLE_H
+/*
+ * struct used to transfer data between user/kernel in
+ * ioctl(vc_fd, TIOCLINUX, &usercons);
+ *
+ */
+#define LINUX_USERCONS 13
+
+#define USERCONS_PUTCELLS 0
+#define USERCONS_GETCELLS 1
+#define USERCONS_SETCURSOR 2
+#define USERCONS_GETCURSOR 3
+#define USERCONS_GETMOUSE 4
+#define USERCONS_SETMOUSE 5
+
+struct usercons_struct {
+ char c; /* LINUX_USERCONS */
+ int cmd, xx, yy, ww, hh, nn;
+ void *bb;
+};
+
+extern int user_console(int arg, struct tty_struct *tty);
+
+#endif