static void mitshm_decode_req(FD fd, const unsigned char *buf) { short Major = IByte(&buf[0]); short Minor = IByte(&buf[1]); switch (Minor) { case 0: MitshmQueryVersion(fd, buf); ExtendedReplyExpected(fd, Major, Minor); break; case 1: MitshmAttach(fd, buf); break; case 2: MitshmDetach(fd, buf); break; case 3: MitshmPutImage(fd, buf); break; case 4: MitshmGetImage(fd, buf); ExtendedReplyExpected(fd, Major, Minor); break; case 5: MitshmCreatePixmap(fd, buf); break; default: break; } }
static void PrintGlyphList(const unsigned char *buf, int length, char *name, int size) { short n; fprintf(stdout, "%s%20s:\n", Leader, name); while (length >= 8) { n = IByte(&buf[0]); if (n != 255) { printfield(buf, 0, 1, CARD8, "length"); PrintField(buf, 4, 2, INT16, "delta x"); PrintField(buf, 6, 2, INT16, "delta y"); switch (size) { case 1: PrintTString8(&buf[8], (long) n, "glyph item 8 string"); break; case 2: PrintTString16(&buf[8], (long) n, "glyph item 16 string"); break; case 4: break; } n = ((n * size + 8) + 3) & ~3; buf += n; length -= n; } else { PrintField(buf, 8, 4, GLYPHSET, "glyphset"); buf += 12; length -= 12; } } }
static void mitshm_decode_error(FD fd, const unsigned char *buf) { short error = IByte(&buf[0]) - MITSHMError; switch (error) { case 0: MitshmShmSegError(fd, buf); break; default: break; } }
void SetValueRec ( unsigned long key, const unsigned char *control, short clength, short ctype, const unsigned char *values) { long cmask; struct ValueListEntry *p; ValuePtr value; int i; value = GetValueRec (key); if (!value) return; /* first get the control mask */ if (clength == 1) cmask = IByte(control); else if (clength == 2) cmask = IShort(control); else cmask = ILong(control); /* now if it is zero, ignore and return */ if (cmask == 0) return; /* there are bits in the controlling bitmask, figure out which */ /* the ctype is a set type, so this code is similar to PrintSET */ for (p = TD[ctype].ValueList, i = 0; p != NULL; p = p->Next, i++) { if ((p->Value & cmask) != 0) { memcpy (&value->values[i], values, sizeof (unsigned long)); values += 4; } } }