chain@paul.rutgers.edu (Chain Lee) (01/07/91)
Next 11 of my postings will be X11R4 patches for SCO Xenix. Load X11R4 source to your system. The top directory should be named X11R4. Apply 18 official patches first. Then load my patches. At the directory where X11R4 resides, run, cat xenix_patch_part?? | patch -p Cd to X11R4/mit/lib/X/sysV, run the following. rm *~ ln Berklib.c .. Then read X11R4/README.XENIX for procedures of building the system. One more thing should be added to step-7 in README.XENIX. Following command should be added at the end of your .xinitrc file to switch VGA screen back to text mode when Xxenix finishes. vidi v80x25 Chain Lee 01/06/91 chain@paul.rutgers.edu
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/lib/Xt/Create.c Sat Jan 5 22:07:35 1991 --- X11R4/mit/lib/Xt/Create.c Sat Nov 3 18:07:00 1990 *************** *** 29,35 **** #include "StringDefs.h" #include "Shell.h" #include "ShellP.h" - #include <stdio.h> static String XtNxtCreateWidget = "xtCreateWidget"; static String XtNxtCreatePopupShell = "xtCreatePopupShell"; --- 29,34 ---- *** X11R4.ORIG/mit/lib/Xt/Imakefile Sat Jan 5 22:06:54 1991 --- X11R4/mit/lib/Xt/Imakefile Sat Nov 3 18:05:55 1990 *************** *** 1,13 **** #include <Library.tmpl> #ifdef BandAidCompiler ! #include BandAidCompiler #endif #if UnalignedReferencesAllowed ALIGN_DEFINES = -DUNALIGNED #endif ! DEFINES = AllocateLocalDefines $(ALIGN_DEFINES) APP_DEFINES = -DXAPPLOADDIR=\"$(XAPPLOADDIR)$(PATHSEP)\" DB_DEFINES = -DERRORDB=\"$(LIBDIR)/XtErrorDB\" SRCH_DEFINES = \ --- 1,14 ---- #include <Library.tmpl> #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif #if UnalignedReferencesAllowed ALIGN_DEFINES = -DUNALIGNED #endif ! LOCAL_DEFINES = -DXFILESEARCHPATHDEFAULT=\"$(LIBDIR)/%L/%T/%N%S\:$(LIBDIR)/%l/%T/%N%S\:$(LIBDIR)/%T/%N%S\" ! DEFINES = AllocateLocalDefines $(ALIGN_DEFINES) $(LOCAL_DEFINES) APP_DEFINES = -DXAPPLOADDIR=\"$(XAPPLOADDIR)$(PATHSEP)\" DB_DEFINES = -DERRORDB=\"$(LIBDIR)/XtErrorDB\" SRCH_DEFINES = \ *** X11R4.ORIG/mit/lib/X/sysV/Berklib.c Sat Jan 5 22:08:30 1991 --- X11R4/mit/lib/X/sysV/Berklib.c Thu Nov 15 22:51:16 1990 *************** *** 1,13 **** - /* $XConsortium: Berklib.c,v 1.4 90/08/27 15:29:40 swick Exp $ */ - /* * This file is used by System V based systems. */ #include <sys/types.h> /* ! * These are routines found in BSD and not found in many SysV's. They are * included so that some clients can compile. */ --- 1,60 ---- /* * This file is used by System V based systems. */ #include <sys/types.h> + #include <sys/timeb.h> + #include <time.h> + #include <errno.h> + #ifndef __TIMEVAL__ + struct timeval { + long tv_sec; + long tv_usec; + }; + struct timezone { + int tz_minuteswest; + int tz_dsttime; + }; + #endif /* __TIMEVAL__ */ + + extern int errno; + + int + gettimeofday(tp, tzp) + struct timeval *tp; + struct timezone *tzp; + { + long clock; + static struct timeb Now, *now; + static struct tm LocalNow, *localnow; + + now = &Now; + localnow = &LocalNow; + + clock = time(0); + localnow = localtime(&clock); + + ftime(now); + + if (tzp != (struct timezone *)0) { + tzp->tz_minuteswest = (int)(localnow->tm_tzadj/60); + tzp->tz_dsttime = (int)(localnow->tm_isdst); + } + + tp->tv_sec = (long)(now->time); + tp->tv_usec = (long)(1000 * (long)(now->millitm)); + + return(0); + } + + getdtablesize() + { + return 60; + } + /* ! * These are routines fould in BDS and not found in HP-UX. They are * included so that some clients can compile. */ *************** *** 73,92 **** return i; } - char * - index (s, c) - char *s, c; - { - return ((char *) strchr (s, c)); - } - - char * - rindex (s, c) - char *s, c; - { - return ((char *) strrchr (s, c)); - } - /* * insque, remque - insert/remove element from a queue * --- 120,125 ---- *************** *** 158,164 **** } ! #ifdef hpux /** on hpux 5.n, readv/writev don't work on sockets; ** Even on 6.0, we'll keep these routines around for doing --- 191,197 ---- } ! #if defined(hpux) || defined(xenix) /** on hpux 5.n, readv/writev don't work on sockets; ** Even on 6.0, we'll keep these routines around for doing *************** *** 166,172 **** --- 199,219 ---- ** demo to blow up.) **/ + #if defined(xenix) + #define swWritev writev + #define swReadv readv + + #ifndef __IOVEC__ + struct iovec { + caddr_t iov_base; + int iov_len; + }; + #endif + #endif + + #if defined(hpux) #include <sys/uio.h> + #endif #define min(x,y) ((x)>(y)?(y):(x)) *************** *** 198,224 **** return(0); } ! #endif /* hpux */ ! ! /* ! * gettimeofday emulation ! * Caution -- emulation is incomplete ! * - has only second, not microsecond, resolution. ! * - does not return timezone info. ! */ ! ! #if defined(USG) && !defined(CRAY) ! int gettimeofday (tvp, tzp) ! struct timeval *tvp; ! struct timezone *tzp; ! { ! time (&tvp->tv_sec); ! tvp->tv_usec = 0L; ! ! if (tzp) { ! fprintf( stderr, ! "Warning: gettimeofday() emulation does not return timezone\n" ! ); ! } ! } ! #endif --- 245,248 ---- return(0); } ! #endif /* hpux || xenix */ *** X11R4.ORIG/mit/lib/X/XConnDis.c Sat Dec 9 19:10:33 1989 --- X11R4/mit/lib/X/XConnDis.c Wed Jan 2 17:06:01 1991 *************** *** 267,273 **** familyp, saddrlenp, saddrp)) < 0) goto bad; - /* * Set the connection non-blocking since we use select() to block; also * set close-on-exec so that programs that fork() doesn't get confused. --- 267,272 ---- *************** *** 346,351 **** --- 345,351 ---- */ #include <sys/socket.h> + #ifndef BSD_SOCKET_EMULATION #ifndef hpux #ifdef apollo /* nest if(n)defs because makedepend is broken */ #ifndef NO_TCP_H *************** *** 355,360 **** --- 355,361 ---- #include <netinet/tcp.h> #endif /* apollo */ #endif + #endif void bcopy(); #endif /* NEED_BSDISH */ *************** *** 415,421 **** --- 416,425 ---- #ifdef UNIXCONN + + #ifndef BSD_SOCKET_EMULATION #include <sys/un.h> + #endif #ifndef X_UNIX_PATH #ifdef hpux *************** *** 446,453 **** #endif unaddr.sun_family = AF_UNIX; sprintf (unaddr.sun_path, "%s%d", X_UNIX_PATH, idisplay); ! addr = (struct sockaddr *) &unaddr; addrlen = strlen(unaddr.sun_path) + sizeof(unaddr.sun_family); --- 450,460 ---- #endif unaddr.sun_family = AF_UNIX; + #ifdef BSD_SOCKET_EMULATION + sprintf (unaddr.sun_path, "%d", idisplay); + #else sprintf (unaddr.sun_path, "%s%d", X_UNIX_PATH, idisplay); ! #endif addr = (struct sockaddr *) &unaddr; addrlen = strlen(unaddr.sun_path) + sizeof(unaddr.sun_family); *************** *** 465,471 **** if ((fd = socket ((int) addr->sa_family, SOCK_STREAM, 0)) < 0) { return -1; } ! if (connect (fd, addr, addrlen) < 0) { int olderrno = errno; (void) close (fd); --- 472,486 ---- if ((fd = socket ((int) addr->sa_family, SOCK_STREAM, 0)) < 0) { return -1; } ! #ifdef BSD_SOCKET_EMULATION ! { ! struct sockaddr_un myaddr; ! myaddr.sun_family = AF_UNIX; ! sprintf(myaddr.sun_path, "%d", getpid()); ! if (bind(fd, &myaddr, strlen(myaddr.sun_path) + 2) < 0) ! return -1; ! } ! #endif if (connect (fd, addr, addrlen) < 0) { int olderrno = errno; (void) close (fd); *************** *** 688,704 **** --- 703,730 ---- { unsigned long r_mask[MSKCNT]; unsigned long w_mask[MSKCNT]; + unsigned long e_mask[MSKCNT]; int nfound; CLEARBITS(r_mask); CLEARBITS(w_mask); + CLEARBITS(e_mask); while (1) { BITSET(r_mask, dpy->fd); BITSET(w_mask, dpy->fd); + BITSET(e_mask, dpy->fd); do { + #if BSD_SOCKET_EMULATION + nfound = select (dpy->fd + 1, r_mask, w_mask, e_mask, NULL); + if (ANYSET(e_mask)) { + nfound = -1; + errno = EPIPE; + } + #else nfound = select (dpy->fd + 1, r_mask, w_mask, NULL, NULL); + #endif if (nfound < 0 && errno != EINTR) _XIOError(dpy); } while (nfound <= 0); *************** *** 746,757 **** Display *dpy; { unsigned long r_mask[MSKCNT]; int result; ! CLEARBITS(r_mask); do { BITSET(r_mask, dpy->fd); result = select(dpy->fd + 1, r_mask, NULL, NULL, NULL); if (result == -1 && errno != EINTR) _XIOError(dpy); } while (result <= 0); } --- 772,797 ---- Display *dpy; { unsigned long r_mask[MSKCNT]; + unsigned long w_mask[MSKCNT]; + unsigned long e_mask[MSKCNT]; int result; ! CLEARBITS(r_mask); + CLEARBITS(w_mask); + CLEARBITS(e_mask); do { BITSET(r_mask, dpy->fd); + BITSET(e_mask, dpy->fd); + #if BSD_SOCKET_EMULATION + result = select(dpy->fd + 1, r_mask, w_mask, e_mask, NULL); + if (ANYSET(e_mask)) { + result = -1; + errno = EPIPE; + } + #else result = select(dpy->fd + 1, r_mask, NULL, NULL, NULL); + + #endif if (result == -1 && errno != EINTR) _XIOError(dpy); } while (result <= 0); } *************** *** 795,797 **** --- 835,847 ---- (void) WritevToServer (dpy->fd, iovarray, niov); return; } + + #ifdef xenix + static void + dummy() + { + extern void ___lib_x_globals(); + + ___lib_x_globals(); + } + #endif *** X11R4.ORIG/mit/lib/X/globals.c Fri Jun 16 16:57:02 1989 --- X11R4/mit/lib/X/globals.c Sat Oct 6 16:12:20 1990 *************** *** 172,177 **** --- 172,182 ---- * to be inserted BELOW this point!!! */ + #ifdef xenix + /* Force brain-damaged MS linker to load this module */ + void ___lib_x_globals(){} + #endif + /* * NOTE: any additional external definition NEED * to be inserted ABOVE this point!!! *** X11R4.ORIG/mit/lib/X/Xlibos.h Mon Dec 18 13:45:55 1989 --- X11R4/mit/lib/X/Xlibos.h Wed Jan 2 14:22:42 1991 *************** *** 17,23 **** --- 17,37 ---- #define MSKCNT ((MAXSOCKS + 31) / 32) #else + + #ifdef xenix /* + * Xenix sysV 2.3.2 + */ + #include <sys/ioctl.h> + #include <sys/param.h> + + #define BytesReadable(fd, ptr) ioctl ((fd), FIONREAD, (ptr)) + #define MALLOC_0_RETURNS_NULL + #define MSKCNT ((NOFILE + 31) / 32) /* size of bit array */ + + #else + + /* * 4.2BSD-based systems */ #include <netinet/in.h> *************** *** 28,33 **** --- 42,49 ---- #define BytesReadable(fd, ptr) ioctl ((fd), FIONREAD, (ptr)) #define MSKCNT ((NOFILE + 31) / 32) /* size of bit array */ + + #endif /* xenix */ #endif /* att else bsdish */ *************** *** 196,205 **** --- 212,224 ---- */ #ifdef USG #if !defined(CRAY) && !defined(umips) + #ifndef __IOVEC__ + #define __IOVEC__ struct iovec { caddr_t iov_base; int iov_len; }; + #endif #ifndef __TIMEVAL__ #define __TIMEVAL__ struct timeval { /* BSD has in <sys/time.h> */ *************** *** 239,244 **** --- 258,268 ---- #ifndef USG + #define _XReadV readv + #define _XWriteV writev + #endif + + #ifdef xenix #define _XReadV readv #define _XWriteV writev #endif *** X11R4.ORIG/mit/lib/X/Berklib.c Sun Jan 6 00:53:26 1991 --- X11R4/mit/lib/X/Berklib.c Thu Nov 15 22:51:16 1990 *************** *** 0 **** --- 1,248 ---- + /* + * This file is used by System V based systems. + */ + + #include <sys/types.h> + #include <sys/timeb.h> + #include <time.h> + #include <errno.h> + + #ifndef __TIMEVAL__ + struct timeval { + long tv_sec; + long tv_usec; + }; + struct timezone { + int tz_minuteswest; + int tz_dsttime; + }; + #endif /* __TIMEVAL__ */ + + extern int errno; + + int + gettimeofday(tp, tzp) + struct timeval *tp; + struct timezone *tzp; + { + long clock; + static struct timeb Now, *now; + static struct tm LocalNow, *localnow; + + now = &Now; + localnow = &LocalNow; + + clock = time(0); + localnow = localtime(&clock); + + ftime(now); + + if (tzp != (struct timezone *)0) { + tzp->tz_minuteswest = (int)(localnow->tm_tzadj/60); + tzp->tz_dsttime = (int)(localnow->tm_isdst); + } + + tp->tv_sec = (long)(now->time); + tp->tv_usec = (long)(1000 * (long)(now->millitm)); + + return(0); + } + + getdtablesize() + { + return 60; + } + + /* + * These are routines fould in BDS and not found in HP-UX. They are + * included so that some clients can compile. + */ + + bcopy (b1, b2, length) + register unsigned char *b1, *b2; + register length; + { + if (b1 < b2) { + b2 += length; + b1 += length; + while (length--) { + *--b2 = *--b1; + } + } + else { + while (length--) { + *b2++ = *b1++; + } + } + } + + bcmp (b1, b2, length) + register unsigned char *b1, *b2; + register length; + { + while (length--) { + if (*b1++ != *b2++) return 1; + } + return 0; + } + + bzero (b, length) + register unsigned char *b; + register length; + { + while (length--) { + *b++ = '\0'; + } + } + + + /* Find the first set bit + * i.e. least signifigant 1 bit: + * 0 => 0 + * 1 => 1 + * 2 => 2 + * 3 => 1 + * 4 => 3 + */ + + int + ffs(mask) + unsigned int mask; + { + register i; + + if ( ! mask ) return 0; + i = 1; + while (! (mask & 1)) { + i++; + mask = mask >> 1; + } + return i; + } + + /* + * insque, remque - insert/remove element from a queue + * + * DESCRIPTION + * Insque and remque manipulate queues built from doubly linked + * lists. Each element in the queue must in the form of + * ``struct qelem''. Insque inserts elem in a queue immedi- + * ately after pred; remque removes an entry elem from a queue. + * + * SEE ALSO + * ``VAX Architecture Handbook'', pp. 228-235. + */ + + struct qelem { + struct qelem *q_forw; + struct qelem *q_back; + char *q_data; + }; + + insque(elem, pred) + register struct qelem *elem, *pred; + { + register struct qelem *q; + /* Insert locking code here */ + if ( elem->q_forw = q = (pred ? pred->q_forw : pred) ) + q->q_back = elem; + if ( elem->q_back = pred ) + pred->q_forw = elem; + /* Insert unlocking code here */ + } + + remque(elem) + register struct qelem *elem; + { + register struct qelem *q; + if ( ! elem ) return; + /* Insert locking code here */ + + if ( q = elem->q_back ) q->q_forw = elem->q_forw; + if ( q = elem->q_forw ) q->q_back = elem->q_back; + + /* insert unlocking code here */ + } + + + /* + * Berkeley random() + * + * We simulate via System V's rand() + */ + + int + random() + { + return (rand()); + } + + /* + * Berkeley srandom() + * + * We simulate via System V's rand() + */ + + int + srandom(seed) + int seed; + { + return (srand(seed)); + } + + + #if defined(hpux) || defined(xenix) + + /** on hpux 5.n, readv/writev don't work on sockets; + ** Even on 6.0, we'll keep these routines around for doing + ** extra large writes; (> 4000); (this caused the Bezier + ** demo to blow up.) + **/ + + #if defined(xenix) + #define swWritev writev + #define swReadv readv + + #ifndef __IOVEC__ + struct iovec { + caddr_t iov_base; + int iov_len; + }; + #endif + #endif + + #if defined(hpux) + #include <sys/uio.h> + #endif + + #define min(x,y) ((x)>(y)?(y):(x)) + + int swWritev(fildes, iov, iovcnt) + int fildes; + register struct iovec *iov; + register int iovcnt; + { + while (iovcnt && iov->iov_len == 0) + iovcnt--, iov++; + + if (iovcnt) + return(write(fildes,iov->iov_base,min(iov->iov_len,4000))); + else + return(0); + } + + int swReadv(fildes, iov, iovcnt) + int fildes; + register struct iovec *iov; + register int iovcnt; + { + while (iovcnt && iov->iov_len == 0) + iovcnt--, iov++; + + if (iovcnt) + return(read(fildes,iov->iov_base,iov->iov_len)); + else + return(0); + } + + #endif /* hpux || xenix */ *** X11R4.ORIG/mit/lib/Xau/Imakefile Tue Dec 12 17:20:47 1989 --- X11R4/mit/lib/Xau/Imakefile Fri Oct 5 21:49:14 1990 *************** *** 1,7 **** #include <Library.tmpl> #ifdef BandAidCompiler ! #include BandAidCompiler #endif INCLUDES = -I. -I$(TOP) --- 1,7 ---- #include <Library.tmpl> #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif INCLUDES = -I. -I$(TOP) *** X11R4.ORIG/mit/lib/Xmu/CvtStdSel.c Sat Dec 2 15:28:28 1989 --- X11R4/mit/lib/Xmu/CvtStdSel.c Sat Oct 6 12:34:29 1990 *************** *** 23,29 **** --- 23,31 ---- #include <X11/ShellP.h> #include <stdio.h> #ifndef att + #ifndef xenix #include <netdb.h> + #endif #include <sys/socket.h> #endif #include "Xmu.h" *** X11R4.ORIG/mit/lib/Xmu/Imakefile Tue Dec 12 18:43:10 1989 --- X11R4/mit/lib/Xmu/Imakefile Mon Oct 29 12:06:21 1990 *************** *** 7,12 **** --- 7,13 ---- INSTALLFLAGS = $(INSTINCFLAGS) LINTLIBS = $(LINTXLIB) + DEFINES = -DBITMAPDIR=\"$(INCDIR)/bitmaps\" #ifdef OsNameDefines OS_NAME_DEFINES = OsNameDefines *** X11R4.ORIG/mit/server/ddx/mi/mispritest.h Tue Oct 3 19:46:28 1989 --- X11R4/mit/server/ddx/mi/mispritest.h Tue Oct 16 20:40:41 1990 *************** *** 92,98 **** */ #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y)) ! #define LINE_SORT(x1,y2,x2,y2) \ { int _t; \ if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \ if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } } --- 92,98 ---- */ #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y)) ! #define LINE_SORT(x1,y1,x2,y2) \ { int _t; \ if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \ if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } } *** X11R4.ORIG/mit/server/ddx/mi/miwideline.h Tue Nov 21 19:04:49 1989 --- X11R4/mit/server/ddx/mi/miwideline.h Sat Oct 6 17:47:55 1990 *************** *** 113,119 **** #ifdef NOINLINEICEIL #define ICEIL(x) ((int)ceil(x)) #else ! #ifdef __GNUC__ static inline int ICEIL(x) double x; { --- 113,119 ---- #ifdef NOINLINEICEIL #define ICEIL(x) ((int)ceil(x)) #else ! #if defined(__GNUC__) && !defined(xenix) static inline int ICEIL(x) double x; { *** X11R4.ORIG/mit/server/ddx/mi/mifpoly.h Fri Jul 28 12:05:51 1989 --- X11R4/mit/server/ddx/mi/mifpoly.h Sat Oct 6 17:48:47 1990 *************** *** 44,50 **** #ifdef NOINLINEICEIL #define ICEIL(x) ((int)ceil(x)) #else ! #ifdef __GNUC__ static inline int ICEIL(x) double x; { --- 44,50 ---- #ifdef NOINLINEICEIL #define ICEIL(x) ((int)ceil(x)) #else ! #if defined(__GNUC__) && !defined(xenix) static inline int ICEIL(x) double x; { *** X11R4.ORIG/mit/server/ddx/mfb/mfbtegblt.c Tue Nov 21 15:19:54 1989 --- X11R4/mit/server/ddx/mfb/mfbtegblt.c Sun Dec 9 19:26:09 1990 *************** *** 210,215 **** --- 210,217 ---- glyphBytes = GLYPHWIDTHBYTESPADDED(pci); #endif + /* quick and dirty fix. It will be slow, so should be cleaned */ + #ifndef xenix if (nglyph >= 4 && widthGlyphs <= 32) { while (nglyph >= 4) *************** *** 265,270 **** --- 267,273 ---- xpos += widthGlyphs; } } + #endif /*xenix */ while(nglyph--) { *** X11R4.ORIG/mit/server/ddx/mfb/mfbfillsp.c Fri Nov 24 18:02:36 1989 --- X11R4/mit/server/ddx/mfb/mfbfillsp.c Sun Nov 4 09:41:21 1990 *************** *** 35,40 **** --- 35,45 ---- #include "servermd.h" + #ifdef xenix + #undef BITMAP_SCANLINE_UNIT + #define BITMAP_SCANLINE_UNIT 32 + #endif + /* scanline filling for monochrome frame buffer written by drewry, oct 1986 *** X11R4.ORIG/mit/server/ddx/xenix/vga/Imakefile Sun Jan 6 01:02:55 1991 --- X11R4/mit/server/ddx/xenix/vga/Imakefile Sun Dec 9 12:25:57 1990 *************** *** 0 **** --- 1,45 ---- + #include <Server.tmpl> + + SRCS1 = \ + xenixInit.c \ + xenixVGA.c \ + xenixKbd.c \ + xenixMouse.c \ + xenixIo.c \ + xenixTty.c \ + xenixKeyMap.c + + SRCS = $(SRCS1) + + OFILES = xenixInit.o + + OBJS = \ + xenixInit.o \ + xenixVGA.o \ + xenixKbd.o \ + xenixMouse.o \ + xenixIo.o \ + xenixTty.o \ + xenixKeyMap.o + + INCLUDES = -I. -I../../mfb -I../../mi -I../../../include -I$(INCLUDESRC) + LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/4.2bsd/llib-los.ln \ + ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln ../../cfb/llib-lcfb.ln + + NormalLibraryObjectRule() + + all:: $(OFILES) kbd_mode + + lintlib: + + NormalLibraryTarget(xenix,$(OBJS)) + NormalLintTarget($(SRCS1)) + SingleProgramTarget(kbd_mode, kbd_mode.o,,) + InstallProgram(kbd_mode,$(BINDIR)) + InstallManPage(kbd_mode,$(MANDIR)) + InstallManPage(Xxenix,$(MANDIR)) + + saber_src: + #load $(CFLAGS) $(SRCS1) + + DependTarget() *** X11R4.ORIG/mit/server/ddx/xenix/vga/README Sun Jan 6 01:02:58 1991 --- X11R4/mit/server/ddx/xenix/vga/README Sun Jan 6 00:59:54 1991 *************** *** 0 **** --- 1,26 ---- + # + # README C.LEE 1/5/91 + # + + This directory contains standard VGA specific routines. + + * Keyboard LED control is built in for the server. + * Keyboard should be in XT mode (kernel default configuration). + * Screen can be changed into text mode for multi-screen switching by + pressing all three mouse buttons down, similar to what I did for MGR. + * kbd_mode program is provided in case the server crashes messing up + the keyboard. You can login from another serial terminal and run + + kbd_mode -a < /dev/tty?? + + where /dev/tty?? is the multiscreen you started Xxenix. + Don't try 'kbd_mode -r' unless you have a serial terminal at hand, + otherwise you will have to power down the machine. There is a bug + in Xenix preventing you from getting current keyboard mode. + * The Xxenix server uses the Xenix Event Manager. Therefore you may have + problem running Xenix version of MGR window (ported by myself) using + bus mouse once Xxenix has been run. + * Screen saver blank mode is not supported. Use noblank mode instead. + + Chain Lee + chain@paul.rutgers.edu
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/server/ddx/xenix/vga/kbd_mode.c Sun Jan 6 01:03:01 1991 --- X11R4/mit/server/ddx/xenix/vga/kbd_mode.c Sat Jan 5 17:50:19 1991 *************** *** 0 **** --- 1,107 ---- + /* + * kbd_mode.c Modified for Xenix by Chain Lee 08/90 + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #ifndef lint + static char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13"; + #endif + + /* + * Copyright (c) 1986 by Sun Microsystems, Inc. + * + * kbd_mode: set keyboard encoding mode + */ + + #include <sys/types.h> + #include <fcntl.h> + #include <sys/vtkd.h> + #include <stdio.h> + + static void die(), usage(); + static int kbd_fd=0; + + main(argc, argv) + int argc; + char *argv[]; + { + int code, translate; + + argc--; + argv++; + if (argc-- && **argv == '-') { + code = *(++*argv); + } else { + usage(); + } + switch (code) { + case 'a': + case 'A': + translate = K_XLATE; + break; + case 'r': + case 'R': + translate = K_RAW; + break; + default: + usage(); + } + if (ioctl(kbd_fd, KDSKBMODE, translate)) { + die("Couldn't initialize translation to Event"); + } + exit(0); + } + + static void + die(msg) + char *msg; + { + fprintf(stderr, "%s\n", msg); + exit(1); + } + + static void + usage() + { + int translate; + #if XENIX_HAS_NO_BUGS + if ((translate = ioctl(kbd_fd, KDGKBMODE, &translate)) == -1) { + die("Couldn't inquire current translation"); + } + #endif + fprintf(stderr, "kbd_mode { -a | -r }\n"); + fprintf(stderr, "\tfor ascii, or raw event.\n"); + fprintf(stderr, "Current mode is %s.\n", + ( translate == K_XLATE ? "a (ascii bytes)" : + ( translate == K_RAW ? "r (raw events)" : "unknown mode"))); + exit(1); + } + + *** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixKbd.c Sun Jan 6 01:03:03 1991 --- X11R4/mit/server/ddx/xenix/vga/xenixKbd.c Mon Dec 10 00:26:22 1990 *************** *** 0 **** --- 1,500 ---- + /* + * xenixKbd.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #define NEED_EVENTS + #include "xenix.h" + #include "Xproto.h" + #include "keysym.h" + #include "inputstr.h" + + typedef struct { + int trans; /* Original translation form */ + } SunKbPrivRec, *SunKbPrivPtr; + + extern CARD8 *xenixModMap[]; + extern CARD8 ibmAT101ModMap[]; + extern KeySymsRec xenixKeySyms[]; + + extern CARD8 keyCodePrefix1, keyCodePrefix2, keyCodeCapsLock; + + extern void ProcessInputEvents(); + extern void miPointerPosition(); + + static void xenixBell(); + static void xenixKbdCtrl(); + void xenixKbdProcessEvent(); + static void xenixKbdDoneEvents(); + + int click = 0; + + int autoRepeatKeyDown = 0; + int autoRepeatDebug = 0; + int autoRepeatReady; + long autoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE; + long autoRepeatDelay = 1000 * AUTOREPEAT_DELAY; + static int autoRepeatFirst; + struct timeval autoRepeatLastKeyDownTv; + struct timeval autoRepeatDeltaTv; + + static KeybdCtrl sysKbCtrl; + + static KbPrivRec sysKbPriv = { + -1, /* Type of keyboard */ + xenixKbdProcessEvent, /* Function to process an event */ + xenixKbdDoneEvents, /* Function called when all events */ + /* have been handled. */ + (pointer) NULL, /* Private to keyboard device */ + 0, /* offset for device keycodes */ + &sysKbCtrl, /* Initial full duration = .20 sec. */ + }; + + static void + sigsegv(){ + reset_tty(0); + ev_close(); + abort(); + } + + /*- + *----------------------------------------------------------------------- + * xenixKbdProc -- + * Handle the initialization, etc. of a keyboard. + * + * Results: + * None. + * + * Side Effects: + * + * Note: + * When using xenixwindows, all input comes off a single fd, stored in the + * global windowFd. Therefore, only one device should be enabled and + * disabled, even though the application still sees both mouse and + * keyboard. We have arbitrarily chosen to enable and disable windowFd + * in the keyboard routine xenixKbdProc rather than in xenixMouseProc. + * + *----------------------------------------------------------------------- + */ + int + xenixKbdProc (pKeyboard, what) + DevicePtr pKeyboard; /* Keyboard to manipulate */ + int what; /* What to do to it */ + { + int qfd; + dmask_t dmask = D_STRING | D_REL | D_BUTTON; + static int kbdFd=0; + + switch (what) { + case DEVICE_INIT: + + signal(SIGSEGV, sigsegv); + + if (pKeyboard != LookupKeyboardDevice()) { + ErrorF ("Cannot open non-system keyboard"); + return (!Success); + } + + /* + * First open the event manager. + */ + if (ev_init() < 0) { + ErrorF("xenixKbdProc: cannot init event manager\n"); + return (!Success); + } + if ((qfd = ev_open(&dmask)) < 0) { + ErrorF("xenixKbdProc: cannot open event manager\n"); + return (!Success); + } + if (dmask != (D_STRING | D_REL | D_BUTTON)) { + Error("xenixKbdProc: cannot attach mouse and keyboard\n"); + return (!Success); + } + + pKeyboard->devicePrivate = (pointer)&sysKbPriv; + pKeyboard->on = FALSE; + sysKbCtrl = defaultKeyboardControl; + sysKbPriv.ctrl = &sysKbCtrl; + + sysKbPriv.type = KBTYPE_IBMAT; + if (xenixKeySyms[sysKbPriv.type].minKeyCode < MIN_KEYCODE) { + int offset=MIN_KEYCODE-xenixKeySyms[sysKbPriv.type].minKeyCode; + + xenixKeySyms[sysKbPriv.type].minKeyCode += offset; + xenixKeySyms[sysKbPriv.type].maxKeyCode += offset; + sysKbPriv.offset = offset; + } + + /* set up keyboard for raw event generating mode */ + /* set up tty to raw mode */ + set_tty(0); + + InitKeyboardDeviceStruct( + pKeyboard, + &(xenixKeySyms[sysKbPriv.type]), + (xenixModMap[sysKbPriv.type]), + xenixBell, + xenixKbdCtrl); + break; + + case DEVICE_ON: + /* AddEnabledDevice(windowFd); + */ pKeyboard->on = TRUE; + break; + + case DEVICE_OFF: + /* RemoveEnabledDevice(kbdFd); + */ pKeyboard->on = FALSE; + break; + case DEVICE_CLOSE: + /* RemoveEnabledDevice(kbdFd); + */ pKeyboard->on = FALSE; + reset_tty(0); + ev_close(); + break; + } + return (Success); + } + + /*- + *----------------------------------------------------------------------- + * xenixBell -- + * Ring the terminal/keyboard bell + * + * Results: + * Ring the keyboard bell for an amount of time proportional to + * "loudness." + * + * Side Effects: + * None, really... + * + *----------------------------------------------------------------------- + */ + static void + xenixBell (loudness, pKeyboard) + int loudness; /* Percentage of full volume */ + DevicePtr pKeyboard; /* Keyboard to ring */ + { + static int bell_fd = -1; + + if (loudness == 0) { + return; + } + if (bell_fd < 0) + if ((bell_fd = open("/dev/bell", O_RDWR, 0)) < 0) { + ErrorF("xenixBell: cannot \"/dev/bell\"\n"); + return; + } + write(bell_fd, "\002", 1 ); + nap(loudness); + write(bell_fd,"\003",1); + } + + /*- + *----------------------------------------------------------------------- + * xenixKbdCtrl -- + * Alter some of the keyboard control parameters + * + * Results: + * None. + * + * Side Effects: + * Some... + * + *----------------------------------------------------------------------- + */ + static void + xenixKbdCtrl (pKeyboard, ctrl) + DevicePtr pKeyboard; /* Keyboard to alter */ + KeybdCtrl *ctrl; + { + /* LEDS */ + ioctl(0, KDSETLED, ctrl->leds); + /* keyboard click */ + click = ctrl->click; + } + + + /*- + *----------------------------------------------------------------------- + * xenixKbdProcessEvent -- + * + * Results: + * + * Side Effects: + * + * Caveat: + * To reduce duplication of code and logic (and therefore bugs), the + * xenixwindows version of kbd processing (xenixKbdProcessEventSunWin()) + * counterfeits a firm event and calls this routine. This + * couunterfeiting relies on the fact this this routine only looks at the + * id, time, and value fields of the firm event which it is passed. If + * this ever changes, the xenixKbdProcessEventSunWin will also have to + * change. + * + *----------------------------------------------------------------------- + */ + void + xenixKbdProcessEvent (pKeyboard, evp) + DevicePtr pKeyboard; + EVENT *evp; + { + xEvent xE; + int delta; + static xEvent autoRepeatEvent; + BYTE key; + CARD8 keyModifiers; + + /* we need to encode three states of the cap lock key */ + static int capsLockDown = 0; + static int capsLockOn = 0; + + #if OK + if (autoRepeatKeyDown && fe->id == AUTOREPEAT_EVENTID) { + pPriv = (KbPrivPtr) pKeyboard->devicePrivate; + if (pPriv->ctrl->autoRepeat != AutoRepeatModeOn) { + autoRepeatKeyDown = 0; + return; + } + /* + * Generate auto repeat event. XXX one for now. + * Update time & pointer location of saved KeyPress event. + */ + if (autoRepeatDebug) + ErrorF("xenixKbdProcessEvent: autoRepeatKeyDown = %d\n", + autoRepeatKeyDown); + + delta = TVTOMILLI(autoRepeatDeltaTv); + autoRepeatFirst = FALSE; + + /* + * Fake a key up event and a key down event + * for the last key pressed. + */ + autoRepeatEvent.u.keyButtonPointer.time += delta; + miPointerPosition (screenInfo.screens[0], + &autoRepeatEvent.u.keyButtonPointer.rootX, + &autoRepeatEvent.u.keyButtonPointer.rootY); + autoRepeatEvent.u.u.type = KeyRelease; + (* pKeyboard->processInputProc) (&autoRepeatEvent, pKeyboard, 1); + + autoRepeatEvent.u.u.type = KeyPress; + (* pKeyboard->processInputProc) (&autoRepeatEvent, pKeyboard, 1); + + /* Update time of last key down */ + tvplus(autoRepeatLastKeyDownTv, autoRepeatLastKeyDownTv, + autoRepeatDeltaTv); + + return; + } + #endif + + key = EV_BUF(*evp)[0]; + + /* caps lock flip flop */ + if (key == (0x80 | keyCodeCapsLock)) { + capsLockDown = 0; + return; + } + + if (key == keyCodeCapsLock) { + if (capsLockDown) + return; + else + capsLockDown = 1; + + if (capsLockOn) { + EV_BUF(*evp)[0] |= 0x80; + capsLockOn = 0; + } + else + { + capsLockOn = 1; + } + } + + /* keyboard click */ + if (!(key & 0x80)) + if (click >= 0) + xenixBell(click, pKeyboard); + + key &= 0x7f; + + /* + keyModifiers = ((DeviceIntPtr)pKeyboard)->key->modifierMap[key]; + */ + keyModifiers = ibmAT101ModMap[key]; + key += sysKbPriv.offset; + + if (autoRepeatKeyDown && (keyModifiers == 0) && + (!(EV_BUF(*evp)[0] & 0x80) || (key == autoRepeatEvent.u.u.detail))) { + /* + * Kill AutoRepeater on any real non-modifier key down, or auto key up + */ + autoRepeatKeyDown = 0; + if (autoRepeatDebug) + ErrorF("xenixKbdProcessEvent: autoRepeat off\n"); + } + + xE.u.keyButtonPointer.time = EV_TIME(*evp); + miPointerPosition (screenInfo.screens[0], + &xE.u.keyButtonPointer.rootX, + &xE.u.keyButtonPointer.rootY); + xE.u.u.type = ((EV_BUF(*evp)[0] & 0x80) ? KeyRelease : KeyPress); + xE.u.u.detail = key; + + #if OK + if (keyModifiers & LockMask) { + if (xE.u.u.type == KeyRelease) + return; /* this assumes autorepeat is not desired */ + if (BitIsOn(((DeviceIntPtr)pKeyboard)->key->down, key)) + xE.u.u.type = KeyRelease; + } + + if ((xE.u.u.type == KeyPress) && (keyModifiers == 0)) { + /* initialize new AutoRepeater event & mark AutoRepeater on */ + if (autoRepeatDebug) + ErrorF("xenixKbdProcessEvent: VKEY_DOWN\n"); + autoRepeatEvent = xE; + autoRepeatFirst = TRUE; + autoRepeatKeyDown++; + autoRepeatLastKeyDownTv = EV_TIME(*evp); + } + #endif + (* pKeyboard->processInputProc) (&xE, pKeyboard, 1); + } + + /*- + *----------------------------------------------------------------------- + * xenixDoneEvents -- + * Nothing to do, here... + * + * Results: + * + * Side Effects: + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static void + xenixKbdDoneEvents (pKeyboard) + DevicePtr pKeyboard; + { + + } + + /*ARGSUSED*/ + Bool + LegalModifier(key) + { + return (TRUE); + } + + static KeybdCtrl *pKbdCtrl = (KeybdCtrl *) 0; + + /*ARGSUSED*/ + void + xenixBlockHandler(nscreen, pbdata, pptv, pReadmask) + int nscreen; + pointer pbdata; + struct timeval **pptv; + pointer pReadmask; + { + static struct timeval artv = { 0, 0 }; /* autorepeat timeval */ + #if OK + if (!autoRepeatKeyDown) + return; + + if (pKbdCtrl == (KeybdCtrl *) 0) + pKbdCtrl = ((KbPrivPtr) LookupKeyboardDevice()->devicePrivate)->ctrl; + + if (pKbdCtrl->autoRepeat != AutoRepeatModeOn) + return; + + if (autoRepeatFirst == TRUE) + artv.tv_usec = autoRepeatInitiate; + else + artv.tv_usec = autoRepeatDelay; + *pptv = &artv; + + if (autoRepeatDebug) + ErrorF("xenixBlockHandler(%d,%d): \n", artv.tv_sec, artv.tv_usec); + #endif + } + + /*ARGSUSED*/ + void + xenixWakeupHandler(nscreen, pbdata, err, pReadmask) + int nscreen; + pointer pbdata; + unsigned long err; + pointer pReadmask; + { + struct timeval tv; + #if OK + if (autoRepeatDebug) + ErrorF("xenixWakeupHandler(ar=%d, err=%d):\n", autoRepeatKeyDown, err); + + if (pKbdCtrl == (KeybdCtrl *) 0) + pKbdCtrl = ((KbPrivPtr) LookupKeyboardDevice()->devicePrivate)->ctrl; + + if (pKbdCtrl->autoRepeat != AutoRepeatModeOn) + return; + + if (autoRepeatKeyDown) { + gettimeofday(&tv, (struct timezone *) NULL); + tvminus(autoRepeatDeltaTv, tv, autoRepeatLastKeyDownTv); + if (autoRepeatDeltaTv.tv_sec > 0 || + (!autoRepeatFirst && autoRepeatDeltaTv.tv_usec > + autoRepeatDelay) || + (autoRepeatDeltaTv.tv_usec > + autoRepeatInitiate)) + autoRepeatReady++; + } + + if (autoRepeatReady) + ProcessInputEvents(); + autoRepeatReady = 0; + #endif + } *** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixMouse.c Sun Jan 6 01:03:07 1991 --- X11R4/mit/server/ddx/xenix/vga/xenixMouse.c Mon Dec 10 00:31:49 1990 *************** *** 0 **** --- 1,367 ---- + /* + * xenixMouse.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * sunMouse.c -- + * Functions for playing cat and mouse... sorry. + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #define NEED_EVENTS + + #include "xenix.h" + #include "mipointer.h" + #include "misprite.h" + + #define ABS(a) (((a)>0)?(a):-(a)) + + Bool ActiveZaphod = TRUE; + + extern void xenixSuspendX(); + + static long xenixEventTime(); + static Bool xenixCursorOffScreen(); + static void xenixCrossScreen(); + extern void miPointerQueueEvent(); + + miPointerCursorFuncRec xenixPointerCursorFuncs = { + xenixEventTime, + xenixCursorOffScreen, + xenixCrossScreen, + miPointerQueueEvent, + }; + + typedef struct { + int bmask; /* Current button state */ + Bool mouseMoved; /* Mouse has moved */ + } XenixMsPrivRec, *XenixMsPrivPtr; + + static void xenixMouseCtrl(); + static int xenixMouseGetMotionEvents(); + void xenixMouseProcessEvent(); + static void xenixMouseDoneEvents(); + + static XenixMsPrivRec xenixMousePriv; + static PtrPrivRec sysMousePriv = { + xenixMouseProcessEvent, /* Function to process an event */ + xenixMouseDoneEvents, /* When all the events have been */ + /* handled, this function will be */ + /* called. */ + 0, /* Current X coordinate of pointer */ + 0, /* Current Y coordinate */ + (pointer)&xenixMousePriv, /* Field private to device */ + }; + + /*- + *----------------------------------------------------------------------- + * xenixMouseProc -- + * Handle the initialization, etc. of a mouse + * + * Results: + * none. + * + * Side Effects: + * + * Note: + * When using xenixwindows, all input comes off a single fd, stored in the + * global windowFd. Therefore, only one device should be enabled and + * disabled, even though the application still sees both mouse and + * keyboard. We have arbitrarily chosen to enable and disable windowFd + * in the keyboard routine xenixKbdProc rather than in xenixMouseProc. + * + *----------------------------------------------------------------------- + */ + int + xenixMouseProc (pMouse, what) + DevicePtr pMouse; /* Mouse to play with */ + int what; /* What to do with it */ + { + register int fd; + int format; + static int oformat; + BYTE map[4]; + + switch (what) { + case DEVICE_INIT: + if (pMouse != LookupPointerDevice()) { + ErrorF ("Cannot open non-system mouse"); + return (!Success); + } + + sysMousePriv.x = 0; + sysMousePriv.y = 0; + + xenixMousePriv.mouseMoved = FALSE; + pMouse->devicePrivate = (pointer) &sysMousePriv; + + pMouse->on = FALSE; + map[1] = 1; + map[2] = 2; + map[3] = 3; + InitPointerDeviceStruct( + pMouse, map, 3, xenixMouseGetMotionEvents, xenixMouseCtrl, 0); + break; + + case DEVICE_ON: + + /* AddEnabledDevice (((PtrPrivPtr)pMouse->devicePrivate)->fd); + */ + pMouse->on = TRUE; + break; + + case DEVICE_CLOSE: + break; + + case DEVICE_OFF: + /* RemoveEnabledDevice (((PtrPrivPtr)pMouse->devicePrivate)->fd); + */ pMouse->on = FALSE; + break; + } + return (Success); + } + + /*- + *----------------------------------------------------------------------- + * xenixMouseCtrl -- + * Alter the control parameters for the mouse. Since acceleration + * etc. is done from the PtrCtrl record in the mouse's device record, + * there's nothing to do here. + * + * Results: + * None. + * + * Side Effects: + * None. + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static void + xenixMouseCtrl (pMouse) + DevicePtr pMouse; + { + } + + /*- + *----------------------------------------------------------------------- + * xenixMouseGetMotionEvents -- + * Return the (number of) motion events in the "motion history + * buffer" (snicker) between the given times. + * + * Results: + * The number of events stuffed. + * + * Side Effects: + * The relevant xTimecoord's are stuffed in the passed memory. + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static int + xenixMouseGetMotionEvents (buff, start, stop, pScreen) + CARD32 start, stop; + xTimecoord *buff; + ScreenPtr pScreen; + { + return 0; + } + + + /*- + *----------------------------------------------------------------------- + * xenixMouseProcessEvent -- + * Given a Firm_event for a mouse, pass it off the the dix layer + * properly converted... + * + * Results: + * None. + * + * Side Effects: + * The cursor may be redrawn...? devPrivate/x/y will be altered. + * + *----------------------------------------------------------------------- + */ + void + xenixMouseProcessEvent (pMouse, evp) + DevicePtr pMouse; /* Mouse from which the event came */ + EVENT *evp; /* Event to process */ + { + xEvent xE; + register XenixMsPrivPtr pXenixPriv; /* Private data for mouse */ + static int button = 0; /* previous button state */ + int b; /* current button state */ + int bKey; /* button value expected by X */ + static int mouseMoved = 0; + + + xE.u.keyButtonPointer.time = EV_TIME(*evp); + + if (EV_TAG(*evp) & T_BUTTON) { + b = EV_BUTTONS(*evp); + + if (b == 7) { + xenixSuspendX(); + return; + } + switch (ABS(b - button)) { + case LT_BUTTON: bKey = 1; break; + case MD_BUTTON: bKey = 2; break; + case RT_BUTTON: bKey = 3; break; + default: return; + } + /* + * A button changed state. Sometimes we will get two events + * for a single state change. Should we get a button event which + * reflects the current state of affairs, that event is discarded. + * + * Mouse buttons start at 1. + */ + xE.u.u.detail = bKey; + if (button - b > 0) + xE.u.u.type = ButtonRelease; + else + xE.u.u.type = ButtonPress; + button = b; + + /* + * If the mouse has moved, we must update any interested client + * as well as DIX before sending a button event along. + */ + if (mouseMoved) { + xenixMouseDoneEvents (pMouse, FALSE); + } + + miPointerPosition (screenInfo.screens[0], + &xE.u.keyButtonPointer.rootX, + &xE.u.keyButtonPointer.rootY); + + (* pMouse->processInputProc) (&xE, pMouse, 1); + } + if (EV_TAG(*evp) & T_REL_LOCATOR) { + miPointerDeltaCursor (screenInfo.screens[0], + EV_DX(*evp), + -EV_DY(*evp), + TRUE); + } + } + + /*ARGSUSED*/ + static Bool + xenixCursorOffScreen (pScreen, x, y) + ScreenPtr *pScreen; + int *x, *y; + { + int index; + + /* + * Active Zaphod implementation: + * increment or decrement the current screen + * if the x is to the right or the left of + * the current screen. + */ + if (ActiveZaphod && + screenInfo.numScreens > 1 && (*x >= (*pScreen)->width || *x < 0)) + { + index = (*pScreen)->myNum; + if (*x < 0) + { + index = (index ? index : screenInfo.numScreens) - 1; + *pScreen = screenInfo.screens[index]; + *x += (*pScreen)->width; + } + else + { + *x -= (*pScreen)->width; + index = (index + 1) % screenInfo.numScreens; + *pScreen = screenInfo.screens[index]; + } + return TRUE; + } + return FALSE; + } + + /*ARGSUSED*/ + static long + xenixEventTime (pScreen) + ScreenPtr pScreen; + { + return lastEventTime; + } + + static void + xenixCrossScreen (pScreen, entering) + ScreenPtr pScreen; + Bool entering; + { + uchar_t select; + + select = 1; + if (entering) + select = 0; + if (xenixFbs[pScreen->myNum].EnterLeave) + (*xenixFbs[pScreen->myNum].EnterLeave) (pScreen, select); + } + + /*- + *----------------------------------------------------------------------- + * xenixMouseDoneEvents -- + * Finish off any mouse motions we haven't done yet. (At the moment + * this code is unused since we never save mouse motions as I'm + * unsure of the effect of getting a keystroke at a given [x,y] w/o + * having gotten a motion event to that [x,y]) + * + * Results: + * None. + * + * Side Effects: + * A MotionNotify event may be generated. + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static void + xenixMouseDoneEvents (pMouse,final) + DevicePtr pMouse; + Bool final; + { + }
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixTty.c Sun Jan 6 01:03:10 1991 --- X11R4/mit/server/ddx/xenix/vga/xenixTty.c Thu Dec 13 20:50:49 1990 *************** *** 0 **** --- 1,41 ---- + /* + * xenixTty.c + */ + + #include <sys/types.h> + #include <sys/vtkd.h> + #include <sgtty.h> + + int + set_tty(file) + int file; + { + set_mode(file,RAW,ECHO,0); + ioctl(file, KDSKBMODE, K_RAW); + } + + int + reset_tty(file) + int file; + { + ioctl(file, KDSKBMODE, K_XLATE); + set_mode(file,ECHO,RAW,0); + } + + static int + set_mode(file,on,off,speed) + int file; + int on; + int off; + { + struct sgttyb buff; + + gtty(file,&buff); + buff.sg_flags |= on; + buff.sg_flags &= ~off; + if (speed) + buff.sg_ispeed = buff.sg_ospeed = speed; + stty(file,&buff); + return(0); + } + *** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixInit.c Sun Jan 6 01:03:12 1991 --- X11R4/mit/server/ddx/xenix/vga/xenixInit.c Sun Dec 9 18:54:39 1990 *************** *** 0 **** --- 1,425 ---- + /* + * xenixInit.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #include "xenix.h" + #include <servermd.h> + #include "dixstruct.h" + #include "dix.h" + #include "opaque.h" + #include "mipointer.h" + + extern int xenixMouseProc(), xenixKbdProc(); + extern Bool xenixVGAProbe(), xenixVGACreate(); + + extern void ProcessInputEvents(); + extern void SetInputCheck(); + + extern char *strncpy(); + extern GCPtr CreateScratchGC(); + + #define XDEVICE "XDEVICE" + + int xenixEventPending = 0; /* For use with SetInputCheck */ + static int autoRepeatHandlersInstalled; /* FALSE each time InitOutput called */ + + static Bool xenixDevsProbed = FALSE; + Bool xenixSupportsDepth8 = FALSE; + unsigned long xenixGeneration = 0; + + extern int xenixCheckEvent(); + + static void + xenixBlock(blockData, pptv, pReadmask) + int *blockData; + int *pptv; + int *pReadmask; + { + if (xenixCheckEvent()) + xenixEventPending = 1; + } + static void + xenixWakeup(blockData, pptv, pReadmask) + int *blockData; + int *pptv; + int *pReadmask; + { + /* nothing */ + } + + xenixFbDataRec xenixFbData[] = { + xenixVGAProbe, "/dev/vga", xenixVGACreate, + xenixVGAProbe, "/dev/vga", xenixVGACreate, + }; + + #define NUMSCREENS (sizeof(xenixFbData)/sizeof(xenixFbData[0])) + #define NUMDEVICES 2 + + fbFd xenixFbs[NUMDEVICES]; + + static PixmapFormatRec formats[] = { + 1, 1, BITMAP_SCANLINE_PAD, /* 1-bit deep */ + 8, 8, BITMAP_SCANLINE_PAD, /* 8-bit deep */ + }; + #define NUMFORMATS (sizeof formats)/(sizeof formats[0]) + + /*- + *----------------------------------------------------------------------- + * InitOutput -- + * Initialize screenInfo for all actually accessible framebuffers. + * The + * + * Results: + * screenInfo init proc field set + * + * Side Effects: + * None + * + *----------------------------------------------------------------------- + */ + + InitOutput(pScreenInfo, argc, argv) + ScreenInfo *pScreenInfo; + int argc; + char **argv; + { + int i, n, dev; + int nonBlockConsole = 1; + static int setup_on_exit = 0; + int devStart = 1; + + if (!monitorResolution) + monitorResolution = 90; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i],"-debug")) + nonBlockConsole = 0; + else if (!strcmp(argv[i],"-mono")) + devStart = 0; + } + + pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; + pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + + pScreenInfo->numPixmapFormats = NUMFORMATS; + for (i=0; i< NUMFORMATS; i++) + pScreenInfo->formats[i] = formats[i]; + + autoRepeatHandlersInstalled = FALSE; + + if (!xenixDevsProbed) + { + n = 0; + for (i = NUMSCREENS, dev = devStart; --i > 0; dev++) { + if ((*xenixFbData[dev].probeProc)(pScreenInfo, n, dev, argc, argv)) + n++; + else + xenixFbData[dev].createProc = (Bool(*)()) NULL; + } + xenixDevsProbed = TRUE; + if (n == 0) + return; + } + if (!xenixSupportsDepth8) + pScreenInfo->numPixmapFormats--; + for (i = NUMSCREENS, dev = devStart; --i > 0; dev++) { + if (xenixFbData[dev].createProc) + (*xenixFbData[dev].createProc)(pScreenInfo, argc, argv); + } + xenixGeneration = serverGeneration; + xenixInitCursor(); + } + + /*- + *----------------------------------------------------------------------- + * InitInput -- + * Initialize all supported input devices...what else is there + * besides pointer and keyboard? + * + * Results: + * None. + * + * Side Effects: + * Two DeviceRec's are allocated and registered as the system pointer + * and keyboard devices. + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + InitInput(argc, argv) + int argc; + char **argv; + { + DevicePtr p, k; + static int zero = 0; + + p = AddInputDevice(xenixMouseProc, TRUE); + k = AddInputDevice(xenixKbdProc, TRUE); + if (!p || !k) + FatalError("failed to create input devices in InitInput"); + + RegisterPointerDevice(p); + RegisterKeyboardDevice(k); + miRegisterPointerDevice(screenInfo.screens[0], p); + + if (RegisterBlockAndWakeupHandlers(xenixBlock, xenixWakeup, 0) == FALSE) + ErrorF("InitInput: RegisterBlockAndWakeupHandlers() failed\n"); + + SetInputCheck (&zero, &xenixEventPending); + } + + /*- + *----------------------------------------------------------------------- + * xenixScreenInit -- + * Things which must be done for all types of frame buffers... + * Should be called last of all. + * + * Results: + * TRUE if successful, else FALSE + * + * Side Effects: + * Both a BlockHandler and a WakeupHandler are installed for the + * first screen. Together, these handlers implement autorepeat + * keystrokes on the Xenix. + * + *----------------------------------------------------------------------- + */ + Bool + xenixScreenInit (pScreen) + ScreenPtr pScreen; + { + extern void xenixBlockHandler(); + extern void xenixWakeupHandler(); + static ScreenPtr autoRepeatScreen; + + extern miPointerCursorFuncRec xenixPointerCursorFuncs; + + /* + * Block/Unblock handlers + */ + + if (autoRepeatHandlersInstalled == FALSE) { + autoRepeatScreen = pScreen; + autoRepeatHandlersInstalled = TRUE; + } + + if (pScreen == autoRepeatScreen) { + pScreen->BlockHandler = xenixBlockHandler; + pScreen->WakeupHandler = xenixWakeupHandler; + } + + miDCInitialize (pScreen, &xenixPointerCursorFuncs); + + return TRUE; + } + + + extern char *getenv(); + + /*- + *----------------------------------------------------------------------- + * nthdev -- + * Return the nth device in a colon-separated list of devices. + * n is 0-origin. + * + * Results: + * A pointer to a STATIC string which is the device name. + * + * Side Effects: + * None. + * + *----------------------------------------------------------------------- + */ + static char * + nthdev (dList, n) + register char *dList; /* Colon-separated device names */ + int n; /* Device number wanted */ + { + char *result; + static char returnstring[100]; + + while (n--) { + while (*dList && *dList != ':') { + dList++; + } + } + if (*dList) { + register char *cp = dList; + + while (*cp && *cp != ':') { + cp++; + } + result = returnstring; + strncpy (result, dList, cp - dList); + result[cp - dList] = '\0'; + } else { + result = (char *)0; + } + return (result); + } + + /*- + *----------------------------------------------------------------------- + * xenixOpenFrameBuffer -- + * Open a frame buffer according to several rules. If running under + * overview and we're set up for it, use the device given in the + * PARENT envariable and note that the screen is under overview. + * Else find the device to use by looking in the xenixFbData table, + * an XDEVICE envariable, a -dev switch or using /dev/fb if trying + * to open screen 0 and all else has failed. + * + * Results: + * The fd of the framebuffer. + * + * Side Effects: + * + *----------------------------------------------------------------------- + */ + int + xenixOpenFrameBuffer(expect, index, fbNum, argc, argv) + int expect; /* The expected type of framebuffer */ + int fbNum; /* Index into the xenixFbData array */ + int index; /* Screen index */ + int argc; /* Command-line arguments... */ + char **argv; /* ... */ + { + char *name=(char *)0; + int i; /* Index into argument list */ + int fd = -1; /* Descriptor to device */ + static int devFbUsed=FALSE; /* true if /dev/fb has been used for a */ + /* screen already */ + static Bool inited = FALSE; + static char *xdevice; /* string of devices to use from environ */ + static char *devsw; /* string of devices from args */ + int type; + + if (!inited) { + xdevice = devsw = (char *)NULL; + + xdevice = getenv (XDEVICE); + /* + * Look for an argument of the form -dev <device-string> + * If such a one is found place the <device-string> in devsw. + */ + for (i = 1; i < argc; i++) { + if ((strcmp(argv[i], "-dev") == 0) && (i + 1 < argc)) { + devsw = argv[i+1]; + break; + } + } + inited = TRUE; + } + + /* + * Attempt to find a file name for the frame buffer + */ + + /* + * First see if any device was given on the command line. + * If one was and the device is both readable and writeable, + * set 'name' to it, else set it to NULL. + */ + if (devsw == (char *)NULL || + (name = nthdev (devsw, index)) == (char *)NULL || + (access (name, R_OK | W_OK) != 0) || + (strcmp(name, xenixFbData[fbNum].devName) != 0)) { + name = (char *)NULL; + } + + /* + * If we still don't have a device for this screen, check the + * environment variable for one. If one was given, stick its + * path in name and check its accessibility. If it's not + * properly accessible, then reset the name to NULL to force the + * checking of the xenixFbData array. + */ + if (devsw == (char *)NULL && name == (char *)NULL && + xdevice != (char *)NULL && + (name = nthdev(xdevice, index)) != (char *)NULL && + (access (name, R_OK | W_OK) != 0)) { + name = (char *)NULL; + } + + /* + * Take the device given in the frame buffer description + * and see if it exists and is accessible. If it does/is, + * we will use it, as long as no other device was given. + */ + if (devsw == (char *)NULL && name == (char *)NULL && + access(xenixFbData[fbNum].devName, (R_OK | W_OK)) == 0) { + name = xenixFbData[fbNum].devName; + } + + /* + * If we still have nothing and have yet to use "/dev/vga" for + * a screen, default the name to be "/dev/vga" + */ + if (devsw == (char *)NULL && name == (char *)NULL && !devFbUsed) { + name = "/dev/vga"; + } + + if (name) { + fd = open(name, O_RDWR, 0); + if (fd < 0) { + return (-1); + } + /* init screen here */ + } + + if (name && strcmp (name, "/dev/vga") == 0) { + devFbUsed = TRUE; + } + + return (fd); + } + + /*****************************************************************************/ + + void + xenixInitCursor() + { + } *** X11R4.ORIG/mit/server/ddx/xenix/vga/xenix.h Sun Jan 6 01:03:15 1991 --- X11R4/mit/server/ddx/xenix/vga/xenix.h Mon Dec 10 00:32:22 1990 *************** *** 0 **** --- 1,241 ---- + /* + * xenix.h Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * sun.h -- + * Internal declarations for the sun ddx interface + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * "$XConsortium: sun.h,v 5.7 89/12/06 09:37:35 rws Exp $ SPRITE (Berkeley)" + */ + + #ifndef _XENIX_H_ + #define _XENIX_H_ + + #include <errno.h> + extern int errno; + #include <sys/param.h> + #include <sys/types.h> + #include <sys/select.h> + #include <sys/file.h> + #include <sys/fcntl.h> + #include <sys/signal.h> + #include <unistd.h> + + #include <sys/termio.h> + #include <sys/machdep.h> + #include <sys/sysmacros.h> + + #define PGSIZE ctob(1) + + #include <sys/event.h> + #include <mouse.h> + #include <sys/vtkd.h> + + #include "xenixDevInfo.h" + + #include "X.h" + #include "Xproto.h" + #include "scrnintstr.h" + #include "screenint.h" + #ifdef NEED_EVENTS + #include "inputstr.h" + #endif NEED_EVENTS + #include "input.h" + #include "cursorstr.h" + #include "cursor.h" + #include "pixmapstr.h" + #include "pixmap.h" + #include "windowstr.h" + #include "gc.h" + #include "gcstruct.h" + #include "regionstr.h" + #include "colormap.h" + #include "miscstruct.h" + #include "dix.h" + #include "mfb.h" + #include "mi.h" + + /* + * MAXEVENTS is the maximum number of events the mouse and keyboard functions + * will read on a given call to their GetEvents vectors. + */ + #define MAXEVENTS 32 + + KeybdCtrl *ctrl; /* Current control structure (for + * keyclick, bell duration, auto- + * repeat, etc.) */ + + typedef struct kbPrivate { + int type; /* Type of keyboard */ + void (*ProcessEvent)(); /* Function to process an event */ + void (*DoneEvents)(); /* Function called when all events */ + /* have been handled. */ + pointer devPrivate; /* Private to keyboard device */ + int offset; /* to be added to device keycodes */ + KeybdCtrl *ctrl; /* Current control structure (for + * keyclick, bell duration, auto- + * repeat, etc.) */ + } KbPrivRec, *KbPrivPtr; + + #define MIN_KEYCODE 8 /* necessary to avoid the mouse buttons */ + + typedef struct ptrPrivate { + void (*ProcessEvent)(); /* Function to process an event */ + void (*DoneEvents)(); /* When all the events have been */ + /* handled, this function will be */ + /* called. */ + short x, /* Current X coordinate of pointer */ + y; /* Current Y coordinate */ + pointer devPrivate; /* Field private to device */ + } PtrPrivRec, *PtrPrivPtr; + + + /* + * Cursor-private data + * screenBits saves the contents of the screen before the cursor + * was placed in the frame buffer. + * source a bitmap for placing the foreground pixels down + * srcGC a GC for placing the foreground pixels down. + * Prevalidated for the cursor's screen. + * invSource a bitmap for placing the background pixels down. + * invSrcGC a GC for placing the background pixels down. + * Also prevalidated for the cursor's screen Pixmap. + * temp a temporary pixmap for low-flicker cursor motion -- + * exists to avoid the overhead of creating a pixmap + * whenever the cursor must be moved. + * fg, bg foreground and background pixels. For a color display, + * these are allocated once and the rgb values changed + * when the cursor is recolored. + * scrX, scrY the coordinate on the screen of the upper-left corner + * of screenBits. + * state one of CR_IN, CR_OUT and CR_XING to track whether the + * cursor is in or out of the frame buffer or is in the + * process of going from one state to the other. + */ + typedef enum { + CR_IN, /* Cursor in frame buffer */ + CR_OUT, /* Cursor out of frame buffer */ + CR_XING /* Cursor in flux */ + } CrState; + + typedef struct crPrivate { + PixmapPtr screenBits; /* Screen before cursor put down */ + PixmapPtr source; /* Cursor source (foreground bits) */ + GCPtr srcGC; /* Foreground GC */ + PixmapPtr invSource; /* Cursor source inverted (background) */ + GCPtr invSrcGC; /* Background GC */ + PixmapPtr temp; /* Temporary pixmap for merging screenBits + * and the sources. Saves creation time */ + Pixel fg; /* Foreground color */ + Pixel bg; /* Background color */ + int scrX, /* Screen X coordinate of screenBits */ + scrY; /* Screen Y coordinate of screenBits */ + CrState state; /* Current state of the cursor */ + } CrPrivRec, *CrPrivPtr; + + /* + * Frame-buffer-private info. + * fd file opened to the frame buffer device. + * info description of the frame buffer -- type, height, depth, + * width, etc. + * fb pointer to the mapped image of the frame buffer. Used + * by the driving routines for the specific frame buffer + * type. + * mapped flag set true by the driver when the frame buffer has + * been mapped in. + * parent set true if the frame buffer is actually a SunWindows + * window. + * fbPriv Data private to the frame buffer type. + */ + typedef struct { + pointer fb; /* Frame buffer itself */ + Bool mapped; /* TRUE if frame buffer already mapped */ + int fd; /* Descriptor open to frame buffer */ + int fb_width; + int fb_height; + int fb_size; + void (*EnterLeave)(); /* screen switch */ + pointer fbPriv; /* Frame-buffer-dependent data */ + } fbFd; + + extern Bool xenixSupportsDepth8; + extern unsigned long xenixGeneration; + + typedef struct _xenixFbDataRec { + Bool (*probeProc)(); /* probe procedure for this fb */ + char *devName; /* device filename */ + Bool (*createProc)(); /* create procedure for this fb */ + } xenixFbDataRec; + + extern xenixFbDataRec xenixFbData[]; + /* + * Cursor functions + */ + extern void xenixInitCursor(); + + /* + * Initialization + */ + extern Bool xenixScreenInit(); + extern int xenixOpenFrameBuffer(); + + extern fbFd xenixFbs[]; + + extern int lastEventTime; /* Time (in ms.) of last event */ + extern void SetTimeSinceLastInputEvent(); + + extern int monitorResolution; + + #define AUTOREPEAT_INITIATE (200) /* milliseconds */ + #define AUTOREPEAT_DELAY (50) /* milliseconds */ + /* + * We signal autorepeat events with the unique Firm_event + * id AUTOREPEAT_EVENTID. + * Because inputevent ie_code is set to Firm_event ids in + * sunKbdProcessEventSunWin, and ie_code is short whereas + * Firm_event id is u_short, we use 0x7fff. + */ + #define AUTOREPEAT_EVENTID (0x7fff) /* AutoRepeat Firm_event id */ + + extern int autoRepeatKeyDown; /* TRUE if key down */ + extern int autoRepeatReady; /* TRUE if time out */ + extern int autoRepeatDebug; /* TRUE if debugging */ + extern long autoRepeatInitiate; + extern long autoRepeatDelay; + extern struct timeval autoRepeatLastKeyDownTv; + extern struct timeval autoRepeatDeltaTv; + + #define tvminus(tv, tv1, tv2) /* tv = tv1 - tv2 */ \ + if ((tv1).tv_usec < (tv2).tv_usec) { \ + (tv1).tv_usec += 1000000; \ + (tv1).tv_sec -= 1; \ + } \ + (tv).tv_usec = (tv1).tv_usec - (tv2).tv_usec; \ + (tv).tv_sec = (tv1).tv_sec - (tv2).tv_sec; + + #define tvplus(tv, tv1, tv2) /* tv = tv1 + tv2 */ \ + (tv).tv_sec = (tv1).tv_sec + (tv2).tv_sec; \ + (tv).tv_usec = (tv1).tv_usec + (tv2).tv_usec; \ + if ((tv).tv_usec > 1000000) { \ + (tv).tv_usec -= 1000000; \ + (tv).tv_sec += 1; \ + } + + /*- + * TVTOMILLI(tv) + * Given a struct timeval, convert its time into milliseconds... + */ + #define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000)) + + #endif _XENIX_H_ *** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixDevInfo.h Sun Jan 6 01:03:18 1991 --- X11R4/mit/server/ddx/xenix/vga/xenixDevInfo.h Sun Dec 9 18:49:07 1990 *************** *** 0 **** --- 1,34 ---- + /* + * devinfo.h By Chain Lee 08/90 + */ + + #define FBTYPE_HERCULES 1 /* 720 x 348 */ + #define FBTYPE_CGA 2 /* 640 x 200 */ + #define FBTYPE_EGA 3 /* 640 x 350 */ + #define FBTYPE_VGA 4 /* 640 x 480 */ + #define FBTYPE_VGA1 4 /* 640 x 480 */ + #define FBTYPE_VGA2 5 /* 800 x 600 */ + #define FBTYPE_VGA3 6 /* 1024 x 600 */ + #define FBTYPE_VGA4 7 /* 1204 x 768 */ + #define FBTYPE_VGA5 8 /* 640 x 480 color */ + + #define HERCULES_FBWIDTH 720 + #define HERCULES_FBHEIGHT 348 + #define HERCULES_FBSIZE (1024 * 32) + + #define VGA1_FBWIDTH 640 + #define VGA1_FBHEIGHT 480 + #define VGA1_FBSIZE ((640 * 480) >> 3) + + #define VGA2_FBWIDTH 800 + #define VGA2_FBHEIGHT 600 + #define VGA2_FBSIZE ((800 * 600) >> 3) + + #define VGA3_FBWIDTH 1024 + #define VGA3_FBHEIGHT 600 + #define VGA3_FBSIZE ((1024 * 600) >> 3) + + /****************************************************************************/ + + #define KBTYPE_IBMAT 2 + *** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixVGA.c Sun Jan 6 01:03:20 1991 --- X11R4/mit/server/ddx/xenix/vga/xenixVGA.c Sun Jan 6 00:17:16 1991 *************** *** 0 **** --- 1,289 ---- + /* + * xenixVGA.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * + * Copyright (c) 1987 by the Regents of the University of California + * Copyright (c) 1987 by Adam de Boor, UC Berkeley + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #include "xenix.h" + #include "resource.h" + + typedef struct vga { + uchar_t image[VGA1_FBSIZE]; /* Pixel buffer */ + } VGARec, *VGAPtr; + + static int xenixVGAScreenIndex; + static int xenixVGAFd; + + /*- + *----------------------------------------------------------------------- + * xenixVGASaveScreen -- + * Disable the video on the frame buffer to save the screen. + * + * Results: + * None. + * + * Side Effects: + * Video enable state changes. + * + *----------------------------------------------------------------------- + */ + static Bool + xenixVGASaveScreen (pScreen, on) + ScreenPtr pScreen; + Bool on; + { + int state = on; + /* + if (on != SCREEN_SAVER_ON) { + SetTimeSinceLastInputEvent(); + state = FBVIDEO_ON; + } else { + state = FBVIDEO_OFF; + } + */ + /* */ + return TRUE; + } + + /*- + *----------------------------------------------------------------------- + * xenixVGACloseScreen -- + * called to ensure video is enabled when server exits. + * + * Results: + * Screen is unsaved. + * + * Side Effects: + * None + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static Bool + xenixVGACloseScreen(i, pScreen) + int i; + ScreenPtr pScreen; + { + Bool ret; + + pScreen->CloseScreen = (Bool (*)()) pScreen->devPrivates[xenixVGAScreenIndex].ptr; + ret = (*pScreen->CloseScreen) (i, pScreen); + (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF); + return ret; + } + + /*- + *----------------------------------------------------------------------- + * xenixVGAInit -- + * Attempt to find and initialize a VGA framebuffer + * + * Results: + * None + * + * Side Effects: + * Most of the elements of the ScreenRec are filled in. The + * video is enabled for the frame buffer... + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static Bool + xenixVGAInit (index, pScreen, argc, argv) + int index; /* The index of pScreen in the ScreenInfo */ + ScreenPtr pScreen; /* The Screen to initialize */ + int argc; /* The number of the Server's arguments. */ + char **argv; /* The arguments themselves. Don't change! */ + { + if (!mfbScreenInit(pScreen, + xenixFbs[index].fb, + xenixFbs[index].fb_width, + xenixFbs[index].fb_height, + monitorResolution, monitorResolution, + xenixFbs[index].fb_width)) + return (FALSE); + + pScreen->devPrivates[xenixVGAScreenIndex].ptr = (pointer) pScreen->CloseScreen; + + pScreen->CloseScreen = xenixVGACloseScreen; + pScreen->SaveScreen = xenixVGASaveScreen; + pScreen->whitePixel = 1; + pScreen->blackPixel = 0; + + /* + * Enable video output...? + */ + (void) xenixVGASaveScreen(pScreen, SCREEN_SAVER_FORCER); + + return (xenixScreenInit(pScreen) && mfbCreateDefColormap(pScreen)); + } + + /*- + *----------------------------------------------------------------------- + * xenixVGAProbe -- + * Attempt to find and initialize a VGA framebuffer + * + * Results: + * None + * + * Side Effects: + * Memory is allocated for the frame buffer and the buffer is mapped. + * + *----------------------------------------------------------------------- + */ + + /*ARGSUSED*/ + Bool + xenixVGAProbe(pScreenInfo, index, fbNum, argc, argv) + ScreenInfo *pScreenInfo; /* The screenInfo struct */ + int index; /* The index of pScreen in the ScreenInfo */ + int fbNum; /* Index into the xenixFbData array */ + int argc; /* The number of the Server's arguments. */ + char **argv; /* The arguments themselves. Don't change! */ + { + int fd; + caddr_t mapaddr; + + if ((fd = xenixOpenFrameBuffer(0, index, fbNum, argc, argv)) < 0) + return FALSE; + + xenixVGAFd = fd; + + if (ioctl(fd, SW_VGA11, 0) < 0) + ErrorF("xenixVGAProbe: cannot switch to VGA graphics mode\n"); + + if ((mapaddr = (caddr_t) ioctl(fd, MAPCONS, 0)) < 0) + ErrorF("xenixVGAProbe: cannot map VGA\n"); + + xenixInitVid(mapaddr); + + xenixFbs[index].fb = (pointer)mapaddr; + xenixFbs[index].fd = fd; + xenixFbs[index].fb_width = VGA1_FBWIDTH; + xenixFbs[index].fb_height = VGA1_FBHEIGHT; + xenixFbs[index].fb_size = VGA1_FBSIZE; + xenixFbs[index].EnterLeave = (void(*)()) NULL; + return TRUE; + } + + Bool + xenixVGACreate(pScreenInfo, argc, argv) + ScreenInfo *pScreenInfo; + int argc; + char **argv; + { + if (xenixGeneration != serverGeneration) + { + xenixVGAScreenIndex = AllocateScreenPrivateIndex(); + if (xenixVGAScreenIndex < 0) + return FALSE; + } + return (AddScreen(xenixVGAInit, argc, argv) >= 0); + } + + + static int xenixConsoleXMode; + static void vga_save(), vga_restore(); + + void + xenixSwitchConsoleMode() + { + if (xenixConsoleXMode) { + vga_save(); + ioctl(xenixVGAFd, SW_VGA80x25, 0); + reset_tty(0); + xenixConsoleXMode = 0; + } else { + ioctl(xenixVGAFd, SW_VGA11, 0); + vga_restore(); + set_tty(0); + xenixConsoleXMode = 1; + } + } + + static uchar_t *xenixVGAFb; + static VGARec VGASaveFb; + + /* + * Set up the graphics multiscreen stuff and call another + * routine to set up card. + */ + xenixInitVid(a) + uchar_t *a; + { + struct vt_mode smode; + + xenixVGAFb = a; + xenixConsoleXMode = 1; + return; + } + + static void + vga_save() + { + uchar_t *p, *q; + int i; + + i = VGA1_FBSIZE; + p = (uchar_t *) &VGASaveFb; + q = (uchar_t *) xenixVGAFb; + + while (i--) + *p++ = *q++; + } + + static void + vga_restore() + { + uchar_t *p, *q; + int i; + + i = VGA1_FBSIZE; + p = (uchar_t *) &VGASaveFb; + q = (uchar_t *) xenixVGAFb; + + while (i--) + *q++ = *p++; + } +
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixIo.c Sun Jan 6 01:03:22 1991 --- X11R4/mit/server/ddx/xenix/vga/xenixIo.c Mon Dec 10 00:28:26 1990 *************** *** 0 **** --- 1,321 ---- + /* + * xenixIo.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #include "xenix.h" + #include "opaque.h" + + extern void + xenixSwitchConsoleMode(); + + int lastEventTime = 0; + extern int xenixSigIO; + extern int screenIsSaved; + extern void SaveScreens(); + + extern CARD8 ibmAT101SecondaryMap[]; + extern CARD8 keyCodePrefix1, keyCodePrefix2, keyCodeCapsLock; + + int xenixEventPending; + + int xenixIgnoreEvent = TRUE; + + void + xenixSuspendX() + { + EVENT *evp; + int i, n, done; + + xenixSwitchConsoleMode(); + + done = 0; + while (!done) { + nap(20); + n = ev_count(); + if (n <= 0) + continue; + for (i=0; i<n; i++) { + evp = ev_read(); + if (EV_TAG(*evp) & T_BUTTON) + if (EV_BUTTONS(*evp) != 7) { + done = 1; + break; + } + ev_pop(); + } + } + + done = 0; + while (!done) { + nap(20); + n = ev_count(); + if (n <= 0) + continue; + for (i=0; i<n; i++) { + evp = ev_read(); + if (EV_TAG(*evp) & T_BUTTON) + if (EV_BUTTONS(*evp) == 7) { + done = 1; + break; + } + ev_pop(); + } + } + + xenixSwitchConsoleMode(); + } + + /*- + *----------------------------------------------------------------------- + * TimeSinceLastInputEvent -- + * Function used for screensaver purposes by the os module. + * + * Results: + * The time in milliseconds since there last was any + * input. + * + * Side Effects: + * None. + * + *----------------------------------------------------------------------- + */ + int + TimeSinceLastInputEvent() + { + struct timeval now; + + gettimeofday (&now, (struct timezone *)0); + + if (lastEventTime == 0) { + lastEventTime = TVTOMILLI(now); + } + return TVTOMILLI(now) - lastEventTime; + } + + int + xenixCheckEvent() + { + int n = ev_count(); + + return (n > 0); + } + + /*- + *----------------------------------------------------------------------- + * ProcessInputEvents -- + * Retrieve all waiting input events and pass them to DIX in their + * correct chronological order. Only reads from the system pointer + * and keyboard. + * + * Results: + * None. + * + * Side Effects: + * Events are passed to the DIX layer. + * + *----------------------------------------------------------------------- + */ + void + ProcessInputEvents () + { + + EVENT *evp; + int i, n; + int evType; + DevicePtr pPointer; + DevicePtr pKeyboard; + + xenixEventPending = 0; + pPointer = LookupPointerDevice(); + pKeyboard = LookupKeyboardDevice(); + + n = ev_count(); + + if (n < 0) { + ErrorF("ProcessInputEvent: cannot get event count\n"); + return; + } + + #if OK + if (autoRepeatKeyDown && autoRepeatReady && n <= 0) { + /* fake a xenixwindows kbd event */ + n = sizeof(struct inputevent); + se->ie_code = AUTOREPEAT_EVENTID; + tvplus(event_time(se), autoRepeatLastKeyDownTv, + autoRepeatDeltaTv); + if (autoRepeatDebug) + ErrorF("ProcessInputEvents: sw auto event\n"); + } + #endif + for (i=0; i<n; i++) { + if ( (evp=ev_read()) == (EVENT *) NULL) + break; + + if (screenIsSaved == SCREEN_SAVER_ON) + SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); + lastEventTime = EV_TIME(*evp); + /* + if (xenixIgnoreEvent) { + ev_pop(); + continue; + } + */ + /* + * Figure out the X device this event should be reported on. + */ + + evType = EV_TAG(*evp); + + if (!(EV_TAG(*evp) & T_STRING)) { + xenixMouseProcessEvent(pPointer,evp); + } + else + { + CARD8 key; + /* see if the key is a secondary key */ + key = EV_BUF(*evp)[0]; + if (key == keyCodePrefix1 || key == keyCodePrefix2) { + ev_pop(); + if (++i, (evp=ev_read()) == (EVENT *) NULL) { + continue; + } + key = EV_BUF(*evp)[0]; + key = ibmAT101SecondaryMap[key & 0x7f]; + EV_BUF(*evp)[0] = key | EV_BUF(*evp)[0] & 0x80; + } + + xenixKbdProcessEvent(pKeyboard,evp); + } + ev_pop(); + } + #if OK + (* kbdPriv->DoneEvents) (pKeyboard, TRUE); + (* ptrPriv->DoneEvents) (pPointer, TRUE); + #endif + } + + /*- + *----------------------------------------------------------------------- + * SetTimeSinceLastInputEvent -- + * Set the lastEventTime to now. + * + * Results: + * None. + * + * Side Effects: + * lastEventTime is altered. + * + *----------------------------------------------------------------------- + */ + void + SetTimeSinceLastInputEvent() + { + struct timeval now; + + gettimeofday (&now, (struct timezone *)0); + lastEventTime = TVTOMILLI(now); + } + + /* + * DDX - specific abort routine. Called by AbortServer(). + */ + void + AbortDDX() + { + } + + /* Called by GiveUp(). */ + void + ddxGiveUp() + { + } + + int + ddxProcessArgument (argc, argv, i) + int argc; + char *argv[]; + int i; + { + extern void UseMsg(); + extern Bool ActiveZaphod; + + if (strcmp (argv[i], "-ar1") == 0) { /* -ar1 int */ + if (++i >= argc) UseMsg (); + autoRepeatInitiate = 1000 * (long)atoi(argv[i]); + return 2; + } + if (strcmp (argv[i], "-ar2") == 0) { /* -ar2 int */ + if (++i >= argc) UseMsg (); + autoRepeatDelay = 1000 * (long)atoi(argv[i]); + return 2; + } + if (strcmp (argv[i], "-debug") == 0) { /* -debug */ + return 1; + } + if (strcmp (argv[i], "-dev") == 0) { /* -dev /dev/mumble */ + if (++i >= argc) UseMsg (); + return 2; + } + if (strcmp (argv[i], "-mono") == 0) { /* -mono */ + return 1; + } + if (strcmp (argv[i], "-zaphod") == 0) { /* -zaphod */ + ActiveZaphod = FALSE; + return 1; + } + return 0; + } + + void + ddxUseMsg() + { + ErrorF("-ar1 int set autorepeat initiate time\n"); + ErrorF("-ar2 int set autorepeat interval time\n"); + ErrorF("-debug disable non-blocking console mode\n"); + ErrorF("-dev filename name of device to open\n"); + ErrorF("-mono force monochrome-only screen\n"); + ErrorF("-zaphod disable active Zaphod mode\n"); + } *** X11R4.ORIG/mit/server/ddx/xenix/vga/xenixKeyMap.c Sun Jan 6 01:03:25 1991 --- X11R4/mit/server/ddx/xenix/vga/xenixKeyMap.c Sun Dec 9 18:54:53 1990 *************** *** 0 **** --- 1,249 ---- + /* + * xenixKeyMap.c Modified for Xenix by Chain Lee 08/90 + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #include "xenix.h" + #include "keysym.h" + + CARD8 keyCodePrefix1 = 0xe0; + CARD8 keyCodePrefix2 = 0xe1; + CARD8 keyCodeCapsLock = 0x3a; + CARD8 keyCodeCrtlLeft = 0x1d; + + static KeySym ibmAT101Map[] = { + NoSymbol, NoSymbol, /* 0x00 */ + XK_Escape, NoSymbol, /* 0x01 */ + XK_1, XK_exclam, /* 0x02 */ + XK_2, XK_at, /* 0x03 */ + XK_3, XK_numbersign, /* 0x04 */ + XK_4, XK_dollar, /* 0x05 */ + XK_5, XK_percent, /* 0x06 */ + XK_6, XK_asciicircum, /* 0x07 */ + XK_7, XK_ampersand, /* 0x08 */ + XK_8, XK_asterisk, /* 0x09 */ + XK_9, XK_parenleft, /* 0x0a */ + XK_0, XK_parenright, /* 0x0b */ + XK_minus, XK_underscore, /* 0x0c */ + XK_equal, XK_plus, /* 0x0d */ + XK_BackSpace, NoSymbol, /* 0x0e */ + XK_Tab, NoSymbol, /* 0x0f */ + XK_Q, NoSymbol, /* 0x10 */ + XK_W, NoSymbol, /* 0x11 */ + XK_E, NoSymbol, /* 0x12 */ + XK_R, NoSymbol, /* 0x13 */ + XK_T, NoSymbol, /* 0x14 */ + XK_Y, NoSymbol, /* 0x15 */ + XK_U, NoSymbol, /* 0x16 */ + XK_I, NoSymbol, /* 0x17 */ + XK_O, NoSymbol, /* 0x18 */ + XK_P, NoSymbol, /* 0x19 */ + XK_bracketleft, XK_braceleft, /* 0x1a */ + XK_bracketright,XK_braceright, /* 0x1b */ + XK_Return, NoSymbol, /* 0x1c */ + XK_Control_L, NoSymbol, /* 0x1d */ + XK_A, NoSymbol, /* 0x1e */ + XK_S, NoSymbol, /* 0x1f */ + XK_D, NoSymbol, /* 0x20 */ + XK_F, NoSymbol, /* 0x21 */ + XK_G, NoSymbol, /* 0x22 */ + XK_H, NoSymbol, /* 0x23 */ + XK_J, NoSymbol, /* 0x24 */ + XK_K, NoSymbol, /* 0x25 */ + XK_L, NoSymbol, /* 0x26 */ + XK_semicolon, XK_colon, /* 0x27 */ + XK_quoteright, XK_quotedbl, /* 0x28 */ + XK_quoteleft, XK_asciitilde, /* 0x29 */ + XK_Shift_L, NoSymbol, /* 0x2a */ + XK_backslash, XK_bar, /* 0x2b */ + XK_Z, NoSymbol, /* 0x2c */ + XK_X, NoSymbol, /* 0x2d */ + XK_C, NoSymbol, /* 0x2e */ + XK_V, NoSymbol, /* 0x2f */ + XK_B, NoSymbol, /* 0x30 */ + XK_N, NoSymbol, /* 0x31 */ + XK_M, NoSymbol, /* 0x32 */ + XK_comma, XK_less, /* 0x33 */ + XK_period, XK_greater, /* 0x34 */ + XK_slash, XK_question, /* 0x35 */ + XK_Shift_R, NoSymbol, /* 0x36 */ + XK_asterisk, NoSymbol, /* 0x37 */ + XK_Alt_L, NoSymbol, /* 0x38 */ + XK_space, NoSymbol, /* 0x39 */ + XK_Caps_Lock, NoSymbol, /* 0x3a */ + XK_F1, NoSymbol, /* 0x3b */ + XK_F2, NoSymbol, /* 0x3c */ + XK_F3, NoSymbol, /* 0x3d */ + XK_F4, NoSymbol, /* 0x3e */ + XK_F5, NoSymbol, /* 0x3f */ + XK_F6, NoSymbol, /* 0x40 */ + XK_F7, NoSymbol, /* 0x41 */ + XK_F8, NoSymbol, /* 0x42 */ + XK_F9, NoSymbol, /* 0x43 */ + XK_F10, NoSymbol, /* 0x44 */ + XK_Num_Lock, NoSymbol, /* 0x45 */ + XK_Scroll_Lock, NoSymbol, /* 0x46 */ + XK_Home, XK_7, /* 0x47 */ + XK_Up, XK_8, /* 0x48 */ + XK_Prior, XK_9, /* 0x49 */ + XK_minus, NoSymbol, /* 0x4a */ + XK_Left, XK_4, /* 0x4b */ + NoSymbol, XK_5, /* 0x4c */ + XK_Right, XK_6, /* 0x4d */ + XK_plus, NoSymbol, /* 0x4e */ + XK_End, XK_1, /* 0x4f */ + XK_Down, XK_2, /* 0x50 */ + XK_Next, XK_3, /* 0x51 */ + XK_Insert, XK_0, /* 0x52 */ + XK_Delete, XK_period, /* 0x53 */ + NoSymbol, NoSymbol, /* 0x54 */ + NoSymbol, NoSymbol, /* 0x55 */ + NoSymbol, XK_colon, /* 0x56 */ + XK_F11, NoSymbol, /* 0x57 */ + XK_F12, NoSymbol, /* 0x58 */ + XK_Return, NoSymbol, /* 0x59 */ + NoSymbol, NoSymbol, /* 0x5a */ + NoSymbol, NoSymbol, /* 0x5b */ + NoSymbol, NoSymbol, /* 0x5c */ + NoSymbol, NoSymbol, /* 0x5d */ + NoSymbol, NoSymbol, /* 0x5e */ + NoSymbol, NoSymbol, /* 0x5f */ + + /* Secondary key map */ + + NoSymbol, NoSymbol, /* 0x60 */ + XK_Alt_R, NoSymbol, /* 0x61 */ + XK_Control_R, NoSymbol, /* 0x62 */ + NoSymbol, NoSymbol, /* 0x63 */ + XK_Insert, NoSymbol, /* 0x64 */ + XK_Delete, NoSymbol, /* 0x65 */ + XK_Home, NoSymbol, /* 0x66 */ + XK_End, NoSymbol, /* 0x67 */ + XK_Prior, NoSymbol, /* 0x68 */ + XK_Next, NoSymbol, /* 0x69 */ + XK_Left, NoSymbol, /* 0x6a */ + XK_Up, NoSymbol, /* 0x6b */ + XK_Down, NoSymbol, /* 0x6c */ + XK_Right, NoSymbol, /* 0x6d */ + XK_slash, NoSymbol, /* 0x6e */ + XK_asterisk, NoSymbol, /* 0x6f */ + NoSymbol, NoSymbol, /* 0x70 */ + NoSymbol, NoSymbol, /* 0x71 */ + NoSymbol, NoSymbol, /* 0x72 */ + NoSymbol, NoSymbol, /* 0x73 */ + NoSymbol, NoSymbol, /* 0x74 */ + NoSymbol, NoSymbol, /* 0x75 */ + NoSymbol, NoSymbol, /* 0x76 */ + NoSymbol, NoSymbol, /* 0x77 */ + NoSymbol, NoSymbol, /* 0x78 */ + NoSymbol, NoSymbol, /* 0x79 */ + NoSymbol, NoSymbol, /* 0x7a */ + NoSymbol, NoSymbol, /* 0x7b */ + NoSymbol, NoSymbol, /* 0x7c */ + NoSymbol, NoSymbol, /* 0x7d */ + NoSymbol, NoSymbol, /* 0x7e */ + NoSymbol, NoSymbol, /* 0x7f */ + }; + + KeySymsRec xenixKeySyms[] = { + /* map minKeyCode maxKC width */ + (KeySym *)NULL, 0, 0, 0, + (KeySym *)NULL, 0, 0, 0, + ibmAT101Map, 0, 0x70, 2, + }; + + #define cT (ControlMask) + #define sH (ShiftMask) + #define lK (LockMask) + #define mT (Mod1Mask) + + CARD8 ibmAT101ModMap[MAP_LENGTH + 8] = { + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + 0, 0, 0, 0, 0, 0, 0, 0, /*buttons*/ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00-0f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, cT, 0, 0, /* 10-1f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sH, 0, 0, 0, 0, 0, /* 20-2f */ + 0, 0, 0, 0, 0, 0, sH, 0, mT, 0, lK, 0, 0, 0, 0, 0, /* 30-3f */ + 0, 0, 0, 0, 0, lK, lK, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40-4f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50-5f */ + 0, mT, cT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60-6f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70-7f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80-8f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90-9f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a0-af */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b0-bf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c0-cf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d0-df */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e0-ef */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f0-ff */ + }; + + CARD8 *xenixModMap[] = { + (CARD8 *) NULL, + (CARD8 *) NULL, + ibmAT101ModMap, + }; + + #define AL 0x61 + #define CT 0x62 + #define IN 0x64 + #define DE 0x65 + #define HO 0x66 + #define EN 0x67 + #define PU 0x68 + #define PD 0x69 + #define LF 0x6a + #define UP 0x6b + #define DN 0x6c + #define RI 0x6d + #define SL 0x6e + #define AS 0x6f + #define CR 0x1c + + CARD8 ibmAT101SecondaryMap[MAP_LENGTH] = { + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00-0f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CR, CT, 0, 0, /* 10-1f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20-2f */ + 0, 0, 0, 0, 0, SL, 0, AS, AL, 0, 0, 0, 0, 0, 0, 0, /* 30-3f */ + 0, 0, 0, 0, 0, 0, 0, HO, UP, PU, 0, LF, 0, RI, 0, EN,/* 40-4f */ + DN, PD, IN, DE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50-5f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60-6f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70-7f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80-8f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90-9f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a0-af */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b0-bf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c0-cf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d0-df */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e0-ef */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f0-ff */ + }; + *** X11R4.ORIG/mit/server/ddx/xenix/trident/Imakefile Sun Jan 6 01:03:28 1991 --- X11R4/mit/server/ddx/xenix/trident/Imakefile Sun Dec 9 12:27:42 1990 *************** *** 0 **** --- 1,49 ---- + #include <Server.tmpl> + + SRCS1 = \ + xenixInit.c \ + xenixVGA.c \ + xenixKbd.c \ + xenixMouse.c \ + xenixIo.c \ + xenixTty.c \ + xenixKeyMap.c \ + vgaTrident.c \ + vgaHWCntl.c + + SRCS = $(SRCS1) kbd_mode.c # constype.c + + OFILES = xenixInit.o + + OBJS = \ + xenixInit.o \ + xenixVGA.o \ + xenixKbd.o \ + xenixMouse.o \ + xenixIo.o \ + xenixTty.o \ + xenixKeyMap.o \ + vgaTrident.o \ + vgaHWCntl.o + + INCLUDES = -I. -I../../mfb -I../../mi -I../../../include -I$(INCLUDESRC) + LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/4.2bsd/llib-los.ln \ + ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln ../../cfb/llib-lcfb.ln + + NormalLibraryObjectRule() + + all:: $(OFILES) kbd_mode + + lintlib: + + NormalLibraryTarget(xenix,$(OBJS)) + NormalLintTarget($(SRCS1)) + SingleProgramTarget(kbd_mode, kbd_mode.o,,) + InstallProgram(kbd_mode,$(BINDIR)) + InstallManPage(kbd_mode,$(MANDIR)) + InstallManPage(Xxenix,$(MANDIR)) + + saber_src: + #load $(CFLAGS) $(SRCS1) + + DependTarget() *** X11R4.ORIG/mit/server/ddx/xenix/trident/README Sun Jan 6 01:03:31 1991 --- X11R4/mit/server/ddx/xenix/trident/README Sun Jan 6 01:00:09 1991 *************** *** 0 **** --- 1,35 ---- + # + # README C.LEE 1/5/91 + # + + This directory contains Trident 8800 VGA specific code. The default + video mode is set to 1024X600 noninterlaced. If you want another mode, + you can edit xenixDevInfo.h, change all 'VGA3's in the first five + definitions to 'VGA2' (for 800X600 noninterlaced) or 'VGA4' (for + (1024X768 interlaced). + + * Keyboard LED control is built in for the server. + * Keyboard should be in XT mode (kernel default configuration). + * Screen can be changed into text mode for multi-screen switching by + pressing all three mouse buttons down, similar to what I did for MGR. + * kbd_mode program is provided in case the server crashes messing up + the keyboard. You can login from another serial terminal and run + + kbd_mode -a < /dev/tty?? + + where /dev/tty?? is the multiscreen you started Xxenix. + Don't try 'kbd_mode -r' unless you have a serial terminal at hand, + otherwise you will have to power down the machine. There is a bug + in Xenix preventing you from getting the current keyboard mode. + * The Xxenix server uses the Xenix Event Manager. Therefore you may have + problem running Xenix version of MGR window (ported by myself) using + bus mouse once Xxenix has been run. + * Screen saver blank mode is supported. + * Black and white pixel color can be customized by setting environment + variable XBACKGROUND and XFOREGROUND to the desired RGB value. Try + + setenv XBACKGROUND 80:100:150 + setenv XFOREGROUND 240:255:180 + + Chain Lee + chain@paul.rutgers.edu *** X11R4.ORIG/mit/server/ddx/xenix/trident/kbd_mode.c Sun Jan 6 01:03:33 1991 --- X11R4/mit/server/ddx/xenix/trident/kbd_mode.c Sat Jan 5 17:50:28 1991 *************** *** 0 **** --- 1,107 ---- + /* + * kbd_mode.c Modified for Xenix by Chain Lee 08/90 + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #ifndef lint + static char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13"; + #endif + + /* + * Copyright (c) 1986 by Sun Microsystems, Inc. + * + * kbd_mode: set keyboard encoding mode + */ + + #include <sys/types.h> + #include <fcntl.h> + #include <sys/vtkd.h> + #include <stdio.h> + + static void die(), usage(); + static int kbd_fd=0; + + main(argc, argv) + int argc; + char *argv[]; + { + int code, translate; + + argc--; + argv++; + if (argc-- && **argv == '-') { + code = *(++*argv); + } else { + usage(); + } + switch (code) { + case 'a': + case 'A': + translate = K_XLATE; + break; + case 'r': + case 'R': + translate = K_RAW; + break; + default: + usage(); + } + if (ioctl(kbd_fd, KDSKBMODE, translate)) { + die("Couldn't initialize translation to Event"); + } + exit(0); + } + + static void + die(msg) + char *msg; + { + fprintf(stderr, "%s\n", msg); + exit(1); + } + + static void + usage() + { + int translate; + #if XENIX_HAS_NO_BUGS + if ((translate = ioctl(kbd_fd, KDGKBMODE, &translate)) == -1) { + die("Couldn't inquire current translation"); + } + #endif + fprintf(stderr, "kbd_mode { -a | -r }\n"); + fprintf(stderr, "\tfor ascii, or raw event.\n"); + fprintf(stderr, "Current mode is %s.\n", + ( translate == K_XLATE ? "a (ascii bytes)" : + ( translate == K_RAW ? "r (raw events)" : "unknown mode"))); + exit(1); + } + + *** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixKbd.c Sun Jan 6 01:03:36 1991 --- X11R4/mit/server/ddx/xenix/trident/xenixKbd.c Sun Dec 9 18:53:17 1990 *************** *** 0 **** --- 1,500 ---- + /* + * xenixKbd.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #define NEED_EVENTS + #include "xenix.h" + #include "Xproto.h" + #include "keysym.h" + #include "inputstr.h" + + typedef struct { + int trans; /* Original translation form */ + } SunKbPrivRec, *SunKbPrivPtr; + + extern CARD8 *xenixModMap[]; + extern CARD8 ibmAT101ModMap[]; + extern KeySymsRec xenixKeySyms[]; + + extern CARD8 keyCodePrefix1, keyCodePrefix2, keyCodeCapsLock; + + extern void ProcessInputEvents(); + extern void miPointerPosition(); + + static void xenixBell(); + static void xenixKbdCtrl(); + void xenixKbdProcessEvent(); + static void xenixKbdDoneEvents(); + + int click = 0; + + int autoRepeatKeyDown = 0; + int autoRepeatDebug = 0; + int autoRepeatReady; + long autoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE; + long autoRepeatDelay = 1000 * AUTOREPEAT_DELAY; + static int autoRepeatFirst; + struct timeval autoRepeatLastKeyDownTv; + struct timeval autoRepeatDeltaTv; + + static KeybdCtrl sysKbCtrl; + + static KbPrivRec sysKbPriv = { + -1, /* Type of keyboard */ + xenixKbdProcessEvent, /* Function to process an event */ + xenixKbdDoneEvents, /* Function called when all events */ + /* have been handled. */ + (pointer) NULL, /* Private to keyboard device */ + 0, /* offset for device keycodes */ + &sysKbCtrl, /* Initial full duration = .20 sec. */ + }; + + static void + sigsegv(){ + reset_tty(0); + ev_close(); + abort(); + } + + /*- + *----------------------------------------------------------------------- + * xenixKbdProc -- + * Handle the initialization, etc. of a keyboard. + * + * Results: + * None. + * + * Side Effects: + * + * Note: + * When using xenixwindows, all input comes off a single fd, stored in the + * global windowFd. Therefore, only one device should be enabled and + * disabled, even though the application still sees both mouse and + * keyboard. We have arbitrarily chosen to enable and disable windowFd + * in the keyboard routine xenixKbdProc rather than in xenixMouseProc. + * + *----------------------------------------------------------------------- + */ + int + xenixKbdProc (pKeyboard, what) + DevicePtr pKeyboard; /* Keyboard to manipulate */ + int what; /* What to do to it */ + { + int qfd; + dmask_t dmask = D_STRING | D_REL | D_BUTTON; + static int kbdFd=0; + + switch (what) { + case DEVICE_INIT: + + signal(SIGSEGV, sigsegv); + + if (pKeyboard != LookupKeyboardDevice()) { + ErrorF ("Cannot open non-system keyboard"); + return (!Success); + } + + /* + * First open the event manager. + */ + if (ev_init() < 0) { + ErrorF("xenixKbdProc: cannot init event manager\n"); + return (!Success); + } + if ((qfd = ev_open(&dmask)) < 0) { + ErrorF("xenixKbdProc: cannot open event manager\n"); + return (!Success); + } + if (dmask != (D_STRING | D_REL | D_BUTTON)) { + Error("xenixKbdProc: cannot attach mouse and keyboard\n"); + return (!Success); + } + + pKeyboard->devicePrivate = (pointer)&sysKbPriv; + pKeyboard->on = FALSE; + sysKbCtrl = defaultKeyboardControl; + sysKbPriv.ctrl = &sysKbCtrl; + + sysKbPriv.type = KBTYPE_IBMAT; + if (xenixKeySyms[sysKbPriv.type].minKeyCode < MIN_KEYCODE) { + int offset=MIN_KEYCODE-xenixKeySyms[sysKbPriv.type].minKeyCode; + + xenixKeySyms[sysKbPriv.type].minKeyCode += offset; + xenixKeySyms[sysKbPriv.type].maxKeyCode += offset; + sysKbPriv.offset = offset; + } + + /* set up keyboard for raw event generating mode */ + /* set up tty to raw mode */ + set_tty(0); + + InitKeyboardDeviceStruct( + pKeyboard, + &(xenixKeySyms[sysKbPriv.type]), + (xenixModMap[sysKbPriv.type]), + xenixBell, + xenixKbdCtrl); + break; + + case DEVICE_ON: + /* AddEnabledDevice(windowFd); + */ pKeyboard->on = TRUE; + break; + + case DEVICE_OFF: + /* RemoveEnabledDevice(kbdFd); + */ pKeyboard->on = FALSE; + break; + case DEVICE_CLOSE: + /* RemoveEnabledDevice(kbdFd); + */ pKeyboard->on = FALSE; + reset_tty(0); + ev_close(); + break; + } + return (Success); + } + + /*- + *----------------------------------------------------------------------- + * xenixBell -- + * Ring the terminal/keyboard bell + * + * Results: + * Ring the keyboard bell for an amount of time proportional to + * "loudness." + * + * Side Effects: + * None, really... + * + *----------------------------------------------------------------------- + */ + static void + xenixBell (loudness, pKeyboard) + int loudness; /* Percentage of full volume */ + DevicePtr pKeyboard; /* Keyboard to ring */ + { + static int bell_fd = -1; + + if (loudness == 0) { + return; + } + if (bell_fd < 0) + if ((bell_fd = open("/dev/bell", O_RDWR, 0)) < 0) { + ErrorF("xenixBell: cannot \"/dev/bell\"\n"); + return; + } + write(bell_fd, "\002", 1 ); + nap(loudness); + write(bell_fd,"\003",1); + } + + /*- + *----------------------------------------------------------------------- + * xenixKbdCtrl -- + * Alter some of the keyboard control parameters + * + * Results: + * None. + * + * Side Effects: + * Some... + * + *----------------------------------------------------------------------- + */ + static void + xenixKbdCtrl (pKeyboard, ctrl) + DevicePtr pKeyboard; /* Keyboard to alter */ + KeybdCtrl *ctrl; + { + /* LEDS */ + ioctl(0, KDSETLED, ctrl->leds); + /* keyboard click */ + click = ctrl->click; + } + + + /*- + *----------------------------------------------------------------------- + * xenixKbdProcessEvent -- + * + * Results: + * + * Side Effects: + * + * Caveat: + * To reduce duplication of code and logic (and therefore bugs), the + * xenixwindows version of kbd processing (xenixKbdProcessEventSunWin()) + * counterfeits a firm event and calls this routine. This + * couunterfeiting relies on the fact this this routine only looks at the + * id, time, and value fields of the firm event which it is passed. If + * this ever changes, the xenixKbdProcessEventSunWin will also have to + * change. + * + *----------------------------------------------------------------------- + */ + void + xenixKbdProcessEvent (pKeyboard, evp) + DevicePtr pKeyboard; + EVENT *evp; + { + xEvent xE; + int delta; + static xEvent autoRepeatEvent; + BYTE key; + CARD8 keyModifiers; + + /* we need to encode three states of the cap lock key */ + static int capsLockDown = 0; + static int capsLockOn = 0; + + #if OK + if (autoRepeatKeyDown && fe->id == AUTOREPEAT_EVENTID) { + pPriv = (KbPrivPtr) pKeyboard->devicePrivate; + if (pPriv->ctrl->autoRepeat != AutoRepeatModeOn) { + autoRepeatKeyDown = 0; + return; + } + /* + * Generate auto repeat event. XXX one for now. + * Update time & pointer location of saved KeyPress event. + */ + if (autoRepeatDebug) + ErrorF("xenixKbdProcessEvent: autoRepeatKeyDown = %d\n", + autoRepeatKeyDown); + + delta = TVTOMILLI(autoRepeatDeltaTv); + autoRepeatFirst = FALSE; + + /* + * Fake a key up event and a key down event + * for the last key pressed. + */ + autoRepeatEvent.u.keyButtonPointer.time += delta; + miPointerPosition (screenInfo.screens[0], + &autoRepeatEvent.u.keyButtonPointer.rootX, + &autoRepeatEvent.u.keyButtonPointer.rootY); + autoRepeatEvent.u.u.type = KeyRelease; + (* pKeyboard->processInputProc) (&autoRepeatEvent, pKeyboard, 1); + + autoRepeatEvent.u.u.type = KeyPress; + (* pKeyboard->processInputProc) (&autoRepeatEvent, pKeyboard, 1); + + /* Update time of last key down */ + tvplus(autoRepeatLastKeyDownTv, autoRepeatLastKeyDownTv, + autoRepeatDeltaTv); + + return; + } + #endif + + key = EV_BUF(*evp)[0]; + + /* caps lock flip flop */ + if (key == (0x80 | keyCodeCapsLock)) { + capsLockDown = 0; + return; + } + + if (key == keyCodeCapsLock) { + if (capsLockDown) + return; + else + capsLockDown = 1; + + if (capsLockOn) { + EV_BUF(*evp)[0] |= 0x80; + capsLockOn = 0; + } + else + { + capsLockOn = 1; + } + } + + /* keyboard click */ + if (!(key & 0x80)) + if (click >= 0) + xenixBell(click, pKeyboard); + + key &= 0x7f; + + /* + keyModifiers = ((DeviceIntPtr)pKeyboard)->key->modifierMap[key]; + */ + keyModifiers = ibmAT101ModMap[key]; + key += sysKbPriv.offset; + + if (autoRepeatKeyDown && (keyModifiers == 0) && + (!(EV_BUF(*evp)[0] & 0x80) || (key == autoRepeatEvent.u.u.detail))) { + /* + * Kill AutoRepeater on any real non-modifier key down, or auto key up + */ + autoRepeatKeyDown = 0; + if (autoRepeatDebug) + ErrorF("xenixKbdProcessEvent: autoRepeat off\n"); + } + + xE.u.keyButtonPointer.time = EV_TIME(*evp); + miPointerPosition (screenInfo.screens[0], + &xE.u.keyButtonPointer.rootX, + &xE.u.keyButtonPointer.rootY); + xE.u.u.type = ((EV_BUF(*evp)[0] & 0x80) ? KeyRelease : KeyPress); + xE.u.u.detail = key; + + #if OK + if (keyModifiers & LockMask) { + if (xE.u.u.type == KeyRelease) + return; /* this assumes autorepeat is not desired */ + if (BitIsOn(((DeviceIntPtr)pKeyboard)->key->down, key)) + xE.u.u.type = KeyRelease; + } + + if ((xE.u.u.type == KeyPress) && (keyModifiers == 0)) { + /* initialize new AutoRepeater event & mark AutoRepeater on */ + if (autoRepeatDebug) + ErrorF("xenixKbdProcessEvent: VKEY_DOWN\n"); + autoRepeatEvent = xE; + autoRepeatFirst = TRUE; + autoRepeatKeyDown++; + autoRepeatLastKeyDownTv = EV_TIME(*evp); + } + #endif + (* pKeyboard->processInputProc) (&xE, pKeyboard, 1); + } + + /*- + *----------------------------------------------------------------------- + * xenixDoneEvents -- + * Nothing to do, here... + * + * Results: + * + * Side Effects: + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static void + xenixKbdDoneEvents (pKeyboard) + DevicePtr pKeyboard; + { + + } + + /*ARGSUSED*/ + Bool + LegalModifier(key) + { + return (TRUE); + } + + static KeybdCtrl *pKbdCtrl = (KeybdCtrl *) 0; + + /*ARGSUSED*/ + void + xenixBlockHandler(nscreen, pbdata, pptv, pReadmask) + int nscreen; + pointer pbdata; + struct timeval **pptv; + pointer pReadmask; + { + static struct timeval artv = { 0, 0 }; /* autorepeat timeval */ + #if OK + if (!autoRepeatKeyDown) + return; + + if (pKbdCtrl == (KeybdCtrl *) 0) + pKbdCtrl = ((KbPrivPtr) LookupKeyboardDevice()->devicePrivate)->ctrl; + + if (pKbdCtrl->autoRepeat != AutoRepeatModeOn) + return; + + if (autoRepeatFirst == TRUE) + artv.tv_usec = autoRepeatInitiate; + else + artv.tv_usec = autoRepeatDelay; + *pptv = &artv; + + if (autoRepeatDebug) + ErrorF("xenixBlockHandler(%d,%d): \n", artv.tv_sec, artv.tv_usec); + #endif + } + + /*ARGSUSED*/ + void + xenixWakeupHandler(nscreen, pbdata, err, pReadmask) + int nscreen; + pointer pbdata; + unsigned long err; + pointer pReadmask; + { + struct timeval tv; + #if OK + if (autoRepeatDebug) + ErrorF("xenixWakeupHandler(ar=%d, err=%d):\n", autoRepeatKeyDown, err); + + if (pKbdCtrl == (KeybdCtrl *) 0) + pKbdCtrl = ((KbPrivPtr) LookupKeyboardDevice()->devicePrivate)->ctrl; + + if (pKbdCtrl->autoRepeat != AutoRepeatModeOn) + return; + + if (autoRepeatKeyDown) { + gettimeofday(&tv, (struct timezone *) NULL); + tvminus(autoRepeatDeltaTv, tv, autoRepeatLastKeyDownTv); + if (autoRepeatDeltaTv.tv_sec > 0 || + (!autoRepeatFirst && autoRepeatDeltaTv.tv_usec > + autoRepeatDelay) || + (autoRepeatDeltaTv.tv_usec > + autoRepeatInitiate)) + autoRepeatReady++; + } + + if (autoRepeatReady) + ProcessInputEvents(); + autoRepeatReady = 0; + #endif + }
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixMouse.c Sun Jan 6 01:03:40 1991 --- X11R4/mit/server/ddx/xenix/trident/xenixMouse.c Sun Dec 9 18:53:08 1990 *************** *** 0 **** --- 1,367 ---- + /* + * xenixMouse.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * sunMouse.c -- + * Functions for playing cat and mouse... sorry. + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #define NEED_EVENTS + + #include "xenix.h" + #include "mipointer.h" + #include "misprite.h" + + #define ABS(a) (((a)>0)?(a):-(a)) + + Bool ActiveZaphod = TRUE; + + extern void xenixSuspendX(); + + static long xenixEventTime(); + static Bool xenixCursorOffScreen(); + static void xenixCrossScreen(); + extern void miPointerQueueEvent(); + + miPointerCursorFuncRec xenixPointerCursorFuncs = { + xenixEventTime, + xenixCursorOffScreen, + xenixCrossScreen, + miPointerQueueEvent, + }; + + typedef struct { + int bmask; /* Current button state */ + Bool mouseMoved; /* Mouse has moved */ + } XenixMsPrivRec, *XenixMsPrivPtr; + + static void xenixMouseCtrl(); + static int xenixMouseGetMotionEvents(); + void xenixMouseProcessEvent(); + static void xenixMouseDoneEvents(); + + static XenixMsPrivRec xenixMousePriv; + static PtrPrivRec sysMousePriv = { + xenixMouseProcessEvent, /* Function to process an event */ + xenixMouseDoneEvents, /* When all the events have been */ + /* handled, this function will be */ + /* called. */ + 0, /* Current X coordinate of pointer */ + 0, /* Current Y coordinate */ + (pointer)&xenixMousePriv, /* Field private to device */ + }; + + /*- + *----------------------------------------------------------------------- + * xenixMouseProc -- + * Handle the initialization, etc. of a mouse + * + * Results: + * none. + * + * Side Effects: + * + * Note: + * When using xenixwindows, all input comes off a single fd, stored in the + * global windowFd. Therefore, only one device should be enabled and + * disabled, even though the application still sees both mouse and + * keyboard. We have arbitrarily chosen to enable and disable windowFd + * in the keyboard routine xenixKbdProc rather than in xenixMouseProc. + * + *----------------------------------------------------------------------- + */ + int + xenixMouseProc (pMouse, what) + DevicePtr pMouse; /* Mouse to play with */ + int what; /* What to do with it */ + { + register int fd; + int format; + static int oformat; + BYTE map[4]; + + switch (what) { + case DEVICE_INIT: + if (pMouse != LookupPointerDevice()) { + ErrorF ("Cannot open non-system mouse"); + return (!Success); + } + + sysMousePriv.x = 0; + sysMousePriv.y = 0; + + xenixMousePriv.mouseMoved = FALSE; + pMouse->devicePrivate = (pointer) &sysMousePriv; + + pMouse->on = FALSE; + map[1] = 1; + map[2] = 2; + map[3] = 3; + InitPointerDeviceStruct( + pMouse, map, 3, xenixMouseGetMotionEvents, xenixMouseCtrl, 0); + break; + + case DEVICE_ON: + + /* AddEnabledDevice (((PtrPrivPtr)pMouse->devicePrivate)->fd); + */ + pMouse->on = TRUE; + break; + + case DEVICE_CLOSE: + break; + + case DEVICE_OFF: + /* RemoveEnabledDevice (((PtrPrivPtr)pMouse->devicePrivate)->fd); + */ pMouse->on = FALSE; + break; + } + return (Success); + } + + /*- + *----------------------------------------------------------------------- + * xenixMouseCtrl -- + * Alter the control parameters for the mouse. Since acceleration + * etc. is done from the PtrCtrl record in the mouse's device record, + * there's nothing to do here. + * + * Results: + * None. + * + * Side Effects: + * None. + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static void + xenixMouseCtrl (pMouse) + DevicePtr pMouse; + { + } + + /*- + *----------------------------------------------------------------------- + * xenixMouseGetMotionEvents -- + * Return the (number of) motion events in the "motion history + * buffer" (snicker) between the given times. + * + * Results: + * The number of events stuffed. + * + * Side Effects: + * The relevant xTimecoord's are stuffed in the passed memory. + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static int + xenixMouseGetMotionEvents (buff, start, stop, pScreen) + CARD32 start, stop; + xTimecoord *buff; + ScreenPtr pScreen; + { + return 0; + } + + + /*- + *----------------------------------------------------------------------- + * xenixMouseProcessEvent -- + * Given a Firm_event for a mouse, pass it off the the dix layer + * properly converted... + * + * Results: + * None. + * + * Side Effects: + * The cursor may be redrawn...? devPrivate/x/y will be altered. + * + *----------------------------------------------------------------------- + */ + void + xenixMouseProcessEvent (pMouse, evp) + DevicePtr pMouse; /* Mouse from which the event came */ + EVENT *evp; /* Event to process */ + { + xEvent xE; + register XenixMsPrivPtr pXenixPriv; /* Private data for mouse */ + static int button = 0; /* previous button state */ + int b; /* current button state */ + int bKey; /* button value expected by X */ + static int mouseMoved = 0; + + + xE.u.keyButtonPointer.time = EV_TIME(*evp); + + if (EV_TAG(*evp) & T_BUTTON) { + b = EV_BUTTONS(*evp); + + if (b == 7) { + xenixSuspendX(); + return; + } + switch (ABS(b - button)) { + case LT_BUTTON: bKey = 1; break; + case MD_BUTTON: bKey = 2; break; + case RT_BUTTON: bKey = 3; break; + default: return; + } + /* + * A button changed state. Sometimes we will get two events + * for a single state change. Should we get a button event which + * reflects the current state of affairs, that event is discarded. + * + * Mouse buttons start at 1. + */ + xE.u.u.detail = bKey; + if (button - b > 0) + xE.u.u.type = ButtonRelease; + else + xE.u.u.type = ButtonPress; + button = b; + + /* + * If the mouse has moved, we must update any interested client + * as well as DIX before sending a button event along. + */ + if (mouseMoved) { + xenixMouseDoneEvents (pMouse, FALSE); + } + + miPointerPosition (screenInfo.screens[0], + &xE.u.keyButtonPointer.rootX, + &xE.u.keyButtonPointer.rootY); + + (* pMouse->processInputProc) (&xE, pMouse, 1); + } + if (EV_TAG(*evp) & T_REL_LOCATOR) { + miPointerDeltaCursor (screenInfo.screens[0], + EV_DX(*evp), + -EV_DY(*evp), + TRUE); + } + } + + /*ARGSUSED*/ + static Bool + xenixCursorOffScreen (pScreen, x, y) + ScreenPtr *pScreen; + int *x, *y; + { + int index; + + /* + * Active Zaphod implementation: + * increment or decrement the current screen + * if the x is to the right or the left of + * the current screen. + */ + if (ActiveZaphod && + screenInfo.numScreens > 1 && (*x >= (*pScreen)->width || *x < 0)) + { + index = (*pScreen)->myNum; + if (*x < 0) + { + index = (index ? index : screenInfo.numScreens) - 1; + *pScreen = screenInfo.screens[index]; + *x += (*pScreen)->width; + } + else + { + *x -= (*pScreen)->width; + index = (index + 1) % screenInfo.numScreens; + *pScreen = screenInfo.screens[index]; + } + return TRUE; + } + return FALSE; + } + + /*ARGSUSED*/ + static long + xenixEventTime (pScreen) + ScreenPtr pScreen; + { + return lastEventTime; + } + + static void + xenixCrossScreen (pScreen, entering) + ScreenPtr pScreen; + Bool entering; + { + uchar_t select; + + select = 1; + if (entering) + select = 0; + if (xenixFbs[pScreen->myNum].EnterLeave) + (*xenixFbs[pScreen->myNum].EnterLeave) (pScreen, select); + } + + /*- + *----------------------------------------------------------------------- + * xenixMouseDoneEvents -- + * Finish off any mouse motions we haven't done yet. (At the moment + * this code is unused since we never save mouse motions as I'm + * unsure of the effect of getting a keystroke at a given [x,y] w/o + * having gotten a motion event to that [x,y]) + * + * Results: + * None. + * + * Side Effects: + * A MotionNotify event may be generated. + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static void + xenixMouseDoneEvents (pMouse,final) + DevicePtr pMouse; + Bool final; + { + } *** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixTty.c Sun Jan 6 01:03:43 1991 --- X11R4/mit/server/ddx/xenix/trident/xenixTty.c Thu Dec 13 20:51:26 1990 *************** *** 0 **** --- 1,41 ---- + /* + * xenixTty.c + */ + + #include <sys/types.h> + #include <sys/vtkd.h> + #include <sgtty.h> + + int + set_tty(file) + int file; + { + set_mode(file,RAW,ECHO,0); + ioctl(file, KDSKBMODE, K_RAW); + } + + int + reset_tty(file) + int file; + { + ioctl(file, KDSKBMODE, K_XLATE); + set_mode(file,ECHO,RAW,0); + } + + static int + set_mode(file,on,off,speed) + int file; + int on; + int off; + { + struct sgttyb buff; + + gtty(file,&buff); + buff.sg_flags |= on; + buff.sg_flags &= ~off; + if (speed) + buff.sg_ispeed = buff.sg_ospeed = speed; + stty(file,&buff); + return(0); + } + *** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixInit.c Sun Jan 6 01:03:45 1991 --- X11R4/mit/server/ddx/xenix/trident/xenixInit.c Fri Dec 14 00:09:36 1990 *************** *** 0 **** --- 1,427 ---- + /* + * xenixInit.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #include "xenix.h" + #include <servermd.h> + #include "dixstruct.h" + #include "dix.h" + #include "opaque.h" + #include "mipointer.h" + + extern int xenixMouseProc(), xenixKbdProc(); + extern Bool xenixVGAProbe(), xenixVGACreate(); + + extern void ProcessInputEvents(); + extern void SetInputCheck(); + + extern char *strncpy(); + extern GCPtr CreateScratchGC(); + + #define XDEVICE "XDEVICE" + + int xenixEventPending = 0; /* For use with SetInputCheck */ + static int autoRepeatHandlersInstalled; /* FALSE each time InitOutput called */ + + static Bool xenixDevsProbed = FALSE; + Bool xenixSupportsDepth8 = FALSE; + unsigned long xenixGeneration = 0; + + extern int xenixCheckEvent(); + + static void + xenixBlock(blockData, pptv, pReadmask) + int *blockData; + int *pptv; + int *pReadmask; + { + if (xenixCheckEvent()) + xenixEventPending = 1; + } + static void + xenixWakeup(blockData, pptv, pReadmask) + int *blockData; + int *pptv; + int *pReadmask; + { + /* nothing */ + } + + xenixFbDataRec xenixFbData[] = { + xenixVGAProbe, "/dev/fb", xenixVGACreate, + xenixVGAProbe, "/dev/fb", xenixVGACreate, + }; + + #define NUMSCREENS (sizeof(xenixFbData)/sizeof(xenixFbData[0])) + #define NUMDEVICES 2 + + fbFd xenixFbs[NUMDEVICES]; + + static PixmapFormatRec formats[] = { + 1, 1, BITMAP_SCANLINE_PAD, /* 1-bit deep */ + 8, 8, BITMAP_SCANLINE_PAD, /* 8-bit deep */ + }; + #define NUMFORMATS (sizeof formats)/(sizeof formats[0]) + + /*- + *----------------------------------------------------------------------- + * InitOutput -- + * Initialize screenInfo for all actually accessible framebuffers. + * The + * + * Results: + * screenInfo init proc field set + * + * Side Effects: + * None + * + *----------------------------------------------------------------------- + */ + + InitOutput(pScreenInfo, argc, argv) + ScreenInfo *pScreenInfo; + int argc; + char **argv; + { + int i, n, dev; + int nonBlockConsole = 1; + static int setup_on_exit = 0; + int devStart = 1; + + if (!monitorResolution) + monitorResolution = 90; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i],"-debug")) + nonBlockConsole = 0; + else if (!strcmp(argv[i],"-mono")) + devStart = 0; + } + + pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; + pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + + pScreenInfo->numPixmapFormats = NUMFORMATS; + for (i=0; i< NUMFORMATS; i++) + pScreenInfo->formats[i] = formats[i]; + + autoRepeatHandlersInstalled = FALSE; + + if (!xenixDevsProbed) + { + n = 0; + for (i = NUMSCREENS, dev = devStart; --i > 0; dev++) { + if ((*xenixFbData[dev].probeProc)(pScreenInfo, n, dev, argc, argv)) + n++; + else + xenixFbData[dev].createProc = (Bool(*)()) NULL; + } + xenixDevsProbed = TRUE; + if (n == 0) + return; + } + if (!xenixSupportsDepth8) + pScreenInfo->numPixmapFormats--; + for (i = NUMSCREENS, dev = devStart; --i > 0; dev++) { + if (xenixFbData[dev].createProc) + (*xenixFbData[dev].createProc)(pScreenInfo, argc, argv); + } + xenixGeneration = serverGeneration; + xenixInitCursor(); + } + + /*- + *----------------------------------------------------------------------- + * InitInput -- + * Initialize all supported input devices...what else is there + * besides pointer and keyboard? + * + * Results: + * None. + * + * Side Effects: + * Two DeviceRec's are allocated and registered as the system pointer + * and keyboard devices. + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + InitInput(argc, argv) + int argc; + char **argv; + { + DevicePtr p, k; + static int zero = 0; + + p = AddInputDevice(xenixMouseProc, TRUE); + k = AddInputDevice(xenixKbdProc, TRUE); + if (!p || !k) + FatalError("failed to create input devices in InitInput"); + + RegisterPointerDevice(p); + RegisterKeyboardDevice(k); + miRegisterPointerDevice(screenInfo.screens[0], p); + + if (RegisterBlockAndWakeupHandlers(xenixBlock, xenixWakeup, 0) == FALSE) + ErrorF("InitInput: RegisterBlockAndWakeupHandlers() failed\n"); + + SetInputCheck (&zero, &xenixEventPending); + } + + /*- + *----------------------------------------------------------------------- + * xenixScreenInit -- + * Things which must be done for all types of frame buffers... + * Should be called last of all. + * + * Results: + * TRUE if successful, else FALSE + * + * Side Effects: + * Both a BlockHandler and a WakeupHandler are installed for the + * first screen. Together, these handlers implement autorepeat + * keystrokes on the Xenix. + * + *----------------------------------------------------------------------- + */ + Bool + xenixScreenInit (pScreen) + ScreenPtr pScreen; + { + extern void xenixBlockHandler(); + extern void xenixWakeupHandler(); + static ScreenPtr autoRepeatScreen; + + extern miPointerCursorFuncRec xenixPointerCursorFuncs; + + /* + * Block/Unblock handlers + */ + + if (autoRepeatHandlersInstalled == FALSE) { + autoRepeatScreen = pScreen; + autoRepeatHandlersInstalled = TRUE; + } + + if (pScreen == autoRepeatScreen) { + pScreen->BlockHandler = xenixBlockHandler; + pScreen->WakeupHandler = xenixWakeupHandler; + } + + miDCInitialize (pScreen, &xenixPointerCursorFuncs); + + return TRUE; + } + + + extern char *getenv(); + + /*- + *----------------------------------------------------------------------- + * nthdev -- + * Return the nth device in a colon-separated list of devices. + * n is 0-origin. + * + * Results: + * A pointer to a STATIC string which is the device name. + * + * Side Effects: + * None. + * + *----------------------------------------------------------------------- + */ + static char * + nthdev (dList, n) + register char *dList; /* Colon-separated device names */ + int n; /* Device number wanted */ + { + char *result; + static char returnstring[100]; + + while (n--) { + while (*dList && *dList != ':') { + dList++; + } + } + if (*dList) { + register char *cp = dList; + + while (*cp && *cp != ':') { + cp++; + } + result = returnstring; + strncpy (result, dList, cp - dList); + result[cp - dList] = '\0'; + } else { + result = (char *)0; + } + return (result); + } + + /*- + *----------------------------------------------------------------------- + * xenixOpenFrameBuffer -- + * Open a frame buffer according to several rules. If running under + * overview and we're set up for it, use the device given in the + * PARENT envariable and note that the screen is under overview. + * Else find the device to use by looking in the xenixFbData table, + * an XDEVICE envariable, a -dev switch or using /dev/fb if trying + * to open screen 0 and all else has failed. + * + * Results: + * The fd of the framebuffer. + * + * Side Effects: + * + *----------------------------------------------------------------------- + */ + int + xenixOpenFrameBuffer(expect, index, fbNum, argc, argv) + int expect; /* The expected type of framebuffer */ + int fbNum; /* Index into the xenixFbData array */ + int index; /* Screen index */ + int argc; /* Command-line arguments... */ + char **argv; /* ... */ + { + char *name=(char *)0; + int i; /* Index into argument list */ + int fd = -1; /* Descriptor to device */ + static int devFbUsed=FALSE; /* true if /dev/fb has been used for a */ + /* screen already */ + static Bool inited = FALSE; + static char *xdevice; /* string of devices to use from environ */ + static char *devsw; /* string of devices from args */ + int type; + + if (!inited) { + xdevice = devsw = (char *)NULL; + + xdevice = getenv (XDEVICE); + /* + * Look for an argument of the form -dev <device-string> + * If such a one is found place the <device-string> in devsw. + */ + for (i = 1; i < argc; i++) { + if ((strcmp(argv[i], "-dev") == 0) && (i + 1 < argc)) { + devsw = argv[i+1]; + break; + } + } + inited = TRUE; + } + + /* + * Attempt to find a file name for the frame buffer + */ + + /* + * First see if any device was given on the command line. + * If one was and the device is both readable and writeable, + * set 'name' to it, else set it to NULL. + */ + if (devsw == (char *)NULL || + (name = nthdev (devsw, index)) == (char *)NULL || + (access (name, R_OK | W_OK) != 0) || + (strcmp(name, xenixFbData[fbNum].devName) != 0)) { + name = (char *)NULL; + } + + /* + * If we still don't have a device for this screen, check the + * environment variable for one. If one was given, stick its + * path in name and check its accessibility. If it's not + * properly accessible, then reset the name to NULL to force the + * checking of the xenixFbData array. + */ + if (devsw == (char *)NULL && name == (char *)NULL && + xdevice != (char *)NULL && + (name = nthdev(xdevice, index)) != (char *)NULL && + (access (name, R_OK | W_OK) != 0)) { + name = (char *)NULL; + } + + /* + * Take the device given in the frame buffer description + * and see if it exists and is accessible. If it does/is, + * we will use it, as long as no other device was given. + */ + if (devsw == (char *)NULL && name == (char *)NULL && + access(xenixFbData[fbNum].devName, (R_OK | W_OK)) == 0) { + name = xenixFbData[fbNum].devName; + } + + /* + * If we still have nothing and have yet to use "/dev/vga" for + * a screen, default the name to be "/dev/vga" + */ + if (devsw == (char *)NULL && name == (char *)NULL && !devFbUsed) { + name = "/dev/vga"; + } + + if (name) { + fd = open(name, O_RDWR, 0); + if (fd < 0) { + return (-1); + } + /* init screen here */ + } + + if (name && strcmp (name, "/dev/vga") == 0) { + devFbUsed = TRUE; + } + + return (fd); + } + + /*****************************************************************************/ + + void + xenixInitCursor() + { + } + + *** X11R4.ORIG/mit/server/ddx/xenix/trident/xenix.h Sun Jan 6 01:03:48 1991 --- X11R4/mit/server/ddx/xenix/trident/xenix.h Sun Dec 9 18:52:38 1990 *************** *** 0 **** --- 1,241 ---- + /* + * xenix.h Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * sun.h -- + * Internal declarations for the sun ddx interface + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * "$XConsortium: sun.h,v 5.7 89/12/06 09:37:35 rws Exp $ SPRITE (Berkeley)" + */ + + #ifndef _XENIX_H_ + #define _XENIX_H_ + + #include <errno.h> + extern int errno; + #include <sys/param.h> + #include <sys/types.h> + #include <sys/select.h> + #include <sys/file.h> + #include <sys/fcntl.h> + #include <sys/signal.h> + #include <unistd.h> + + #include <sys/termio.h> + #include <sys/machdep.h> + #include <sys/sysmacros.h> + + #define PGSIZE ctob(1) + + #include <sys/event.h> + #include <mouse.h> + #include <sys/vtkd.h> + + #include "xenixDevInfo.h" + + #include "X.h" + #include "Xproto.h" + #include "scrnintstr.h" + #include "screenint.h" + #ifdef NEED_EVENTS + #include "inputstr.h" + #endif NEED_EVENTS + #include "input.h" + #include "cursorstr.h" + #include "cursor.h" + #include "pixmapstr.h" + #include "pixmap.h" + #include "windowstr.h" + #include "gc.h" + #include "gcstruct.h" + #include "regionstr.h" + #include "colormap.h" + #include "miscstruct.h" + #include "dix.h" + #include "mfb.h" + #include "mi.h" + + /* + * MAXEVENTS is the maximum number of events the mouse and keyboard functions + * will read on a given call to their GetEvents vectors. + */ + #define MAXEVENTS 32 + + KeybdCtrl *ctrl; /* Current control structure (for + * keyclick, bell duration, auto- + * repeat, etc.) */ + + typedef struct kbPrivate { + int type; /* Type of keyboard */ + void (*ProcessEvent)(); /* Function to process an event */ + void (*DoneEvents)(); /* Function called when all events */ + /* have been handled. */ + pointer devPrivate; /* Private to keyboard device */ + int offset; /* to be added to device keycodes */ + KeybdCtrl *ctrl; /* Current control structure (for + * keyclick, bell duration, auto- + * repeat, etc.) */ + } KbPrivRec, *KbPrivPtr; + + #define MIN_KEYCODE 8 /* necessary to avoid the mouse buttons */ + + typedef struct ptrPrivate { + void (*ProcessEvent)(); /* Function to process an event */ + void (*DoneEvents)(); /* When all the events have been */ + /* handled, this function will be */ + /* called. */ + short x, /* Current X coordinate of pointer */ + y; /* Current Y coordinate */ + pointer devPrivate; /* Field private to device */ + } PtrPrivRec, *PtrPrivPtr; + + + /* + * Cursor-private data + * screenBits saves the contents of the screen before the cursor + * was placed in the frame buffer. + * source a bitmap for placing the foreground pixels down + * srcGC a GC for placing the foreground pixels down. + * Prevalidated for the cursor's screen. + * invSource a bitmap for placing the background pixels down. + * invSrcGC a GC for placing the background pixels down. + * Also prevalidated for the cursor's screen Pixmap. + * temp a temporary pixmap for low-flicker cursor motion -- + * exists to avoid the overhead of creating a pixmap + * whenever the cursor must be moved. + * fg, bg foreground and background pixels. For a color display, + * these are allocated once and the rgb values changed + * when the cursor is recolored. + * scrX, scrY the coordinate on the screen of the upper-left corner + * of screenBits. + * state one of CR_IN, CR_OUT and CR_XING to track whether the + * cursor is in or out of the frame buffer or is in the + * process of going from one state to the other. + */ + typedef enum { + CR_IN, /* Cursor in frame buffer */ + CR_OUT, /* Cursor out of frame buffer */ + CR_XING /* Cursor in flux */ + } CrState; + + typedef struct crPrivate { + PixmapPtr screenBits; /* Screen before cursor put down */ + PixmapPtr source; /* Cursor source (foreground bits) */ + GCPtr srcGC; /* Foreground GC */ + PixmapPtr invSource; /* Cursor source inverted (background) */ + GCPtr invSrcGC; /* Background GC */ + PixmapPtr temp; /* Temporary pixmap for merging screenBits + * and the sources. Saves creation time */ + Pixel fg; /* Foreground color */ + Pixel bg; /* Background color */ + int scrX, /* Screen X coordinate of screenBits */ + scrY; /* Screen Y coordinate of screenBits */ + CrState state; /* Current state of the cursor */ + } CrPrivRec, *CrPrivPtr; + + /* + * Frame-buffer-private info. + * fd file opened to the frame buffer device. + * info description of the frame buffer -- type, height, depth, + * width, etc. + * fb pointer to the mapped image of the frame buffer. Used + * by the driving routines for the specific frame buffer + * type. + * mapped flag set true by the driver when the frame buffer has + * been mapped in. + * parent set true if the frame buffer is actually a SunWindows + * window. + * fbPriv Data private to the frame buffer type. + */ + typedef struct { + pointer fb; /* Frame buffer itself */ + Bool mapped; /* TRUE if frame buffer already mapped */ + int fd; /* Descriptor open to frame buffer */ + int fb_width; + int fb_height; + int fb_size; + void (*EnterLeave)(); /* screen switch */ + pointer fbPriv; /* Frame-buffer-dependent data */ + } fbFd; + + extern Bool xenixSupportsDepth8; + extern unsigned long xenixGeneration; + + typedef struct _xenixFbDataRec { + Bool (*probeProc)(); /* probe procedure for this fb */ + char *devName; /* device filename */ + Bool (*createProc)(); /* create procedure for this fb */ + } xenixFbDataRec; + + extern xenixFbDataRec xenixFbData[]; + /* + * Cursor functions + */ + extern void xenixInitCursor(); + + /* + * Initialization + */ + extern Bool xenixScreenInit(); + extern int xenixOpenFrameBuffer(); + + extern fbFd xenixFbs[]; + + extern int lastEventTime; /* Time (in ms.) of last event */ + extern void SetTimeSinceLastInputEvent(); + + extern int monitorResolution; + + #define AUTOREPEAT_INITIATE (200) /* milliseconds */ + #define AUTOREPEAT_DELAY (50) /* milliseconds */ + /* + * We signal autorepeat events with the unique Firm_event + * id AUTOREPEAT_EVENTID. + * Because inputevent ie_code is set to Firm_event ids in + * sunKbdProcessEventSunWin, and ie_code is short whereas + * Firm_event id is u_short, we use 0x7fff. + */ + #define AUTOREPEAT_EVENTID (0x7fff) /* AutoRepeat Firm_event id */ + + extern int autoRepeatKeyDown; /* TRUE if key down */ + extern int autoRepeatReady; /* TRUE if time out */ + extern int autoRepeatDebug; /* TRUE if debugging */ + extern long autoRepeatInitiate; + extern long autoRepeatDelay; + extern struct timeval autoRepeatLastKeyDownTv; + extern struct timeval autoRepeatDeltaTv; + + #define tvminus(tv, tv1, tv2) /* tv = tv1 - tv2 */ \ + if ((tv1).tv_usec < (tv2).tv_usec) { \ + (tv1).tv_usec += 1000000; \ + (tv1).tv_sec -= 1; \ + } \ + (tv).tv_usec = (tv1).tv_usec - (tv2).tv_usec; \ + (tv).tv_sec = (tv1).tv_sec - (tv2).tv_sec; + + #define tvplus(tv, tv1, tv2) /* tv = tv1 + tv2 */ \ + (tv).tv_sec = (tv1).tv_sec + (tv2).tv_sec; \ + (tv).tv_usec = (tv1).tv_usec + (tv2).tv_usec; \ + if ((tv).tv_usec > 1000000) { \ + (tv).tv_usec -= 1000000; \ + (tv).tv_sec += 1; \ + } + + /*- + * TVTOMILLI(tv) + * Given a struct timeval, convert its time into milliseconds... + */ + #define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000)) + + #endif _XENIX_H_
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixDevInfo.h Sun Jan 6 01:03:51 1991 --- X11R4/mit/server/ddx/xenix/trident/xenixDevInfo.h Sun Jan 6 00:45:47 1991 *************** *** 0 **** --- 1,67 ---- + /* + * xenixDevInfo.h By Chain Lee 08/90 + */ + + /************************************************************************\ + * Set following definitions to the mode you desire * + * Note that only VGA[2,3,4] are actually supported here * + \************************************************************************/ + + #define FBTYPE FBTYPE_VGA3 + #define FBWIDTH VGA3_FBWIDTH + #define FBHEIGHT VGA3_FBHEIGHT + #define FBSIZE VGA3_FBSIZE + #define SETMODE VGA3_SETMODE + + /************************************************************************\ + * Do not change following definitions * + \************************************************************************/ + + /* + * to be for multiscreen support + */ + + #define FBTYPE_HERCULES 1 /* 720 x 348 */ + #define FBTYPE_CGA 2 /* 640 x 200 */ + #define FBTYPE_EGA 3 /* 640 x 350 */ + #define FBTYPE_VGA 4 /* 640 x 480 */ + #define FBTYPE_VGA1 4 /* 640 x 480 */ + #define FBTYPE_VGA2 5 /* 800 x 600 */ + #define FBTYPE_VGA3 6 /* 1024 x 600 */ + #define FBTYPE_VGA4 7 /* 1024 x 768 interlaced */ + #define FBTYPE_VGA5 8 /* 640 x 480 color */ + + #define HERCULES_FBWIDTH 720 + #define HERCULES_FBHEIGHT 348 + #define HERCULES_FBSIZE (1024 * 32) + + #define VGA1_FBWIDTH 640 + #define VGA1_FBHEIGHT 480 + #define VGA1_FBSIZE ((640 * 480) >> 3) + #define VGA1_SETMODE trident_vga1 + + #define VGA2_FBWIDTH 800 + #define VGA2_FBHEIGHT 600 + #define VGA2_FBSIZE ((800 * 600) >> 3) + #define VGA2_SETMODE trident_vga2 + + #define VGA3_FBWIDTH 1024 + #define VGA3_FBHEIGHT 600 + #define VGA3_FBSIZE ((1024 * 600) >> 3) + #define VGA3_SETMODE trident_vga3 + + #define VGA4_FBWIDTH 1024 + #define VGA4_FBHEIGHT 768 + #define VGA4_FBSIZE ((1024 * 768) >> 3) + #define VGA4_SETMODE trident_vga4 + + #define VGA5_FBWIDTH 640 + #define VGA5_FBHEIGHT 480 + #define VGA5_FBSIZE (640 * 480) + #define VGA5_SETMODE trident_vga5 + + /****************************************************************************/ + + #define KBTYPE_IBMAT 2 + + #include "vgaSave.h" *** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixVGA.c Sun Jan 6 01:03:53 1991 --- X11R4/mit/server/ddx/xenix/trident/xenixVGA.c Fri Dec 14 00:18:59 1990 *************** *** 0 **** --- 1,380 ---- + /* + * xenixVGA.c Modified for Xenix by Chain Lee 80/90 + */ + + /*- + * sunBW2.c -- + * Functions for handling the sun BWTWO board. + * + * Copyright (c) 1987 by the Regents of the University of California + * Copyright (c) 1987 by Adam de Boor, UC Berkeley + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #include "xenix.h" + #include "resource.h" + + typedef struct vga { + uchar_t image[FBSIZE]; /* Pixel buffer */ + } VGARec, *VGAPtr; + + static int xenixVGAScreenIndex; + int xenixVGAFd; + caddr_t xenixVGAFb; + static VGARec VGASaveFb; + + unsigned fg_red=255, fg_green=255, fg_blue=255; + unsigned bg_red=0, bg_green=0, bg_blue=0; + + static struct vga_video_hardware_state *VS; + static int fg_color = 15; bg_color = 1; + + static void xenixInitSwitcher(); + static int xenixInitVGAScreen(); + static void xenixVGASetScreen(), xenixVGAResetScreen(); + static void xenixVGASetcolor(), xenixVGAResetColor(); + static int xenixConsoleXMode; + static void xenixVGASaveFb(), xenixVGARestoreFb(); + + /*- + *----------------------------------------------------------------------- + * xenixVGASaveScreen -- + * Disable the video on the frame buffer to save the screen. + * + * Results: + * None. + * + * Side Effects: + * Video enable state changes. + * + *----------------------------------------------------------------------- + */ + static Bool + xenixVGASaveScreen (pScreen, on) + ScreenPtr pScreen; + Bool on; + { + int state = on; + int i; + + if (on != SCREEN_SAVER_ON) { + SetTimeSinceLastInputEvent(); + state = 1; + /* in case server reset and interlace turned off */ + outb(0x3d4, 0x1e); + #if FBTYPE == FBTYPE_VGA4 + outb(0x3d5, 0x04); + #else + outb(0x3d5, 0x00); + #endif + vgaSetColor(0, 0, 0, 0); + vgaSetColor(1, bg_red, bg_green, bg_blue); + vgaSetColor(63, fg_red, fg_green, fg_blue); + } else { + state = 0; + vgaSetColor(0, 0, 0, 0); + vgaSetColor(1, 0, 0, 0); + vgaSetColor(63, 0, 0, 0); + } + return TRUE; + } + + /*- + *----------------------------------------------------------------------- + * xenixVGACloseScreen -- + * called to ensure video is enabled when server exits. + * + * Results: + * Screen is unsaved. + * + * Side Effects: + * None + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static Bool + xenixVGACloseScreen(i, pScreen) + int i; + ScreenPtr pScreen; + { + Bool ret; + + pScreen->CloseScreen = (Bool (*)()) pScreen->devPrivates[xenixVGAScreenIndex].ptr; + ret = (*pScreen->CloseScreen) (i, pScreen); + (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF); + + /* Turn off interlaced mode */ + outb(0x3d4, 0x1e); + outb(0x3d5, 0x00); + + return ret; + } + + /*- + *----------------------------------------------------------------------- + * xenixVGAInit -- + * Attempt to find and initialize a VGA framebuffer + * + * Results: + * None + * + * Side Effects: + * Most of the elements of the ScreenRec are filled in. The + * video is enabled for the frame buffer... + * + *----------------------------------------------------------------------- + */ + /*ARGSUSED*/ + static Bool + xenixVGAInit (index, pScreen, argc, argv) + int index; /* The index of pScreen in the ScreenInfo */ + ScreenPtr pScreen; /* The Screen to initialize */ + int argc; /* The number of the Server's arguments. */ + char **argv; /* The arguments themselves. Don't change! */ + { + if (!mfbScreenInit(pScreen, + xenixFbs[index].fb, + xenixFbs[index].fb_width, + xenixFbs[index].fb_height, + monitorResolution, monitorResolution, + xenixFbs[index].fb_width)) + return (FALSE); + + pScreen->devPrivates[xenixVGAScreenIndex].ptr = (pointer) pScreen->CloseScreen; + + pScreen->CloseScreen = xenixVGACloseScreen; + pScreen->SaveScreen = xenixVGASaveScreen; + pScreen->blackPixel = 0; + pScreen->whitePixel = 1; + + /* + * Enable video output...? + */ + (void) xenixVGASaveScreen(pScreen, SCREEN_SAVER_FORCER); + + return (xenixScreenInit(pScreen) && mfbCreateDefColormap(pScreen)); + } + + /*- + *----------------------------------------------------------------------- + * xenixVGAProbe -- + * Attempt to find and initialize a VGA framebuffer + * + * Results: + * None + * + * Side Effects: + * Memory is allocated for the frame buffer and the buffer is mapped. + * + *----------------------------------------------------------------------- + */ + + /*ARGSUSED*/ + Bool + xenixVGAProbe(pScreenInfo, index, fbNum, argc, argv) + ScreenInfo *pScreenInfo; /* The screenInfo struct */ + int index; /* The index of pScreen in the ScreenInfo */ + int fbNum; /* Index into the xenixFbData array */ + int argc; /* The number of the Server's arguments. */ + char **argv; /* The arguments themselves. Don't change! */ + { + int fd; + caddr_t mapaddr; + + if ((fd = xenixOpenFrameBuffer(0, index, fbNum, argc, argv)) < 0) + return FALSE; + + if ((xenixVGAFd = open("/dev/vga", 0)) < 0) + return FALSE; + + if ((mapaddr = (caddr_t) xenixInitVGAScreen(fd)) < 0) + ErrorF("xenixVGAProbe: cannot open VGA screen\n"); + + xenixInitSwitcher(); + + xenixFbs[index].fb = (pointer)mapaddr; + xenixFbs[index].fd = fd; + xenixFbs[index].fb_width = FBWIDTH; + xenixFbs[index].fb_height = FBHEIGHT; + xenixFbs[index].fb_size = FBSIZE; + xenixFbs[index].EnterLeave = (void(*)()) NULL; + return TRUE; + } + + Bool + xenixVGACreate(pScreenInfo, argc, argv) + ScreenInfo *pScreenInfo; + int argc; + char **argv; + { + if (xenixGeneration != serverGeneration) + { + xenixVGAScreenIndex = AllocateScreenPrivateIndex(); + if (xenixVGAScreenIndex < 0) + return FALSE; + } + return (AddScreen(xenixVGAInit, argc, argv) >= 0); + } + + void + xenixSwitchConsoleMode() + { + if (xenixConsoleXMode) { + xenixVGASaveFb(); + xenixVGAResetColor(); + xenixVGAResetScreen(); + reset_tty(0); + xenixConsoleXMode = 0; + } else { + xenixVGASetScreen(); + xenixVGASetColor(); + xenixVGARestoreFb(); + set_tty(0); + xenixConsoleXMode = 1; + } + } + + static void + xenixInitSwitcher() + { + struct vt_mode smode; + + xenixConsoleXMode = 1; + return; + } + + static void + xenixVGASaveFb() + { + ulong_t *p, *q; + int i; + + i = FBSIZE / sizeof(ulong_t); + p = (ulong_t *) &VGASaveFb; + q = (ulong_t *) xenixVGAFb; + + while (i--) + *p++ = *q, *q++ = 0; + } + + static void + xenixVGARestoreFb() + { + ulong_t *p, *q; + int i; + + i = FBSIZE / sizeof(ulong_t); + p = (ulong_t *) &VGASaveFb; + q = (ulong_t *) xenixVGAFb; + + while (i--) + *q++ = *p++; + } + + static int + xenixInitVGAScreen(fd) + int fd; + { + int mapaddr; + char *color, *getenv(); + + if (color=getenv("XBACKGROUND")) + sscanf(color, "%d:%d:%d", &bg_red, &bg_green, &bg_blue); + if (color=getenv("XFOREGROUND")) + sscanf(color, "%d:%d:%d", &fg_red, &fg_green, &fg_blue); + + xenixVGASetScreen(); + mapaddr = ioctl(fd, 0, 0); + xenixVGAFb = (caddr_t) mapaddr; + xenixVGASetColor(); + return mapaddr; + } + + static void + xenixVGASetScreen() + { + ioctl(xenixVGAFd, SW_VGA11, 0); + + save_vga_state(VS); + SETMODE(VS); + restore_vga_state(VS); + outb(0x3ce, 0x06); + outb(0x3cf, inb(0x3cf)&0xf3); + + /* set interlace mode */ + outb(0x3d4, 0x1e); + #if FBTYPE == FBTYPE_VGA4 + outb(0x3d5, 0x04); + #else + outb(0x3d5, 0x00); + #endif + outb(0x3c4, 0); + outb(0x3c5, 1); + outb(0x3c5, 3); + } + + static void + xenixVGAResetScreen() + { + ioctl(xenixVGAFd, SW_VGA80x25, 0); + + /* Turn off interlace mode */ + outb(0x3d4, 0x1e); + outb(0x3d5, 0x00); + } + + static void + xenixVGASetColor() + { + int i; + + vgaSetColor(0, 0, 0, 0); + vgaSetColor(1, bg_red, bg_green, bg_blue); + vgaSetColor(63, fg_red, fg_green, fg_blue); + vga_color_init(xenixVGAFb,bg_color,fg_color,FBSIZE); + } + + static void + xenixVGAResetColor() + { + vga_color_init(xenixVGAFb,0,0,FBSIZE); + } + *** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixIo.c Sun Jan 6 01:03:56 1991 --- X11R4/mit/server/ddx/xenix/trident/xenixIo.c Sun Dec 9 18:53:33 1990 *************** *** 0 **** --- 1,321 ---- + /* + * xenixIo.c Modified for Xenix by Chain Lee 08/90 + */ + + /*- + * + * Copyright (c) 1987 by the Regents of the University of California + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #include "xenix.h" + #include "opaque.h" + + extern void + xenixSwitchConsoleMode(); + + int lastEventTime = 0; + extern int xenixSigIO; + extern int screenIsSaved; + extern void SaveScreens(); + + extern CARD8 ibmAT101SecondaryMap[]; + extern CARD8 keyCodePrefix1, keyCodePrefix2, keyCodeCapsLock; + + int xenixEventPending; + + int xenixIgnoreEvent = TRUE; + + void + xenixSuspendX() + { + EVENT *evp; + int i, n, done; + + xenixSwitchConsoleMode(); + + done = 0; + while (!done) { + nap(20); + n = ev_count(); + if (n <= 0) + continue; + for (i=0; i<n; i++) { + evp = ev_read(); + if (EV_TAG(*evp) & T_BUTTON) + if (EV_BUTTONS(*evp) != 7) { + done = 1; + break; + } + ev_pop(); + } + } + + done = 0; + while (!done) { + nap(20); + n = ev_count(); + if (n <= 0) + continue; + for (i=0; i<n; i++) { + evp = ev_read(); + if (EV_TAG(*evp) & T_BUTTON) + if (EV_BUTTONS(*evp) == 7) { + done = 1; + break; + } + ev_pop(); + } + } + + xenixSwitchConsoleMode(); + } + + /*- + *----------------------------------------------------------------------- + * TimeSinceLastInputEvent -- + * Function used for screensaver purposes by the os module. + * + * Results: + * The time in milliseconds since there last was any + * input. + * + * Side Effects: + * None. + * + *----------------------------------------------------------------------- + */ + int + TimeSinceLastInputEvent() + { + struct timeval now; + + gettimeofday (&now, (struct timezone *)0); + + if (lastEventTime == 0) { + lastEventTime = TVTOMILLI(now); + } + return TVTOMILLI(now) - lastEventTime; + } + + int + xenixCheckEvent() + { + int n = ev_count(); + + return (n > 0); + } + + /*- + *----------------------------------------------------------------------- + * ProcessInputEvents -- + * Retrieve all waiting input events and pass them to DIX in their + * correct chronological order. Only reads from the system pointer + * and keyboard. + * + * Results: + * None. + * + * Side Effects: + * Events are passed to the DIX layer. + * + *----------------------------------------------------------------------- + */ + void + ProcessInputEvents () + { + + EVENT *evp; + int i, n; + int evType; + DevicePtr pPointer; + DevicePtr pKeyboard; + + xenixEventPending = 0; + pPointer = LookupPointerDevice(); + pKeyboard = LookupKeyboardDevice(); + + n = ev_count(); + + if (n < 0) { + ErrorF("ProcessInputEvent: cannot get event count\n"); + return; + } + + #if OK + if (autoRepeatKeyDown && autoRepeatReady && n <= 0) { + /* fake a xenixwindows kbd event */ + n = sizeof(struct inputevent); + se->ie_code = AUTOREPEAT_EVENTID; + tvplus(event_time(se), autoRepeatLastKeyDownTv, + autoRepeatDeltaTv); + if (autoRepeatDebug) + ErrorF("ProcessInputEvents: sw auto event\n"); + } + #endif + for (i=0; i<n; i++) { + if ( (evp=ev_read()) == (EVENT *) NULL) + break; + + if (screenIsSaved == SCREEN_SAVER_ON) + SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); + lastEventTime = EV_TIME(*evp); + /* + if (xenixIgnoreEvent) { + ev_pop(); + continue; + } + */ + /* + * Figure out the X device this event should be reported on. + */ + + evType = EV_TAG(*evp); + + if (!(EV_TAG(*evp) & T_STRING)) { + xenixMouseProcessEvent(pPointer,evp); + } + else + { + CARD8 key; + /* see if the key is a secondary key */ + key = EV_BUF(*evp)[0]; + if (key == keyCodePrefix1 || key == keyCodePrefix2) { + ev_pop(); + if (++i, (evp=ev_read()) == (EVENT *) NULL) { + continue; + } + key = EV_BUF(*evp)[0]; + key = ibmAT101SecondaryMap[key & 0x7f]; + EV_BUF(*evp)[0] = key | EV_BUF(*evp)[0] & 0x80; + } + + xenixKbdProcessEvent(pKeyboard,evp); + } + ev_pop(); + } + #if OK + (* kbdPriv->DoneEvents) (pKeyboard, TRUE); + (* ptrPriv->DoneEvents) (pPointer, TRUE); + #endif + } + + /*- + *----------------------------------------------------------------------- + * SetTimeSinceLastInputEvent -- + * Set the lastEventTime to now. + * + * Results: + * None. + * + * Side Effects: + * lastEventTime is altered. + * + *----------------------------------------------------------------------- + */ + void + SetTimeSinceLastInputEvent() + { + struct timeval now; + + gettimeofday (&now, (struct timezone *)0); + lastEventTime = TVTOMILLI(now); + } + + /* + * DDX - specific abort routine. Called by AbortServer(). + */ + void + AbortDDX() + { + } + + /* Called by GiveUp(). */ + void + ddxGiveUp() + { + } + + int + ddxProcessArgument (argc, argv, i) + int argc; + char *argv[]; + int i; + { + extern void UseMsg(); + extern Bool ActiveZaphod; + + if (strcmp (argv[i], "-ar1") == 0) { /* -ar1 int */ + if (++i >= argc) UseMsg (); + autoRepeatInitiate = 1000 * (long)atoi(argv[i]); + return 2; + } + if (strcmp (argv[i], "-ar2") == 0) { /* -ar2 int */ + if (++i >= argc) UseMsg (); + autoRepeatDelay = 1000 * (long)atoi(argv[i]); + return 2; + } + if (strcmp (argv[i], "-debug") == 0) { /* -debug */ + return 1; + } + if (strcmp (argv[i], "-dev") == 0) { /* -dev /dev/mumble */ + if (++i >= argc) UseMsg (); + return 2; + } + if (strcmp (argv[i], "-mono") == 0) { /* -mono */ + return 1; + } + if (strcmp (argv[i], "-zaphod") == 0) { /* -zaphod */ + ActiveZaphod = FALSE; + return 1; + } + return 0; + } + + void + ddxUseMsg() + { + ErrorF("-ar1 int set autorepeat initiate time\n"); + ErrorF("-ar2 int set autorepeat interval time\n"); + ErrorF("-debug disable non-blocking console mode\n"); + ErrorF("-dev filename name of device to open\n"); + ErrorF("-mono force monochrome-only screen\n"); + ErrorF("-zaphod disable active Zaphod mode\n"); + } *** X11R4.ORIG/mit/server/ddx/xenix/trident/xenixKeyMap.c Sun Jan 6 01:03:59 1991 --- X11R4/mit/server/ddx/xenix/trident/xenixKeyMap.c Sun Dec 9 18:53:53 1990 *************** *** 0 **** --- 1,249 ---- + /* + * xenixKeyMap.c Modified for Xenix by Chain Lee 08/90 + */ + + /************************************************************ + Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright no- + tice appear in all copies and that both that copyright no- + tice and this permission notice appear in supporting docu- + mentation, and that the names of Sun or MIT not be used in + advertising or publicity pertaining to distribution of the + software without specific prior written permission. Sun and + M.I.T. make no representations about the suitability of this + software for any purpose. It is provided "as is" without any + express or implied warranty. + + SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- + NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- + ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + + #include "xenix.h" + #include "keysym.h" + + CARD8 keyCodePrefix1 = 0xe0; + CARD8 keyCodePrefix2 = 0xe1; + CARD8 keyCodeCapsLock = 0x3a; + CARD8 keyCodeCrtlLeft = 0x1d; + + static KeySym ibmAT101Map[] = { + NoSymbol, NoSymbol, /* 0x00 */ + XK_Escape, NoSymbol, /* 0x01 */ + XK_1, XK_exclam, /* 0x02 */ + XK_2, XK_at, /* 0x03 */ + XK_3, XK_numbersign, /* 0x04 */ + XK_4, XK_dollar, /* 0x05 */ + XK_5, XK_percent, /* 0x06 */ + XK_6, XK_asciicircum, /* 0x07 */ + XK_7, XK_ampersand, /* 0x08 */ + XK_8, XK_asterisk, /* 0x09 */ + XK_9, XK_parenleft, /* 0x0a */ + XK_0, XK_parenright, /* 0x0b */ + XK_minus, XK_underscore, /* 0x0c */ + XK_equal, XK_plus, /* 0x0d */ + XK_BackSpace, NoSymbol, /* 0x0e */ + XK_Tab, NoSymbol, /* 0x0f */ + XK_Q, NoSymbol, /* 0x10 */ + XK_W, NoSymbol, /* 0x11 */ + XK_E, NoSymbol, /* 0x12 */ + XK_R, NoSymbol, /* 0x13 */ + XK_T, NoSymbol, /* 0x14 */ + XK_Y, NoSymbol, /* 0x15 */ + XK_U, NoSymbol, /* 0x16 */ + XK_I, NoSymbol, /* 0x17 */ + XK_O, NoSymbol, /* 0x18 */ + XK_P, NoSymbol, /* 0x19 */ + XK_bracketleft, XK_braceleft, /* 0x1a */ + XK_bracketright,XK_braceright, /* 0x1b */ + XK_Return, NoSymbol, /* 0x1c */ + XK_Control_L, NoSymbol, /* 0x1d */ + XK_A, NoSymbol, /* 0x1e */ + XK_S, NoSymbol, /* 0x1f */ + XK_D, NoSymbol, /* 0x20 */ + XK_F, NoSymbol, /* 0x21 */ + XK_G, NoSymbol, /* 0x22 */ + XK_H, NoSymbol, /* 0x23 */ + XK_J, NoSymbol, /* 0x24 */ + XK_K, NoSymbol, /* 0x25 */ + XK_L, NoSymbol, /* 0x26 */ + XK_semicolon, XK_colon, /* 0x27 */ + XK_quoteright, XK_quotedbl, /* 0x28 */ + XK_quoteleft, XK_asciitilde, /* 0x29 */ + XK_Shift_L, NoSymbol, /* 0x2a */ + XK_backslash, XK_bar, /* 0x2b */ + XK_Z, NoSymbol, /* 0x2c */ + XK_X, NoSymbol, /* 0x2d */ + XK_C, NoSymbol, /* 0x2e */ + XK_V, NoSymbol, /* 0x2f */ + XK_B, NoSymbol, /* 0x30 */ + XK_N, NoSymbol, /* 0x31 */ + XK_M, NoSymbol, /* 0x32 */ + XK_comma, XK_less, /* 0x33 */ + XK_period, XK_greater, /* 0x34 */ + XK_slash, XK_question, /* 0x35 */ + XK_Shift_R, NoSymbol, /* 0x36 */ + XK_asterisk, NoSymbol, /* 0x37 */ + XK_Alt_L, NoSymbol, /* 0x38 */ + XK_space, NoSymbol, /* 0x39 */ + XK_Caps_Lock, NoSymbol, /* 0x3a */ + XK_F1, NoSymbol, /* 0x3b */ + XK_F2, NoSymbol, /* 0x3c */ + XK_F3, NoSymbol, /* 0x3d */ + XK_F4, NoSymbol, /* 0x3e */ + XK_F5, NoSymbol, /* 0x3f */ + XK_F6, NoSymbol, /* 0x40 */ + XK_F7, NoSymbol, /* 0x41 */ + XK_F8, NoSymbol, /* 0x42 */ + XK_F9, NoSymbol, /* 0x43 */ + XK_F10, NoSymbol, /* 0x44 */ + XK_Num_Lock, NoSymbol, /* 0x45 */ + XK_Scroll_Lock, NoSymbol, /* 0x46 */ + XK_Home, XK_7, /* 0x47 */ + XK_Up, XK_8, /* 0x48 */ + XK_Prior, XK_9, /* 0x49 */ + XK_minus, NoSymbol, /* 0x4a */ + XK_Left, XK_4, /* 0x4b */ + NoSymbol, XK_5, /* 0x4c */ + XK_Right, XK_6, /* 0x4d */ + XK_plus, NoSymbol, /* 0x4e */ + XK_End, XK_1, /* 0x4f */ + XK_Down, XK_2, /* 0x50 */ + XK_Next, XK_3, /* 0x51 */ + XK_Insert, XK_0, /* 0x52 */ + XK_Delete, XK_period, /* 0x53 */ + NoSymbol, NoSymbol, /* 0x54 */ + NoSymbol, NoSymbol, /* 0x55 */ + NoSymbol, XK_colon, /* 0x56 */ + XK_F11, NoSymbol, /* 0x57 */ + XK_F12, NoSymbol, /* 0x58 */ + XK_Return, NoSymbol, /* 0x59 */ + NoSymbol, NoSymbol, /* 0x5a */ + NoSymbol, NoSymbol, /* 0x5b */ + NoSymbol, NoSymbol, /* 0x5c */ + NoSymbol, NoSymbol, /* 0x5d */ + NoSymbol, NoSymbol, /* 0x5e */ + NoSymbol, NoSymbol, /* 0x5f */ + + /* Secondary key map */ + + NoSymbol, NoSymbol, /* 0x60 */ + XK_Alt_R, NoSymbol, /* 0x61 */ + XK_Control_R, NoSymbol, /* 0x62 */ + NoSymbol, NoSymbol, /* 0x63 */ + XK_Insert, NoSymbol, /* 0x64 */ + XK_Delete, NoSymbol, /* 0x65 */ + XK_Home, NoSymbol, /* 0x66 */ + XK_End, NoSymbol, /* 0x67 */ + XK_Prior, NoSymbol, /* 0x68 */ + XK_Next, NoSymbol, /* 0x69 */ + XK_Left, NoSymbol, /* 0x6a */ + XK_Up, NoSymbol, /* 0x6b */ + XK_Down, NoSymbol, /* 0x6c */ + XK_Right, NoSymbol, /* 0x6d */ + XK_slash, NoSymbol, /* 0x6e */ + XK_asterisk, NoSymbol, /* 0x6f */ + NoSymbol, NoSymbol, /* 0x70 */ + NoSymbol, NoSymbol, /* 0x71 */ + NoSymbol, NoSymbol, /* 0x72 */ + NoSymbol, NoSymbol, /* 0x73 */ + NoSymbol, NoSymbol, /* 0x74 */ + NoSymbol, NoSymbol, /* 0x75 */ + NoSymbol, NoSymbol, /* 0x76 */ + NoSymbol, NoSymbol, /* 0x77 */ + NoSymbol, NoSymbol, /* 0x78 */ + NoSymbol, NoSymbol, /* 0x79 */ + NoSymbol, NoSymbol, /* 0x7a */ + NoSymbol, NoSymbol, /* 0x7b */ + NoSymbol, NoSymbol, /* 0x7c */ + NoSymbol, NoSymbol, /* 0x7d */ + NoSymbol, NoSymbol, /* 0x7e */ + NoSymbol, NoSymbol, /* 0x7f */ + }; + + KeySymsRec xenixKeySyms[] = { + /* map minKeyCode maxKC width */ + (KeySym *)NULL, 0, 0, 0, + (KeySym *)NULL, 0, 0, 0, + ibmAT101Map, 0, 0x70, 2, + }; + + #define cT (ControlMask) + #define sH (ShiftMask) + #define lK (LockMask) + #define mT (Mod1Mask) + + CARD8 ibmAT101ModMap[MAP_LENGTH + 8] = { + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + 0, 0, 0, 0, 0, 0, 0, 0, /*buttons*/ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00-0f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, cT, 0, 0, /* 10-1f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sH, 0, 0, 0, 0, 0, /* 20-2f */ + 0, 0, 0, 0, 0, 0, sH, 0, mT, 0, lK, 0, 0, 0, 0, 0, /* 30-3f */ + 0, 0, 0, 0, 0, lK, lK, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40-4f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50-5f */ + 0, mT, cT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60-6f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70-7f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80-8f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90-9f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a0-af */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b0-bf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c0-cf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d0-df */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e0-ef */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f0-ff */ + }; + + CARD8 *xenixModMap[] = { + (CARD8 *) NULL, + (CARD8 *) NULL, + ibmAT101ModMap, + }; + + #define AL 0x61 + #define CT 0x62 + #define IN 0x64 + #define DE 0x65 + #define HO 0x66 + #define EN 0x67 + #define PU 0x68 + #define PD 0x69 + #define LF 0x6a + #define UP 0x6b + #define DN 0x6c + #define RI 0x6d + #define SL 0x6e + #define AS 0x6f + #define CR 0x1c + + CARD8 ibmAT101SecondaryMap[MAP_LENGTH] = { + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00-0f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CR, CT, 0, 0, /* 10-1f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20-2f */ + 0, 0, 0, 0, 0, SL, 0, AS, AL, 0, 0, 0, 0, 0, 0, 0, /* 30-3f */ + 0, 0, 0, 0, 0, 0, 0, HO, UP, PU, 0, LF, 0, RI, 0, EN,/* 40-4f */ + DN, PD, IN, DE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50-5f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60-6f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70-7f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80-8f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90-9f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* a0-af */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* b0-bf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* c0-cf */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d0-df */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* e0-ef */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* f0-ff */ + }; +
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/server/ddx/xenix/trident/vgaHWCntl.c Sun Jan 6 01:04:01 1991 --- X11R4/mit/server/ddx/xenix/trident/vgaHWCntl.c Wed Nov 14 22:03:52 1990 *************** *** 0 **** --- 1,529 ---- + /* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + */ + + #define PCIO + #ifndef i386 + #define i386 + #endif + + extern unsigned char inb(); + extern void outb(); + extern void outw(); + + #include "vgaVideo.h" + #include "vgaReg.h" + #include "vgaSave.h" + + + /* + * HARDWARE REGISTER USAGE : + ******* EVERYTHING + */ + + void + save_vga_state( VS ) + register struct vga_video_hardware_state *VS ; + { + register IO_Address Target_Reg ; /* if mono == 0x3B0, if color == 3D0 */ + register IO_Address Base_Reg ; /* if mono == 0x3B0, if color == 3D0 */ + + /* Read General Registers */ + VS->Feature_Control = inb( 0x3CA ) ; + VS->Video_Enable = inb( 0x3C3 ) ; + Base_Reg = ( ( VS->Misc_Output_Reg = inb( 0x3CC ) ) & 1 ) ? 0x3D0 : 0x3B0 ; + VS->Input_Status_0 = inb( 0x3C2 ) ; + /* Initialize Flip-Flop */ + VS->Input_Status_1 = inb( Base_Reg + 0xA ) ; + + /* Save Attribute Registers 03C0 & 03C1 */ + /* + INTS_OFF() ; + */ + VS->Attr_Addr_Reg = inb( 0x3C0 ) ; /* Save Existing Index First */ + /* Target_Reg Used As Scrap */ + for ( Target_Reg = 0 ; Target_Reg <= 0xF ; Target_Reg++ ) { + outb( 0x3C0, (unsigned char) Target_Reg ) ; + /* Read It, Save It, Then Write It Back */ + outb( 0x3c0, ( VS->Palette[Target_Reg] = inb( 0x3C1 ) ) ) ; + } + outb( 0x3c0, 0x30 ) ; + outb( 0x3c0, ( VS->Attr_Mode = inb( 0x3C1 ) ) ) ; + outb( 0x3c0, 0x31 ) ; + outb( 0x3c0, ( VS->Overscan_Color = inb( 0x3C1 ) ) ) ; + outb( 0x3c0, 0x32 ) ; + outb( 0x3c0, ( VS->Color_Plane_En = inb( 0x3C1 ) ) ) ; + outb( 0x3c0, 0x33 ) ; + outb( 0x3c0, ( VS->Horiz_PEL_Pan = inb( 0x3C1 ) ) ) ; + outb( 0x3c0, 0x34 ) ; + outb( 0x3c0, ( VS->Color_Select = inb( 0x3C1 ) ) ) ; /* Attr_Addr_Reg == 14 */ + /* Re-Enable Video Access To The Color Palette */ + /* + INTS_ON() ; + */ + + /* Save Crt Controller Registers 03?4 & 03?5 */ + VS->Index_Reg = inb( Target_Reg = ( Base_Reg += 0x4 ) ) ; + outb( Base_Reg, 0x00 ) ; + VS->Horiz_Total = inb( ++Target_Reg ) ; + outb( Base_Reg, 0x01 ) ; + VS->Horiz_End = inb( Target_Reg ) ; + outb( Base_Reg, 0x02 ) ; + VS->H_Blank_Start = inb( Target_Reg ) ; + outb( Base_Reg, 0x03 ) ; + VS->H_Blank_End = inb( Target_Reg ) ; + outb( Base_Reg, 0x04 ) ; + VS->H_Retrace_Start = inb( Target_Reg ) ; + outb( Base_Reg, 0x05 ) ; + VS->H_Retrace_End = inb( Target_Reg ) ; + outb( Base_Reg, 0x06 ) ; + VS->Vert_Total = inb( Target_Reg ) ; + outb( Base_Reg, 0x07 ) ; + VS->Overflow = inb( Target_Reg ) ; + outb( Base_Reg, 0x08 ) ; + VS->Preset_Row_Scan = inb( Target_Reg ) ; + outb( Base_Reg, 0x09 ) ; + VS->Max_Scan_Line = inb( Target_Reg ) ; + outb( Base_Reg, 0x0A ) ; + VS->Cursor_Start = inb( Target_Reg ) ; + outb( Base_Reg, 0x0B ) ; + VS->Cursor_End = inb( Target_Reg ) ; + outb( Base_Reg, 0x0C ) ; + VS->Start_Addr_Hi = inb( Target_Reg ) ; + outb( Base_Reg, 0x0D ) ; + VS->Start_Addr_Lo = inb( Target_Reg ) ; + outb( Base_Reg, 0x0E ) ; + VS->Cursor_Loc_Hi = inb( Target_Reg ) ; + outb( Base_Reg, 0x0F ) ; + VS->Cursor_Loc_Lo = inb( Target_Reg ) ; + outb( Base_Reg, 0x10 ) ; + VS->V_Retrace_Start = inb( Target_Reg ) ; + outb( Base_Reg, 0x11 ) ; + VS->V_Retrace_End = inb( Target_Reg ) ; + outb( Base_Reg, 0x12 ) ; + VS->V_Display_End = inb( Target_Reg ) ; + outb( Base_Reg, 0x13 ) ; + VS->Underline_Loc = inb( Target_Reg ) ; + outb( Base_Reg, 0x14 ) ; + VS->Offset = inb( Target_Reg ) ; + outb( Base_Reg, 0x15 ) ; + VS->V_Blank_Start = inb( Target_Reg ) ; + outb( Base_Reg, 0x16 ) ; + VS->V_Blank_End = inb( Target_Reg ) ; + outb( Base_Reg, 0x17 ) ; + VS->CRTC_Mode = inb( Target_Reg ) ; + outb( Base_Reg, 0x18 ) ; + VS->Line_Compare = inb( Target_Reg ) ; + /* Readjust Base Register */ + Base_Reg -= 0x4 ; + + /* Sequencer Registers 03C4 & 03C5 */ + /* VS->Seq_Addr_Reg = inb( 0x3C4 ) ; */ /* 03C4 -- SAME */ + outb( 0x3C4, 0x00 ) ; + VS->Seq_Reset = inb( 0x3C5 ) ; + outb( 0x3C4, 0x01 ) ; + VS->Clock_Mode = inb( 0x3C5 ) ; + outb( 0x3C4, 0x02 ) ; + VS->Mask_Map = inb( 0x3C5 ) ; + outb( 0x3C4, 0x03 ) ; + VS->Char_Map_Select = inb( 0x3C5 ) ; + outb( 0x3C4, 0x04 ) ; + VS->Memory_Mode = inb( 0x3C5 ) ; + + /* Graphics Registers 03CE & 03CF */ + /* VS->Graphics_Addr = inb( 0x3CE ) ; */ /* 03CE -- SAME */ + /* ??????? */ /* 03CF -- SAME */ + outb( 0x3CE, 0x00 ) ; + VS->Set_Reset = inb( 0x3CF ) ; + outb( 0x3CE, 0x01 ) ; + VS->Enb_Set_Reset = inb( 0x3CF ) ; + outb( 0x3CE, 0x02 ) ; + VS->Color_Compare = inb( 0x3CF ) ; + outb( 0x3CE, 0x03 ) ; + VS->Data_Rotate = inb( 0x3CF ) ; + outb( 0x3CE, 0x04 ) ; + VS->Read_Map_Select = inb( 0x3CF ) ; + outb( 0x3CE, 0x05 ) ; + VS->Graphics_Mode = inb( 0x3CF ) ; + outb( 0x3CE, 0x06 ) ; + VS->Miscellaneous = inb( 0x3CF ) ; + outb( 0x3CE, 0x07 ) ; + VS->Color_Dont_Care = inb( 0x3CF ) ; + outb( 0x3CE, 0x08 ) ; + VS->Bit_Mask = inb( 0x3CF ) ; /* Graphics_Addr == 08 */ + + /* Video DAC Registers 03CE & 03CF */ + VS->PEL_WR_Addr = inb( 0x3C8 ) ; /* 03C8 -- SAME */ + /* PEL_RD_Addr is WRITE-ONLY */ + VS->DAC_State = inb( 0x3C7 ) ; /* XXXX -- 03C7 */ + VS->PEL_Data_Reg = inb( 0x3C9 ) ; /* 03C9 -- SAME */ + VS->PEL_Mask_Reg = inb( 0x3C6 ) ; + + return ; + } ; + + void + restore_vga_state( VS ) + register struct vga_video_hardware_state * const VS ; + { + register IO_Address Base_Reg ; /* if mono == 0x3B0, if color == 3D0 */ + register IO_Address Target_Reg ; + + /* Setup I/O Base Address */ + Base_Reg = ( VS->Misc_Output_Reg & 1 ) ? 0x3D0 : 0x3B0 ; + + /* Sequencer Registers 03C4 & 03C5 */ + /* Do Hardware Syncronous RESET */ + SetVideoSequencer( Seq_ResetIndex, VS->Seq_Reset & 0xFD ) ; + SetVideoSequencer( Clock_ModeIndex, VS->Clock_Mode ) ; + SetVideoSequencer( Mask_MapIndex, VS->Mask_Map ) ; + SetVideoSequencer( Char_Map_SelectIndex, VS->Char_Map_Select ) ; + SetVideoSequencer( Memory_ModeIndex, VS->Memory_Mode ) ; + + /* Write General Registers */ + outb( 0x3C2, VS->Misc_Output_Reg ) ; + /* VS->Input_Status_0 & VS->Input_Status_1 are READ-ONLY */ + outb( Base_Reg + 0xA, VS->Feature_Control ) ; + outb( 0x3C3, VS->Video_Enable ) ; + + /* Attribute Registers */ + /* Initialize Flip-Flop */ + { register tmp = inb( Base_Reg + 0xA ) ; } + + /* Target_Reg Used As Scrap */ + for ( Target_Reg = 0 ; Target_Reg <= 0xF ; Target_Reg++ ) { + SetVideoAttribute( Target_Reg, VS->Palette[Target_Reg] ) ; + } + SetVideoAttribute( AttributeModeIndex, VS->Attr_Mode ) ; + SetVideoAttribute( OverScanColorIndex, VS->Overscan_Color ) ; + SetVideoAttribute( ColorPlaneEnableIndex, VS->Color_Plane_En ) ; + SetVideoAttribute( HorizPelPanIndex, VS->Horiz_PEL_Pan ) ; + SetVideoAttribute( ColorSelectIndex, VS->Color_Select ) ; + + /* Enable CRT Controller Registers 0-7 */ + outb( Target_Reg = ( Base_Reg += 0x4 ), 0x11 ) ; + outb( ++Target_Reg, 0x0C ) ; + /* Restore Crt Controller Registers 03?4 & 03?5 */ + outb( Base_Reg, 0x00 ) ; + outb( Target_Reg, VS->Horiz_Total ) ; + outb( Base_Reg, 0x01 ) ; + outb( Target_Reg, VS->Horiz_End ) ; + outb( Base_Reg, 0x02 ) ; + outb( Target_Reg, VS->H_Blank_Start ) ; + outb( Base_Reg, 0x03 ) ; + outb( Target_Reg, VS->H_Blank_End ) ; + outb( Base_Reg, 0x04 ) ; + outb( Target_Reg, VS->H_Retrace_Start ) ; + outb( Base_Reg, 0x05 ) ; + outb( Target_Reg, VS->H_Retrace_End ) ; + outb( Base_Reg, 0x06 ) ; + outb( Target_Reg, VS->Vert_Total ) ; + outb( Base_Reg, 0x07 ) ; + outb( Target_Reg, VS->Overflow ) ; + outb( Base_Reg, 0x08 ) ; + outb( Target_Reg, VS->Preset_Row_Scan ) ; + outb( Base_Reg, 0x09 ) ; + outb( Target_Reg, VS->Max_Scan_Line ) ; + outb( Base_Reg, 0x0A ) ; + outb( Target_Reg, VS->Cursor_Start ) ; + outb( Base_Reg, 0x0B ) ; + outb( Target_Reg, VS->Cursor_End ) ; + outb( Base_Reg, 0x0C ) ; + outb( Target_Reg, VS->Start_Addr_Hi ) ; + outb( Base_Reg, 0x0D ) ; + outb( Target_Reg, VS->Start_Addr_Lo ) ; + outb( Base_Reg, 0x0E ) ; + outb( Target_Reg, VS->Cursor_Loc_Hi ) ; + outb( Base_Reg, 0x0F ) ; + outb( Target_Reg, VS->Cursor_Loc_Lo ) ; + outb( Base_Reg, 0x10 ) ; + outb( Target_Reg, VS->V_Retrace_Start ) ; + outb( Base_Reg, 0x11 ) ; + outb( Target_Reg, VS->V_Retrace_End ) ; + outb( Base_Reg, 0x12 ) ; + outb( Target_Reg, VS->V_Display_End ) ; + outb( Base_Reg, 0x13 ) ; + outb( Target_Reg, VS->Underline_Loc ) ; + outb( Base_Reg, 0x14 ) ; + outb( Target_Reg, VS->Offset ) ; + outb( Base_Reg, 0x15 ) ; + outb( Target_Reg, VS->V_Blank_Start ) ; + outb( Base_Reg, 0x16 ) ; + outb( Target_Reg, VS->V_Blank_End ) ; + outb( Base_Reg, 0x17 ) ; + outb( Target_Reg, VS->CRTC_Mode ) ; + outb( Base_Reg, 0x18 ) ; + outb( Target_Reg, VS->Line_Compare ) ; + + /* Restore Graphics Registers 03CE & 03CF */ + SetVideoGraphics( Set_ResetIndex, VS->Set_Reset ) ; + SetVideoGraphics( Enb_Set_ResetIndex, VS->Enb_Set_Reset ) ; + SetVideoGraphics( Color_CompareIndex, VS->Color_Compare ) ; + SetVideoGraphics( Data_RotateIndex, VS->Data_Rotate ) ; + SetVideoGraphics( Read_Map_SelectIndex, VS->Read_Map_Select ) ; + SetVideoGraphics( Graphics_ModeIndex, VS->Graphics_Mode ) ; + SetVideoGraphics( MiscellaneousIndex, VS->Miscellaneous ) ; + SetVideoGraphics( Color_Dont_CareIndex, VS->Color_Dont_Care ) ; + SetVideoGraphics( Bit_MaskIndex, VS->Bit_Mask ) ; /* Graphics_Addr == 08 */ + + /* Restore ?? Video DAC Registers 03C7 & 03C8 */ + outb( 0x3C9, VS->PEL_Data_Reg ) ; /* 03C9 -- SAME */ + outb( 0x3C6, VS->PEL_Mask_Reg ) ; + + /* Re-Enable Hardware i.e. Reset Register */ + SetVideoSequencer( Seq_ResetIndex, VS->Seq_Reset | 0x03 ) ; + + return ; + } ; + + void + vgaSetColor( color, r, g, b ) + register unsigned long int color ; + register short r, b, g ; + { + outb( 0x3C8, color ) ; /* Point PEL Address Register To Color Entry */ + outb( 0x3C9, r >> 2 ) ; + outb( 0x3C9, g >> 2 ) ; + outb( 0x3C9, b >> 2 ) ; + + return ; + } + + void + save_dac( tablePtr ) + register DAC_TABLE tablePtr ; + { + register int i ; + register unsigned char *cptr ; + + outb( 0x3C7, 0x0 ) ; /* Point PEL Address Register To First Entry */ + for ( i = 768, cptr = (unsigned char *) tablePtr ; --i ; ) + *cptr++ = inb( 0x03C9 ) ; + return ; + } + + void + restore_dac( tablePtr ) + register DAC_TABLE tablePtr ; + { + register int i ; + register unsigned char *cptr ; + + outb( 0x3C8, 0x0 ) ; /* Point PEL Address Register To First Entry */ + for ( i = 768, cptr = (unsigned char *) tablePtr ; --i ; ) + outb( 0x03C9, *cptr++ ) ; + return ; + } + + /* + * Initialize the vga to 640 x 480, 16 of 64 colors @ a0000 + OR -- Initialize the vga to 720 x 540, 16 of 64 colors @ a0000 + */ + + void + set_graphics_mode( VS ) + register struct vga_video_hardware_state *VS ; + { + /* Setup I/O Base Address */ + /* Color 640 by 480 -- 16 Color + OR - Color 720 by 540 -- 16 Color */ + #define Color_Base_Reg ( 0x3D0 ) + + /* Sequencer Registers 03C4 & 03C5 */ + SetVideoSequencer( Seq_ResetIndex, 0x01 ) ; /* Syncronous RESET */ + SetVideoSequencer( Clock_ModeIndex, 0x01 ) ; + /* Make All Planes Writable */ + SetVideoSequencer( Mask_MapIndex, VGA_ALLPLANES ) ; + SetVideoSequencer( Char_Map_SelectIndex, 0x00 ) ; + SetVideoSequencer( Memory_ModeIndex, 0x06 ) ; + + /* Write General Registers */ + /* VS.Input_Status_0 & VS.Input_Status_1 are READ-ONLY */ + #ifndef VGA720 + outb( 0x3C2, /* VS.Misc_Output_Reg */ 0xE3 ) ; /* VS.Misc_Output_Reg */ + #else /* VGA720 */ + outb( 0x3C2, 0xE7 ) ; /* VS.Misc_Output_Reg */ /* XXX */ + #endif + outb( Color_Base_Reg + 0xA, VS->Feature_Control ) ; + outb( 0x3C3, /* VS.Video_Enable */ 0x1 ) ; + + /* Re-Enable Hardware i.e. Reset Register */ + outb( 0x3C4, 0x00 ) ; + outb( 0x3C5, /* VS.Seq_Reset */ 0x03 ) ; /* Enable Hardware Reset Register */ + + /* Attribute Registers */ + /* + INTS_OFF() ; + */ + /* Initialize Flip-Flop */ + { register tmp = inb( Color_Base_Reg + 0xA ) ; } + + /* Set Palette Register Value Equal To Palette Register Index Number */ + /* i.e. Palette is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F */ + { + register IO_Address Target_Reg ; + for ( Target_Reg = 0 ; Target_Reg <= 0xF ; Target_Reg++ ) { + SetVideoAttribute( Target_Reg, Target_Reg ) ; + } + } + /* Rest Of The Attribute Registers */ + /* Note: 0x20 is added to the index + * to Re-Enable Video Access To The Color Palette */ + /* VS.Attr_Mode - P4,P5 for color select */ + SetVideoAttribute( AttributeModeIndex, 0x81 ) ; + SetVideoAttribute( OverScanColorIndex, 0x00 ) ; + SetVideoAttribute( ColorPlaneEnableIndex, VGA_ALLPLANES ) ; + SetVideoAttribute( HorizPelPanIndex, 0x00 ) ; + SetVideoAttribute( ColorSelectIndex, 0x00 ) ; + + /* Enable CRT Controller Registers 0-7 */ + outb( 0x3D4, 0x11 ) ; + outb( 0x3D5, 0x0C ) ; + /* Set CRT Controller Registers 03?4 & 03?5 */ + outb( 0x3D4, 0x00 ) ; + #ifndef VGA720 + outb( 0x3D5, 95 ) ; /* VS.Horiz_Total */ + #else /* VGA720 */ + outb( 0x3D5, 105 ) ; /* VS.Horiz_Total */ /* XXX */ + #endif + outb( 0x3D4, 0x01 ) ; + #ifndef VGA720 + outb( 0x3D5, 79 ) ; /* VS.Horiz_End */ + #else /* VGA720 */ + outb( 0x3D5, 89 ) ; /* VS.Horiz_End */ /* XXX */ + #endif + outb( 0x3D4, 0x02 ) ; + #ifndef VGA720 + outb( 0x3D5, 0x50 ) ; /* VS.H_Blank_Start */ + #else /* VGA720 */ + outb( 0x3D5, 0x5A ) ; /* VS.H_Blank_Start */ /* XXX */ + #endif + outb( 0x3D4, 0x03 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.H_Blank_End */ 0x82 ) ; + #else /* VGA720 */ + outb( 0x3D5, 0x8A ) ; /* VS.H_Blank_End */ /* XXX */ + #endif + outb( 0x3D4, 0x04 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.H_Retrace_Start */ 0x54 ) ; + #else /* VGA720 */ + outb( 0x3D5, 0x5C ) ; /* VS.H_Retrace_Start */ /* XXX */ + #endif + outb( 0x3D4, 0x05 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.H_Retrace_End */ 0x80 ) ; + #else /* VGA720 */ + outb( 0x3D5, 0x88 ) ; /* VS.H_Retrace_End */ + #endif + outb( 0x3D4, 0x06 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.Vert_Total */ 0x0B ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.Vert_Total */ 0x4F ) ; /* XXX */ + #endif + outb( 0x3D4, 0x07 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.Overflow */ 0x3E ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.Overflow */ 0xF0 ) ; /* XXX */ + #endif + outb( 0x3D4, 0x08 ) ; + outb( 0x3D5, /* VS.Preset_Row_Scan */ 0 ) ; + outb( 0x3D4, 0x09 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.Max_Scan_Line */ 0x40 ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.Max_Scan_Line */ 0x60 ) ; /* XXX */ + #endif + outb( 0x3D4, 0x0A ) ; + outb( 0x3D5, /* VS.Cursor_Start */ 0 ) ; + outb( 0x3D4, 0x0B ) ; + outb( 0x3D5, /* VS.Cursor_End */ 0 ) ; + outb( 0x3D4, 0x0C ) ; + outb( 0x3D5, /* VS.Start_Addr_Hi */ 0 ) ; + outb( 0x3D4, 0x0D ) ; + outb( 0x3D5, /* VS.Start_Addr_Lo */ 0 ) ; + outb( 0x3D4, 0x0E ) ; + outb( 0x3D5, /* VS.Cursor_Loc_Hi */ 0 ) ; + outb( 0x3D4, 0x0F ) ; + outb( 0x3D5, /* VS.Cursor_Loc_Lo */ 0 ) ; + outb( 0x3D4, 0x10 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.V_Retrace_Start */ 234 ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.V_Retrace_Start */ 32 ) ; /* XXX */ + #endif + outb( 0x3D4, 0x11 ) ; + outb( 0x3D5, /* VS.V_Retrace_End */ 0x8C ) ; + outb( 0x3D4, 0x12 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.V_Display_End */ 223 ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.V_Display_End */ 27 ) ; /* XXX */ + #endif + outb( 0x3D4, 0x13 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.Underline_Loc */ 40 ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.Offset */ 45 ) ; /* XXX */ + #endif + outb( 0x3D4, 0x14 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.Offset */ 0 ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.Underline_Loc */ 0 ) ; + #endif + outb( 0x3D4, 0x15 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.V_Blank_Start */ 231 ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.V_Blank_Start */ 35 ) ; /* XXX */ + #endif + outb( 0x3D4, 0x16 ) ; + #ifndef VGA720 + outb( 0x3D5, /* VS.V_Blank_End */ 4 ) ; + #else /* VGA720 */ + outb( 0x3D5, /* VS.V_Blank_End */ 2 ) ; + #endif + outb( 0x3D4, 0x17 ) ; + outb( 0x3D5, /* VS.CRTC_Mode */ 0xE3 ) ; + outb( 0x3D4, 0x18 ) ; + outb( 0x3D5, /* VS.Line_Compare */ 255 ) ; + + /* Set Graphics Registers 03CE & 03CF */ + SetVideoGraphics( Set_ResetIndex, 0x00 ) ; + SetVideoGraphics( Enb_Set_ResetIndex, 0x00 ) ; + SetVideoGraphics( Color_CompareIndex, 0x00 ) ; + SetVideoGraphics( Data_RotateIndex, 0x00 ) ; + SetVideoGraphics( Read_Map_SelectIndex, 0x00 ) ; + SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_2 ) ; + SetVideoGraphics( MiscellaneousIndex, 0x05 ) ; + SetVideoGraphics( Color_Dont_CareIndex, VGA_ALLPLANES ) ; + SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* All Bits Writable */ + + /* Video DAC Registers 03C7 & 03C8 */ + outb( 0x3C9, VS->PEL_Data_Reg ) ; /* 03C9 -- SAME */ + outb( 0x3C6, VS->PEL_Mask_Reg ) ; + + return ; + } *** X11R4.ORIG/mit/server/ddx/xenix/trident/vgaReg.h Sun Jan 6 01:04:05 1991 --- X11R4/mit/server/ddx/xenix/trident/vgaReg.h Mon Oct 15 15:36:33 1990 *************** *** 0 **** --- 1,134 ---- + /* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + */ + /*********************************************************** + Copyright IBM Corporation 1987,1988 + + All Rights Reserved + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of IBM not be + used in advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + + ******************************************************************/ + + /* $Header: /andrew/X11/R3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaReg.h,v 6.1 88/10/30 20:23:42 paul Exp $ */ + /* $Source: /andrew/X11/R3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaReg.h,v $ */ + + #if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS) + static char *rcsidvga_reg = "$Header: /andrew/X11/R3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaReg.h,v 6.1 88/10/30 20:23:42 paul Exp $"; + #endif + + #define SET_BYTE_REGISTER( ioport, value ) outb( ioport, value ) + #define SET_INDEX_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value ) + #define SET_DATA_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value ) + #if defined(RTIO) || defined(ATRIO) + #define SET_INDEXED_REGISTER( RegGroup, index, value ) \ + outw( RegGroup, ( ( index ) << 8 ) | ( value ) ) + #else + #if defined(PCIO) + #define SET_INDEXED_REGISTER( RegGroup, index, value ) \ + outw( RegGroup, ( ( value ) << 8 ) | ( index ) ) + #else + ******** ERROR ******** + #endif + #endif + + /* There is a jumper on the ega to change this to 0x200 instead !! */ + #define REGBASE 0x300 + + #define AttributeIndexRegister REGBASE + 0xC0 + #define AttributeDataWriteRegister REGBASE + 0xC0 + #define AttributeDataReadRegister REGBASE + 0xC1 + #define AttributeRegister AttributeIndexRegister + #define AttributeModeIndex 0x30 + #define OverScanColorIndex 0x31 + #define ColorPlaneEnableIndex 0x32 + #define HorizPelPanIndex 0x33 + #define ColorSelectIndex 0x34 + #define SetVideoAttributeIndex( index ) \ + SET_INDEX_REGISTER( AttributeIndexRegister, index ) + #define SetVideoAttribute( index, value ) \ + SetVideoAttributeIndex( index ) ; \ + SET_BYTE_REGISTER( AttributeDataWriteRegister, value ) + + /* Graphics Registers 03CE & 03CF */ + #define GraphicsIndexRegister REGBASE + 0xCE + #define GraphicsDataRegister REGBASE + 0xCF + #define GraphicsRegister GraphicsIndexRegister + #define Set_ResetIndex 0x00 + #define Enb_Set_ResetIndex 0x01 + #define Color_CompareIndex 0x02 + #define Data_RotateIndex 0x03 + #define Read_Map_SelectIndex 0x04 + #define Graphics_ModeIndex 0x05 + #define MiscellaneousIndex 0x06 + #define Color_Dont_CareIndex 0x07 + #define Bit_MaskIndex 0x08 + #define SetVideoGraphicsIndex( index ) \ + SET_INDEX_REGISTER( GraphicsIndexRegister, index ) + #define SetVideoGraphicsData( value ) \ + SET_INDEX_REGISTER( GraphicsDataRegister, value ) + #define SetVideoGraphics( index, value ) \ + SET_INDEXED_REGISTER( GraphicsRegister, index, value ) + + /* Sequencer Registers 03C4 & 03C5 */ + #define SequencerIndexRegister REGBASE + 0xC4 + #define SequencerDataRegister REGBASE + 0xC5 + #define SequencerRegister SequencerIndexRegister + #define Seq_ResetIndex 00 + #define Clock_ModeIndex 01 + #define Mask_MapIndex 02 + #define Char_Map_SelectIndex 03 + #define Memory_ModeIndex 04 + #define SetVideoSequencerIndex( index ) \ + SET_INDEX_REGISTER( SequencerIndexRegister, index ) + #define SetVideoSequencer( index, value ) \ + SET_INDEXED_REGISTER( SequencerRegister, index, value ) + + /* BIT CONSTANTS FOR THE VGA/EGA HARDWARE */ + /* for the Graphics' Data_Rotate Register */ + #define VGA_ROTATE_FUNC_SHIFT 3 + #define VGA_COPY_MODE ( 0 << VGA_ROTATE_FUNC_SHIFT ) /* 0x00 */ + #define VGA_AND_MODE ( 1 << VGA_ROTATE_FUNC_SHIFT ) /* 0x08 */ + #define VGA_OR_MODE ( 2 << VGA_ROTATE_FUNC_SHIFT ) /* 0x10 */ + #define VGA_XOR_MODE ( 3 << VGA_ROTATE_FUNC_SHIFT ) /* 0x18 */ + /* for the Graphics' Graphics_Mode Register */ + #define VGA_READ_MODE_SHIFT 3 + #define VGA_WRITE_MODE_0 0 + #define VGA_WRITE_MODE_1 1 + #define VGA_WRITE_MODE_2 2 + #define VGA_WRITE_MODE_3 3 + #define VGA_READ_MODE_0 ( 0 << VGA_READ_MODE_SHIFT ) + #define VGA_READ_MODE_1 ( 1 << VGA_READ_MODE_SHIFT ) *** X11R4.ORIG/mit/server/ddx/xenix/trident/vgaSave.h Sun Jan 6 01:04:07 1991 --- X11R4/mit/server/ddx/xenix/trident/vgaSave.h Mon Oct 15 15:36:33 1990 *************** *** 0 **** --- 1,140 ---- + /* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + */ + /*********************************************************** + Copyright IBM Corporation 1987,1988 + + All Rights Reserved + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of IBM not be + used in advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + + ******************************************************************/ + /* $Header: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaSave.h,v 6.2 88/11/24 00:35:06 paul Exp $ */ + /* $Source: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaSave.h,v $ */ + + #if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS) + static char *rcsidvgaSave = "$Header: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaSave.h,v 6.2 88/11/24 00:35:06 paul Exp $"; + #endif + + typedef unsigned char io86reg ; /* 8 bit hardware registers */ + typedef short int IO_Address ; /* 64K Intel-Style I/O space */ + + typedef unsigned char DAC_TABLE[768] ; + + struct vga_video_hardware_state { + /* Address locations READ -- WRITE */ + /* General Registers */ + io86reg Misc_Output_Reg ; /* 03CC -- 03C2 */ + io86reg Input_Status_0 ; /* 03C2 -- XXXX */ + io86reg Input_Status_1 ; /* 03?A -- XXXX */ + io86reg Feature_Control ; /* 03?C -- 03CA */ + io86reg Video_Enable ; /* 03C3 -- SAME */ + + /* Attribute Registers 03C0 & 03C1 */ + io86reg Attr_Addr_Reg ; /* 03C0 -- SAME */ + /* io86reg ??????? */ /* 03C0 -- SAME */ + io86reg Palette[16] ; /* Attr_Addr_Reg == 00 - 0F */ + io86reg Attr_Mode ; /* Attr_Addr_Reg == 10 */ + io86reg Overscan_Color ; /* Attr_Addr_Reg == 11 */ + io86reg Color_Plane_En ; /* Attr_Addr_Reg == 12 */ + io86reg Horiz_PEL_Pan ; /* Attr_Addr_Reg == 13 */ + io86reg Color_Select ; /* Attr_Addr_Reg == 14 */ + + /* Crt Controller Registers 03?4 & 03?5 */ + io86reg Index_Reg ; /* 03?4 -- SAME */ + /* io86reg ??????? */ /* 03?5 -- SAME */ + io86reg Horiz_Total ; /* Index_Reg == 00 */ + io86reg Horiz_End ; /* Index_Reg == 01 */ + io86reg H_Blank_Start ; /* Index_Reg == 02 */ + io86reg H_Blank_End ; /* Index_Reg == 03 */ + io86reg H_Retrace_Start ; /* Index_Reg == 04 */ + io86reg H_Retrace_End ; /* Index_Reg == 05 */ + io86reg Vert_Total ; /* Index_Reg == 06 */ + io86reg Overflow ; /* Index_Reg == 07 */ + io86reg Preset_Row_Scan ; /* Index_Reg == 08 */ + io86reg Max_Scan_Line ; /* Index_Reg == 09 */ + io86reg Cursor_Start ; /* Index_Reg == 0A */ + io86reg Cursor_End ; /* Index_Reg == 0B */ + io86reg Start_Addr_Hi ; /* Index_Reg == 0C */ + io86reg Start_Addr_Lo ; /* Index_Reg == 0D */ + io86reg Cursor_Loc_Hi ; /* Index_Reg == 0E */ + io86reg Cursor_Loc_Lo ; /* Index_Reg == 0F */ + io86reg V_Retrace_Start ; /* Index_Reg == 10 */ + io86reg V_Retrace_End ; /* Index_Reg == 11 */ + io86reg V_Display_End ; /* Index_Reg == 12 */ + io86reg Underline_Loc ; /* Index_Reg == 13 */ + io86reg Offset ; /* Index_Reg == 14 */ + io86reg V_Blank_Start ; /* Index_Reg == 15 */ + io86reg V_Blank_End ; /* Index_Reg == 16 */ + io86reg CRTC_Mode ; /* Index_Reg == 17 */ + io86reg Line_Compare ; /* Index_Reg == 18 */ + + /* Sequencer Registers 03C4 & 03C5 */ + io86reg Seq_Addr_Reg ; /* 03C4 -- SAME */ + /* io86reg ??????? */ /* 03?5 -- SAME */ + io86reg Seq_Reset ; /* Seq_Addr_Reg == 00 */ + io86reg Clock_Mode ; /* Seq_Addr_Reg == 01 */ + io86reg Mask_Map ; /* Seq_Addr_Reg == 02 */ + io86reg Char_Map_Select ; /* Seq_Addr_Reg == 03 */ + io86reg Memory_Mode ; /* Seq_Addr_Reg == 04 */ + + /* Graphics Registers 03CE & 03CF */ + io86reg Graphics_Addr ; /* 03CE -- SAME */ + /* io86reg ??????? */ /* 03CF -- SAME */ + io86reg Set_Reset ; /* Graphics_Addr == 00 */ + io86reg Enb_Set_Reset ; /* Graphics_Addr == 01 */ + io86reg Color_Compare ; /* Graphics_Addr == 02 */ + io86reg Data_Rotate ; /* Graphics_Addr == 03 */ + io86reg Read_Map_Select ; /* Graphics_Addr == 04 */ + io86reg Graphics_Mode ; /* Graphics_Addr == 05 */ + io86reg Miscellaneous ; /* Graphics_Addr == 06 */ + io86reg Color_Dont_Care ; /* Graphics_Addr == 07 */ + io86reg Bit_Mask ; /* Graphics_Addr == 08 */ + + /* Video DAC Registers 03CE & 03CF */ + io86reg PEL_WR_Addr ; /* 03C8 -- SAME */ + io86reg PEL_RD_Addr ; /* XXXX -- 03C7 */ + io86reg DAC_State ; /* XXXX -- 03C7 */ + io86reg PEL_Data_Reg ; /* 03C9 -- SAME */ + io86reg PEL_Mask_Reg ; /* 03C6 -- SAME */ + } ; + + /* Global Flag for Virtual Screen Saves */ + extern int vgaDisabled ; + + #define PhysicalVgaAccessDisabled 0x1 + #define VirtualVgaHardwareOpenPending 0x2 + #define VirtualVgaHardwareClosePending 0x4 *** X11R4.ORIG/mit/server/ddx/xenix/trident/vgaTrident.c Sun Jan 6 01:04:12 1991 --- X11R4/mit/server/ddx/xenix/trident/vgaTrident.c Mon Dec 3 00:12:20 1990 *************** *** 0 **** --- 1,318 ---- + #include <stdio.h> + #include <sys/ioctl.h> + #include "vgaSave.h" + + struct port_io_arg vga_port; + + extern xenixVGAFd; + + unsigned char inb( port ) + unsigned int port; + { + vga_port.args[0].dir = IN_ON_PORT; + vga_port.args[0].port = port; + ioctl(xenixVGAFd, VGAIO, &vga_port); + return(vga_port.args[0].data); + } + + void outb( port, data ) + unsigned int port; + unsigned char data; + { + vga_port.args[0].dir = OUT_ON_PORT; + vga_port.args[0].port = port; + vga_port.args[0].data = data; + ioctl(xenixVGAFd, VGAIO, &vga_port); + } + + void outw( port, word ) + unsigned int port; + unsigned int word; + { + outb(port, (unsigned char)(word >> 8)); + outb(port+1, (unsigned char)(word)); + } + + vga_color_init(fb_addr,bg_color,fg_color,fb_size) + char *fb_addr; + int bg_color, fg_color; + long int fb_size; + { + char *fb_ptr; + + /* set write mode 3 for writing the background */ + /* Graphics Controller: 0x3cf, Address port 0x3ce */ + outb(0x3ce, 0x05); /* Mode Register */ + outb(0x3cf, 0x0b); /* xxxx1011 */ + outb(0x3ce, 0x01); /* Enable Set/Reset Register */ + outb(0x3cf, 0x0f); /* type b of write mode 0 */ + outb(0x3ce, 0x08); /* Bit Mask Register */ + outb(0x3cf, 0xff); /* Don't mask anything: 0xff */ + outb(0x3ce, 0x03); /* Data Rotate/Function Select Register */ + outb(0x3cf, 0x00); /* pixel replace with no rotation */ + + /* set registers for read mode 1 */ + outb(0x3ce, 0x07); /* Color Don't Care */ + outb(0x3cf, bg_color ^ fg_color); /* only where bg and fg differs */ + outb(0x3ce, 0x02); /* Color Compare */ + outb(0x3cf, fg_color); + + /* unlock all bit planes */ + outb(0x3c4, 0x02); + outb(0x3c5, 0xf); + + /* initialize screen with background color */ + outb(0x3ce, 0x00); /* Set/Reset Register */ + outb(0x3cf, bg_color); + for (fb_ptr=fb_addr; fb_size; fb_ptr++, fb_size--) + *fb_ptr = 0xff; + + /* lock all bit planes except where bg and fg differs */ + outb(0x3c4, 0x02); + outb(0x3c5, bg_color ^ fg_color); + + /* set write mode 0, read mode 1 for pixel read write */ + /* Graphics Controller: 0x3cf, Address port 0x3ce */ + outb(0x3ce, 0x05); /* Mode Register */ + outb(0x3cf, 0x08); /* xxxx1000 */ + outb(0x3ce, 0x01); /* Enable Set/Reset Register */ + outb(0x3cf, 0x00); /* type b of write mode 0 */ + outb(0x3ce, 0x08); /* Bit Mask Register */ + outb(0x3cf, 0xff); /* Don't mask anything: 0xff */ + outb(0x3ce, 0x03); /* Data Rotate/Function Select Register */ + outb(0x3cf, 0x00); /* pixel replace with no rotation */ + } + + void + trident_vga1( VS ) + register struct vga_video_hardware_state *VS; + { + } + + void + trident_vga2( VS ) + register struct vga_video_hardware_state *VS; + { + /* Miscellaneous Output Register */ + VS->Misc_Output_Reg = 0x2B; + + /* Attribute Registers 00 - 14 */ + VS->Palette[0] = 0x00; + VS->Palette[1] = 0x01; + VS->Palette[2] = 0x02; + VS->Palette[3] = 0x03; + VS->Palette[4] = 0x04; + VS->Palette[5] = 0x05; + VS->Palette[6] = 0x14; + VS->Palette[7] = 0x07; + VS->Palette[8] = 0x38; + VS->Palette[9] = 0x39; + VS->Palette[10] = 0x3A; + VS->Palette[11] = 0x3B; + VS->Palette[12] = 0x3C; + VS->Palette[13] = 0x3D; + VS->Palette[14] = 0x3E; + VS->Palette[15] = 0x3F; + VS->Attr_Mode = 0x01; + VS->Overscan_Color = 0x00; + VS->Color_Plane_En = 0x0F; + VS->Horiz_PEL_Pan = 0x00; + VS->Color_Select = 0x00; + + /* CRT Controller Registers 00 - 18 */ + VS->Horiz_Total = 0x99; + VS->Horiz_End = 0x63; + VS->H_Blank_Start = 0x64; + VS->H_Blank_End = 0x1C; + VS->H_Retrace_Start = 0x74; + VS->H_Retrace_End = 0x10; + VS->Vert_Total = 0x7F; + VS->Overflow = 0xF0; + VS->Preset_Row_Scan = 0x00; + VS->Max_Scan_Line = 0x60; + VS->Cursor_Start = 0x00; + VS->Cursor_End = 0x00; + VS->Start_Addr_Hi = 0x00; + VS->Start_Addr_Lo = 0x00; + VS->Cursor_Loc_Hi = 0x00; + VS->Cursor_Loc_Lo = 0x00; + VS->V_Retrace_Start = 0x5E; + VS->V_Retrace_End = 0x8E; + VS->V_Display_End = 0x57; + VS->Underline_Loc = 0x32; + VS->Offset = 0x00; + VS->V_Blank_Start = 0x58; + VS->V_Blank_End = 0x7F; + VS->CRTC_Mode = 0xE3; + VS->Line_Compare = 0xFF; + + /* Sequencer Registers 00 - 04 */ + VS->Seq_Reset = 0x03; + VS->Clock_Mode = 0x01; + VS->Mask_Map = 0x0F; + VS->Char_Map_Select = 0x00; + VS->Memory_Mode = 0x06; + + /* Graphics Registers 00 - 08 */ + VS->Set_Reset = 0x00; + VS->Enb_Set_Reset = 0x00; + VS->Color_Compare = 0x00; + VS->Data_Rotate = 0x00; + VS->Read_Map_Select = 0x00; + VS->Graphics_Mode = 0x00; + VS->Miscellaneous = 0x05; + VS->Color_Dont_Care = 0x0F; + VS->Bit_Mask = 0xFF; + } + + void + trident_vga3( VS ) + register struct vga_video_hardware_state *VS; + { + /* Miscellaneous Output Register */ + VS->Misc_Output_Reg = 0x2B; + + /* Attribute Registers 00 - 14 */ + VS->Palette[0] = 0x00; + VS->Palette[1] = 0x01; + VS->Palette[2] = 0x02; + VS->Palette[3] = 0x03; + VS->Palette[4] = 0x04; + VS->Palette[5] = 0x05; + VS->Palette[6] = 0x14; + VS->Palette[7] = 0x07; + VS->Palette[8] = 0x38; + VS->Palette[9] = 0x39; + VS->Palette[10] = 0x3A; + VS->Palette[11] = 0x3B; + VS->Palette[12] = 0x3C; + VS->Palette[13] = 0x3D; + VS->Palette[14] = 0x3E; + VS->Palette[15] = 0x3F; + VS->Attr_Mode = 0x01; + VS->Overscan_Color = 0x00; + VS->Color_Plane_En = 0x0F; + VS->Horiz_PEL_Pan = 0x00; + VS->Color_Select = 0x00; + + /* CRT Controller Registers 00 - 18 */ + VS->Horiz_Total = 0x99; + VS->Horiz_End = 0x7F; + VS->H_Blank_Start = 0x81; + VS->H_Blank_End = 0x1B; + VS->H_Retrace_Start = 0x83; + VS->H_Retrace_End = 0x1B; + VS->Vert_Total = 0x9D; + VS->Overflow = 0xf0/*0x1F*/; + VS->Preset_Row_Scan = 0x00; + VS->Max_Scan_Line = 0x60/*0x00*/; + VS->Cursor_Start = 0x00; + VS->Cursor_End = 0x00; + VS->Start_Addr_Hi = 0x00; + VS->Start_Addr_Lo = 0x00; + VS->Cursor_Loc_Hi = 0x00; + VS->Cursor_Loc_Lo = 0x00; + VS->V_Retrace_Start = 0x74/*0x84*/; + VS->V_Retrace_End = 0x10/*0x8C*/; + VS->V_Display_End = 0x57/*0x7F*/; + VS->Underline_Loc = 0x40/*0x80*/; + VS->Offset = 0x00; + VS->V_Blank_Start = 0x84; + VS->V_Blank_End = 0x98; + VS->CRTC_Mode = 0xE3; + VS->Line_Compare = 0xFF; + + /* Sequencer Registers 00 - 04 */ + VS->Seq_Reset = 0x03; + VS->Clock_Mode = 0x01; + VS->Mask_Map = 0x0F; + VS->Char_Map_Select = 0x00; + VS->Memory_Mode = 0x06; + + /* Graphics Registers 00 - 08 */ + VS->Set_Reset = 0x00; + VS->Enb_Set_Reset = 0x00; + VS->Color_Compare = 0x00; + VS->Data_Rotate = 0x00; + VS->Read_Map_Select = 0x00; + VS->Graphics_Mode = 0x00; + VS->Miscellaneous = 0x05; + VS->Color_Dont_Care = 0x0F; + VS->Bit_Mask = 0xFF; + } + + void + trident_vga4( VS ) + register struct vga_video_hardware_state *VS; + { + /* Miscellaneous Output Register */ + VS->Misc_Output_Reg = 0x2B; + + /* Attribute Registers 00 - 14 */ + VS->Palette[0] = 0x00; + VS->Palette[1] = 0x01; + VS->Palette[2] = 0x02; + VS->Palette[3] = 0x03; + VS->Palette[4] = 0x04; + VS->Palette[5] = 0x05; + VS->Palette[6] = 0x14; + VS->Palette[7] = 0x07; + VS->Palette[8] = 0x38; + VS->Palette[9] = 0x39; + VS->Palette[10] = 0x3A; + VS->Palette[11] = 0x3B; + VS->Palette[12] = 0x3C; + VS->Palette[13] = 0x3D; + VS->Palette[14] = 0x3E; + VS->Palette[15] = 0x3F; + VS->Attr_Mode = 0x01; + VS->Overscan_Color = 0x00; + VS->Color_Plane_En = 0x0F; + VS->Horiz_PEL_Pan = 0x00; + VS->Color_Select = 0x00; + + /* CRT Controller Registers 00 - 18 */ + VS->Horiz_Total = 0x99; + VS->Horiz_End = 0x7F; + VS->H_Blank_Start = 0x81; + VS->H_Blank_End = 0x1B; + VS->H_Retrace_Start = 0x83; + VS->H_Retrace_End = 0x1B; + VS->Vert_Total = 0x9D; + VS->Overflow = 0x1F; + VS->Preset_Row_Scan = 0x00; + VS->Max_Scan_Line = 0x00; + VS->Cursor_Start = 0x00; + VS->Cursor_End = 0x00; + VS->Start_Addr_Hi = 0x00; + VS->Start_Addr_Lo = 0x00; + VS->Cursor_Loc_Hi = 0x00; + VS->Cursor_Loc_Lo = 0x00; + VS->V_Retrace_Start = 0x84; + VS->V_Retrace_End = 0x8C; + VS->V_Display_End = 0x7F; + VS->Underline_Loc = 0x80; + VS->Offset = 0x00; + VS->V_Blank_Start = 0x84; + VS->V_Blank_End = 0x98; + VS->CRTC_Mode = 0xE3; + VS->Line_Compare = 0xFF; + + /* Sequencer Registers 00 - 04 */ + VS->Seq_Reset = 0x03; + VS->Clock_Mode = 0x01; + VS->Mask_Map = 0x0F; + VS->Char_Map_Select = 0x00; + VS->Memory_Mode = 0x06; + + /* Graphics Registers 00 - 08 */ + VS->Set_Reset = 0x00; + VS->Enb_Set_Reset = 0x00; + VS->Color_Compare = 0x00; + VS->Data_Rotate = 0x00; + VS->Read_Map_Select = 0x00; + VS->Graphics_Mode = 0x00; + VS->Miscellaneous = 0x05; + VS->Color_Dont_Care = 0x0F; + VS->Bit_Mask = 0xFF; + }
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/server/ddx/xenix/trident/vgaVideo.h Sun Jan 6 01:04:15 1991 --- X11R4/mit/server/ddx/xenix/trident/vgaVideo.h Mon Oct 15 15:36:34 1990 *************** *** 0 **** --- 1,231 ---- + /* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + */ + /*********************************************************** + Copyright IBM Corporation 1987,1988 + + All Rights Reserved + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of IBM not be + used in advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + + ******************************************************************/ + + /* $Header: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaVideo.h,v 6.3 88/11/10 22:51:31 paul Exp $ */ + /* $Source: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaVideo.h,v $ */ + + #if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS) + static char *rcsidvga_video = "$Header: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/vga/RCS/vgaVideo.h,v 6.3 88/11/10 22:51:31 paul Exp $"; + #endif + + #define XENIX + + #if defined(lint) | defined(XENIX) + #if defined(volatile) + #undef volatile + #endif + #define volatile /**/ + #if defined(const) + #undef const + #endif + #define const /**/ + #if defined(signed) + #undef signed + #endif + #define signed /**/ + #endif + + /* + * References to all pc ( i.e. '286 ) memory in the + * regions used by the [ev]ga server ( the 128K windows ) + * MUST be long-word ( i.e. 32-bit ) reads or writes. + * This definition will change for other memory architectures + * ( e.g. AIX-Rt ) + */ + #if defined(ATRIO) + typedef unsigned long int VideoAdapterObject ; + #else + #if defined(RTIO) || defined(PCIO) + typedef unsigned char VideoAdapterObject ; + #else + ******** ERROR ******** + #endif + #endif + typedef volatile VideoAdapterObject *VideoMemoryPtr ; + #if !defined(BUILD_EGA) + typedef volatile VideoAdapterObject *VgaMemoryPtr ; + #else + typedef volatile VideoAdapterObject *EgaMemoryPtr ; + #endif + + #if defined(BUILD_EGA) + #define EGA_DEV_FILE "/dev/ega" + #else + #define VGA_DEV_FILE "/dev/vga" + #endif + + #if !defined(BITMAP_BIT_ORDER) + #if defined(ibm032) || defined(i386) || defined(iAPX286) || defined(DOS) + #define BITMAP_BIT_ORDER MSBFirst + #else + ******** ERROR ******** + #endif + #endif + + #if !defined(IMAGE_BYTE_ORDER) + #if defined(ibm032) + #define IMAGE_BYTE_ORDER MSBFirst + #else + #if defined(i386) || defined(iAPX286) || defined(DOS) + #define IMAGE_BYTE_ORDER LSBFirst + #else + ******** ERROR ******** + #endif + #endif + #endif + + #if defined(BUILD_EGA) + #if defined(BSDrt) && defined(ATRIO) + #define SCREEN_ADDR 0x000b8000 + #else + #define SCREEN_ADDR 0x000a0000 + #endif + #else /* Must be for the vga */ + #if defined(i386) && defined(AIX386) + #define SCREEN_ADDR 0x020400000 /* "very" MAGIC NUMBER */ + #else + #define SCREEN_ADDR 0x000a0000 + #endif + #endif + + #if defined(i386) || defined(iAPX286) || defined(DOS) + #define VIDEO_MEMORY_BASE ( (volatile unsigned char *) ( SCREEN_ADDR ) ) + #else /* BSD43 */ + #if defined(ATRIO) + #define VIDEO_MEMORY_BASE ( (volatile unsigned char *) \ + ( 0xd00c0000 | ( SCREEN_ADDR & 0x0001ffff ) ) ) + #else + #if defined(RTIO) + #define VIDEO_MEMORY_BASE ( (volatile unsigned char *) \ + ( 0xd00c0000 | ( SCREEN_ADDR & 0x0001ffff ) ) ) + #endif + #endif + #endif + + #if defined(BUILD_EGA) + #define EGABASE VIDEO_MEMORY_BASE + #else + #define VGABASE VIDEO_MEMORY_BASE + #endif + + /* Bit Ordering Macros */ + #if !defined(SCRLEFT8) + #if (BITMAP_BIT_ORDER == MSBFirst) /* pc/rt */ + #define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) ) + #else + #if (BITMAP_BIT_ORDER == LSBFirst) /* intel */ + #define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) >> (n)) ) + #else + ******** ERROR ******** + #endif + #endif + #endif + #if !defined(SCRRIGHT8) + #if BITMAP_BIT_ORDER == MSBFirst /* pc/rt */ + #define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) ) + #else + #if BITMAP_BIT_ORDER == LSBFirst + #define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) << (n)) ) + #else + ******** ERROR ******** + #endif + #endif + #endif + /* These work ONLY on 8-bit wide Quantities !! */ + #define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF ) + #define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF ) + + /* + * [ev]ga video screen defines & macros + */ + #define PIX_PER_BYTE 8 + + #define xGA_BLACK_PIXEL 0 + #define xGA_WHITE_PIXEL 1 + + #define xGA_MAXPLANES 4 + #define xGA_ALLPLANES 0xF + + #if !defined(BUILD_EGA) + #define NO_TUBE 0 + #define COLOR_TUBE 1 + #define MONO_TUBE 2 + + #define VGA_BLACK_PIXEL xGA_BLACK_PIXEL + #define VGA_WHITE_PIXEL xGA_WHITE_PIXEL + + #define VGA_MAXPLANES xGA_MAXPLANES + #define VGA_ALLPLANES xGA_ALLPLANES + + #define VIDEO_MEM_BYTES_PER_PLANE ( 64 * 1024 ) + + #ifndef VGA720 + #define BYTES_PER_ROW 80 + #define MAX_ROW 479 + #else + #define BYTES_PER_ROW 90 + #define MAX_ROW 539 + #endif + #else /* Must be for ega */ + #define EGA_BLACK_PIXEL xGA_BLACK_PIXEL + #define EGA_WHITE_PIXEL xGA_WHITE_PIXEL + + #define EGA_MAXPLANES xGA_MAXPLANES + #define EGA_ALLPLANES xGA_ALLPLANES + + #define VIDEO_MEM_BYTES_PER_PLANE ( 32 * 1024 ) + + #define BYTES_PER_ROW 80 + #define MAX_ROW 349 + #endif + + #define MAX_COLUMN ( ( BYTES_PER_ROW * PIX_PER_BYTE ) - 1 ) + #define MAX_OFFSCREEN_ROW ( ( VIDEO_MEM_BYTES_PER_PLANE / BYTES_PER_ROW ) - 1 ) + #define ROW_OFFSET( PIXEL_X_VALUE ) ( ( PIXEL_X_VALUE ) >> 3 ) + #define BIT_OFFSET( PIXEL_X_VALUE ) ( ( PIXEL_X_VALUE ) & 0x7 ) + #define BYTE_OFFSET( PIXEL_X_VALUE, PIXEL_Y_VALUE ) \ + ( ( ( PIXEL_Y_VALUE ) * BYTES_PER_ROW ) + ( ( PIXEL_X_VALUE ) >> 3 ) ) + #define SCREENADDRESS( PIXEL_X_VALUE, PIXEL_Y_VALUE ) \ + ( VIDEO_MEMORY_BASE + BYTE_OFFSET( PIXEL_X_VALUE, PIXEL_Y_VALUE ) ) *** X11R4.ORIG/mit/server/ddx/xenix/README Sun Jan 6 01:04:17 1991 --- X11R4/mit/server/ddx/xenix/README Sun Jan 6 00:58:57 1991 *************** *** 0 **** --- 1,19 ---- + # + # README C. Lee 1/5/90 + # + + Following files and directories are under this directory + + README - the one you are reading + + vga - standard VGA 640 X 480 monchrome mode + + trident - trident 8800 vga 800 X 600, 1024 X 600, 1024 X 768 interlaced + + trident.color - trident 8800 640x480 256 color mode. Unfinished, needs + significant changes in cfb to support _trident_bank_mapping_ + which is terribly poor for bitblt. + + I have never seen a technical document worse than the + Trident's. I have done enough reverse engineering and might + just give up for a better designed and documented card. *** X11R4.ORIG/mit/server/include/servermd.h Wed Dec 6 16:56:30 1989 --- X11R4/mit/server/include/servermd.h Wed Oct 17 22:31:34 1990 *************** *** 126,131 **** --- 126,140 ---- #endif /* sun */ + #ifdef xenix + + #define IMAGE_BYTE_ORDER LSBFirst /* Values for the Xenix only*/ + #define BITMAP_BIT_ORDER MSBFirst + #define GLYPHPADBYTES 1 + #define GETLEFTBITS_ALIGNMENT 4 + + #endif /* xenix */ + #ifdef apollo #define IMAGE_BYTE_ORDER MSBFirst /* Values for the Apollo only*/ *************** *** 226,232 **** #endif /* pad scanline to a longword */ ! #if defined(ibm) && defined(i386) #define BITMAP_SCANLINE_UNIT 8 #else #define BITMAP_SCANLINE_UNIT 32 --- 235,241 ---- #endif /* pad scanline to a longword */ ! #if defined(ibm) && defined(i386) || defined(xenix) #define BITMAP_SCANLINE_UNIT 8 #else #define BITMAP_SCANLINE_UNIT 32 *** X11R4.ORIG/mit/server/include/os.h Wed Dec 6 16:41:39 1989 --- X11R4/mit/server/include/os.h Sun Nov 4 09:43:31 1990 *************** *** 70,76 **** #endif /* defined(__HIGHC__) */ ! #ifdef __GNUC__ #define alloca __builtin_alloca #define ALLOCATE_LOCAL(size) alloca((int)(size)) #define DEALLOCATE_LOCAL(ptr) /* as nothing */ --- 70,76 ---- #endif /* defined(__HIGHC__) */ ! #if defined(__GNUC__) #define alloca __builtin_alloca #define ALLOCATE_LOCAL(size) alloca((int)(size)) #define DEALLOCATE_LOCAL(ptr) /* as nothing */ *** X11R4.ORIG/mit/server/os/4.2bsd/connection.c Mon Nov 13 11:53:50 1989 --- X11R4/mit/server/os/4.2bsd/connection.c Wed Jan 2 17:03:50 1991 *************** *** 49,55 **** #include <sys/socket.h> #include <signal.h> - #include <fcntl.h> #include <setjmp.h> #ifdef hpux --- 49,54 ---- *************** *** 74,86 **** --- 73,90 ---- /* * sites should be careful to have separate /tmp directories for diskless nodes */ + #ifndef BSD_SOCKET_EMULATION #include <sys/un.h> + #endif #include <sys/stat.h> static int unixDomainConnection = -1; #endif + #undef NULL #include <stdio.h> + #ifndef xenix #include <sys/uio.h> + #endif #include "osstruct.h" #include "osdep.h" #include "opaque.h" *************** *** 225,231 **** #endif /* TCPCONN */ #ifdef UNIXCONN - static struct sockaddr_un unsock; static int --- 229,234 ---- *************** *** 237,246 **** --- 240,253 ---- unsock.sun_family = AF_UNIX; oldUmask = umask (0); #ifdef X_UNIX_DIR + #ifndef BSD_SOCKET_EMULATION mkdir (X_UNIX_DIR, 0777); chmod (X_UNIX_DIR, 0777); #endif + #endif + #ifndef BSD_SOCKET_EMULATION strcpy (unsock.sun_path, X_UNIX_PATH); + #endif strcat (unsock.sun_path, display); #ifdef hpux { *************** *** 263,269 **** --- 270,278 ---- symlink(unsock.sun_path, oldLinkName); } #endif /* hpux */ + #ifndef BSD_SOCKET_EMULATION unlink (unsock.sun_path); + #endif if ((request = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { Error ("Creating Unix socket"); *************** *** 439,444 **** --- 448,458 ---- { ResetOsBuffers(); #ifdef UNIXCONN + /* + * The xenix socket is clean, so we don't have to deal with this mess! + * - Chain Lee + */ + #ifndef BSD_SOCKET_EMULATION if (unixDomainConnection != -1) { /* *************** *** 459,464 **** --- 473,479 ---- WellKnownConnections |= (1L << unixDomainConnection); } } + #endif #endif /* UNIXCONN */ ResetAuthorization (); ResetHosts(display); *************** *** 530,535 **** --- 545,554 ---- auth_id = (XID) 0; } + #ifdef xenix + auth_id = (XID) 0; + #endif + if (auth_id == (XID) ~0L) return "Client is not authorized to connect to Server"; *************** *** 753,758 **** --- 772,780 ---- * If would truly be wonderful if select() would put the bogus * file descriptors in the exception mask, but nooooo. So we have * to check each and every socket individually. + * + * The Xenix socket driver support select() on exception condition. + * So things are much better here. - Chain Lee. *****************/ void *************** *** 768,775 **** --- 790,815 ---- notime.tv_sec = 0; notime.tv_usec = 0; + #if BSD_SOCKET_EMULATION + /* + * Much more efficient here, but may not be reliable. + */ + COPYBITS(AllClients, tmask); + r = select (MAXSOCKS, (int *)NULL, (int *)NULL, (int *)tmask, + ¬ime); for (i=0; i<mskcnt; i++) { + mask = tmask[i]; + while (mask) { + curoff = ffs (mask) - 1; + curclient = curoff + (i << 5); + CloseDownClient(clients[ConnectionTranslation[curclient]]); + mask &= ~(1 << curoff); + } + } + #else + for (i=0; i<mskcnt; i++) + { mask = AllClients[i]; while (mask) { *************** *** 783,791 **** CloseDownClient(clients[ConnectionTranslation[curclient]]); mask &= ~(1 << curoff); } ! } } - /***************** * CloseDownConnection --- 823,831 ---- CloseDownClient(clients[ConnectionTranslation[curclient]]); mask &= ~(1 << curoff); } ! } ! #endif } /***************** * CloseDownConnection *** X11R4.ORIG/mit/server/os/4.2bsd/WaitFor.c Sat Dec 2 11:57:55 1989 --- X11R4/mit/server/os/4.2bsd/WaitFor.c Wed Jan 2 17:01:57 1991 *************** *** 112,117 **** --- 112,126 ---- } #endif + + char *tvtos(tv) + struct timeval *tv; + { + static char buf[20]; + sprintf(buf, "(%d, %d)", tv->tv_sec, tv->tv_usec); + return buf; + } + int WaitForSomething(pClientsReady) int *pClientsReady; *************** *** 121,140 **** long timeout; long clientsReadable[mskcnt]; long clientsWritable[mskcnt]; long curclient; int selecterr; int nready; long devicesReadable[mskcnt]; CLEARBITS(clientsReadable); /* We need a while loop here to handle crashed connections and the screen saver timeout */ while (1) { if (ANYSET(ClientsWithInput)) { ! COPYBITS(ClientsWithInput, clientsReadable); break; } if (ScreenSaverTime) --- 130,156 ---- long timeout; long clientsReadable[mskcnt]; long clientsWritable[mskcnt]; + long clientsBroken[mskcnt]; long curclient; int selecterr; int nready; long devicesReadable[mskcnt]; CLEARBITS(clientsReadable); + CLEARBITS(clientsBroken); /* We need a while loop here to handle crashed connections and the screen saver timeout */ while (1) { + #ifdef xenix + extern int xenixEventPending; + if (xenixEventPending) + break; + #endif if (ANYSET(ClientsWithInput)) { ! COPYBITS(ClientsWithInput, clientsReadable); break; } if (ScreenSaverTime) *************** *** 166,171 **** --- 182,193 ---- } if (timeTilFrob >= 0) { + + #ifdef xenix + /* should get rid of this busy waiting loop */ + if (timeout > 5) + timeout = 5; + #endif waittime.tv_sec = timeout / MILLI_PER_SECOND; waittime.tv_usec = (timeout % MILLI_PER_SECOND) * (1000000 / MILLI_PER_SECOND); *************** *** 179,184 **** --- 201,208 ---- else wt = NULL; COPYBITS(AllSockets, LastSelectMask); + COPYBITS(AllSockets, clientsBroken); + #ifdef apollo COPYBITS(apInputMask, LastWriteMask); #endif *************** *** 198,214 **** --- 222,259 ---- else if (AnyClientsWriteBlocked) { COPYBITS(ClientsWriteBlocked, clientsWritable); + #ifdef BSD_SOCKET_EMULATION i = select (MAXSOCKS, (int *)LastSelectMask, + (int *)clientsWritable, (int *)clientsBroken, wt); + if (ANYSET(clientsBroken)) { + i = -1; + errno = EBADF; + } + #else + i = select (MAXSOCKS, (int *)LastSelectMask, (int *)clientsWritable, (int *) NULL, wt); + #endif } else + { #ifdef apollo i = select (MAXSOCKS, (int *)LastSelectMask, (int *)LastWriteMask, (int *) NULL, wt); #else + #ifdef BSD_SOCKET_EMULATION + CLEARBITS(clientsWritable); i = select (MAXSOCKS, (int *)LastSelectMask, + (int *) clientsWritable, (int *) clientsBroken, wt); + if (ANYSET(clientsBroken)) { + i = -1; + errno = EBADF; + } + #else + i = select (MAXSOCKS, (int *)LastSelectMask, (int *) NULL, (int *) NULL, wt); #endif + #endif + } selecterr = errno; WakeupHandler((unsigned long)i, (pointer)LastSelectMask); #ifdef XTESTEXT1 *************** *** 273,278 **** } return nready; } - --- 318,322 ---- *** X11R4.ORIG/mit/server/os/4.2bsd/access.c Sun Nov 12 15:39:31 1989 --- X11R4/mit/server/os/4.2bsd/access.c Wed Jan 2 17:02:57 1991 *************** *** 33,48 **** #include <sys/socket.h> #include <sys/ioctl.h> ! #ifdef hpux # include <sys/utsname.h> - # ifdef HAS_IFREQ - # include <net/if.h> - # endif #else ! # include <net/if.h> ! #endif /* hpux */ #include <netdb.h> #ifdef TCPCONN #include <netinet/in.h> #endif /* TCPCONN */ --- 33,54 ---- #include <sys/socket.h> #include <sys/ioctl.h> ! #ifdef xenix # include <sys/utsname.h> #else ! # if defined(hpux) ! # include <sys/utsname.h> ! # ifdef HAS_IFREQ ! # include <net/if.h> ! # endif ! # else ! # include <net/if.h> ! # endif /* hpux */ ! #endif /*xenix */ + #ifndef BSD_SOCKET_EMULATION #include <netdb.h> + #endif #ifdef TCPCONN #include <netinet/in.h> #endif /* TCPCONN */ *************** *** 106,114 **** #endif /* AF_CHAOS */ #ifdef AF_INET #ifdef TCPCONN ! {AF_INET, FamilyInternet} #endif #endif }; /* --- 112,121 ---- #endif /* AF_CHAOS */ #ifdef AF_INET #ifdef TCPCONN ! {AF_INET, FamilyInternet}, #endif #endif + {0, 0} }; /* *************** *** 136,142 **** LocalHostEnabled = FALSE; } ! #define FAMILIES ((sizeof familyMap)/(sizeof familyMap[0])) #if defined (hpux) && ! defined (HAS_IFREQ) /* Define this host for access control. Find all the hosts the OS knows about --- 143,149 ---- LocalHostEnabled = FALSE; } ! #define FAMILIES ((sizeof familyMap)/(sizeof familyMap[0]) - 1) #if defined (hpux) && ! defined (HAS_IFREQ) /* Define this host for access control. Find all the hosts the OS knows about *************** *** 199,204 **** --- 206,218 ---- } #else + #ifdef BSD_SOCKET_EMULATION + DefineSelf (fd) + int fd; + { + + } + #else /* Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. */ *************** *** 314,319 **** --- 328,334 ---- #endif } } + #endif #endif /* hpux && !HAS_IFREQ */ #ifdef XDMCP *** X11R4.ORIG/mit/server/os/4.2bsd/io.c Thu Sep 14 16:19:57 1989 --- X11R4/mit/server/os/4.2bsd/io.c Fri Oct 5 21:16:45 1990 *************** *** 35,41 **** --- 35,43 ---- #include "Xmd.h" #include <errno.h> #include <sys/param.h> + #ifndef xenix #include <sys/uio.h> + #endif #include "X.h" #include "Xproto.h" #include "os.h" *** X11R4.ORIG/mit/server/os/4.2bsd/oscolor.c Thu Oct 4 16:07:56 1990 --- X11R4/mit/server/os/4.2bsd/oscolor.c Wed Aug 29 00:02:43 1990 *************** *** 22,37 **** ******************************************************************/ /* $XConsortium: oscolor.c,v 1.17 89/12/18 15:41:43 rws Exp $ */ - - #include "rgb.h" - #include "os.h" - #if !defined(sparc) - #ifdef NDBM #include <ndbm.h> #else #include <dbm.h> #endif /* Looks up the color in the database. Note that we are assuming there * is only one database for all the screens. If you have multiple databases, --- 22,34 ---- ******************************************************************/ /* $XConsortium: oscolor.c,v 1.17 89/12/18 15:41:43 rws Exp $ */ #ifdef NDBM #include <ndbm.h> #else #include <dbm.h> #endif + #include "rgb.h" + #include "os.h" /* Looks up the color in the database. Note that we are assuming there * is only one database for all the screens. If you have multiple databases, *************** *** 90,139 **** } return(0); } - #else /* It is a sun4 with broken DBM. */ - /* Looks up the color in the database. - */ - static struct { - unsigned short sRed, sGreen, sBlue; - char *pcName; - } ptDataBase[] = { - #include "rgbdb.h" - }; - - static int iDbSize = sizeof(ptDataBase)/sizeof(ptDataBase[0]); - - extern void CopyISOLatin1Lowered(); - - int OsLookupColor(screen, name, len, pred, pgreen, pblue) - int screen; - char *name; - unsigned len; - unsigned short *pred, *pgreen, *pblue; - - { - int i; - char *lowername; - - /* convert name to lower case */ - lowername = (char *)ALLOCATE_LOCAL(len + 1); - if (!lowername) - return(0); - CopyISOLatin1Lowered ((unsigned char *) lowername, (unsigned char *) name, - (int)len); - - for(i=0;i<iDbSize;i++){ - if(!strcmp(ptDataBase[i].pcName,lowername)) - break; - } - DEALLOCATE_LOCAL(lowername); - if(i < iDbSize){ - *pred = (ptDataBase[i].sRed * 65535) / 255; - *pgreen = (ptDataBase[i].sGreen * 65535) / 255; - *pblue = (ptDataBase[i].sBlue * 65535) / 255; - return 1; - } else { - return 0; - } - } - #endif sun4 --- 87,90 ---- *** X11R4.ORIG/mit/server/os/4.2bsd/xdmcp.c Wed Dec 13 14:42:17 1989 --- X11R4/mit/server/os/4.2bsd/xdmcp.c Fri Aug 31 09:47:29 1990 *************** *** 13,18 **** --- 13,20 ---- * */ + #ifdef XDMCP + #include "Xos.h" #include <sys/param.h> #include <sys/socket.h> *************** *** 26,32 **** #include "input.h" #include "opaque.h" - #ifdef XDMCP #include "Xdmcp.h" extern int argcGlobal; --- 28,33 ---- *** X11R4.ORIG/mit/server/Imakefile Sat Dec 16 19:09:30 1989 --- X11R4/mit/server/Imakefile Sun Dec 16 23:08:49 1990 *************** *** 9,14 **** --- 9,17 ---- #else OTHEREXTS = /* nothing */ #endif + + VGA = vga /* trident */ + EXTENSIONS = $(OTHEREXTS) $(EXTENSIONSRC)/server/libext.a EXTDIR = $(EXTENSIONSRC)/server FONTUTILDIR = $(FONTSRC)/mkfontdir *************** *** 24,29 **** --- 27,33 ---- APOLLO = ddx/apollo/libapollo.a APC = ddx/apollo/apc/libapc.a SUN = ddx/sun/libsun.a + XENIX = ddx/xenix/$(VGA)/libxenix.a os/4.2bsd/libos.a ../lib/X/libX11.a MACII = ddx/macII/libmacII.a TEK = ddx/tek/libtek.a XAULIB = $(TOP)/lib/Xau/libXau.a *************** *** 89,94 **** --- 93,104 ---- #define XsunServer /* as nothing */ #endif + #ifdef XxenixServer + #define doxenixServer + #else + #define doxenixServer /* as nothing */ + #endif + #ifdef XhpServer #define dohpServer #else *************** *** 126,133 **** * * /***************************************************************************** */ ! ALL = XqvssServer XqdssServer XsunServer XapolloServer XibmServer XhpServer XmacIIServer XmfbpmaxServer XcfbpmaxServer XtekServer ! ALLPOSSIBLE = Xqvss Xqdss Xsun Xibm Xapollo Xhp XmacII Xcfbpmax Xmfbpmax Xtek all: $(ALL) --- 136,144 ---- * * /***************************************************************************** */ ! #ALL = XqvssServer XqdssServer XsunServer XapolloServer XibmServer XhpServer XmacIIServer XmfbpmaxServer XcfbpmaxServer XtekServer ! ALL = XxenixServer ! ALLPOSSIBLE = Xqvss Xqdss Xsun Xxenix Xibm Xapollo Xhp XmacII Xcfbpmax Xmfbpmax Xtek all: $(ALL) *************** *** 271,278 **** --- 282,334 ---- #load /usr/lib/libdbm.a #endif /* dosunServer */ + #ifdef doxenixServer + /**/# + /**/# xenix server + /**/# + #define need_dix + #define need_ddx_snf + #define need_ddx_mi + #define need_ddx_mfb + #define need_ddx_cfb + #define need_ddx_xenix + #define need_os_xenix + XENIXDIRS = dix ddx/snf ddx/mi ddx/mfb ddx/cfb ddx/xenix/$(VGA) os/4.2bsd + XENIXOBJS = ddx/xenix/$(VGA)/xenixInit.o $(FONTUTIL) + XENIXLIBS = $(XENIX) $(CFB) $(DIX) $(SNF) $(MFB) $(MI) $(EXTENSIONS) + XENIXSYSLIBS = $(SYSLIBS) + XxenixDIRS = $(XENIXDIRS) + ServerTarget(Xxenix,$(EXTDIR) $(FONTUTILDIR) $(XENIXDIRS),$(XENIXOBJS),$(XENIXLIBS),$(XENIXSYSLIBS)) + saber_src_xenix: + #cd dix + #make saber_src + #cd ../ddx/snf + #make saber_src + #cd ../mi + #make saber_src + #cd ../mfb + #make saber_src + #cd ../cfb + #make saber_src + #cd ../xenix + #make saber_src + #cd ../../os/4.2bsd + #make saber_src + #cd ../../../extensions/server + #make saber_src + #cd ../../fonts/mkfontdir + #make saber_src_server + #cd ../../lib/Xau + #make saber_src + #cd ../../server + #load /usr/lib/libm.a + #load /usr/lib/libdbm.a + #endif /* doxenixServer */ + + + #ifdef dohpServer /**/# /**/# HP server *************** *** 417,422 **** --- 473,483 ---- #else #define dir_os_bsdemul /**/ #endif + #ifdef need_os_xenix + #define dir_os_xenix os/4.2bsd + #else + #define dir_os_xenix /**/ + #endif #ifdef need_ddx_snf #define dir_ddx_snf ddx/snf *************** *** 502,526 **** #else #define dir_ddx_sun /**/ #endif OURDIX = dir_dix OURDDX = dir_ddx_snf dir_ddx_mfb dir_ddx_cfb dir_ddx_mi ! OUROS = dir_os_42bsd dir_os_bsdemul DECDDX = dir_ddx_dec_lk201 dir_ddx_dec_qdss dir_ddx_dec_qvss dir_ddx_dec_mfbpmax dir_ddx_dec_cfbpmax HPDDX = dir_ddx_hp ! OTHERDDX = dir_ddx_apollo dir_ddx_apollo_apc dir_ddx_ibm dir_ddx_macII dir_ddx_sun dir_ddx_tek SUBDIRS = $(OURDIX) $(OURDDX) $(OUROS) $(DECDDX) $(HPDDX) $(OTHERDDX) ALLDDXDIRS = ddx/snf ddx/mi ddx/cfb ddx/mfb \ ddx/dec/lk201 ddx/dec/qvss ddx/dec/qdss ddx/dec/qdss/libtl \ ddx/sun \ ddx/apollo ddx/apollo/apc \ ddx/ibm \ ddx/dec/mfbpmax ddx/dec/cfbpmax \ ddx/hp ddx/tek \ ddx/macII ! ALLOSDIRS = os/4.2bsd os/bsdemul ALLSUBDIRS = dix $(ALLDDXDIRS) $(ALLOSDIRS) InstallMultiple($(ALL),$(BINDIR)) --- 563,593 ---- #else #define dir_ddx_sun /**/ #endif + #ifdef need_ddx_xenix + #define dir_ddx_xenix ddx/xenix/$(VGA) + #else + #define dir_ddx_xenix /**/ + #endif OURDIX = dir_dix OURDDX = dir_ddx_snf dir_ddx_mfb dir_ddx_cfb dir_ddx_mi ! OUROS = dir_os_42bsd dir_os_bsdemul dir_os_xenix DECDDX = dir_ddx_dec_lk201 dir_ddx_dec_qdss dir_ddx_dec_qvss dir_ddx_dec_mfbpmax dir_ddx_dec_cfbpmax HPDDX = dir_ddx_hp ! OTHERDDX = dir_ddx_apollo dir_ddx_apollo_apc dir_ddx_ibm dir_ddx_macII dir_ddx_sun dir_ddx_xenix dir_ddx_tek SUBDIRS = $(OURDIX) $(OURDDX) $(OUROS) $(DECDDX) $(HPDDX) $(OTHERDDX) ALLDDXDIRS = ddx/snf ddx/mi ddx/cfb ddx/mfb \ ddx/dec/lk201 ddx/dec/qvss ddx/dec/qdss ddx/dec/qdss/libtl \ ddx/sun \ + ddx/xenix/$(VGA) \ ddx/apollo ddx/apollo/apc \ ddx/ibm \ ddx/dec/mfbpmax ddx/dec/cfbpmax \ ddx/hp ddx/tek \ ddx/macII ! ALLOSDIRS = os/4.2bsd /* os/bsdemul */ ALLSUBDIRS = dix $(ALLDDXDIRS) $(ALLOSDIRS) InstallMultiple($(ALL),$(BINDIR))
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/fonts/mkfontdir/mkfontdir.c Sun Dec 10 11:03:37 1989 --- X11R4/mit/fonts/mkfontdir/mkfontdir.c Sat Oct 6 17:08:46 1990 *************** *** 28,34 **** --- 28,39 ---- #include <X11/Xos.h> /* #include <X11/Xmu.h> don't include this */ void XmuCopyISOLatin1Lowered(); + #ifdef xenix + #include <dirent.h> + #define direct dirent + #else #include <sys/dir.h> + #endif #include <sys/param.h> #include "fontdir.h" *** X11R4.ORIG/mit/fonts/bdftosnf/bdftosnf.h Mon Oct 9 14:54:56 1989 --- X11R4/mit/fonts/bdftosnf/bdftosnf.h Sun Dec 16 11:11:10 1990 *************** *** 56,63 **** # endif # else ! # ifdef apollo # define DEFAULTGLPAD 2 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ --- 56,71 ---- # endif # else ! # ifdef xenix + # define DEFAULTGLPAD 1 /* default padding for glyphs */ + # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ + # define DEFAULTBYTEORDER LSBFirst /* default bitmap byte order */ + # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ + + # else + # ifdef apollo + # define DEFAULTGLPAD 2 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ *************** *** 71,122 **** # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else ! # ifdef hpux # define DEFAULTGLPAD 2 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else ! # ifdef pegasus # define DEFAULTGLPAD 4 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else ! # ifdef macII # define DEFAULTGLPAD 4 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else ! # ifdef mips ! # ifdef MIPSEL # define DEFAULTGLPAD 4 /* default padding for glyphs */ # define DEFAULTBITORDER LSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER LSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else # define DEFAULTGLPAD 4 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # endif ! # else # define DEFAULTGLPAD 1 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ # endif # endif # endif --- 79,131 ---- # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else ! # ifdef hpux # define DEFAULTGLPAD 2 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else ! # ifdef pegasus # define DEFAULTGLPAD 4 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else ! # ifdef macII # define DEFAULTGLPAD 4 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else ! # ifdef mips ! # ifdef MIPSEL # define DEFAULTGLPAD 4 /* default padding for glyphs */ # define DEFAULTBITORDER LSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER LSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # else # define DEFAULTGLPAD 4 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ ! # endif ! # else # define DEFAULTGLPAD 1 /* default padding for glyphs */ # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */ # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */ # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */ + # endif # endif # endif # endif *** X11R4.ORIG/mit/clients/xterm/main.c Sat Jan 5 22:00:04 1991 --- X11R4/mit/clients/xterm/main.c Sat Nov 3 17:39:33 1990 *************** *** 2377,2387 **** --- 2377,2393 ---- ioctl (fd, FIONREAD, (char *) &arg); return (int) arg; #else + #ifdef xenix + static long arg; + fionread (fd, (char *) &arg); + return (int) arg; + #else struct pollfd pollfds[1]; pollfds[0].fd = fd; pollfds[0].events = POLLIN; return poll (pollfds, 1, 0); + #endif #endif } *** X11R4.ORIG/mit/clients/xterm/Imakefile Sat Jan 5 22:03:59 1991 --- X11R4/mit/clients/xterm/Imakefile Sat Nov 3 17:50:53 1990 *************** *** 10,16 **** /**/########################################################################### #ifdef BandAidCompiler ! #include BandAidCompiler #endif /* --- 10,16 ---- /**/########################################################################### #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif /* *** X11R4.ORIG/mit/clients/xmh/command.c Sat Dec 16 21:54:10 1989 --- X11R4/mit/clients/xmh/command.c Sun Oct 7 15:46:11 1990 *************** *** 376,382 **** --- 376,386 ---- int *lenP; { long nread; + #ifdef xenix + if (fionread( fd, &nread ) < 0 /*failed*/) { + #else if (ioctl( fd, FIONREAD, &nread ) /*failed*/) { + #endif SystemError( "couldn't inquire bytes in pipe" ); } else if (nread) { *** X11R4.ORIG/mit/clients/xmh/msg.c Sat Dec 16 03:35:47 1989 --- X11R4/mit/clients/xmh/msg.c Sun Nov 4 20:16:12 1990 *************** *** 751,756 **** --- 751,757 ---- static int compsize = 0; static XawTextPosition startPos; char *file, **argv; + char *index(); int fid; if (blankcomp == NULL) { file = MakeNewTempFileName(); *** X11R4.ORIG/mit/clients/xmh/Imakefile Fri Oct 6 15:11:21 1989 --- X11R4/mit/clients/xmh/Imakefile Fri Oct 5 21:59:20 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif INCLUDES = -I$(TOP) -I$(AWIDGETSRC) -I$(TOOLKITSRC) --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif INCLUDES = -I$(TOP) -I$(AWIDGETSRC) -I$(TOOLKITSRC) *** X11R4.ORIG/mit/clients/xfd/Imakefile Fri Nov 24 17:46:52 1989 --- X11R4/mit/clients/xfd/Imakefile Fri Oct 5 21:57:27 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif DEPLIBS = XawClientDepLibs --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif DEPLIBS = XawClientDepLibs *** X11R4.ORIG/mit/clients/xedit/Imakefile Fri Nov 24 18:03:32 1989 --- X11R4/mit/clients/xedit/Imakefile Fri Oct 5 21:57:02 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif DEPLIBS = XawClientDepLibs --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif DEPLIBS = XawClientDepLibs *** X11R4.ORIG/mit/clients/xinit/xinit.c Fri May 18 11:25:27 1990 --- X11R4/mit/clients/xinit/xinit.c Wed Nov 7 00:02:20 1990 *************** *** 381,389 **** serverpid = vfork(); switch(serverpid) { case 0: close(0); close(1); ! /* * don't hang on read/write to control tty */ --- 381,390 ---- serverpid = vfork(); switch(serverpid) { case 0: + #ifndef xenix close(0); close(1); ! #endif /* * don't hang on read/write to control tty */ *************** *** 403,410 **** * prevent server from getting sighup from vhangup() * if client is xterm -L */ setpgrp(0,getpid()); ! Execute (server); Error ("no server \"%s\" in PATH\n", server[0]); { --- 404,412 ---- * prevent server from getting sighup from vhangup() * if client is xterm -L */ + #ifndef xenix setpgrp(0,getpid()); ! #endif Execute (server); Error ("no server \"%s\" in PATH\n", server[0]); { *************** *** 486,492 **** --- 488,498 ---- } #ifdef SYSV + #ifdef xenix + #define killpg(pgrp, sig) kill(pgrp, sig) + #else #define killpg(pgrp, sig) kill(-(pgrp), sig) + #endif #endif /* SYSV */ static jmp_buf close_env; *** X11R4.ORIG/mit/clients/xcalc/Imakefile Fri Dec 15 17:52:09 1989 --- X11R4/mit/clients/xcalc/Imakefile Fri Oct 5 21:55:38 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif #ifdef MacIIArchitecture --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif #ifdef MacIIArchitecture *** X11R4.ORIG/mit/clients/xclipboard/Imakefile Tue Dec 12 17:21:22 1989 --- X11R4/mit/clients/xclipboard/Imakefile Fri Oct 5 21:56:20 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif SRCS1 = xclipboard.c --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif SRCS1 = xclipboard.c *** X11R4.ORIG/mit/clients/xman/man.c Wed Dec 13 17:07:56 1989 --- X11R4/mit/clients/xman/man.c Wed Oct 31 22:46:33 1990 *************** *** 128,134 **** /* * realloc manual to be minimum space necessary. */ - manual = (Manual *) realloc( (char *) manual, (sizeof(Manual) * sect)); if (manual == NULL) PrintError("Could not allocate memory for manual sections."); --- 128,133 ---- *** X11R4.ORIG/mit/clients/xdm/Imakefile Sat Jan 5 22:02:34 1991 --- X11R4/mit/clients/xdm/Imakefile Sat Nov 3 17:48:22 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif #if InstallXdmConfig --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif #if InstallXdmConfig *** X11R4.ORIG/mit/clients/oclock/Imakefile Thu Dec 14 14:08:59 1989 --- X11R4/mit/clients/oclock/Imakefile Fri Oct 5 21:54:50 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif DEFINES = ExtensionDefines --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif DEFINES = ExtensionDefines *** X11R4.ORIG/mit/clients/Imakefile Fri Dec 15 10:53:04 1989 --- X11R4/mit/clients/Imakefile Sun Oct 7 18:41:37 1990 *************** *** 5,20 **** #ifdef ATTArchitecture OTHERSUBDIRS = xhost #else ! OTHERSUBDIRS = xdm xhost #endif #endif SUBDIRS = \ ! appres bitmap listres oclock twm xauth xbiff xcalc xclipboard xclock \ ! xditview xdpyinfo xedit xfd xinit xkill xload xlogo \ xlsatoms xlsclients xlsfonts xlswins xmag xman xmh \ xmodmap xpr xprop xrdb xrefresh xfontsel $(OTHERSUBDIRS) \ xset xsetroot xstdcmap xterm xwd xwininfo xwud MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) --- 5,25 ---- #ifdef ATTArchitecture OTHERSUBDIRS = xhost #else ! OTHERSUBDIRS = ! OTHERSUBDIRS_UNBUILDABLE = \ ! xdm xhost #endif #endif SUBDIRS = \ ! appres bitmap listres oclock twm xbiff xcalc xclipboard xclock \ ! xdpyinfo xedit xfd xinit xkill xlogo \ xlsatoms xlsclients xlsfonts xlswins xmag xman xmh \ xmodmap xpr xprop xrdb xrefresh xfontsel $(OTHERSUBDIRS) \ xset xsetroot xstdcmap xterm xwd xwininfo xwud + + UNBUILDABLE = \ + xauth xditview xload MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) *** X11R4.ORIG/mit/util/scripts/bsdinst.sh Thu Oct 20 17:37:12 1988 --- X11R4/mit/util/scripts/bsdinst.sh Sat Oct 6 22:11:56 1990 *************** *** 85,91 **** # do the actual install (remove destination since SysV install doesn't) rm -f $dst/$srcbase ! (cd $srcdir ; install -f $dst $flags $src) # and clean up --- 85,92 ---- # do the actual install (remove destination since SysV install doesn't) rm -f $dst/$srcbase ! #(cd $srcdir ; install -f $dst $flags $src) ! (cd $srcdir ; cp $src $dst) # and clean up *** X11R4.ORIG/mit/rgb/showrgb.c Wed Dec 13 09:01:50 1989 --- X11R4/mit/rgb/showrgb.c Sat Oct 6 21:41:00 1990 *************** *** 99,104 **** fprintf (stderr, "\"\n"); } } ! dbm_close (rgb_dbm); } --- 99,123 ---- fprintf (stderr, "\"\n"); } } ! #ifndef xenix dbm_close (rgb_dbm); + #endif + } + + bcopy (b1, b2, length) + register unsigned char *b1, *b2; + register length; + { + if (b1 < b2) { + b2 += length; + b1 += length; + while (length--) { + *--b2 = *--b1; + } + } + else { + while (length--) { + *b2++ = *b1++; + } + } } *** X11R4.ORIG/mit/rgb/rgb.c Wed Dec 13 09:01:47 1989 --- X11R4/mit/rgb/rgb.c Sat Oct 6 21:37:44 1990 *************** *** 127,134 **** fflush (stderr); } } ! dbm_close(rgb_dbm); ! exit(0); } --- 127,134 ---- fflush (stderr); } } ! #ifndef xenix dbm_close(rgb_dbm); ! #endif exit(0); } *** X11R4.ORIG/mit/examples/Xaw/Imakefile Wed Dec 13 18:12:23 1989 --- X11R4/mit/examples/Xaw/Imakefile Fri Oct 12 21:04:59 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif SRCS = popup.c \ --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif SRCS = popup.c \ *** X11R4.ORIG/mit/demos/ico/ico.c Tue Dec 19 13:45:36 1989 --- X11R4/mit/demos/ico/ico.c Wed Oct 17 23:17:59 1990 *************** *** 147,153 **** --- 147,157 ---- " -copy copy multibuffer frames instead of clearing", " -lw number line width to use", " -i invert", + #ifdef xenix + " -sleep number miliseconds to sleep in between draws", + #else " -sleep number seconds to sleep in between draws", + #endif " -obj objname type of polyhedral object to draw", " -objhelp list polyhedral objects available", NULL}; *************** *** 732,738 **** --- 736,746 ---- } if (dblbuf) dbpair.dbufnum = 1 - dbpair.dbufnum; + #ifdef xenix + if (!multibuf && sleepcount) nap(sleepcount); + #else if (!multibuf && sleepcount) sleep(sleepcount); + #endif } char *xalloc(nbytes) *** X11R4.ORIG/mit/demos/xeyes/Imakefile Fri Jul 21 12:57:51 1989 --- X11R4/mit/demos/xeyes/Imakefile Fri Oct 5 22:02:21 1990 *************** *** 1,5 **** #ifdef BandAidCompiler ! #include BandAidCompiler #endif DEFINES = -DSHAPE --- 1,5 ---- #ifdef BandAidCompiler ! #include "BandAidCompiler" #endif DEFINES = -DSHAPE *** X11R4.ORIG/mit/demos/puzzle/puzzle.c Tue Dec 12 14:43:09 1989 --- X11R4/mit/demos/puzzle/puzzle.c Sun Oct 7 19:38:08 1990 *************** *** 419,436 **** LogMoveSpace(first_x,first_y,last_x,last_y,shift_dir); } - #ifdef USG - int gettimeofday (tvp, tzp) - struct timeval *tvp; - struct timezone *tzp; - { - time (&tvp->tv_sec); - tvp->tv_usec = 0L; - - /* ignore tzp for now since this file doesn't use it */ - } - #endif - initialize() { /** Initialize the position and --- 419,424 ---- *** X11R4.ORIG/mit/extensions/lib/extutil.c Sun Dec 10 22:54:49 1989 --- X11R4/mit/extensions/lib/extutil.c Sat Oct 6 16:57:22 1990 *************** *** 257,259 **** --- 257,268 ---- if (!ext_name) ext_name = X_EXTENSION_UNKNOWN; return (*func) (dpy, ext_name, X_EXTENSION_MISSING); } + + #ifdef xenix + static void + dummy() + { + extern void ___extensions_lib_globals(); + ___extensions_lib_globals(); + } + #endif *** X11R4.ORIG/mit/extensions/lib/globals.c Tue Oct 3 17:25:12 1989 --- X11R4/mit/extensions/lib/globals.c Sat Oct 6 16:35:18 1990 *************** *** 58,63 **** --- 58,67 ---- * to be inserted BELOW this point!!! */ + #ifdef xenix + void ___extensions_lib_globals(){} + #endif + /* * NOTE: any additional external definition NEED * to be inserted ABOVE this point!!! *** X11R4.ORIG/mit/extensions/server/multibuf.c Sun Dec 10 11:03:58 1989 --- X11R4/mit/extensions/server/multibuf.c Sat Oct 6 15:44:52 1990 *************** *** 44,50 **** #include "regionstr.h" #include "gcstruct.h" #include "inputstr.h" ! #include <sys/time.h> /* * per-Multibuffer data --- 44,51 ---- #include "regionstr.h" #include "gcstruct.h" #include "inputstr.h" ! ! #include "Xos.h" /* * per-Multibuffer data *** X11R4.ORIG/mit/config/Imake.tmpl Thu Aug 30 13:44:24 1990 --- X11R4/mit/config/Imake.tmpl Fri Oct 5 21:03:08 1990 *************** *** 43,53 **** * 4. Create a .cf file with the name given by MacroFile. */ - #ifdef OSK - #define MacroIncludeFile <osk.cf> - #define MacroFile osk.cf - #endif - #ifdef ultrix #define MacroIncludeFile <ultrix.cf> #define MacroFile ultrix.cf --- 43,48 ---- *************** *** 77,82 **** --- 72,84 ---- #define SunArchitecture #endif /* sun */ + #ifdef xenix + #define MacroIncludeFile <xenix.cf> + #define MacroFile xenix.cf + #undef xenix + #define SunArchitecture + #endif /* xenix */ + #ifdef hpux #define MacroIncludeFile <hp.cf> #define MacroFile hp.cf *************** *** 187,193 **** #ifndef MacroIncludeFile /**/# WARNING: Imake.tmpl not configured; guessing at definitions!!! ! /**/# This might mean that BOOTSTRAPCFLAGS wasnt set when building imake. #define MacroIncludeFile <generic.cf> #define MacroFile generic.cf #endif --- 189,195 ---- #ifndef MacroIncludeFile /**/# WARNING: Imake.tmpl not configured; guessing at definitions!!! ! /**/# This might mean that BOOTSTRAPCFLAGS wasn't set when building imake. #define MacroIncludeFile <generic.cf> #define MacroFile generic.cf #endif *************** *** 333,348 **** #endif #ifndef DestDir ! #define DestDir /* as nothing */ #endif #ifndef UsrLibDir /* if changed under SunOS with shared */ ! #define UsrLibDir $(DESTDIR)/usr/lib /* libs, then need to run ldconfig */ #endif /* as root */ #ifndef IncRoot ! #define IncRoot $(DESTDIR)/usr/include #endif #ifndef UNCOMPRESSPATH ! #define UNCOMPRESSPATH /usr/ucb/uncompress #endif #ifndef OptimizedCDebugFlags #define OptimizedCDebugFlags -O --- 335,350 ---- #endif #ifndef DestDir ! #define DestDir /usr/local/X11 #endif #ifndef UsrLibDir /* if changed under SunOS with shared */ ! #define UsrLibDir $(DESTDIR)/lib /* libs, then need to run ldconfig */ #endif /* as root */ #ifndef IncRoot ! #define IncRoot $(DESTDIR)/include #endif #ifndef UNCOMPRESSPATH ! #define UNCOMPRESSPATH /usr/local/bin/uncompress #endif #ifndef OptimizedCDebugFlags #define OptimizedCDebugFlags -O *** X11R4.ORIG/mit/config/Imake.rules Fri Feb 16 15:40:03 1990 --- X11R4/mit/config/Imake.rules Mon Dec 18 17:14:19 1989 *************** *** 328,334 **** #ifndef InstallSharedLibrary #define InstallSharedLibrary(libname,rev,dest) @@\ install:: lib/**/libname.so.rev @@\ ! $(INSTALL) -c lib/**/libname.so.rev dest @@\ #endif /* InstallSharedLibrary */ --- 328,334 ---- #ifndef InstallSharedLibrary #define InstallSharedLibrary(libname,rev,dest) @@\ install:: lib/**/libname.so.rev @@\ ! $(INSTALL) -c $(INSTLIBFLAGS) lib/**/libname.so.rev dest @@\ #endif /* InstallSharedLibrary */ *************** *** 338,345 **** #ifndef InstallSharedLibraryData #define InstallSharedLibraryData(libname,rev,dest) @@\ install:: lib/**/libname.sa.rev @@\ ! $(INSTALL) -c lib/**/libname.sa.rev dest @@\ ! $(RANLIB) $(RANLIBINSTFLAGS) dest/lib/**/libname.sa.rev #endif /* InstallSharedLibraryData */ --- 338,344 ---- #ifndef InstallSharedLibraryData #define InstallSharedLibraryData(libname,rev,dest) @@\ install:: lib/**/libname.sa.rev @@\ ! $(INSTALL) -c $(INSTLIBFLAGS) lib/**/libname.sa.rev dest #endif /* InstallSharedLibraryData */ *** X11R4.ORIG/mit/config/Project.tmpl Fri Feb 16 18:09:05 1990 --- X11R4/mit/config/Project.tmpl Thu Sep 13 04:55:47 1990 *************** *** 20,26 **** #define BuildServer YES /* go ahead and build server */ #endif #ifndef BuildExamples ! #define BuildExamples YES /* but they do take a lot of space */ #endif #ifndef BuildXawBC #define BuildXawBC NO /* be pure */ --- 20,26 ---- #define BuildServer YES /* go ahead and build server */ #endif #ifndef BuildExamples ! #define BuildExamples NO /* but they do take a lot of space */ #endif #ifndef BuildXawBC #define BuildXawBC NO /* be pure */ *************** *** 83,89 **** #define NeedBerklibInXlib NO #endif #ifndef ManDirectoryRoot ! #define ManDirectoryRoot /usr/man/X11 /* if not set in .macros */ #endif #ifndef ManSuffix #define ManSuffix n /* use just one tab or cpp will die */ --- 83,89 ---- #define NeedBerklibInXlib NO #endif #ifndef ManDirectoryRoot ! #define ManDirectoryRoot /usr/man /* if not set in .macros */ #endif #ifndef ManSuffix #define ManSuffix n /* use just one tab or cpp will die */ *************** *** 148,157 **** #endif #ifndef BinDir ! #define BinDir $(DESTDIR)/usr/bin/X11 #endif #ifndef IncRoot ! #define IncRoot $(DESTDIR)/usr/include #endif #ifndef BuildIncRoot #define BuildIncRoot $(TOP) --- 148,157 ---- #endif #ifndef BinDir ! #define BinDir $(DESTDIR)/bin #endif #ifndef IncRoot ! #define IncRoot $(DESTDIR)/include #endif #ifndef BuildIncRoot #define BuildIncRoot $(TOP) *************** *** 172,178 **** #define FontDir $(LIBDIR)/fonts #endif #ifndef AdmDir ! #define AdmDir $(DESTDIR)/usr/adm #endif #ifndef XinitDir #define XinitDir $(LIBDIR)/xinit --- 172,178 ---- #define FontDir $(LIBDIR)/fonts #endif #ifndef AdmDir ! #define AdmDir /usr/adm #endif #ifndef XinitDir #define XinitDir $(LIBDIR)/xinit *************** *** 193,199 **** #define GwmDir $(LIBDIR)/gwm #endif #ifndef ManPath ! #define ManPath $(DESTDIR)/**/ManDirectoryRoot #endif #ifndef ManSourcePath #define ManSourcePath $(MANPATH)/man --- 193,199 ---- #define GwmDir $(LIBDIR)/gwm #endif #ifndef ManPath ! #define ManPath $(DESTDIR)/man #endif #ifndef ManSourcePath #define ManSourcePath $(MANPATH)/man *************** *** 430,443 **** #define _Use(a,b) b #endif #if SharedLibXext ! DEPEXTENSIONLIB = _Use($(USRLIBDIR),$(EXTENSIONSRC)/lib)/libXext.so.$(SOXEXTREV) EXTENSIONLIB = _Use(-lXext,-L$(EXTENSIONSRC) -lXext) #else DEPEXTENSIONLIB = _Use($(USRLIBDIR),$(EXTENSIONSRC)/lib)/libXext.a EXTENSIONLIB = LoaderLibPrefix _Use(-lXext, $(DEPEXTENSIONLIB)) #endif #if SharedLibX ! DEPXLIB = $(DEPEXTENSIONLIB) _Use($(USRLIBDIR),$(XLIBSRC))/libX11.so.$(SOXLIBREV) XLIB = $(EXTENSIONLIB) _Use(-lX11,-L$(XLIBSRC) -lX11) #else DEPXLIB = $(DEPEXTENSIONLIB) _Use($(USRLIBDIR),$(XLIBSRC))/libX11.a --- 430,443 ---- #define _Use(a,b) b #endif #if SharedLibXext ! DEPEXTENSIONLIB = /* _Use($(USRLIBDIR),$(EXTENSIONSRC)/lib)/libXext.so.$(SOXEXTREV) */ EXTENSIONLIB = _Use(-lXext,-L$(EXTENSIONSRC) -lXext) #else DEPEXTENSIONLIB = _Use($(USRLIBDIR),$(EXTENSIONSRC)/lib)/libXext.a EXTENSIONLIB = LoaderLibPrefix _Use(-lXext, $(DEPEXTENSIONLIB)) #endif #if SharedLibX ! DEPXLIB = $(DEPEXTENSIONLIB) /* _Use($(USRLIBDIR),$(XLIBSRC))/libX11.so.$(SOXLIBREV) */ XLIB = $(EXTENSIONLIB) _Use(-lX11,-L$(XLIBSRC) -lX11) #else DEPXLIB = $(DEPEXTENSIONLIB) _Use($(USRLIBDIR),$(XLIBSRC))/libX11.a *************** *** 446,473 **** DEPXAUTHLIB = _Use($(USRLIBDIR),$(XAUTHSRC))/libXau.a XAUTHLIB = LoaderLibPrefix _Use(-lXau,$(DEPXAUTHLIB)) #if SharedLibXmu ! DEPXMULIB = _Use($(USRLIBDIR),$(XMUSRC))/libXmu.so.$(SOXMUREV) XMULIB = _Use(-lXmu,-L$(XMUSRC) -lXmu) #else DEPXMULIB = _Use($(USRLIBDIR),$(XMUSRC))/libXmu.a XMULIB = LoaderLibPrefix _Use(-lXmu,$(DEPXMULIB)) #endif #if SharedOldLibX ! DEPOLDXLIB = _Use($(USRLIBDIR),$(OLDXLIBSRC))/liboldX.so.$(SOOLDXREV) OLDXLIB = _Use(-loldX,-L$(OLDXLIBSRC) -loldX) #else DEPOLDXLIB = _Use($(USRLIBDIR),$(OLDXLIBSRC))/liboldX.a OLDXLIB = LoaderLibPrefix _Use(-loldX,$(DEPOLDXLIB)) #endif #if SharedLibXt ! DEPXTOOLLIB = _Use($(USRLIBDIR),$(TOOLKITSRC))/libXt.so.$(SOXTREV) XTOOLLIB = _Use(-lXt,-L$(TOOLKITSRC) -lXt) #else DEPXTOOLLIB = _Use($(USRLIBDIR),$(TOOLKITSRC))/libXt.a XTOOLLIB = LoaderLibPrefix _Use(-lXt,$(DEPXTOOLLIB)) #endif #if SharedLibXaw ! DEPXAWLIB = _Use($(USRLIBDIR),$(AWIDGETSRC))/libXaw.so.$(SOXAWREV) XAWLIB = _Use(-lXaw,-L$(AWIDGETSRC) -lXaw) #else DEPXAWLIB = _Use($(USRLIBDIR),$(AWIDGETSRC))/libXaw.a --- 446,473 ---- DEPXAUTHLIB = _Use($(USRLIBDIR),$(XAUTHSRC))/libXau.a XAUTHLIB = LoaderLibPrefix _Use(-lXau,$(DEPXAUTHLIB)) #if SharedLibXmu ! DEPXMULIB = /* _Use($(USRLIBDIR),$(XMUSRC))/libXmu.so.$(SOXMUREV) */ XMULIB = _Use(-lXmu,-L$(XMUSRC) -lXmu) #else DEPXMULIB = _Use($(USRLIBDIR),$(XMUSRC))/libXmu.a XMULIB = LoaderLibPrefix _Use(-lXmu,$(DEPXMULIB)) #endif #if SharedOldLibX ! DEPOLDXLIB = /* _Use($(USRLIBDIR),$(OLDXLIBSRC))/liboldX.so.$(SOOLDXREV) */ OLDXLIB = _Use(-loldX,-L$(OLDXLIBSRC) -loldX) #else DEPOLDXLIB = _Use($(USRLIBDIR),$(OLDXLIBSRC))/liboldX.a OLDXLIB = LoaderLibPrefix _Use(-loldX,$(DEPOLDXLIB)) #endif #if SharedLibXt ! DEPXTOOLLIB = /* _Use($(USRLIBDIR),$(TOOLKITSRC))/libXt.so.$(SOXTREV) */ XTOOLLIB = _Use(-lXt,-L$(TOOLKITSRC) -lXt) #else DEPXTOOLLIB = _Use($(USRLIBDIR),$(TOOLKITSRC))/libXt.a XTOOLLIB = LoaderLibPrefix _Use(-lXt,$(DEPXTOOLLIB)) #endif #if SharedLibXaw ! DEPXAWLIB = /* _Use($(USRLIBDIR),$(AWIDGETSRC))/libXaw.so.$(SOXAWREV) */ XAWLIB = _Use(-lXaw,-L$(AWIDGETSRC) -lXaw) #else DEPXAWLIB = _Use($(USRLIBDIR),$(AWIDGETSRC))/libXaw.a *** X11R4.ORIG/mit/config/imakemdep.h Mon Dec 18 16:56:39 1989 --- X11R4/mit/config/imakemdep.h Fri Oct 5 21:30:20 1990 *************** *** 13,18 **** --- 13,22 ---- * These will be passed to the compile along with the contents of the * make variable BOOTSTRAPCFLAGS. */ + #ifdef M_XENIX + #define imake_ccflags "-DSYSV -DUSG" + #endif + #ifdef hpux #define imake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV" #endif *************** *** 111,116 **** --- 115,123 ---- #ifdef M4310 "-DM4310", /* Tektronix */ #endif + #ifdef M_XENIX + "-Dxenix", + #endif #ifdef macII "-DmacII", /* Apple A/UX */ #endif *************** *** 135,140 **** --- 142,150 ---- * in util/makedepend/main.c. */ struct symtab predefs[] = { + #ifdef M_XENIX + {"M_XENIX", "1"}, + #endif #ifdef apollo {"apollo", "1"}, #endif
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/mit/config/sun.cf Wed Sep 26 17:19:02 1990 --- X11R4/mit/config/sun.cf Sat Dec 23 16:10:11 1989 *************** *** 8,18 **** #define OSName SunOS 4.0.3 #define OSMajorVersion 4 #define OSMinorVersion 0 ! #define HasSaberC NO /* for machines that have it */ #define HasNdbm YES #define XsunServer Xsun ! #define HasGcc YES /* VERY USEFUL for server on Sun3 */ #define SystemV NO #define HasPutenv YES --- 8,18 ---- #define OSName SunOS 4.0.3 #define OSMajorVersion 4 #define OSMinorVersion 0 ! #define HasSaberC YES /* for machines that have it */ #define HasNdbm YES #define XsunServer Xsun ! /* #define HasGcc YES */ /* VERY USEFUL for server on Sun3 */ #define SystemV NO #define HasPutenv YES *************** *** 55,61 **** #define OptimizedCDebugFlags /* as nothing */ #endif ! #define UseSunWindowsInServer YES /* link in SunWindows support? */ #if UseSunWindowsInServer #define SunWindowsDefines -DSUN_WINDOWS --- 55,61 ---- #define OptimizedCDebugFlags /* as nothing */ #endif ! #define UseSunWindowsInServer NO /* link in SunWindows support? */ #if UseSunWindowsInServer #define SunWindowsDefines -DSUN_WINDOWS *************** *** 73,81 **** #define ExtensionDefines -DSHAPE -DMITSHM -DMULTIBUFFER -DMITMISC #define ServerDefines -DXDMCP SunWindowsDefines ExtensionDefines AllocateLocalDefines - - #define SHAPE - #define MITSHM #if OSMajorVersion >= 4 && OSMinorVersion >= 0 #define SetTtyGroup YES --- 73,78 ---- *** X11R4.ORIG/mit/config/site.def Fri Sep 28 09:32:38 1990 --- X11R4/mit/config/site.def Sun Sep 9 14:36:01 1990 *************** *** 66,72 **** * so to get to contrib, go up from TOP: */ #ifndef ContribDir ! #define ContribDir /home/datacube/disk1/X11R4/contrib #endif /* --- 66,72 ---- * so to get to contrib, go up from TOP: */ #ifndef ContribDir ! #define ContribDir $(TOP)/../contrib #endif /* *************** *** 86,91 **** --- 86,93 ---- #define HasXcuWidgets NO #endif + + /***************************************************************************** * * * Build Parameters * *************** *** 105,111 **** #ifdef UseInstalled /* if outside the tree */ #define CcCmd gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fwritable-strings -traditional #else /* server won't compile with -traditional */ ! #define CcCmd gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fcombine-regs #endif #endif #endif --- 107,113 ---- #ifdef UseInstalled /* if outside the tree */ #define CcCmd gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fwritable-strings -traditional #else /* server won't compile with -traditional */ ! #define CcCmd gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -traditional #endif #endif #endif *** X11R4.ORIG/mit/config/xenix.cf Sun Jan 6 01:40:33 1991 --- X11R4/mit/config/xenix.cf Sat Jan 5 19:52:17 1991 *************** *** 0 **** --- 1,47 ---- + /* + * SET VERSION NUMBERS BEFORE MAKING MAKEFILES; also, you'll need to install + * util/scripts/bsdinstall.sh before doing a "make install" + */ + + /* + * undefine it if you are not using socket emulator + */ + + #define SocketEmulationDefines -DBSD_SOCKET_EMULATION + + #define SunOSPlatform NO + #define HasNdbm NO + + #define SystemV YES + + #define OSName SCO Xenix System V Release 2.3.2 + #define OSMajorVersion 2 + #define OSMinorVersion 3 + #define RemoveTargetProgramByMoving YES + #define BootstrapCFlags -Dxenix + #define StandardDefines -Dxenix -DSYSV -DUSG + #define StandardCppDefines -Dxenix -DSYSV -DUSG + #define ServerDefines StandardDefines SocketEmulationDefines \ + ExtensionDefines + #define LibraryDefines StandardDefines SocketEmulationDefines + #define ExecableScripts NO + #define BuildServer YES + #define XxenixServer Xxenix + + #define HasPutenv YES + #define HasBsearch YES + #define HasVoidSignalReturn YES + + #define ExtraLibraries -lsocket -ldir -levent -lmalloc -lx + + #define ExtraLoadFlags + + #define NeedBerklibInXlib YES + + #define HasSockets YES + #define ConnectionFlags -DUNIXCONN + + #define RanlibCmd ranlib + + #define HasGcc YES + #define LibraryCcCmd CcCmd *** X11R4.ORIG/mit/include/Xos.h Mon Dec 18 16:14:36 1989 --- X11R4/mit/include/Xos.h Wed Jan 2 15:52:37 1991 *************** *** 43,48 **** --- 43,57 ---- #include <sys/types.h> #endif /* USG */ + #ifdef xenix + #ifndef __IOVEC__ + #define __IOVEC__ + struct iovec { + caddr_t iov_base; + int iov_len; + }; + #endif + #endif /* * Just about everyone needs the strings routines. For uniformity, we use *************** *** 63,70 **** #ifdef SYSV #include <string.h> - #define index strchr - #define rindex strrchr #else #include <strings.h> #endif /* SYSV */ --- 72,77 ---- *************** *** 140,145 **** --- 147,163 ---- #ifdef hpux #define sigvec sigvector + #endif + + #ifdef xenix + #ifndef EWOULDBLOCK + #define EWOULDBLOCK 35 + #endif + #ifndef FIONREAD + #define FIONREAD (1 << 5) + #endif + #define MAXPATHLEN 128 + #define u_char uchar_t #endif #endif /* _XOS_H_ */ *** X11R4.ORIG/mit/include/Xmd.h Tue Aug 15 14:38:59 1989 --- X11R4/mit/include/Xmd.h Sun Nov 11 21:24:17 1990 *************** *** 36,41 **** --- 36,44 ---- #define UNSIGNEDBITFIELDS /* bit fields do not honor sign */ #endif + #if defined(xenix) && !defined(__GNUC__) + #define UNSIGNEDBITFIELDS /* bit fields do not honor sign */ + #endif /* * Stuff to handle large architecture machines; the constants were generated *** X11R4.ORIG/mit/Imakefile Thu Aug 30 13:55:34 1990 --- X11R4/mit/Imakefile Sat Dec 15 18:13:39 1990 *************** *** 17,23 **** EXAMPLESDIRS = examples #endif SUBDIRS = config include lib extensions $(SERVERDIRSTOMAKE) \ ! clients demos $(EXAMPLESDIRS) util doc LNINSTALLDIRS = $(EXTENSIONSRC) $(LIBSRC) MakeSubdirs($(SUBDIRS)) --- 17,23 ---- EXAMPLESDIRS = examples #endif SUBDIRS = config include lib extensions $(SERVERDIRSTOMAKE) \ ! clients demos $(EXAMPLESDIRS) util /* doc */ LNINSTALLDIRS = $(EXTENSIONSRC) $(LIBSRC) MakeSubdirs($(SUBDIRS)) *** X11R4.ORIG/README.XENIX Sun Jan 6 01:43:13 1991 --- X11R4/README.XENIX Sun Jan 6 01:29:06 1991 *************** *** 0 **** --- 1,157 ---- + + --- X11R4 for Xenix 386 --- + It's NEW! It's FAST! + + The mit directory contains patched sources that you can use to build + your own complete X Window System Version 11 Release 4 server and + clients for Xenix SysV. It is quite a fast, stable X11R4 with all the + source and libraries available that you can use as an X window application + and development environment for Xenix; and provides instant access to a + large user contributed windowing software base. + + The server currently supports standarded VGA 640x480 monochrome mode. + It also supports 800x600, 1024x600, and 1024x768 interlaced mode for + Trident VGA card. A device driver is used to handle high resolution + mode (1024x600 and 1024x768) memory mapping (Xenix VGA driver only maps + first 64K of the video memory). The port to Xenix was NOT done with + network support in mind. More specifically, I use BSD socket emulator + device driver to handle all network related stuff on a local machine + only. This presents no problem in most cases. However, if you want to + run clients remotely, and if you have TCP/IP, you will need some changes + (should be minimal) of your own under mit/server/os/4.2bsd directory; + if you are using STREAM, a lot more work will be needed. + + Note that you need GCC to compile the source. Server compiled by Microsoft + CC runs slower therefore I dropped any changes made for MSCC. + + + ---- Procedures for Building the System ---- + + 1. Get GCC and ranlib.c and install them on your system. + + 2. Decide how you are going to have network support. + + a. If you want to run clients remotely and you have TCP/IP package, + you will have to make changes under directory mit/server/os/4.2bsd. + and mit/lib/X. Changes should be minimal. + + b. If you want to run clients remotely and you have STREAM package, + you will have to make changes under directory mit/server/os/4.2bsd. + and mit/lib/X. This might not be trivial. You will probably want + to use connection code found in port of X11R4 to SCO UNIX or ESIX + or ISC UNIX. + + c. If you only need to run everything on your own machine, you can + write your own connection code, which is definitely not trivial. + Or you can get my BSD socket emulation driver for a small fee. Get + the driver, extract the driver files into drivers/xenix directory. + Then become super user, run + + make install + + [ See drivers/xenix/INFO for more detailed description of the + device driver and how to get it ]. + + Before you get and install the driver, you can also cd to + drivers/xenix, become super user, then run + + make install + + By doing so, necessary header and library files will be properly + installed so you can continue to build the system. It is good + to check first to see whether the whole source will compile + sucessfully. + + 3. Configure the soure for your system. You may need to change files + under mit/config directory for definitions such as installation + directory (default is /usr/local/X11). Edit mit/server/Imakefile, + set variable VGA to the one you have. If you are using trident VGA, + also edit file mit/server/ddx/xenix/trident/xenix/xenixDevInfo.h + to chose desired resolution definitions (default is for 1024x600 + non-interlaced mode). + + 4. Cd to X11R4/mit, run following + + make World + make install + or + make Makefile + make Makefiles + make clean + make includes + make + make install + + This may take from a few hours to almost a day, depending on the + hardware configuration you have. + + Ignore any warning messages given by the C compiler. + + Make sure you have 20Meg disk space reserved for /usr/local/X11 + runtime directory for installation. If you run out of disk space + while building the system, you may choose to delete mit/doc + directory, and/or, build, install then clean directories under + X11R4/mit by hand one at a time. + + 5. Check and make sure you have mouse driver installed. + + 6. If you chosed to use the socket emulation driver and have not + installed it. It is time to do so. Reboot the machine after intalling + the driver. Make sure device 'socket', 'bell' and 'fb' all signed on + when booting. + + 7. Create .xinitrc, .twmrc, .Xdefault, etc.. Put following in ~/.login + or $HOME/.profile file of your X server machine. + + setenv DISPLAY unix:0 + + Relogin and run xinit to start Xxenix. + + 8. Enjoy it. + + + ---- Xenix Specific Features and Misfeatures ---- + + Both standard VGA and Trident + + * Keyboard LED control is built in for the server. + * Keyboard should be in XT mode (kernel default configuration). + * Screen can be changed into text mode for multi-screen switching by + pressing all three mouse buttons down, similar to what I did for MGR. + * Client authorization machanism is disabled for local connection. + * kbd_mode program is provided in case the server crashes messing up + the keyboard. (Never happened to me when the server is up, BTW.) + You can login from another serial terminal and run + + kbd_mode -a < /dev/tty?? + + where /dev/tty?? is the multiscreen you started Xxenix. + Don't try 'kbd_mode -r' unless you have a serial terminal at hand, + otherwise you will have to power down the machine. There is a bug + in Xenix preventing you from getting current keyboard mode. + * The Xxenix server uses the Xenix Event Manager. Therefore you may have + problem running Xenix version of MGR window (ported by myself) using + bus mouse once Xxenix has been run. + * Some floating-point computational intensive programs such as 'ico' + run quite slow when you are using the FP software emulator. This is + normal for a low end PC. (Don't believe what you have seen of the + same program running on some versions of commercial X. They fake the + performance by precalculating all the data points. Have you watched + When Harry Met Sally? :-) + + Standard VGA + + * Screen saver blank mode is not supported. Use noblank mode instead. + + Trident + + * Screen saver blank mode is supported. + * Black and white pixel color can be customized by setting environment + variable XBACKGROUND and XFOREGROUND to the desired RGB value. Try + + setenv XBACKGROUND 80:100:150 + setenv XFOREGROUND 240:255:180 + + + Chain Lee 12/30/90 + chain@paul.rutgers.edu *** X11R4.ORIG/drivers/xenix/Slibsocket.uue Sun Jan 6 12:36:24 1991 --- X11R4/drivers/xenix/Slibsocket.uue Sun Jan 6 12:34:44 1991 *************** *** 0 **** --- 1,193 ---- + begin 644 Slibsocket.a + M9?]?7RY364U$148 %%>AR?),J2-I0 T !U]A8V-E<'2^!P !E]B + M8V]P>2X= %7V)I;F3& P !E]B>F5R;^X; (7V-O;FYE8W0:!0 "%]E + M<G)D871AU P Q?9V5T<&5E<FYA;640"@ #%]G971S;V-K;F%M97(+ & + M7VEN9&5XGAX =?;&ES=&5N> 8 =?<&5R<F]RU P =?<FEN9&5XZA\ + M =?<V]C:V5TP@ !S;V-K970N;P Q>AR?),J2!Z0( ( * AS + M;V-K970N8U2(!P $U3($-NB 4 )]%34*("0 GU-,24)&4!"(" GU-, + M24)#9(@' "?3$E"2+.(!@ G3-S3^"(!@ H0%#5C>6+@ !D1'4D]54 5? + M5$585 1#3T1%!5]$051!!$1!5$$%0T].4U0$7T)34P-"4U,_F0D J? # + M! &]F0D J8P %!@$=F0D J0 '!P&FF0D J0 ("0&CF@@ O\# + M_P3_ E:=#0 P$" @$#!$ !10&_C"T "E]?86-R='5S960!!5]O<&5N 9? + M8VQO<V4 !E]I;V-T; '7W-O8VME= CH8@ @ O9&5V+W-O8VME="]D + M865M;VX "]D978O<V]C:V5T+W-O8VM86 <V]C:V5T+F,L(%)E=FES:6]N + M(#$N,2 Q+S8O.3$@0V]P>7)I9VAT("AC*2 Q.3DP+" Q.3DQ(&)Y($-H86EN + M($QE92X*06QL(')I9VAT<R!R97-E<G9E9"X _Z$. *$ !0 "W + MG0< Y 2=Y "=5J'V $ 58OL@^P,:@+_-80 #H (/$"(E%^ O + M?0>X_____\G#:@!J ?]U^.@ @\0,B47\"\!\X[D* F??Y!#"+#8@ + M "(01"+1?RY"@ )GW^8#",*&( B% 1:@+_-8@ #H (/$"(E% + M] O ?*-J &BQ:-XZ4.@ @\0,"\!]#O]U].@ @\0$ZX*0_W4(:A#_ + M=?3H (/$# O ?-[_=0QJ$?]U].@ @\0,"\!\RO]U$&H2_W7TZ + M "#Q P+P'RV:@!J$_]U].@ @\0,"\!\HXM%],G#E)TQ *3@5@2DS58$ + MI+E6!*2E5@2DDE8#I(-6!*1L5@+D9YWD7)WD1IVD+%8$I ]6 N0*G6N1$ + M 0=?<V]C:V5T !OB@( '1S8FEN9"YO ;7H<GR3*D@3H! + M " " &8FEN9"YC1(@' 35,@0VZ(!0 GT5-0H@) "?4TQ)0D90$(@( + M "?4TQ)0D-DB < )],24)(LX@& "=,W-/X(@& "A 4-6-Y8N &1$=2 + M3U50!5]415A4!$-/1$4%7T1!5$$$1$%4005#3TY35 1?0E-3 T)34S^9"0"I + M* ,$ 869"0"I 4& :F9"0"I <' ::9"0"I @) :.: + M" "_P/_!/\"5IT- # 0(" 0,$0 %% ;^,' *7U]A8W)T=7-E9 $&7VEO + M8W1L 5?8FEN9 "SH2X 0 !5B^R#[ R+10R)1?B+11")1?2-1?10:@+_ + M=0CH (/$#(E%_,G#%IT% *0<5@)&D0X $%7V)I;F0 %^* @ + M=&-O;FYE8W0N;P (5Z')\DRI(%# 0 @ L "6-O;FYE8W0N8_&(!P + M $U3($-NB 4 )]%34*("0 GU-,24)&4!"(" GU-,24)#9(@' "?3$E" + M2+.(!@ G3-S3^"(!@ H0%#5C>6+@ !D1'4D]54 5?5$585 1#3T1%!5]$ + M051!!$1!5$$%0T].4U0$7T)34P-"4U,_F0D J2@ #! &%F0D J0 % + M!@&IF0D J0 '!P&FF0D J0 ("0&CF@@ O\#_P3_ E:=#0 P$" + M @$#!$ !10&_C!\ "E]?86-R='5S960!!E]I;V-T; (7V-O;FYE8W0 8*$N + M $ 58OL@^P,BT4,B47XBT40B47TC47T4&H%_W4(Z "#Q R)1?S) + MPQ.=!0"D'%8"1I$1 !"%]C;VYN96-T ,B@( '0Q;&ES=&5N+F\ + M G7H<GR3*D@2P! " "@ (;&ES=&5N+F-.B < !-4R!#;H@% "? + M14U"B D )]33$E"1E 0B @ )]33$E"0V2(!P GTQ)0DBSB 8 )TS<T_@ + MB 8 *$!0U8WEBX 9$1U)/55 %7U1%6%0$0T]$105?1$%4001$051!!4-/ + M3E-4!%]"4U,#0E-3/YD) *D4 P0!F9D) *D !08!J9D) *D + M!P<!IID) *D " D!HYH( +_ _\$_P)6G0T ,! @(! P1 44!OXP> + M I?7V%C<G1U<V5D 09?:6]C=&P !U]L:7-T96X O:$: $ 58OL_W4, + M:@/_=0CH ,G#D)![G04 I Q6 E:1$ 0=?;&ES=&5N !IB@( + M '1A8V-E<'0N;P "]>AR?),J2!-P( ( * AA8V-E<'0N8VV(!P + M $U3($-NB 4 )]%34*("0 GU-,24)&4!"(" GU-,24)#9(@' "?3$E" + M2+.(!@ G3-S3^"(!@ H0%#5C>6+@ !D1'4D]54 5?5$585 1#3T1%!5]$ + M051!!$1!5$$%0T].4U0$7T)34P-"4U,_F0D J;@ #! 'UF0D J3 % + M!@%YF0D J0 '!P&FF0D J0 ("0&CF@@ O\#_P3_ E:=#0 P$" + M @$#!$ !10&_C"T "E]?86-R='5S960!!5]O<&5N 9?8VQO<V4 !E]I;V-T + M; '7V%C8V5P= \H38 @ O9&5V+W-O8VME="]D865M;VX "]D978O + M<V]C:V5T+W-O8VM86 !0 "5G0< Y"R=Y"B=!J&^ $ 58OL + M@^PD@WT, '4&C47<B44,@WT0 '4&C47LB440BT4,B47XBT40B47TC47T4&H$ + M_W4(Z "#Q R)1?P+P'T*N/_____)PY"0D(M%_+D* F??Y!#"+#2P + M "(01"+1?RY"@ )GW^8#",*$L B% 1:@+_-2P #H (/$"(E% + M\ O ?+-J &BQ:-XZ4.@ @\0,"\!]#?]U\.@ @\0$ZY*+1?#)PY"0 + MD*F=&@"DIU8#I)A6!*2!5@+D?)WD<9WD6YVD-%8$E9$0 !!U]A8V-E<'0 + M (B* @ = =G971P965R+F\ #9>AR?),J2!1P$ ( + EG971P + M965R+F/OB < !-4R!#;H@% "?14U"B D )]33$E"1E 0B @ )]33$E" + M0V2(!P GTQ)0DBSB 8 )TS<T_@B 8 *$!0U8WEBX 9$1U)/55 %7U1% + M6%0$0T]$105?1$%4001$051!!4-/3E-4!%]"4U,#0E-3/YD) *DD P0! + MB9D) *D !08!J9D) *D !P<!IID) *D " D!HYH( +_ _\$ + M_P)6G0T ,! @(! P1 44!OXPC I?7V%C<G1U<V5D 09?:6]C=&P #%]G + M971P965R;F%M90"UH2H 0 !5B^R#[!"+10R)1?B+11")1?2-1?10:A7_ + M=0CH ,G#D) G04 I!Q6 D:1%0 0Q?9V5T<&5E<FYA;64 &&* + M @ = !G971S;V-K+F\ #M>AR?),J2!1P$ ( + EG971S;V-K+F/K + MB < !-4R!#;H@% "?14U"B D )]33$E"1E 0B @ )]33$E"0V2(!P + MGTQ)0DBSB 8 )TS<T_@B 8 *$!0U8WEBX 9$1U)/55 %7U1%6%0$0T]$ + M105?1$%4001$051!!4-/3E-4!%]"4U,#0E-3/YD) *DD P0!B9D) *D + M !08!J9D) *D !P<!IID) *D " D!HYH( +_ _\$_P)6G0T + M ,! @(! P1 44!OXPC I?7V%C<G1U<V5D 09?:6]C=&P #%]G971S;V-K + M;F%M90"QH2H 0 !5B^R#[!"+10R)1?B+11")1?2-1?10:A3_=0CH + M ,G#D) !G04 I!Q6 D:1%0 0Q?9V5T<V]C:VYA;64 %V* @ = !P + M97)R;W(N;P $!>AR?),J2! \ ( * AP97)R;W(N8T.(!P $U3 + M($-NB 4 )]%34*("0 GU-,24)&4!"(" GU-,24)#9(@' "?3$E"2+.( + M!@ G3-S3^"(!@ H0%#5C>6+@ !D1'4D]54 5?5$585 1#3T1%!5]$051! + M!$1!5$$%0T].4U0$7T)34P-"4U,_F0D J6@ #! %%F0D J?0* %!@&K + MF0D J0 '!P&FF0D J0 ("0&CF@@ O\#_P3_ E:=#0 P$" @$# + M!$ !10&_C"\ "E]?86-R='5S960!!E]E<G)N;P &7W=R:71E =?<W1R;&5N + M =?<&5R<F]R BA!P " !6H1 @0 !.;W0@;W=N97( S:$@ (0 + M 3F\@<W5C:"!F:6QE(&]R(&1I<F5C=&]R>0#GH3@ BP !.;R!S=6-H + M('!R;V-E<W, 26YT97)R=7!T960@<WES=&5M(&-A;&P 22]/(&5R<F]R "*A + M( "8 $YO('-U8V@@9&5V:6-E(&]R(&%D9')E<W, MJ$8 )\ 07)G + M(&QI<W0@=&]O(&QO;F< D:$8 *0 17AE8R!F;W)M870@97)R;W( /:$T + M *D 0F%D(&9I;&4@;G5M8F5R $YO(&-H:6QD<F5N $YO(&UO<F4@<')O + M8V5S<V5S &BA* "U $YO="!E;F]U9V@@8V]R90!097)M:7-S:6]N(&1E + M;FEE9 /H2@ O@ !"860@861D<F5S<P!";&]C:R!D979I8V4@<F5Q=6ER + M960 -*$8 (< 0 36]U;G0@9&5V:6-E(&)U<WD HJ$D (P 0 1FEL92!E + M>&ES=', 0W)O<W,M9&5V:6-E(&QI;FL 4Z%' )0 0 3F\@<W5C:"!D979I + M8V4 $YO="!A(&1I<F5C=&]R>0!)<R!A(&1I<F5C=&]R>0 26YV86QI9"!A + M<F=U;65N= ""H3\ I0! !&:6QE('1A8FQE(&]V97)F;&]W %1O;R!M86YY + M(&]P96X@9FEL97, 3F]T(&$@='EP97=R:71E<@ 0H4L M ! !497AT(&9I + M;&4@8G5S>0 1FEL92!T;V\@;&%R9V4 $YO('-P86-E(&QE9G0@;VX@9&5V + M:6-E $EL;&5G86P@<V5E:P 9H1P A@" !296%D+6]N;'D@9FEL92!S>7-T + M96T -Z%' (P @ 5&]O(&UA;GD@;&EN:W, $)R;VME;B!P:7!E $%R9W5M + M96YT('1O;R!L87)G90 4F5S=6QT('1O;R!L87)G90!QH1P G0" !/<&5R + M871I;VX@=V]U;&0@8FQO8VL I*$@ *, @ 3W!E<F%T:6]N(&YO=R!I;B!P + M<F]G<F5S<P#^H20 J@" !/<&5R871I;VX@86QR96%D>2!I;B!P<F]G<F5S + M<P!0H4, L@" !3;V-K970@;W!E<F%T:6]N(&]N(&YO;BUS;V-K970 $1E + M<W1I;F%T:6]N(&%D9')E<W,@<F5Q=6ER960 SZ$7 (( P 365S<V%G92!T + M;V\@;&]N9P TH7 AP# !0<F]T;V-O;"!W<F]N9R!T>7!E(&9O<B!S;V-K + M970 %!R;W1O8V]L(&YO="!A=F%I;&%B;&4 %!R;W1O8V]L(&YO="!S=7!P + M;W)T960 %-O8VME="!T>7!E(&YO="!S=7!P;W)T960 +J$H *( P 3W!E + M<F%T:6]N(&YO="!S=7!P;W)T960@;VX@<V]C:V5T -RA) "K , %!R;W1O + M8V]L(&9A;6EL>2!N;W0@<W5P<&]R=&5D !^AVP "S , $%D9')E<W,@9F%M + M:6QY(&YO="!S=7!P;W)T960@8GD@<')O=&]C;VP@9F%M:6QY $%D9')E<W,@ + M86QR96%D>2!I;B!U<V4 $-A;B=T(&%S<VEG;B!R97%U97-T960@861D<F5S + M<P 3F5T=V]R:R!I<R!D;W=N $YE='=O<FL@:7,@=6YR96%C:&%B;&4 $YE + M='=O<FL@9')O<'!E9"!C;VYN96-T:6]N(&]N(')E<V5T %-O9G1W87)E(&-A + M=7-E9"!C;VYN96-T:6]N(&%B;W)T &A'P "I 0 $-O;FYE8W1I;VX@<F5S + M970@8GD@<&5E<@!\H2 L $ !.;R!B=69F97(@<W!A8V4@879A:6QA8FQE + M #6A6P "W 0 %-O8VME="!I<R!A;')E861Y(&-O;FYE8W1E9 !3;V-K970@ + M:7,@;F]T(&-O;FYE8W1E9 !#86XG="!S96YD(&%F=&5R('-O8VME="!S:'5T + M9&]W;@!1H2@ C0% !4;V\@;6%N>2!R969E<F5N8V5S.B!C86XG="!S<&QI + M8V4 [*$; )8!0 0V]N;F5C=&EO;B!T:6UE9"!O=70 *J$\ )P!0 0V]N + M;F5C=&EO;B!R969U<V5D !4;V\@;6%N>2!L979E;',@;V8@<WEM8F]L:6,@ + M;&EN:W, )*$G *H!0 1FEL92!N86UE('1O;R!L;VYG !(;W-T(&ES(&1O + M=VX E*$7 +,!0 3F\@<F]U=&4@=&\@:&]S= "(H6@ N % !$:7)E8W1O + M<GD@;F]T(&5M<'1Y %1O;R!M86YY('!R;V-E<W-E<P 5&]O(&UA;GD@=7-E + M<G, $1I<V,@<75O=&$@97AC965D960 4W1A;&4@3D93(&9I;&4@:&%N9&QE + M -2A* "1 8 %1O;R!M86YY(&QE=F5L<R!O9B!R96UO=&4@:6X@<&%T: #4 + MH2P F@& !$979I8V4@:7,@;F]T(&$@<W1R96%M !4:6UE<B!E>'!I<F5D + M ,>A'P "D 8 $]U="!O9B!S=')E86US(')E<V]U<F-E<P!AH40 JP& !. + M;R!M97-S86=E(&]F(&1E<VER960@='EP90 5')Y:6YG('1O(')E860@=6YR + M96%D86)L92!M97-S86=E %JA: "[ 8 $ED96YT:69I97(@<F5M;W9E9 + M1&5A9&QO8VL@8V]N9&ET:6]N+@!.;R!R96-O<F0@;&]C:W,@879A:6QA8FQE + M+@ 36%C:&EN92!I<R!N;W0@;VX@=&AE(&YE='=O<FL D:$7 )0!P 3V)J + M96-T(&ES(')E;6]T90#PH2 F0' !T:&4@;&EN:R!H87,@8F5E;B!S979E + M<F5D )^A) "@ < &%D=F5R=&ES92!E<G)O<@!S<FUO=6YT(&5R<F]R #^A + M9P "H < $-O;6UU;FEC871I;VX@97)R;W(@;VX@<V5N9 !0<F]T;V-O;"!E + M<G)O<@ ;75L=&EH;W @871T96UP=&5D !#<F]S<R!M;W5N="!P;VEN=" H + M;F]T(&%N(&5R<F]R*0!0H20 @0( !296UO=&4@861D<F5S<R!C:&%N9V5D + M Z( "@!MH=8" B0( $ $ @ ! # + M+ 0 \ !0 %0 & 8 < !\ " ) ) + M I H "T "P , , U T #D #@ /@ + M / ! $ ! < 0 $0 # ! 2 / $ !, !0 0 % + M & ! 5 < $ !8 " 0 %P )0! 8 J $ !D "\ 0 + M&@ - ! ; X $ !P #P 0 '0 @" > & ( !\ P + M @ ( $ " A 3 ( "( !@ @ (P '0" D C ( "4 + M "H @ )@ ,@" G Z ( "@ ( P *0 !P# J / , + M "L !4 P + &P# M B , "X "L P +P ,P# P + M_ , #$ 4! ,@ #0$ S 1 0 #0 !<! -0 ( $ V + M I 0 #< # ! . -P$ Y ^ 0 #H 0!0 .P #0% + M \ 6 4 #T !P!0 /@ (0% _ J 4 $ "\!0 00 + M ,P% !" X 4 $, #T!0 1 @& !% & 8 $8 L!@ + M1P $0& !( : 8 $D " !@ 2@ ) & !+ K 8 $P #( + M!@ 30 .P& !. < $\ 4!P 4 # ' !1 4 < %( + M !D!P 4P ( ' !4 D < %4 "@!P 5@ +P' !7 S < + M %@ #@!P 60 0( !FG0\!YLR=YL2=YKR=YK2=YJR=YJ2=YIR=YI2= + MYHR=YH2=YGR=YG2=YFR=YF2=YER=YE2=YDR=YD2=YCR=YC2=YBR=YB2=YAR= + MYA2=Y@R=Y@2=Y?R=Y?2=Y>R=Y>2=Y=R=Y=2=Y<R=Y<2=Y;R=Y;2=Y:R=Y:2= + MY9R=Y92=Y8R=Y82=Y7R=Y72=Y6R=Y62=Y5R=Y52=Y4R=Y42=Y3R=Y32=Y2R= + MY22=Y1R=Y12=Y0R=Y02=Y/R=Y/2=Y.R=Y.2=Y-R=Y-2=Y,R=Y,2=Y+R=Y+2= + MY*R=Y*2=Y)R=Y)2=Y(R=Y(2=Y'R=Y'2=Y&R=Y&2=Y%R=Y%2=Y$R=Y$2=Y#R= + MY#2=Y"R=Y"2=Y!R=Y!2=Y R=Y 2=%:%N $ 58OL@^P$H0 "+!,4H + M" B47\_W4(Z "#Q 10_W4(:@+H (/$#&H":!P( !J N@ + M@\0,_W7\Z "#Q 10_W7\:@+H (/$#&H!:" ( !J N@ R<,< + MG28 I&)6 ^1;G:115@.D0U8$I#A6 ^0QG:0G5@.D&58$Y Z=Y =6 G^1$0 ! + M @A?97)R9&%T820( Y9$0 !!U]P97)R;W( %Z* @ =&)Z97)O + M+F\ 0EZ')\DRI($E 0 @ D !V)Z97)O+F.]B < !-4R!#;H@% + M "?14U"B D )]33$E"1E 0B @ )]33$E"0V2(!P GTQ)0DBSB 8 )TS + M<T_@B 8 *$!0U8WEBX 9$1U)/55 %7U1%6%0$0T]$105?1$%4001$051! + M!4-/3E-4!%]"4U,#0E-3/YD) *D@ P0!C9D) *D !08!J9D) *D + M !P<!IID) *D " D!HYH( +_ _\$_P)6G0T ,! @(! P1 44! + MOXP5 I?7V%C<G1U<V5D 09?8GIE<F\ M*$F $ 58OLZPR0D)"+10C_ + M10C& "+10S_30P+P'7MR<.0D) ^D0\ $&7V)Z97)O #8B@( '0 + M8F-O<'DN;P !'7H<GR3*D@54! " "0 '8F-O<'DN8\*(!P $U3 + M($-NB 4 )]%34*("0 GU-,24)&4!"(" GU-,24)#9(@' "?3$E"2+.( + M!@ G3-S3^"(!@ H0%#5C>6+@ !D1'4D]54 5?5$585 1#3T1%!5]$051! + M!$1!5$$%0T].4U0$7T)34P-"4U,_F0D J5 #! %=F0D J0 %!@&I + MF0D J0 '!P&FF0D J0 ("0&CF@@ O\#_P3_ E:=#0 P$" @$# + M!$ !10&_C!4 "E]?86-R='5S960!!E]B8V]P>0"YH58 0 !5B^R+10PY + M10AR'8M%$/]-$ O =#F+10S_10R+30C_10B*"8@(Z^20BT40 44, 44(ZQ&0 + M_TT,BT4,_TT(BTT(B@F("(M%$/]-$ O =>;)PSB1#P 09?8F-O<'D + M -V* @ =.9I;F1E>"YO $Q>AR?),J2!,0$ ( ) =I;F1E>"YC + MQX@' 35,@0VZ(!0 GT5-0H@) "?4TQ)0D90$(@( "?4TQ)0D-DB < + M )],24)(LX@& "=,W-/X(@& "A 4-6-Y8N &1$=23U50!5]415A4!$-/ + M1$4%7T1!5$$$1$%4005#3TY35 1?0E-3 T)34S^9"0"I+ ,$ 8&9"0"I + M 4& :F9"0"I <' ::9"0"I @) :.:" "_P/_!/\"5IT- + M # 0(" 0,$0 %% ;^,%0 *7U]A8W)T=7-E9 $&7VEN9&5X +ZA,@ ! + M %6+[(/L!%:#?0@ =0<SP%[)PY"0BW4(@#X =/&*!CA%#'4%B\9>R<-&Z^R0 + M<)$/ !!E]I;F1E> XHH" !TBW)I;F1E>"YO 4%Z')\DR + MI(% 0 @ H "')I;F1E>"YC4X@' 35,@0VZ(!0 GT5-0H@) "?4TQ) + M0D90$(@( "?4TQ)0D-DB < )],24)(LX@& "=,W-/X(@& "A 4-6-Y8N + M &1$=23U50!5]415A4!$-/1$4%7T1!5$$$1$%4005#3TY35 1?0E-3 T)3 + M4S^9"0"I. ,$ 769"0"I 4& :F9"0"I <' ::9"0"I + M @) :.:" "_P/_!/\"5IT- # 0(" 0,$0 %% ;^,%@ *7U]A8W)T=7-E + M9 $'7W)I;F1E> !*H3X 0 !5B^R#[ 16@WT( '4',\!>R<.0D(MU".L$ + MD)"01H ^ '7Z.74(=^:*!CA%#'4&B\9>R<.03NOKD,J1$ 0=?<FEN9&5X + + !NB@( '0( + + end
chain@paul.rutgers.edu (Chain Lee) (01/07/91)
*** X11R4.ORIG/drivers/xenix/Makefile Sun Jan 6 12:36:31 1991 --- X11R4/drivers/xenix/Makefile Sun Jan 6 12:00:09 1991 *************** *** 0 **** --- 1,43 ---- + SHELL= /bin/sh + CC= cc + + LIBSOCK= Slibsocket.a + HDRSOCK= socket.h + UTILS= whoami exec_shell + SYSLIBDIR= /lib/386 + SYSINCDIR= /usr/include/sys + + ALL= $(LIBSOCK) + + all: $(ALL) whoami + + $(LIBSOCK): Slibsocket.uue + uudecode Slibsocket.uue + ranlib $@ + + install: all libinstall hdrinstall + + whoami: whoami.uue + uudecode whoami.uue + chmod a+x whoami + + libinstall: $(LIBSOCK) + @echo Installing $(LIBSOCK) + @if [ ! `./whoami` = root ]; \ + then \ + echo "Must be root to install"; exit 1; \ + else \ + cp $(LIBSOCK) $(SYSLIBDIR)/$(LIBSOCK); \ + fi + + hdrinstall: $(HDRSOCK) + @echo Installing $(HDRSOCK) + @if [ ! `./whoami` = root ]; \ + then \ + echo "Must be root to install"; exit 1; \ + else \ + cp $(HDRSOCK) $(SYSINCDIR)/$(HDRSOCK); \ + fi + + clean: + rm -f whoami *.a *~ *** X11R4.ORIG/drivers/xenix/INFO Sun Jan 6 12:36:34 1991 --- X11R4/drivers/xenix/INFO Sat Jan 5 18:39:26 1991 *************** *** 0 **** --- 1,69 ---- + + --- The Socket Emulator Driver Package --- + + 1. What's in it? + + The socket emulator device driver package includes a pseudo device + driver and a library that provide support for most of the system calls + associated with 4.2 BSD UNIX socket interface. It provides excellent + support for running X11R4 on SCO Xenix SysV 386 2.3.2 in the absense of + networking software such TCP/IP or STREAM. The package emulates socket + interface to the degree that hardly any changes is needed under 4.2bsd + directory. The changes I made are mostly related to header file usage + and the effort of making full use of the driver capacity to enhance the + Xxenix server performance. + + Following calls are supported. + + socket(), bind(), listen(), connect(), accept(), select(), + read(), write(), getsockname(), getpeername() + + These calls almost have the same semantics as those of 4.2 BSD UNIX. + The driver supports a protocol same as AF_UNIX and SOCK_STREAM, except + that a socket address is not bound to any file under the file system + and the maximum socket address length is limited to 14 characters. + The driver FULLY supports BSD select() on socket read/write/exception + conditions. Socket descriptors returned by socket() call WILL BE inherited + by subprocesses created by fork() or exec() call. ( This is hardly ever + true for any other socket emulation packages. ) The socket interface can + be used in your application program as if the mechanism is well designed + and built-in to the kernel. Besides supporting X11R4, you can also use + it to port many network oriented (TCP/IP in particular) applications. + However, since the driver was written primarily for supporting X, there + is no guarantee that it will work as what you would have expected when + used for other applications. + + An 'ss' program similar to 'ps' or 'ipcs' is provided to let you list + current status information of the socket devices for debugging purpose. + + Also included are a few test and example programs. 'testsocket' is a + simple proram testing socket connection and select. 'server' is a server + program that makes copy of a client's data and writes them back. 'xerox' + is a client requesting such service. Multiple clients can be connected + to the server. + + A VGA memory mapping device driver and a bell device driver is also + provided to support the Xxenix server. + + Example source programs are provided in the package. Source code for + the device drivers is NOT included and will NOT be released in general. + (However, if you are willing to put a big price tag on it, feel free :-) + + 2. What version of Xenix does it work on? + + It is tested and known to work on SCO Xenix SysV 386 version 2.3.2 only. + It may or may not run on other versions of Xenix. + + 3. How to get? + + Send $30, check only to + + Chain Lee + 11 Holton Road + Lexington, MA 02173 + + Please specify media type (5 1/4 or 3 1/2 floppy). Allow time for + processing. + + Chain Lee 12/30/90 + chain@paul.rutgers.edu *** X11R4.ORIG/drivers/xenix/socket.h Sun Jan 6 12:36:38 1991 --- X11R4/drivers/xenix/socket.h Sun Jan 6 11:43:59 1991 *************** *** 0 **** --- 1,30 ---- + /* + * socket.h, Revision 1.1 1/6/91 cl + */ + + #define u_short ushort + #ifndef FIONREAD + #define FIONREAD (1 << 5) + #endif + #ifndef EWOULDBLOCK + #define EWOULDBLOCK 35 + #endif + + #define AF_UNSPEC 0 + #define AF_UNIX 1 + #define AF_INET 2 + + #define SOCK_STREAM 1 + + #define SO_LINGER 0x0080 + + struct sockaddr { + ushort sa_family; + char sa_data[14]; + }; + + struct sockaddr_un { + ushort sun_family; + char sun_path[14]; + }; + *** X11R4.ORIG/drivers/xenix/README Sun Jan 6 12:36:42 1991 --- X11R4/drivers/xenix/README Sun Jan 6 11:57:52 1991 *************** *** 0 **** --- 1,13 ---- + # + # README + # + + This directory contains necessary header and library file for building + the system when you are using the socket emulator. + + To install, run following. + + make + su root + make install + *** X11R4.ORIG/drivers/xenix/whoami.uue Sun Jan 6 12:36:45 1991 --- X11R4/drivers/xenix/whoami.uue Sun Jan 6 11:48:10 1991 *************** *** 0 **** --- 1,247 ---- + begin 755 whoami + M!@(L ! > "\!@ 1 X $ID!]@ + M & ! @$"/P + M 0!(@#\ ! $!X ! > " $2 1P + M D "\!@ !4 B $ + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M .M^Z_[K_NO^Z_X + M + M + M ##HP@ B $S[>A$! 4.C^! + MZ_Y5B^R#[ CH"04 (E%^%#H' 4 (/$!(E%_ O =1K_=?AH% "( >@Q!0 + M@\0(:@'HQP0 (/$!(M%_/\P:$0 B 'H%04 (/$"&H Z*L$ #)PY!5B^R# + M[ 16OE0 B $Y-10$B %W!%[)PY!6Z!( "#Q 2#QA Y-10$B %W[%[)PY!5 + MB^R#[ 175HMU"+______"_9U"(O'7E_)PY"0]D8,@W0U]D8,!'0$,\#K"5;H + M4@ (/$!(OX#[Y#HWPX (/$! O ?0^______\<%! "( 0( #V1@P( + M=!+_=@CH1Q, (/$!,=&" #&1@P QP8 BT8(B48$ZY.0D)!5B^Q6 + MBW4(]D8, G4HQP8 ZS>0D)#V1@P"=!V#?@@ =!>+1@@Y1@1V#U;H+@$ + M (/$!/9&# 1TW?9&#"!T"[C_____7LG#D)"0,\!>R<.0D)!5B^R#[ 16BW4, + MBD8,)%(\0G4]#[YM.!#D,A1@$B $/AJ4 "+P?]&!(I-"(@(@/D*#X7* + M 5NC, @\0$0 ^%N@ .FM D(I&#"06/ 9U,XI%"(A%_\<& + M &H!C47_4 ^^1@U0Z&,3 "#Q R#^ $/A(, " 3@P@ZW60D)"0D(I&#"02 + M/ )U&8-^" !T$XM&"#E&!'49@SX =13V1@Q$=0Y6Z-P "#Q 3K!9"0D#/ + M"\!U.O9&#$0/A3[___]6Z#H "#Q 3_#G@/BD4(BTX$_T8$B 'K$)"05@^^ + M10A0Z W___^#Q CV1@P@= BX_____U[)PP^V10A>R<.058OL@^P(4U=6BW4( + MBUX$BWX(B\<KV(E^!/9&#$1T!3/ ZP^0#[YL$A1@$B $K1@B)!@^^1@V+ + M!(48!(@!*T8$BPX+R7\",\D[P7T)5NA 0 @\0$"]M^(5-7#[Y#H91( + M (/$##O#= Z 3@P@N/____]>7UO)PS/ 7E];R<.058OL5HMU"(I&#"02/ )T + M&O9&#()U"KC_____7LG#D)"*1@PD[PP"B$8,@WX( '4)5NA* @\0$BT8( + M.48$=3GV1@Q$=3,/OD8-BP2%& 2( 2M&"(D&#[YL$A1@$B $K1@2+#@O) + M?P(SR3O!?0E6Z)D "#Q 0SP%[)PY!5B^R#[ 175HMU" ^^?@WV1@P$=3^# + M_P)]%@^^1@V+#+U, (@!B4X(@<$ ! ZS5H" 0 .A>#@ @\0$B48("\!T + M$(!.# @/OD8-BTX(Z]>0D) /OD8-C0S]# ^( 8E."(/!"(D,A1@$B &+1@B) + M1@17Z!01 "#Q 0+P'0*]D8,!'4$@$X,0%Y?R<.0D)!5B^R#[ 175HMU" ^^ + M1@V+!(48!(@!*T8$B_@+_WT5#[YL$A1@$B &)1@1>7\G#D)"0.3Y^ HD^ + M7E_)PY"058OL@^P,5U:-=0R)-0 +B &+10BC_!2( 5;H+0 (/$!(OXB3U( + M (@!Z$$ !75O]U".B+^___@\0,B47XZ%0 "+1?A>7\G#D%6+[(/L!%=6 + MBW4(BSZ#Q@2#?OP =?<[]W4#@^X$B\9>7\G#D%6+[(/L!%:^O :( 8'^O :( + M 74$7LG#D/\6@\8$@?Z\!H@!=?->R<-5B^R#[ 16OKP&B &!_KP&B %U!%[) + MPY#_%H/&!('^O :( 77S7LG#58OLZ%#[___HR_____]U".A["@ R<.0N!@ + M ": < <@*2PZ,$ (@!N/_____# %6+[(/L!%=6BW4(Z( * #H%PL + M (OX"_]T!3EW"'7PZ*,* "+QUY?R<.058OL@^P(5HU%#(E%_/8%< "( 0)U + M$/8%< "( 8!T)8 -< "( 0)H9 "( ?]U_/]U".C. @\0,B_#V!7 B $@ + M= BX_____U[)PXO&7LG#D)"058OL@^P(BT4(BP E 0 (E%^(M%"(L T?@E + M____?XE%_+D% F??YBTT(B0&Y!0 (M%_)GW^8O"T> #1?B#P##)PY"0 + M58OL4U=6BW4(BWT,BUT0@'L-/'0WBT44BP K0P0I XM%%(L B4,$4^C7_?__ + M@\0$4U=J 5;H3A$ (/$$(M%%(M+!(D(7E];R<.0D%=6BT44_S#HT!( (/$ + M# /'BTT4B0%>7UO)PY!5B^R![+@ !35U:+=0B+?1#'1> QT6< + M ,=%] #'1?P #[Y'#8E%D(I'#"02/ )U&8-_" !T$XM'"#E'!'48 + M@S\ =1/V1PQ$=0U7Z"_\__^#Q 3K!)"0,\ +P'0*,\!>7UO)PY"0D(M'!(E% + ME(-]D#QU" W___]_ZPN0BT60BP2%& 2( 8E%F ^^!HE%N O =%:#^"5T48O> + M1@^^!HE%N O = 6#^"5U\(O&*\.)18P!1> #192)18@[19AV%8U%E%!7_W6, + M4^B__O__@\00ZQ>0D/]UC%/_=93HU!$ (/$#(M%B(E%E(-]N !U<8M%E"M' + M!(E%A"D'BT64B4<$BT64 P<[19AV#X!_#3QT"5?H>OS__X/$!/9'#$1T)_9' + M# 1U&/]UA&H*BT64*T6$4.A:$0 @\0,"\!T"5?HN?K__X/$!/9'#"!T#+C_ + M____7E];R<.0D(M%X%Y?6\G#,\")1;R)1?B)1:R)1=!&1@^^1O^)1;B#^#D/ + MCQP$ "#^#$/C8T "#Z""#^! /AS8$ N_R2%6 P )"0D(!-O +KR9"0 + M@$V\!.O!D)" 3;P(Z[F0D(!-O!#KL9"0@$V\0,=%L #KHI"0D/9%O$!U + M'H-%# 2+10R+0/R)1= +P'V(]UW0@'6\!.E\____D(-%# 2+10R+0/R)1; + + MP ^-9O___^NYD/9%O$1U!(!-O""+1;B#Z#")18#K$9"0D&M%@ H#1;B#Z#") + M18!&#[X&B46X]H"Y!8@!!'7C]D6\0'0-BT6 B46PZ1W___^0D(M%@(E%T.D0 + M____D(!-O 'I!O___Y"0D/9%O 
P$BT4,BT#\B47<C5VKB5WH"\!](<=% + MU P%B ''1:P! /0 ( /A H! #W7=SK)Y"0D/9%O )T"L=%U X%B 'K + M#I#V1;P(= ['1=00!8@!QT6L 0 (M%W(F%?/___X/X"7\."\!U2_9%O$!U + M4.M#D)"+A7S___^)18RY"@ )GW^8F%?/___V:+A7S___]FN0H 9O?IP>(0 + M#[? "\**38PJR(#!,$N("X.]?/___PE_OTN*A7S___\$,(@#]D6\0'0>BT6P + MBTWH*\LKP8F%>/___PO ?@J)1<B)1?B 3;T"@WV< ^$S0( (-]_ /A)@" + M #'1=0D!8@!QT6L 0 ,=%_ #IH@( )"0]D6\ 8-%# 2+10R+0/R) + M1=R-7:N)7>BI @ ^$(O___XU%W%#HD?O__X/$!$N( ^D.____D)#'1< ' + M QT7, @ .L.QT7 #P ,=%S , #V1;P!@T4,!(M%#(M _(E%W(-] + MN%AU![A<!8@!ZP6X< 6( 8E%Y(U=JXE=Z(M%W(F%=/___PO =1GV1;Q =4"X + M 0 (E%R(E%^(!-O0+K+Y"02XN%=/___R-%P -%Y(H B .+A73____1^"7_ + M__]_BDW,T_B)A73___\+P'73]D6\0'0>BT6PBTWH*\LKP8F%</___PO ?@J) + M1<B)1?B 3;T"]D6\$ ^$S?[__X-]W /A,/^__^+1;B#^%AT.X/X;W0*@_AX + M=!WIK/[__V;W1;P @^%H/[__[@! Z8S^__^0D,=%U!0%B ''1:P" + MZ8'^__^0QT74& 6( >OJD)"0BD6XZPV0D)"#10P$BT4,BD#\B$6@C5V@B\- + MZR>0D)"#10P$BT4,BUC\"]MU!;L<!8@!]D6\0'434^AI#@ @\0$ \.)1>CI + M*/[__XF=;/___XN%;/____^%;/___X X '0%_TVP>>J+A6S___](Z].0D)"P + M" RPP ,L, "X" RPP .0+ #+# RPP ,L, #+# T @ * ( + M #+# J @ , ( #+# # D (/X:0^$Q_S__W\M@_A8#X0@_O__@_AC + M#X0S____@_AD#X2J_/__@_AH#X2D^___3NFX^O__D)"0@_AL#X2#_/__@_AO + M#X3:_?__@_AS#X05____@_AU#X20_?__@_AX#X3/_?__Z\B0]D6\ G0*QT74 + M)@6( >L.D/9%O AT#L=%U"@%B ''1:P! QT6< (M%Z"O#B46, T6L + M T7X T7TB46T.470?P@!1>#IPP (M%T %%X/9%O"!T+&;W1;P G4,@$V] + M BM%M(E%R.L)BT70*T6T 47(BT70B46TZ8\ "0D)"0]D6\! ^%@0 (M% + MT"M%M(F%:/___^L;C4644%=J%&@L!8@!Z-OX__^#Q!"#K6C___\4@[UH____ + M%'_<BX5H____ T64B85D____.T68=AR-19105_^U:/___V@L!8@!Z)_X__^# + MQ!#K(9"0_[5H____:"P%B '_=93HK0L (/$#(N%9/___XE%E(-]K !T08M% + MK -%E(F%8/___SM%F'86C4644%?_=:S_==3H4OC__X/$$.L;D/]UK/]UU/]U + ME.AF"P @\0,BX5@____B464@WWT '1(BT64@\ %B85<____.T68=A>-1910 + M5VH%_W7$Z SX__^#Q!#K')"0D&H%_W7$_W64Z!\+ "#Q R+A5S___^)193' + M1?0 9O=%O "='^+1<B)A5C____K')"-19105VH4:$0%B 'HO_?__X/$ + M$(.M6/___Q2#O5C___\4?]R+A5C___\#192)A53___\[19AV'(U%E%!7_[58 + M____:$0%B 'H@_?__X/$$.LAD)#_M5C___]H1 6( ?]UE.B1"@ @\0,BX54 + M____B464@WV, 'X_BT6, T64B850____.T68=A:-19105_]UC%/H./?__X/$ + M$.L;D)"0_W6,4_]UE.A,"@ @\0,BX50____B4649O=%O(0!#X0)^/__]D6\ + M! ^$__?__XM%M#E%T ^.\_?__XM%T"M%M(F%3/___^L;C4644%=J%&@L!8@! + MZ-?V__^#Q!"#K4S___\4@[U,____%'_<BX5,____ T64B85(____.T68=B"- + M19105_^U3/___V@L!8@!Z)OV__^#Q!#ID/?__Y"0D/^U3/___V@L!8@!_W64 + MZ*4) "#Q R+A4C___^)193I:??__[@! F@ ' *,$ (@!N/_____# + M +@& F@ ' '(#,\##HP0 B &X_____\-5B^R#/; %B $ =1QHG 6( + M 6B@!8@!Z%D& "#Q BCL 6( <G#D)"0_S6P!8@!Z'D) "#Q 3)PU6+[(,] + ML 6( 0!T&/\UL 6( >AU\/__@\0$QP6P!8@! ,G#D)!5B^Q6BW4(ZPZ0 + MD)" /CIT"X ^"G0&1H ^ '7P@#X*=0O&!@"+QE[)PY"0D( ^ '0$Q@8 1HO& + M7LG#D)!5B^R#[ Q6@SVP!8@! '4U:+0%B %HH 6( >BY!0 @\0(H[ %B $+ + MP'4:,\!>R<.+1?2CQ :( 0OV= F /CH/A:, "AL 6( ?9 #!!UVU!H 0 + M &C@!H@!Z+P$ "#Q R+\ OV=,*)-;P&B %6Z$____^#Q 2+\(DUP :( 5;H + M/O___X/$!(OP"_9TMH ^.G2Q:@J-1?A05N@<"0 @\0,B47T5NCP" @\0$ + M4&HZ5NCH!P @\0,.T7X=856Z/[^__^#Q 2+\(-]] !\#8%]]&#J /CE+_ + M__^X8>H .E+____:@J-1?A05NC(" @\0,B47T5NB<" @\0$4&HZ5NB4 + M!P @\0,.T7X#X4M____5NBF_O__@\0$B_"#??0 ? F!??1@Z@ ?@JX8>H + M .L&D)"0BT7TH\@&B &)-= &B &)-=0&B %6Z&[^__^#Q 2+\(DUV :( 5;H + M7?[__X/$!(OPB37<!H@!5NA,_O__@\0$BS7 !H@!ZP>0@#XL= 9&@#X =?6 + M/@!T!,8& $:)-<P&B &XO :( 5[)PY"058OL@^P84U=6QT7H (,]Z J( + M 0!U-KCL"H@!# &CZ J( ;CH"H@!# &C[ J( <<%\ J( >P*B ''!>0*B 'H + M"H@!H? *B &C^ J( 8M%"(/ !\'H HO8BS7D"H@!QT7P /8& 74UZQJ0 + MD(DUY J( 8L'B08Y/?@*B %U!HDU^ J( 8L^]@<!=.&-!)X[QW<+C02>.\8/ + M@TL! "+_HL&)/Z+\#OW=[HY/? *B %U"('^Z J( 70',\!>7UO)P_]%\(-] + M\ %VFHLU^ J( 6H Z,X& "#Q 2+^*'P"H@!@\ $.\=T/8V#_P +D 0 + MF??YB47PP67P"HO'N00 "9]_D+TG0^B\>9]_DKT??:B57HB\(#QXOXB\(! + M1?#K)9"A\ J( 2L%^ J( <'X BO#]]B)1? % $ ,'H"(E%\,%E\ J+1? # + MQSO'#X)D____BT7PB47T/0#\_W]V&V@ _/]_Z#@& "#Q 1 #X1#____@6WP + M /S_?_]U\.@?!@ @\0$0'415^BW 0 @\0$Z2#___^0D)")/?@*B &A\ J( + M 8DXBT7T*T7HC40'_(D'H? *B &#P 0[QW0.H? *B &+R(L)@,D!B0B+!Z/P + M"H@!N>@*B & R0&)"(O^Z77^__^0C02>H^0*B $[QW,0BP"C] J( :'D"H@! + MBPZ)"*'D"H@!# &)!CDU^ J( 74*H>0*B &C^ J( 8U&!%Y?6\G#D%6+[(/L + M!%=6BW4(B_Z#[P2)/>0*B &+!R3^B0>A\ J( 3D'=0:)/?@*B %>7\G#D%6+ + M[(/L%%-75HM]"/9'_ %T"5?HN/___X/$!(M'_"O'P?@"B47L_W4,Z';]__^# + MQ 2+\ OV= 4Y=0AU"(O&7E];R<.0BT4,@\ #P>@"B47PBT7L.47P<P:+1?") + M1>R+1>S!X )0_W4(5NA2! @\0,B]@[WW/%BT7PC02#.\=RNXM%\(T$@RO' + MP?@"BPWT"H@!B0R#ZZ6058OL@^P8H00 B &)1>B-1>Q0: %4 #_=0CHR0, + M (/$# O ?0Z+1>BC! "( 3/ R<.0D+@! R<.0N 0 ": < <@'# + MHP0 B &X_____\, +@1 F@ ' '(,BT0D!*,( (@!,\##HP0 B &X + M_____\, !5B^R#[ Q35U:+=0R+?1"+10B)1?3V1PR!=0DSP%Y?6\G#D)!. + MZV^0_T\$_P>+!SO&? *+QHO84VH*_W<$_W4(Z!\' "#Q!")1?@+P'0%B]@K + M70@!70@I'P%?! ^^1PV+!(48!(@!*T<$BP\+R7\",\D[P7T)5^@([O__@\0$ + M@WWX '0/BT4(Q@ BT7T7E];R<.0*_,+]G[K@S\ ?XY7Z*<% "#Q 1 #X5Y + M____BT4(.47T=<[I7____U6+[.A4!@ 4/]U#/]U".@H R<.0D%6+[%:+ + M=1!6Z"OJ__^#Q 16_W4,_W4(Z @ "#Q Q>R<.0D%6+[(/L#%-75HMU$ OV + M= Z#?0@ = B+10B . !U"C/ 7E];R<.0D)"+10R > $K#Y3 #[; B_B+10P/ + MO@"#^&%T.H/X<G11@_AW==(+_W0(N ( #K!I"X 0 (O8@,\#:+8! !3 + M_W4(Z&0& "#Q R)1?@+P'TRZZ(+_W0(N ( #K!I"X 0 (O89H'+" 'K + MS)"0"_]T"+@" ZP.0,\"+V.NXD)#'!@ "*1?B(1@T+_W0$L(#K#HM% + M#( X<G4$L 'K K "B$8,BT4,@#AA=1L+_W47:@)J /]U^.AG!0 @\0,"\ / + MC"K___\/OD8-,\F)3@2)3@B)#(48!(@!B\9>7UO)PY"058OL@^P04U=6BW44 + M@WT, 'X\@WT0 'XVBD8,)!(\ G49@WX( '03BT8(.48$=1F#/@!U%/9&#$1U + M#E;H+.O__X/$!.L%D)"0,\ +P'0*,\!>7UO)PY"0D ^^1@V+!(48!(@!B47X + MBT40#Z]%#(OXBT8$.48(<F3V1@P$=0B!_P $ !R5E?_=0@/OD8-4.@A_?__ + M@\0,B]@[WW0,@$X,( O ?P(SP(O8B\.9]WT,7E];R<.05N@NZO__@\0$0'4; + MBT4, \=(*]+W=0R+R(M%$"O!7E];R<.0 5T(BT7XBTX$B4WT*\&+V O;?LB+ + MQSO#<@*+PXO84_]U"/]U].B> @\0,*1X!7@0/OD8-BP2%& 2( 2M&!(L. + M"\E_ C/).\%]"5;H4NO__X/$!"O[=:?V1@Q$="'V1@P$=1)3:@K_=@CH- + M (/$# O = E6Z)/I__^#Q 2+11!>7UO)P[@V F@ ' '(!PZ,$ (@! + MN/_____# !5B^Q7BTT0"\E^%(S?CL>+?0B+10S\\JYU!8O'2.L"*\!?R<-5 + MB^Q65XM5$(S?CL>+?0B+QXMU#/R#^@=^)??& P '03]\<# = N+S_?9 + M@^$#*]'SI(O*P>D"\Z6#X@.+R@O)?@+SI%]>R<, 58OL5HMU"%;HC^?__X/$ + M!&H :@ /OD8-4.@V P @\0,QP8 BT8(B48$@&8,S_9&#(!T!(!F#/Q> + MR<.0D%6+[(/L!%=6BW4("_9U":$( (@!7E_)PXL]" "( 8O' \90Z'S[__^# + MQ 1 =1;'!00 B $, N/____]>7\G#D)"0B\=>7\G#D)!5B^Q7C-^.QXM] + M""O N?_____\\JZ+P??02%_)PP %6+[(/L$%-75HMU"(M]$,=%] "# + M?0P = 6+10R), O_? 6#_R1^"C/ 7E];R<.0D) /O@:)1?SV@+D%B $'=2SK + M"I"0D$8/O@:)1?R+1?SV@+D%B $(=>V#^"MT"(/X+74*_T7T1@^^!HE%_ O_ + M=2:#??PP= >_"@ .L9@'X!>'0&@'X!6'4(OQ #K!I"_" (M%_/: + MN06( 0=TA?: N06( 01T!H/H,.L;D(M%_/: N06( 0)T"(/H5^L)D)"0BT7\ + M@^@WB47P.\</C5'___^#_Q!U*(-]_#!U(@^^1@+V@+D%B & =!6 ?@%X= : + M?@%8=0F#Q@(/O@:)1?R+1?SV@+D%B $$= :#Z##K&Y"+1?SV@+D%B $"= B# + MZ%?K"9"0D(M%_(/H-_?8ZS^0D(M%_/: N06( 01T"(/H,.L=D)"0BT7\]H"Y + M!8@! G0(@^A7ZPF0D)"+1?R#Z#>)1? [QWT:B\</K\,K1?"+V$8/O@:)1?SV + M@+D%B $'=;&#?0P = 6+10R),(-]] !T"(O#7E];R<.0B\/WV%Y?6\G#D)"0 + M58OL@^P$5U:+=0B#?@@ =0E6Z)'G__^#Q 3V1@P!=0[V1@R #X26 @$X, + M ?9&#$1T)+]4 (@!ZP20@\<0.3T4!(@!=A'V1PQ =.]7Z/'D__^#Q 3KY(M& + M"(E&!/9&# 1T"+@! ZP^0#[YL$A1@$B $K1@A0_W8(#[Y#H% $ + M (/$#(D&_PYX#XM&!/]&! ^V %Y?R<.0D(,^_W0'@$X,(.L/D(!.#!#V1@R + M= 2 9@S^QP8 N/____]>7\G#D)"058OL@^P$5KY4 (@!ZP60D(/&$#DU + M% 2( 78-]D8,@W7OB\9>R<.0D#/ 7LG#D)"0N!, ": < <@'#HP0 + MB &X_____\, %6+[%97*\"+310+R7Y5C-^.QXM]#(OW_(O1BT40\JZX 0 + M '0"*\ KT8M]"(/Z!WXG]\8# =!/WQP, !T"XO/]]F#X0,KT?.DB\K! + MZ0+C!?.E@^(#B\KSI O = *+QU]>R<, N 4 ": < <@'#HP0 B &X + M_____\, +@# F@ ' '(!PZ,$ (@!N/_____# + M + M + M + M + M + M + M + M + M + M + M + M !W:&]A;6DZ(&YO('5S97(@;F%M92!A<W-O8VEA=&5D('=I + M=&@@=6ED("5U+@H E<PH 0+B 'T$(@! 0 + M (! ' ^( 1P/B $& @ + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M + M% 2( 0 ) ^( 0 + M + M + M + M + M M "L ( #!X P6 *&YU;&PI + M M "L ( " @(" @(" @(" @(" @(" @(" @ # P,# P,# P,# P + M,# P,# P,# P # Q,C,T-38W.#E!0D-$148 ,#$R,S0U-C<X.6%B + M8V1E9@ !N86XP> $Y!3C!8 :6YF $E.1@!R +V5T8R]P87-S + M=V0 !R " @(" @(" @("@H*"@H(" @(" @(" @(" @(" @ + M(" @2! 0$! 0$! 0$! 0$! 0$(2$A(2$A(2$A(00$! 0$! 0@8&!@8&! 0$! + M 0$! 0$! 0$! 0$! 0$! 0$0$! 0$!""@H*"@H(" @(" @(" @(" @(" @(" + M @(" A 0$! @ + M + M + % + + end *** X11R4.ORIG/mit/server/os/4.2bsd/connection.c Sun Jan 6 19:30:03 1991 --- X11R4/mit/server/os/4.2bsd/connection.c Sun Jan 6 19:52:09 1991 *************** *** 790,813 **** notime.tv_sec = 0; notime.tv_usec = 0; ! #if BSD_SOCKET_EMULATION /* ! * Much more efficient here, but may not be reliable. */ COPYBITS(AllClients, tmask); r = select (MAXSOCKS, (int *)NULL, (int *)NULL, (int *)tmask, ¬ime); ! for (i=0; i<mskcnt; i++) ! { ! mask = tmask[i]; ! while (mask) { ! curoff = ffs (mask) - 1; ! curclient = curoff + (i << 5); ! CloseDownClient(clients[ConnectionTranslation[curclient]]); ! mask &= ~(1 << curoff); } } ! #else for (i=0; i<mskcnt; i++) { mask = AllClients[i]; --- 790,816 ---- notime.tv_sec = 0; notime.tv_usec = 0; ! #ifdef BSD_SOCKET_EMULATION /* ! * Much more efficient here. In the case select fails, check each one. */ COPYBITS(AllClients, tmask); r = select (MAXSOCKS, (int *)NULL, (int *)NULL, (int *)tmask, ¬ime); ! if (r >= 0) { ! for (i=0; i<mskcnt; i++) ! { ! mask = tmask[i]; ! while (mask) { ! curoff = ffs (mask) - 1; ! curclient = curoff + (i << 5); ! CloseDownClient(clients[ConnectionTranslation[curclient]]); ! mask &= ~(1 << curoff); ! } } + return; } ! #endif for (i=0; i<mskcnt; i++) { mask = AllClients[i]; *************** *** 824,830 **** mask &= ~(1 << curoff); } } - #endif } /***************** --- 827,832 ----