diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-02-23 14:10:59 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-02-23 14:10:59 +0000 |
commit | 788935aae6a144972fa10842f9031274539ea15b (patch) | |
tree | 674bae9f7be243ff2c0b5081323ea26178135c04 /usr.bin/window/ww.h | |
parent | a1af50e492a0fe75c1d06ee538abb365947fb218 (diff) |
Minor cleanup for 8-bit cleanliness. From der Mouse, PR 1322.
Eliminate the use of char variables for holding booleans.
Compress struct ww somewhat.
Make ww_index and related variables explicitly unsigned.
Diffstat (limited to 'usr.bin/window/ww.h')
-rw-r--r-- | usr.bin/window/ww.h | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/usr.bin/window/ww.h b/usr.bin/window/ww.h index cea40105d05..6b44cf0dcab 100644 --- a/usr.bin/window/ww.h +++ b/usr.bin/window/ww.h @@ -1,4 +1,4 @@ -/* $NetBSD: ww.h,v 1.5 1995/12/21 11:05:58 mycroft Exp $ */ +/* $NetBSD: ww.h,v 1.8 1996/02/08 21:48:51 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -48,6 +48,11 @@ #define NWW 30 /* maximum number of windows */ +/* Macros to clear/set/test flags. */ +#define SET(t, f) (t) |= (f) +#define CLR(t, f) (t) &= ~(f) +#define ISSET(t, f) ((t) & (f)) + /* a rectangle */ struct ww_dim { int nr; /* number of rows */ @@ -64,15 +69,25 @@ struct ww_pos { /* the window structure */ struct ww { + int ww_flags; + /* general flags and states */ - char ww_state; /* state of window */ - char ww_oflags; /* wwopen flags */ + int ww_state; /* state of window */ +#define WWS_INITIAL 0 /* just opened */ +#define WWS_HASPROC 1 /* has process on pty */ +#define WWS_DEAD 3 /* child died */ +#define ww_oflags ww_flags +#define WWO_REVERSE 0x0001 /* make it all reverse video */ +#define WWO_GLASS 0x0002 /* make it all glass */ +#define WWO_FRAME 0x0004 /* this is a frame window */ +#define WWO_ALLFLAGS 0x0007 /* information for overlap */ struct ww *ww_forw; /* doubly linked list, for overlapping info */ struct ww *ww_back; - char ww_index; /* the window index, for wwindex[] */ - char ww_order; /* the overlapping order */ + unsigned char ww_index; /* the window index, for wwindex[] */ +#define WWX_NOBODY NWW + int ww_order; /* the overlapping order */ /* sizes and positions */ struct ww_dim ww_w; /* window size and pos */ @@ -87,18 +102,23 @@ struct ww { short *ww_nvis; /* how many ww_buf chars are visible per row */ /* information for wwwrite() and company */ - char ww_wstate; /* state for outputting characters */ + int ww_wstate; /* state for outputting characters */ char ww_modes; /* current display modes */ - char ww_insert; /* insert mode */ - char ww_mapnl; /* map \n to \r\n */ - char ww_noupdate; /* don't do updates in wwwrite() */ - char ww_unctrl; /* expand control characters */ - char ww_nointr; /* wwwrite() not interruptable */ - char ww_hascursor; /* has fake cursor */ +#define ww_wflags ww_flags +#define WWW_INSERT 0x0008 /* insert mode */ +#define WWW_MAPNL 0x0010 /* map \n to \r\n */ +#define WWW_NOUPDATE 0x0020 /* don't do updates in wwwrite() */ +#define WWW_UNCTRL 0x0040 /* expand control characters */ +#define WWW_NOINTR 0x0080 /* wwwrite() not interruptable */ +#define WWW_HASCURSOR 0x0100 /* has fake cursor */ /* things for the window process and io */ - char ww_type; /* ww_pty is really a pty, not socket pair */ - char ww_stopped; /* output stopped */ + int ww_type; +#define WWT_PTY 0 /* pty */ +#define WWT_SOCKET 1 /* socket pair */ +#define WWT_INTERNAL 2 +#define ww_pflags ww_flags +#define WWP_STOPPED 0x0200 /* output stopped */ int ww_pty; /* file descriptor of pty or socket pair */ int ww_socket; /* other end of socket pair */ int ww_pid; /* pid of process, if WWS_HASPROC true */ @@ -109,10 +129,12 @@ struct ww { char *ww_obq; /* current write position in ww_ob */ /* things for the user, they really don't belong here */ - char ww_id; /* the user window id */ - char ww_center; /* center the label */ - char ww_hasframe; /* frame it */ - char ww_keepopen; /* keep it open after the process dies */ + int ww_id; /* the user window id */ +#define ww_uflags ww_flags +#define WWU_CENTER 0x0400 /* center the label */ +#define WWU_HASFRAME 0x0800 /* frame it */ +#define WWU_KEEPOPEN 0x1000 /* keep it open after the process dies */ +#define WWU_ALLFLAGS 0x1c00 char *ww_label; /* the user supplied label */ struct ww_dim ww_alt; /* alternate position and size */ }; @@ -167,11 +189,6 @@ struct ww_update { #define WWM_USR 0x20 /* user specified mode */ #define WWM_GLS 0x40 /* window only, glass, i.e., transparent */ - /* ww_state values */ -#define WWS_INITIAL 0 /* just opened */ -#define WWS_HASPROC 1 /* has process on pty */ -#define WWS_DEAD 3 /* child died */ - /* flags for ww_fmap */ #define WWF_U 0x01 #define WWF_R 0x02 @@ -181,21 +198,6 @@ struct ww_update { #define WWF_LABEL 0x40 #define WWF_TOP 0x80 - /* ww_type values */ -#define WWT_PTY 0 /* pty */ -#define WWT_SOCKET 1 /* socket pair */ -#define WWT_INTERNAL 2 - - /* flags to wwopen() */ -#define WWO_PTY 0x01 /* want pty */ -#define WWO_SOCKET 0x02 /* want socket pair */ -#define WWO_REVERSE 0x04 /* make it all reverse video */ -#define WWO_GLASS 0x08 /* make it all glass */ -#define WWO_FRAME 0x10 /* this is a frame window */ - - /* special ww_index value */ -#define WWX_NOBODY NWW - /* error codes */ #define WWE_NOERR 0 #define WWE_SYS 1 /* system error */ @@ -227,7 +229,7 @@ char wwavailmodes; /* actually supported modes */ char wwcursormodes; /* the modes for the fake cursor */ char wwwrap; /* terminal has auto wrap around */ int wwdtablesize; /* result of getdtablesize() call */ -char **wwsmap; /* the screen map */ +unsigned char **wwsmap; /* the screen map */ union ww_char **wwos; /* the old (current) screen */ union ww_char **wwns; /* the new (desired) screen */ union ww_char **wwcs; /* the checkpointed screen */ |