|
|
1.1 ! root 1: #ifndef lint ! 2: static char *rcsid_util_c = "$Header: util.c,v 10.1 86/11/29 13:53:19 jg Rel $"; ! 3: #endif lint ! 4: /* ! 5: ! 6: Copyright 1986 by the University of Utah ! 7: ! 8: Permission to use, copy, modify, and distribute this ! 9: software and its documentation for any purpose and without ! 10: fee is hereby granted, provided that the above copyright ! 11: notice appear in all copies and that both that copyright ! 12: notice and this permission notice appear in supporting ! 13: documentation, and that the name of the University of Utah ! 14: not be used in advertising or publicity pertaining to ! 15: distribution of the software without specific, written ! 16: prior permission. The University of Utah makes no ! 17: representations about the suitability of this software for ! 18: any purpose. It is provided "as is" without express or ! 19: implied warranty. ! 20: ! 21: */ ! 22: ! 23: ! 24: /* util.c Various utilities ! 25: * ! 26: * SoundBell Generate audible bell ! 27: * SetKeyClick Control key click ! 28: * SetAutoRepeat Control auto repeat ! 29: * SetLockLED Control Lock LED ! 30: * SetVideo Disable/enable video ! 31: * QueryShape Determine shapes ! 32: * ResolveColors doesn't do much ! 33: * StoreColors sets the color map ! 34: */ ! 35: ! 36: /* ! 37: * ToDo: ! 38: * Implement SetVideo ! 39: */ ! 40: ! 41: #include "Xapollo.h" ! 42: #include "/sys/ins/tone.ins.c" ! 43: ! 44: extern int vsdev; ! 45: ! 46: /* Sound bell, volume between 0 (quiet) and 7 (loud) */ ! 47: ! 48: SoundBell (volume) ! 49: int volume; ! 50: { ! 51: time_$clock_t ToneTime; ! 52: ToneTime.high = 1; ! 53: ToneTime.low = 0; ! 54: tone_$time(ToneTime); ! 55: return (0); ! 56: } ! 57: ! 58: /* Set key click, volume between -1 (default), 0 (off) and 8 (loud) */ ! 59: ! 60: SetKeyClick (volume) ! 61: int volume; ! 62: { ! 63: return (0); ! 64: } ! 65: ! 66: /* Set autorepeat */ ! 67: ! 68: SetAutoRepeat (onoff) ! 69: int onoff; ! 70: { ! 71: return (0); ! 72: } ! 73: ! 74: int SetVideo(onoff) ! 75: int onoff; ! 76: { ! 77: return(0); ! 78: } ! 79: ! 80: QueryShape (shape, width, height) ! 81: int shape; ! 82: short *width, *height; ! 83: { ! 84: switch (shape) { ! 85: case CursorShape: ! 86: if (*width > 16) ! 87: *width = 16; ! 88: if (*height > 16) ! 89: *height = 16; ! 90: break; ! 91: case TileShape: ! 92: *width = *height = 32; ! 93: break; ! 94: } ! 95: } ! 96: ! 97: SetLockLED (onoff) ! 98: int onoff; ! 99: { ! 100: return (0); ! 101: } ! 102: ! 103: ResolveColor (red, green, blue) ! 104: unsigned short *red, *green, *blue; ! 105: { ! 106: *red &= ~0377; ! 107: *green &= ~0377; ! 108: *blue &= ~0377; ! 109: } ! 110: ! 111: long ! 112: color_entry(red, green, blue) ! 113: int red, green, blue; ! 114: { ! 115: red = red >> 8; ! 116: green = green >> 8; ! 117: blue = blue >> 8; ! 118: return(( red * 65536) + (green * 256) + blue); ! 119: } ! 120: ! 121: StoreColors (count, entries) ! 122: int count; ! 123: ColorDef *entries; ! 124: ! 125: { ! 126: gpr_$color_vector_t values; ! 127: int n; ! 128: status_$t status; ! 129: ! 130: for (n=0;n<count;n++) { ! 131: values[0] = color_entry(entries->red, entries->green, entries->blue); ! 132: gpr_$set_color_map( (gpr_$pixel_value_t)entries->pixel, (short)1, values, status); ! 133: check_status( status, "StoreColors: "); ! 134: entries++; ! 135: } ! 136: } ! 137: ! 138: extern unsigned char InvertedPixelArray[]; ! 139: ! 140: InvertPixelOrder(p, n) ! 141: register unsigned short *p; ! 142: register int n; ! 143: { ! 144: for (; n--; p++) ! 145: *p = (unsigned short) ((InvertedPixelArray[*p & 0xFF] << 8) | ! 146: InvertedPixelArray[*p >> 8]); ! 147: } ! 148: ! 149:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.