|
|
1.1 ! root 1: /* $Header: util.c,v 10.3 86/02/01 15:47:51 tony Rel $ */ ! 2: /* util.c Various utilities ! 3: * ! 4: * ErrorString Interprets an error string ! 5: * SoundBell Generate audible bell ! 6: * SetKeyClick Control key click ! 7: * SetAutoRepeat Control auto repeat ! 8: * SetLockLED Control Lock LED ! 9: * QueryShape Determine shapes ! 10: * SetVideo Set video blanking ! 11: * ResolveColors does nothing ! 12: * StoreColors does nothing ! 13: * ! 14: */ ! 15: ! 16: /**************************************************************************** ! 17: * * ! 18: * Copyright (c) 1983, 1984 by * ! 19: * DIGITAL EQUIPMENT CORPORATION, Maynard, Massachusetts. * ! 20: * All rights reserved. * ! 21: * * ! 22: * This software is furnished on an as-is basis and may be used and copied * ! 23: * only with inclusion of the above copyright notice. This software or any * ! 24: * other copies thereof may be provided or otherwise made available to * ! 25: * others only for non-commercial purposes. No title to or ownership of * ! 26: * the software is hereby transferred. * ! 27: * * ! 28: * The information in this software is subject to change without notice * ! 29: * and should not be construed as a commitment by DIGITAL EQUIPMENT * ! 30: * CORPORATION. * ! 31: * * ! 32: * DIGITAL assumes no responsibility for the use or reliability of its * ! 33: * software on equipment which is not supplied by DIGITAL. * ! 34: * * ! 35: * * ! 36: ****************************************************************************/ ! 37: ! 38: #include "vs100.h" ! 39: #include "reason.h" ! 40: ! 41: extern int sys_nerr; ! 42: extern char *sys_errlist[]; ! 43: ! 44: char *AllocateSpace(); ! 45: ! 46: struct _ErrEntry { ! 47: int code; ! 48: char *reason; ! 49: } errorList[NUM_ERR_CODES] = { ! 50: {INT_ID , INT_ID_MSG}, ! 51: {INT_CD , INT_CD_MSG}, ! 52: {INT_SE , INT_SE_MSG}, ! 53: {INT_BE , INT_BE_MSG}, ! 54: {INT_CM , INT_CM_MSG}, ! 55: {INT_TM , INT_TM_MSG}, ! 56: {INT_MM , INT_MM_MSG}, ! 57: {INT_PD , INT_PD_MSG}, ! 58: {ERR_NYI , ERR_NYI_MSG}, ! 59: {ERR_IFC , ERR_IFC_MSG}, ! 60: {ERR_ICC , ERR_ICC_MSG}, ! 61: {ERR_RN , ERR_RN_MSG}, ! 62: {ERR_RO , ERR_RO_MSG}, ! 63: {ERR_LD , ERR_LD_MSG}, ! 64: {ERR_BE , ERR_BE_MSG}, ! 65: {ERR_AE , ERR_AE_MSG}, ! 66: {ERR_SI , ERR_SI_MSG}, ! 67: {ERR_II , ERR_II_MSG}, ! 68: {ERR_BN , ERR_BN_MSG}, ! 69: {ERR_BNI , ERR_BNI_MSG}, ! 70: {ERR_KBO , ERR_KBO_MSG}, ! 71: {ERR_TBO , ERR_TBO_MSG}, ! 72: {ERR_BBO , ERR_BBO_MSG}, ! 73: {ERR_ITP , ERR_ITP_MSG}, ! 74: {ERR_ISRCMB , ERR_ISRCMB_MSG}, ! 75: {ERR_ISRCBW , ERR_ISRCBW_MSG}, ! 76: {ERR_ISRCBH , ERR_ISRCBH_MSG}, ! 77: {ERR_ISRCC , ERR_ISRCC_MSG}, ! 78: {ERR_ISRCBD , ERR_ISRCBD_MSG}, ! 79: {ERR_ISRCD , ERR_ISRCD_MSG}, ! 80: {ERR_IMSKMB , ERR_IMSKMB_MSG}, ! 81: {ERR_IMSKBW , ERR_IMSKBW_MSG}, ! 82: {ERR_IMSKBH , ERR_IMSKBH_MSG}, ! 83: {ERR_IMSKBD , ERR_IMSKBD_MSG}, ! 84: {ERR_IDSTMB , ERR_IDSTMB_MSG}, ! 85: {ERR_IDSTBW , ERR_IDSTBW_MSG}, ! 86: {ERR_IDSTBH , ERR_IDSTBH_MSG}, ! 87: {ERR_IDSTBD , ERR_IDSTBD_MSG}, ! 88: {ERR_NOAREA , ERR_NOAREA_MSG}, ! 89: {ERR_IMAPMB , ERR_IMAPMB_MSG}, ! 90: {ERR_IMAPFC , ERR_IMAPFC_MSG}, ! 91: {ERR_ZIMAP , ERR_ZIMAP_MSG}, ! 92: {ERR_ZCIMAP , ERR_ZCIMAP_MSG}, ! 93: {ERR_ICLPMB , ERR_ICLPMB_MSG}, ! 94: {ERR_ICLPRC , ERR_ICLPRC_MSG}, ! 95: {ERR_SMC_ITC , ERR_SMC_ITC_MSG}, ! 96: {ERR_ITC_MULT , ERR_ITC_MULT_MSG}, ! 97: {ERR_ITC_DIV , ERR_ITC_DIV_MSG}, ! 98: {ERR_ICD , ERR_ICD_MSG}, ! 99: {ERR_MO_IBC , ERR_MO_IBC_MSG}, ! 100: {ERR_MO_IOT , ERR_MO_IOT_MSG}, ! 101: {ERR_MO_IDT , ERR_MO_IDT_MSG}, ! 102: {ERR_IPC , ERR_IPC_MSG}, ! 103: {ERR_DC_IPC , ERR_DC_IPC_MSG}, ! 104: {ERR_DC_IPSL , ERR_DC_IPSL_MSG}, ! 105: {ERR_DC_IPSM , ERR_DC_IPSM_MSG}, ! 106: {ERR_DC_ICF , ERR_DC_ICF_MSG}, ! 107: {ERR_DC_IPSP , ERR_DC_IPSP_MSG}, ! 108: {ERR_DC_IPSMB , ERR_DC_IPSMB_MSG}, ! 109: {ERR_DC_IPMMB , ERR_DC_IPMMB_MSG}, ! 110: {ERR_DC_IPSC , ERR_DC_IPSC_MSG}, ! 111: {ERR_DC_ISSRCBW , ERR_DC_ISSRCBW_MSG}, ! 112: {ERR_DC_ISSRCBH , ERR_DC_ISSRCBH_MSG}, ! 113: {ERR_DC_ISSRCBD , ERR_DC_ISSRCBD_MSG}, ! 114: {ERR_DC_ISSRCC , ERR_DC_ISSRCC_MSG}, ! 115: {ERR_DC_IDPM , ERR_DC_IDPM_MSG}, ! 116: {ERR_PT_ICSL , ERR_PT_ICSL_MSG}, ! 117: {ERR_PT_ICSO , ERR_PT_ICSO_MSG}, ! 118: {ERR_PT_ICSP , ERR_PT_ICSP_MSG}, ! 119: {ERR_PT_ITSL , ERR_PT_ITSL_MSG}, ! 120: {ERR_PT_ICI , ERR_PT_ICI_MSG}, ! 121: {ERR_PT_TSE , ERR_PT_TSE_MSG}, ! 122: {ERR_PT_NFP , ERR_PT_NFP_MSG}, ! 123: {ERR_PT_ISRCFW , ERR_PT_ISRCFW_MSG}, ! 124: {ERR_PT_ISRCFH , ERR_PT_ISRCFH_MSG}, ! 125: {ERR_PT_ISRCFD , ERR_PT_ISRCFD_MSG}, ! 126: {ERR_PT_IMSKFW , ERR_PT_IMSKFW_MSG}, ! 127: {ERR_PT_IMSKFH , ERR_PT_IMSKFH_MSG}, ! 128: {ERR_PT_IMSKFD , ERR_PT_IMSKFD_MSG}, ! 129: {ERR_PT_CSMF , ERR_PT_CSMF_MSG}, ! 130: {ERR_FA_ISRCB , ERR_FA_ISRCB_MSG}, ! 131: {ERR_FA_SPIOB , ERR_FA_SPIOB_MSG}, ! 132: {ERR_FA_SO , ERR_FA_SO_MSG}, ! 133: {ERR_FA_IBMMB , ERR_FA_IBMMB_MSG}, ! 134: {ERR_FP_ISRCB , ERR_FP_ISRCB_MSG}, ! 135: {ERR_FP_SO , ERR_FP_SO_MSG}, ! 136: {ERR_FP_IPC , ERR_FP_IPC_MSG}, ! 137: {ERR_FP_ICF , ERR_FP_ICF_MSG}, ! 138: {ERR_68K , ERR_68K_MSG}, ! 139: {ERR_RC , ERR_RC_MSG}, ! 140: {ERR_PR , ERR_PR_MSG}, ! 141: {ERR_CRT , ERR_CRT_MSG}, ! 142: {ERR_TU , ERR_TU_MSG}, ! 143: {ERR_KU , ERR_KU_MSG}, ! 144: {ERR_FOE , ERR_FOE_MSG}, ! 145: {ERR_VTO , ERR_VTO_MSG}, ! 146: {ERR_SB , ERR_SB_MSG}, ! 147: {ERR_BS , ERR_BS_MSG}, ! 148: {ERR_BC , ERR_BC_MSG}, ! 149: {ERR_TTO , ERR_TTO_MSG}, ! 150: {ERR_FOO , ERR_FOO_MSG}, ! 151: {ERR_KTO , ERR_KTO_MSG}, ! 152: {ERR_KST , ERR_KST_MSG}, ! 153: {ERR_LDC_IATRV , ERR_LDC_IATRV_MSG}, ! 154: {ERR_LDC_ICH , ERR_LDC_ICH_MSG}, ! 155: {ERR_LDC_ICW , ERR_LDC_ICW_MSG}, ! 156: {ERR_NOVALCUR , ERR_NOVALCUR_MSG} ! 157: }; ! 158: ! 159: /* Interpret a string corresponding to an error code. This doesn't ! 160: * work very well since the driver can't return enough bits for the ! 161: * code, but we do our best */ ! 162: ! 163: char *ErrorString (error) ! 164: int error; ! 165: { ! 166: register int i; ! 167: ! 168: for (i = 0; i < NUM_ERR_CODES; i++) { ! 169: if (errorList[i].code == error) ! 170: return (errorList[i].reason); ! 171: } ! 172: if (error > 0 && error < sys_nerr) ! 173: return (sys_errlist[error]); ! 174: return ("Unknown error"); ! 175: } ! 176: ! 177: SoundBell (volume) ! 178: int volume; ! 179: { ! 180: char *buf; ! 181: ! 182: if ((buf = (char *) AllocateSpace(4)) == NULL) ! 183: return; ! 184: buf[0] = 3; ! 185: buf[1] = 0x23; ! 186: buf[2] = 0x87 - volume; ! 187: buf[3] = 0xa7; ! 188: SendToPeripheral(buf, 4, VSE_DKB); ! 189: } ! 190: ! 191: SetKeyClick (volume) ! 192: int volume; ! 193: { ! 194: char *buf; ! 195: ! 196: if ((buf = (char *) AllocateSpace(3)) == NULL) ! 197: return; ! 198: if (volume) { ! 199: buf[0] = 2; ! 200: buf[1] = 0x1b; ! 201: buf[2] = 0x88 - volume; ! 202: } else { ! 203: buf[0] = 1; ! 204: buf[1] = 0x99; ! 205: buf[2] = 0x99; ! 206: } ! 207: SendToPeripheral(buf, 3, VSE_DKB); ! 208: } ! 209: ! 210: QueryShape (shape, width, height) ! 211: int shape; ! 212: short *width, *height; ! 213: { ! 214: switch (shape) { ! 215: case CursorShape: ! 216: if (*width > 64) ! 217: *width = 64; ! 218: if (*height > 64) ! 219: *height = 64; ! 220: break; ! 221: case TileShape: ! 222: *width = *height = 16; ! 223: break; ! 224: } ! 225: } ! 226: ! 227: SetAutoRepeat (onoff) ! 228: int onoff; ! 229: { ! 230: char *buf; ! 231: ! 232: if ((buf = (char *) AllocateSpace(2)) == NULL) ! 233: return; ! 234: buf[0] = 1; ! 235: buf[1] = onoff ? 0xe3 : 0xe1; ! 236: SendToPeripheral(buf, 2, VSE_DKB); ! 237: } ! 238: ! 239: /*ARGSUSED*/ ! 240: SetLockLED (onoff) ! 241: int onoff; ! 242: { ! 243: } ! 244: ! 245: SetVideo (onoff) ! 246: int onoff; ! 247: { ! 248: return (onoff - 1); ! 249: } ! 250: ! 251: /*ARGSUSED*/ ! 252: ResolveColor (red, green, blue) ! 253: unsigned short *red, *green, *blue; ! 254: { ! 255: } ! 256: ! 257: /*ARGSUSED*/ ! 258: StoreColors (count, entries) ! 259: int count; ! 260: ColorDef *entries; ! 261: ! 262: { ! 263: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.