1: /* 2: * Copyright 1984, 1985 by the Regents of the University of 3: * California and by Gregory Glenn Minshall. 4: * 5: * Permission to use, copy, modify, and distribute these 6: * programs and their documentation for any purpose and 7: * without fee is hereby granted, provided that this 8: * copyright and permission appear on all copies and 9: * supporting documentation, the name of the Regents of 10: * the University of California not be used in advertising 11: * or publicity pertaining to distribution of the programs 12: * without specific prior permission, and notice be given in 13: * supporting documentation that copying and distribution is 14: * by permission of the Regents of the University of California 15: * and by Gregory Glenn Minshall. Neither the Regents of the 16: * University of California nor Gregory Glenn Minshall make 17: * representations about the suitability of this software 18: * for any purpose. It is provided "as is" without 19: * express or implied warranty. 20: */ 21: 22: 23: /* this file implements primitives to drive the screen. */ 24: #ifndef lint 25: static char sccsid[] = "@(#)screen.c 2.1 4/11/85"; 26: #endif /* ndef lint */ 27: 28: #include <stdio.h> 29: 30: #include "screen.h" 31: #include "3270.h" 32: 33: char CIABuffer[64] = { 34: 0x40, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 35: 0xc8, 0xc9, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 36: 0x50, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 37: 0xd8, 0xd9, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 38: 0x60, 0x61, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 39: 0xe8, 0xe9, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 40: 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 41: 0xf8, 0xf9, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f 42: }; 43: 44: /* These are the routines compiled if we are using a parallel array to hold 45: the field information... 46: */ 47: 48: /* What is the screen address of the attribute byte for the terminal */ 49: 50: WhereTermAttrByte(p) 51: register int p; 52: { 53: register int i; 54: 55: i = p; 56: 57: do { 58: if (TermIsStartField(i)) { 59: return(i); 60: } 61: i = ScreenDec(i); 62: } while (i != p); 63: 64: return(LowestScreen()); /* unformatted screen... */ 65: } 66: 67: /* What we know is that table is of size SCREENSIZE */ 68: 69: FieldFind(table, position, failure) 70: register char *table; /* which table of bytes to use */ 71: register int position; /* what position to start from */ 72: int failure; /* if unformatted, what value to return */ 73: { 74: register int ourp; 75: 76: ourp = position + 1 + bskip(table+position+1, SCREENSIZE-position-1, 0); 77: if (ourp < SCREENSIZE) { 78: return(ourp); 79: } 80: /* No fields in table after position. Look for fields from beginning 81: * of table. 82: */ 83: ourp = bskip(table, position+1, 0); 84: if (ourp <= position) { 85: return(ourp); 86: } 87: return(failure); 88: }