home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!news.ysu.edu!malgudi.oar.net!caen!sol.ctr.columbia.edu!usc!news.service.uci.edu!unogate!mvb.saic.com!vmsnet-sources
- From: mahan@tgv.com (Patrick L. Mahan - TGV Window Washer)
- Newsgroups: vmsnet.sources
- Subject: XSCOPE/VMS 1.0, part 08/08
- Message-ID: <8045411@MVB.SAIC.COM>
- Date: Fri, 04 Sep 1992 05:34:40 GMT
- Reply-To: mahan@tgv.com
- Organization: TGV Incorporated (Tech Support) in Santa Cruz, CA
- Lines: 863
- Approved: Mark.Berryman@Mvb.Saic.Com
-
- Submitted-by: mahan@tgv.com (Patrick L. Mahan - TGV Window Washer)
- Posting-number: Volume 3, Issue 160
- Archive-name: xscope/part08
-
-
- -+-+-+-+-+-+-+-+ START OF PART 8 -+-+-+-+-+-+-+-+
- X PrintField(buf, 12, 4, CARD32, "black-pixel");
- X PrintField(buf, 16, 4, SETofEVENT, "current-input-masks");
- X PrintField(buf, 20, 2, CARD16, "width-in-pixels");
- X PrintField(buf, 22, 2, CARD16, "height-in-pixels");
- X PrintField(buf, 24, 2, CARD16, "width-in-millimeters");
- X PrintField(buf, 26, 2, CARD16, "height-in-millimeters");
- X PrintField(buf, 28, 2, CARD16, "min-installed-maps");
- X PrintField(buf, 30, 2, CARD16, "max-installed-maps");
- X PrintField(buf, 32, 4, VISUALID, "root-visual");
- X PrintField(buf, 36, 1, BACKSTORE, "backing-stores");
- X PrintField(buf, 37, 1, BOOL, "save-unders");
- X PrintField(buf, 38, 1, CARD8, "root-depth");
- X PrintField(buf, 39, 1, CARD8, "number of allowed-depths");
- X n = IByte(&buf`5B39`5D);
- X m = PrintList(&buf`5B40`5D, (long)n, DEPTH, "allowed-depths");
- X return(40 + m);
- X`7D
- X
- XPrintDEPTH(buf)
- X unsigned char *buf;
- X`7B
- X short n /* number of elements in List of VISUALTYPE */ ;
- X short m /* length (in bytes) of List of VISUALTYPE */ ;
- X
- X PrintField(buf, 0, 1, CARD8, "depth");
- X PrintField(buf, 2, 2, DVALUE2(n), "number of visuals");
- X n = IShort(&buf`5B2`5D);
- X m = PrintList(&buf`5B8`5D, (long)n, VISUALTYPE, "visuals");
- X return(8 + m);
- X`7D
- X
- XPrintVISUALTYPE(buf)
- X unsigned char *buf;
- X`7B
- X PrintField(buf, 0, 4, VISUALID, "visual-id");
- X PrintField(buf, 4, 1, COLORCLASS, "class");
- X PrintField(buf, 5, 1, CARD8, "bits-per-rgb-value");
- X PrintField(buf, 6, 2, CARD16, "colormap-entries");
- X PrintField(buf, 8, 4, CARD32, "red-mask");
- X PrintField(buf, 12, 4, CARD32, "green-mask");
- X PrintField(buf, 16, 4, CARD32, "blue-mask");
- X return(24);
- X`7D
- X
- X/* ************************************************************ */
- X
- XInitRecordTypes()
- X`7B
- X (void) DefineType(CHAR2B, RECORD, "CHAR2B", PrintCHAR2B);
- X (void) DefineType(POINT, RECORD, "POINT", PrintPOINT);
- X (void) DefineType(RECTANGLE, RECORD, "RECTANGLE", PrintRECTANGLE);
- X (void) DefineType(ARC, RECORD, "ARC", PrintARC);
- X (void) DefineType(HOST, RECORD, "HOST", PrintHOST);
- X (void) DefineType(TIMECOORD, RECORD, "TIMECOORD", PrintTIMECOORD);
- X (void) DefineType(FONTPROP, RECORD, "FONTPROP", PrintFONTPROP);
- X (void) DefineType(CHARINFO, RECORD, "CHARINFO", PrintCHARINFO);
- X (void) DefineType(SEGMENT, RECORD, "SEGMENT", PrintSEGMENT);
- X (void) DefineType(COLORITEM, RECORD, "COLORITEM", PrintCOLORITEM);
- X (void) DefineType(RGB, RECORD, "RGB", PrintRGB);
- X (void) DefineType(FORMAT, RECORD, "FORMAT", PrintFORMAT);
- X (void) DefineType(SCREEN, RECORD, "SCREEN", PrintSCREEN);
- X (void) DefineType(DEPTH, RECORD, "DEPTH", PrintDEPTH);
- X (void) DefineType(VISUALTYPE, RECORD, "VISUALTYPE", PrintVISUALTYPE);
- X`7D
- X
- X
- X
- X/* ************************************************************ */
- X/*`09`09`09`09`09`09`09`09*/
- X/*`09`09`09`09`09`09`09`09*/
- X/* ************************************************************ */
- X
- XInitValuesTypes()
- X`7B
- X TYPE p;
- X
- X p = DefineType(WINDOW_BITMASK, SET, "WINDOW_BITMASK", PrintSET);
- X
- X DefineValues(p, 0x00000001L, 4, PIXMAPNPR, "background-pixmap");
- X DefineValues(p, 0x00000002L, 4, CARD32, "background-pixel");
- X DefineValues(p, 0x00000004L, 4, PIXMAPC, "border-pixmap");
- X DefineValues(p, 0x00000008L, 4, CARD32, "border-pixel");
- X DefineValues(p, 0x00000010L, 1, BITGRAVITY, "bit-gravity");
- X DefineValues(p, 0x00000020L, 1, WINGRAVITY, "win-gravity");
- X DefineValues(p, 0x00000040L, 1, BACKSTORE, "backing-store");
- X DefineValues(p, 0x00000080L, 4, CARD32, "backing-planes");
- X DefineValues(p, 0x00000100L, 4, CARD32, "backing-pixel");
- X DefineValues(p, 0x00000200L, 1, BOOL, "override-redirect");
- X DefineValues(p, 0x00000400L, 1, BOOL, "save-under");
- X DefineValues(p, 0x00000800L, 4, SETofEVENT, "event-mask");
- X DefineValues(p, 0x00001000L, 4, SETofDEVICEEVENT, "do-not-propagate-mask")
- V;
- X DefineValues(p, 0x00002000L, 4, COLORMAPC, "colormap");
- X DefineValues(p, 0x00004000L, 4, CURSOR, "cursor");
- X
- X p = DefineType(CONFIGURE_BITMASK, SET, "CONFIGURE_BITMASK", PrintSET);
- X DefineValues(p, 0x0001L, 2, INT16, "x");
- X DefineValues(p, 0x0002L, 2, INT16, "y");
- X DefineValues(p, 0x0004L, 2, CARD16, "width");
- X DefineValues(p, 0x0008L, 2, CARD16, "height");
- X DefineValues(p, 0x0010L, 2, CARD16, "border-width");
- X DefineValues(p, 0x0020L, 4, WINDOW, "sibling");
- X DefineValues(p, 0x0040L, 1, STACKMODE, "stack-mode");
- X
- X p = DefineType(GC_BITMASK, SET, "GC_BITMASK", PrintSET);
- X DefineValues(p, 0x00000001L, 1, GCFUNC, "function");
- X DefineValues(p, 0x00000002L, 4, CARD32, "plane-mask");
- X DefineValues(p, 0x00000004L, 4, CARD32, "foreground");
- X DefineValues(p, 0x00000008L, 4, CARD32, "background");
- X DefineValues(p, 0x00000010L, 2, CARD16, "line-width");
- X DefineValues(p, 0x00000020L, 1, LINESTYLE, "line-style");
- X DefineValues(p, 0x00000040L, 1, CAPSTYLE, "cap-style");
- X DefineValues(p, 0x00000080L, 1, JOINSTYLE, "join-style");
- X DefineValues(p, 0x00000100L, 1, FILLSTYLE, "fill-style");
- X DefineValues(p, 0x00000200L, 1, FILLRULE, "fill-rule");
- X DefineValues(p, 0x00000400L, 4, PIXMAP, "tile");
- X DefineValues(p, 0x00000800L, 4, PIXMAP, "stipple");
- X DefineValues(p, 0x00001000L, 2, INT16, "tile-stipple-x-origin");
- X DefineValues(p, 0x00002000L, 2, INT16, "tile-stipple-y-origin");
- X DefineValues(p, 0x00004000L, 4, FONT, "font");
- X DefineValues(p, 0x00008000L, 1, SUBWINMODE, "subwindow-mode");
- X DefineValues(p, 0x00010000L, 1, BOOL, "graphics-exposures");
- X DefineValues(p, 0x00020000L, 2, INT16, "clip-x-origin");
- X DefineValues(p, 0x00040000L, 2, INT16, "clip-y-origin");
- X DefineValues(p, 0x00080000L, 4, PIXMAP, "clip-mask");
- X DefineValues(p, 0x00100000L, 2, CARD16, "dash-offset");
- X DefineValues(p, 0x00200000L, 1, CARD8, "dashes");
- X DefineValues(p, 0x00400000L, 1, ARCMODE, "arc-mode");
- X
- X p = DefineType(KEYBOARD_BITMASK, SET, "KEYBOARD_BITMASK", PrintSET);
- X DefineValues(p, 0x0001L, 1, INT8, "key-click-percent");
- X DefineValues(p, 0x0002L, 1, INT8, "bell-percent");
- X DefineValues(p, 0x0004L, 2, INT16, "bell-pitch");
- X DefineValues(p, 0x0008L, 2, INT16, "bell-duration");
- X DefineValues(p, 0x0010L, 1, CARD8, "led");
- X DefineValues(p, 0x0020L, 1, OFF_ON, "led-mode");
- X DefineValues(p, 0x0040L, 1, KEYCODE, "key");
- X DefineValues(p, 0x0080L, 1, OFF_ON, "auto-repeat-mode");
- X`7D
- $ CALL UNPACK TABLE11.C;3 1260789462
- $ create 'f'
- X./Imakefile,v
- X./common.c,v
- X./fd.c,v
- X./decode11.c,v
- X./fd.h,v
- X./print11.c,v
- X./patchlevel.h,v
- X./prtype.c,v
- X./scope.c,v
- X./scope.h,v
- X./server.c,v
- X./table11.c,v
- X./x11.h,v
- X./xscope.man,v
- X./tarfiles
- $ CALL UNPACK TARFILES.;1 1601260302
- $ create 'f'
- X/* ************************************************************ *
- X *`09`09`09`09`09`09 `09`09*
- X * Type definitions and Connection State for the X11 protocol *
- X *`09`09`09`09`09`09 `09`09*
- X *`09James Peterson, 1988`09`09`09 `09`09*
- X *`09(c) Copyright MCC, 1988 `09`09 `09`09*
- X *`09`09`09`09`09`09 `09`09*
- X * ************************************************************ */
- X
- X
- X/* Some field contents are constants, not just types */
- X
- X#define CONST1(n) CARD8
- X#define CONST2(n) CARD16
- X#define CONST4(n) CARD32
- X
- X/* Some field contents define the components of an expression */
- X
- X#define DVALUE1(expression) CARD8
- X#define DVALUE2(expression) CARD16
- X#define DVALUE4(expression) CARD32
- X
- X
- X/* ************************************************************ */
- X/*`09`09`09`09`09`09`09`09*/
- X/*`09`09`09`09`09`09`09`09*/
- X/* ************************************************************ */
- X
- X/* Built-in Types */
- X
- X#define BYTE 1`09`09 /* 8-bit value */
- X#define INT8 2`09`09 /* 8-bit signed integer */
- X#define INT16 3`09`09 /* 16-bit signed integer */
- X#define INT32 4`09`09 /* 32-bit signed integer */
- X#define CARD8 5`09`09 /* 8-bit unsigned integer */
- X#define CARD16 6`09 /* 16-bit unsigned integer */
- X#define CARD32 7`09 /* 32-bit unsigned integer */
- X#define STRING8 8`09 /* List of CARD8 */
- X#define STRING16 9`09 /* List of CHAR2B */
- X#define TEXTITEM8 10`09 /* STRING8 or Font shift */
- X#define TEXTITEM16 11`09 /* STRING16 or Font shift */
- X
- X#define WINDOW 12`09 /* CARD32 plus 0 = None */
- X#define WINDOWD 13`09 /* CARD32 plus 0 = PointerWindow, 1 =
- X`09`09`09 InputFocus */
- X#define WINDOWNR 14`09 /* CARD32 plus 0 = None, 1 = PointerRoot */
- X
- X#define PIXMAP 15`09 /* CARD32 plus 0 = None */
- X#define PIXMAPNPR 16`09 /* CARD32 plus 0 = None, 1 = ParentRelative`2
- V0
- X`09`09`09 */
- X#define PIXMAPC 17`09 /* CARD32 plus 0 = CopyFromParent */
- X
- X#define CURSOR 18`09 /* CARD32 plus 0 = None */
- X
- X#define FONT 19`09`09 /* CARD32 plus 0 = None */
- X
- X#define GCONTEXT 20`09 /* CARD32 */
- X
- X#define COLORMAP 21`09 /* CARD32 plus 0 = None */
- X#define COLORMAPC 22`09 /* CARD32 plus 0 = CopyFromParent */
- X
- X#define DRAWABLE 23`09 /* CARD32 */
- X#define FONTABLE 24`09 /* CARD32 */
- X
- X#define ATOM 25`09`09 /* CARD32 plus 0 = None */
- X#define ATOMT 26`09 /* CARD32 plus 0 = AnyPropertyType */
- X
- X#define VISUALID 27`09 /* CARD32 plus 0 = None */
- X#define VISUALIDC 28`09 /* CARD32 plus 0 = CopyFromParent */
- X
- X#define TIMESTAMP 29`09 /* CARD32 plus 0 as the current time */
- X
- X#define RESOURCEID 30`09 /* CARD32 plus 0 = AllTemporary */
- X
- X#define KEYSYM 31`09 /* CARD32 */
- X#define KEYCODE 32`09 /* CARD8 */
- X#define KEYCODEA 33`09 /* CARD8 plus 0 = AnyKey */
- X
- X#define BUTTON 34`09 /* CARD8 */
- X#define BUTTONA 35`09 /* CARD8 plus 0 = AnyButton */
- X
- X#define EVENTFORM 34`09 /* event format */
- X#define CHAR8 35`09 /* CARD8 interpreted as a character */
- X#define STR 36`09`09 /* String of CHAR8 with preceding length */
- X
- X/* ************************************************************ */
- X/*`09`09`09`09`09`09`09`09*/
- X/*`09`09`09`09`09`09`09`09*/
- X/* ************************************************************ */
- X
- X/* Defined types */
- X
- X#define BITGRAVITY`09 40`20
- X#define WINGRAVITY`09 41`20
- X#define BOOL`09`09 42`20
- X#define HOSTFAMILY`09 43`20
- X#define PK_MODE`09`09 44`20
- X#define NO_YES`09`09 45`20
- X#define WINDOWCLASS`09 46`20
- X#define BACKSTORE`09 47`20
- X#define MAPSTATE`09 48`20
- X#define STACKMODE`09 49`20
- X#define CIRMODE`09 `09 50`20
- X#define CHANGEMODE`09 51`20
- X#define GRABSTAT`09 52`20
- X#define EVENTMODE`09 53`20
- X#define FOCUSAGENT`09 54`20
- X#define DIRECT`09`09 55`20
- X#define GCFUNC`09`09 56`20
- X#define LINESTYLE`09 57`20
- X#define CAPSTYLE`09 58`20
- X#define JOINSTYLE`09 59`20
- X#define FILLSTYLE`09 60`20
- X#define FILLRULE`09 61`20
- X#define SUBWINMODE`09 62`20
- X#define ARCMODE`09 `09 63`20
- X#define RECTORDER`09 64`20
- X#define COORMODE`09 65`20
- X#define POLYSHAPE`09 66`20
- X#define IMAGEMODE`09 67`20
- X#define ALLORNONE`09 68`20
- X#define OBJECTCLASS`09 69`20
- X#define OFF_ON`09`09 70`20
- X#define INS_DEL`09 `09 71`20
- X#define DIS_EN`09`09 72`20
- X#define CLOSEMODE`09 73`20
- X#define SAVEMODE`09 74`20
- X#define RSTATUS`09 `09 75`20
- X#define MOTIONDETAIL`09 76`20
- X#define ENTERDETAIL`09 77`20
- X#define BUTTONMODE`09 78`20
- X#define SCREENFOCUS`09 79`20
- X#define VISIBLE`09 `09 80`20
- X#define CIRSTAT`09 `09 81`20
- X#define PROPCHANGE`09 82`20
- X#define CMAPCHANGE`09 83`20
- X#define MAPOBJECT`09 84`20
- X#define SETofEVENT`09 85`20
- X#define SETofPOINTEREVENT`09 86`20
- X#define SETofDEVICEEVENT`09 87`20
- X#define SETofKEYBUTMASK`09 `09 88`20
- X#define SETofKEYMASK`09`09 89`20
- X#define WINDOW_BITMASK`09`09 90`20
- X#define CONFIGURE_BITMASK`09 91`20
- X#define GC_BITMASK`09`09 92`20
- X#define KEYBOARD_BITMASK`09 93`20
- X#define COLORMASK`09`09 94`20
- X#define CHAR2B`09`09 95`20
- X#define POINT`09`09 96`20
- X#define RECTANGLE`09 97`20
- X#define ARC`09`09 98`20
- X#define HOST`09`09 99`20
- X#define TIMECOORD`09100`20
- X#define FONTPROP`09101`20
- X#define CHARINFO`09102`20
- X#define SEGMENT`09`09103`20
- X#define COLORITEM`09104`20
- X#define RGB`09`09105`20
- X#define BYTEMODE`09110
- X#define BYTEORDER`09111
- X#define COLORCLASS`09112
- X#define FORMAT`09`09113
- X#define SCREEN`09`09114
- X#define DEPTH`09`09115
- X#define VISUALTYPE`09116
- X
- X#define REQUEST`09`09117
- X#define REPLY`09`09118
- X#define ERROR`09`09119
- X#define EVENT`09`09120
- X
- X#define MaxTypes 128
- X
- X/* ************************************************************ */
- X/*`09`09`09`09`09`09`09`09*/
- X/*`09`09`09`09`09`09`09`09*/
- X/* ************************************************************ */
- X
- X/* declaration of the existance of print routines for the basic types */
- X
- XPrintINT8();
- XPrintINT16();
- XPrintINT32();
- XPrintCARD8();
- XPrintCARD16();
- XPrintCARD32();
- XPrintBYTE();
- XPrintCHAR8();
- X#ifdef vax11c
- XMYPrintSTRING16();
- X#define PrintSTRING16 MYPrintSTRING16
- X#else
- XPrintSTRING16();
- X#endif /* vax11c */
- XPrintTEXTITEM8();
- XPrintTEXTITEM16();
- XPrintSTR();
- XPrintWINDOW();
- XPrintWINDOWD();
- XPrintWINDOWNR();
- XPrintPIXMAP();
- XPrintPIXMAPNPR();
- XPrintPIXMAPC();
- XPrintCURSOR();
- XPrintFONT();
- XPrintGCONTEXT();
- XPrintCOLORMAP();
- XPrintCOLORMAPC();
- XPrintDRAWABLE();
- XPrintFONTABLE();
- XPrintATOM();
- XPrintATOMT();
- XPrintVISUALID();
- XPrintVISUALIDC();
- XPrintTIMESTAMP();
- XPrintRESOURCEID();
- XPrintKEYSYM();
- XPrintKEYCODE();
- XPrintKEYCODEA();
- XPrintBUTTON();
- XPrintBUTTONA();
- XPrintEVENTFORM();
- XPrintENUMERATED();
- XPrintSET();
- X
- X/* ************************************************************ */
- X/*`09`09`09`09`09`09`09`09*/
- X/*`09`09`09`09`09`09`09`09*/
- X/* ************************************************************ */
- X
- X/* Type Definition Table
- X
- X Each item in the X11 Protocol has a type. There are about 120
- X different types. We need to be able to print each item in a`20
- X format and interpretation which is appropriate for the type of
- X that item. To do so, we build a table describing each type.
- X Each type has a name, possibly a list of named values and a
- X procedure which knows how to print that type.
- X*/
- X
- X/* Types of Types */
- X
- X#define BUILTIN 1
- X#define ENUMERATED 2
- X#define SET 3
- X#define RECORD 5
- X
- X
- X/* Enumerated and Set types need a list of Named Values */
- X
- Xstruct ValueListEntry
- X`7B
- X struct ValueListEntry *Next;
- X char *Name;
- X short Type;
- X short Length;
- X long Value;
- X`7D;
- X
- Xstruct TypeDef
- X`7B
- X char *Name;
- X short Type /* BUILTIN, ENUMERATED, SET, or RECORD */ ;
- X struct ValueListEntry *ValueList;
- X int (*PrintProc)();
- X`7D;
- X
- Xtypedef struct TypeDef *TYPE;
- X
- Xstruct TypeDef TD`5BMaxTypes`5D;
- X
- X/* ************************************************************ */
- X/*`09`09`09`09`09`09`09`09*/
- X/*`09`09`09`09`09`09`09`09*/
- X/* ************************************************************ */
- X
- X/* Reply Buffer: Pseudo-buffer used to provide the opcode for the
- X request to which this is a reply: Set by DecodeReply
- X`09`09 and used in the PrintField of the Reply procedure */
- Xunsigned char RBf`5B2`5D;
- X
- X
- X/* Sequence Buffer: Pseudo-buffer used to provide the sequence number for a
- X request: Set by DecodeReply and used in a PrintField of`20
- X`09`09 the Request procedure */
- Xunsigned char SBf`5B4`5D;
- X
- X
- X#define PRINTSERVER 5`09 /* indent output as if it comes from server *
- V/
- X#define PRINTCLIENT 1`09 /* indent output as if it comes from client *
- V/
- X
- X/* ************************************************************ */
- X/*`09`09`09`09`09`09`09`09*/
- X/*`09`09`09`09`09`09`09`09*/
- X/* ************************************************************ */
- X
- X/*`20
- X In general, we are called with a buffer of bytes and are supposed to
- X try to make sense of these bytes according to the X11 protocol. There
- X are two different types of communication: requests from the client to
- X the server and replies/errors/events from the server to the client.
- X We must interpret these two differently.
- X
- X Also, we must consider that the bytes on the communication socket may
- X be sent asynchronously in any amount. This means that we must be prepared
- X to read in and save some bytes until we get enough to do something with
- X them. For example, suppose that we get a buffer from a client. We would
- X expect it to be a request. The request may be 24 bytes long. We may find
- V,
- X however, that only 16 bytes have actually arrived -- the other 8 are stuck
- X in a buffer somewhere. We must be prepared to simply hold the 16 bytes we
- X have until more bytes arrive.
- X
- X In general, we do two things: we wait for some number of bytes, and
- X then we interpret this set of bytes. To interpret this data we use`20
- X a modified state machine. We keep two pieces of information:
- X
- X (1) the number of bytes that we need
- X (2) what to do with those bytes.
- X
- X This last piece of information is the "state" of the interpretation.
- X We keep the state as a pointer to the procedure that is to be executed.
- X
- X
- X CLIENTS:
- X
- X The data going from the client to the x11 server consists of a
- X set-up message followed by an infinite stream of variable length
- X requests. `20
- X
- X Our overall flow is then:
- X
- X (a) Wait for 12 bytes.
- X (b) Interpret these first 12 bytes of the set-up message to get the
- X length of the rest of the message.
- X (c) Wait for the rest of the set-up message.
- X (d) Interpret and print the set-up message.
- X `20
- X *** end of set-up phase -- start normal request loop ***
- X
- X (e) Wait for 4 bytes.
- X (f) Interpret these 4 bytes to get the length of the rest of the command.
- X (g) Wait for the rest of the command.
- X (h) Interpret and print the command.
- X (i) Go back to step (e).
- X
- X SERVERS:
- X
- X Again, we have a set-up reply followed by an infinite stream of variable
- X length replies/errors/events.
- X
- X Our overall flow is then:
- X
- X (a) Wait for 8 bytes.
- X (b) Interpret the 8 bytes to get the length of the rest of the set-up repl
- Vy.
- X (c) Wait for the rest of the set-up reply.
- X (d) Interpret and print the set-up reply.
- X
- X *** end of set-up phase -- start normal reply/error/event loop ***
- X
- X We have the following properties of X11 replies, errors, and events:
- X
- X Replies: 32 bytes plus a variable amount. Byte 0 is 1.
- X Bytes 2-3 are a sequence number; bytes 4-7 are length (n). The
- X`09 complete length of the reply is 32 + 4 * n.
- X
- X Errors: 32 bytes. Byte 0 is 0.
- X Byte 1 is an error code; bytes 2-3 are a sequence number.
- X`09 Bytes 8-9 are a major opcode; byte 10 is a minor opcode.
- X
- X Events: 32 bytes. Byte 0 is 2, 3, 4, ....
- X
- X Looking at this we have two choices: wait for one byte and then separatel
- Vy
- X wait for replies, errors, and events, or wait for 32 bytes, then separatel
- Vy
- X process each type. We may have to wait for more, in the event of a reply.
- X This latter seems more effective. It appears reply/error/event formats
- X were selected to allow waiting for 32 bytes, and it will allow short packe
- Vts
- X which are only 32 bytes long, to be processed completely in one step.
- X `20
- X Thus, For normal reply/error/event processing we have`20
- X
- X (e) Wait for 32 bytes.
- X (f) Interpret these 32 bytes. If possible, go back to step (e).
- X (g) If the packet is a reply with bytes 4-7 non-zero, wait for the
- X remainder of the the reply.
- X (h) Interpret and print the longer reply. Go back to step (e).
- X `20
- X
- X The similarity in approach to how both the client and server are handled
- X suggests we can use the same control structure to drive the interpretation
- X of both types of communication client->server and server->client. `20
- X Accordingly, we package up the relevant variables in a ConnState
- X record. The ConnState record contains the buffer of saved bytes (if any),
- X the size and length of this buffer, the number of bytes we are waiting for
- X and what to do when we get them. A separate ConnState record is kept
- X for the client and server.
- X
- X In addition, we may have several different client or server connections.
- X Thus we need an array of all the necessary state for each client or server
- V.
- X A client/server is identified with a file descriptor (fd), so we use the
- X fd to identify the client/server and use it as an index into an array of
- X state variables.
- X*/
- X
- Xstruct ConnState
- X`7B
- X unsigned char *SavedBytes;
- X int`09 littleEndian;
- X long SizeofSavedBytes;
- X long NumberofSavedBytes;
- X
- X long NumberofBytesNeeded;
- X long (*ByteProcessing)();
- X
- X long SequenceNumber;
- X`7D;
- X
- X#ifdef vax11c
- Xstruct ConnState *CS = NULL;
- X#else
- Xstruct ConnState CS`5BStaticMaxFD`5D;
- X#endif /* vax11c */
- X
- X
- X
- X
- X/* ************************************************************ */
- X/*`09`09`09`09`09`09`09`09*/
- X/*`09`09`09`09`09`09`09`09*/
- X/* ************************************************************ */
- X
- X/* declaraction of the types of some common functions */
- X
- Xextern unsigned long ILong();
- Xextern unsigned short IShort();
- Xextern unsigned short IByte();
- Xextern Boolean IBool();
- X
- Xextern long PrintList();
- Xextern long PrintListSTR();
- Xextern long pad();
- $ CALL UNPACK X11.H;6 117966406
- $ create 'f'
- X.TH XSCOPE 1 "8 Sept 1988" "X Version 11"
- X.SH NAME
- Xxscope - X Window Protocol Viewer
- X.SH SYNOPSIS
- X.B xscope
- X`5B option `5D ...
- X.SH DESCRIPTION
- X.I Xscope
- Xsits in-between an X11 client and an X11 server and prints the contents
- Xof each request, reply, error, or event that is communicated between them.
- XThis information can be useful in debugging and performance
- Xtuning of X11 servers and clients.
- X.PP
- XTo operate, \fIxscope\fP must know the host, port, and display to use
- Xto connect to the X11 server. In addition, it must know the port on
- Xwhich it should listen for X11 clients. Two cases are common:
- X.PP
- X.TP 5
- X(1) The X11 server is on the same host as \fIxscope\fP.
- XIn this case, the input port for \fIxscope\fP should be selected as an
- XX11 server on a different display, and the client DISPLAY argument
- Xadjusted to select \fIxscope\fP . For example, if the X11 server is
- Xon port 6000, display 1, then \fIxscope\fP can use port 6002 as its
- Xinput port. The client can use display 1 for direct access to X11 or
- Xdisplay 2 for access to \fIxscope\fP.
- X.PP
- X.TP 5
- X(2) The X11 server is on a different host than \fIxscope\fP.
- XIn this case the same input and output ports can be used, and the host
- Xcomponent of the DISPLAY is used to select \fIxscope\fP or X11.
- X.SH ARGUMENTS
- X.PP
- X.TP 10
- X.B \-i<input-port>
- XSpecify the port that \fIxscope\fP will use to take requests from clients
- X(defaults to 1).
- XFor X11, this port is automatically biased by 6000.
- X.PP
- X.TP 10
- X.B \-o<output-port>
- XDetermines the port that`20
- X\fIxscope\fP will use to connect to X11 (defaults to 0).`20
- XFor X11, this port is automatically biased by 6000.
- X.PP
- X.TP 10
- X.B \-h<host>
- XDetermines the host that \fIxscope\fP will use to find its X11 server.
- X.PP
- X.TP 10
- X.B \-d<display>
- XDefines the display number. The display number is added to the input
- Xand output port to give the actual ports which are used by \fIxscope\fP.
- X.PP
- X.TP 10
- X.B \-q
- XQuiet output mode. Gives only the names of requests, replies, errors, and`2
- V0
- Xevents, but does not indicate contents.
- X.PP
- X.TP 10
- X.B \-v<print-level>
- XDetermines the level of printing which \fIxscope\fP will provide. The
- Xprint-level can be 0 (same as quiet mode), 1, 2, 3, 4. The larger
- Xnumbers give more and more output. For example, a successful setup
- Xreturns a string which is the name of the vendor of the X11 server.
- XAt level 1, the explicit field giving the length of the string is
- Xsuppressed since it can be inferred from the string. At level 2 and
- Xabove the length is explicitly printed.
- X.SH EXAMPLES
- X.LP
- Xxscope -v4 -hcleo -d0 -o0 -i1
- X.PP
- XThis command would have xscope communicate with an X11 server on host
- X`60`60cleo'', display 0; xscope itself would be available on the current
- Xhost as display 1 (display of 0 plus the 1 of -i1). Verbose level 4.
- X.LP
- Xxscope -q -d1 -o1 -o3
- X.PP
- XThe X11 server for the current host, display 2 (1 for -d1 plus 1 for -o1)
- Xwould be used by xscope which would run as display 4 (1 for -d1 plus 3 for
- X-o3). Quite mode (verbose level 0).
- X.SH SEE ALSO
- XX(1), X11 Protocol document (doc/Protocol/X11.protocol)
- X.SH AUTHOR
- X.PP
- XJames L. Peterson (MCC)
- X.PP
- XCopyright 1988, MCC
- X.SH BUGS
- XCode has only been tested on Sun3's.
- $ CALL UNPACK XSCOPE.1;1 1534005916
- $ create 'f'
- X
- X
- X
- XXSCOPE(1) USER COMMANDS XSCOPE(1)
- X
- X
- X
- XNAME
- X xscope - X Window Protocol Viewer
- X
- XSYNOPSIS
- X xscope `5B option `5D ...
- X
- XDESCRIPTION
- X _`08X_`08s_`08c_`08o_`08p_`08e sits in-between an X11 client and an X11
- V server and
- X prints the contents of each request, reply, error, or event
- X that is communicated between them. This information can be
- X useful in debugging and performance tuning of X11 servers
- X and clients.
- X
- X To operate, _`08x_`08s_`08c_`08o_`08p_`08e must know the host, port, an
- Vd display to
- X use to connect to the X11 server. In addition, it must know
- X the port on which it should listen for X11 clients. Two
- X cases are common:
- X
- X (1) The X11 server is on the same host as _`08x_`08s_`08c_`08o_`08p_`08
- Ve.
- X In this case, the input port for _`08x_`08s_`08c_`08o_`08p_`08
- Ve should be
- X selected as an X11 server on a different display, and
- X the client DISPLAY argument adjusted to select _`08x_`08s_`08c_`08
- Vo_`08p_`08e .
- X For example, if the X11 server is on port 6000, display
- X 1, then _`08x_`08s_`08c_`08o_`08p_`08e can use port 6002 as its
- V input port.
- X The client can use display 1 for direct access to X11
- X or display 2 for access to _`08x_`08s_`08c_`08o_`08p_`08e.
- X
- X (2) The X11 server is on a different host than _`08x_`08s_`08c_`08o_`08
- Vp_`08e.
- X In this case the same input and output ports can be
- X used, and the host component of the DISPLAY is used to
- X select _`08x_`08s_`08c_`08o_`08p_`08e or X11.
- X
- XARGUMENTS
- X -i<input-port>
- X Specify the port that _`08x_`08s_`08c_`08o_`08p_`08e will
- V use to take
- X requests from clients (defaults to 1). For X11,
- X this port is automatically biased by 6000.
- X
- X -o<output-port>
- X Determines the port that _`08x_`08s_`08c_`08o_`08p_`08e will
- V use to con-
- X nect to X11 (defaults to 0). For X11, this port is
- X automatically biased by 6000.
- X
- X -h<host> Determines the host that _`08x_`08s_`08c_`08o_`08p_`08e will
- V use to find
- X its X11 server.
- X
- X -d<display>
- X Defines the display number. The display number is
- X added to the input and output port to give the
- X actual ports which are used by _`08x_`08s_`08c_`08o_`08p_`08
- Ve.
- X
- X
- X
- X
- X
- XX Version 11 Last change: 8 Sept 1988 1
- X
- X
- X
- X
- X
- X
- XXSCOPE(1) USER COMMANDS XSCOPE(1)
- X
- X
- X
- X -q Quiet output mode. Gives only the names of
- X requests, replies, errors, and events, but does
- X not indicate contents.
- X
- X -v<print-level>
- X Determines the level of printing which _`08x_`08s_`08c_`08o_`
- V08p_`08e will
- X provide. The print-level can be 0 (same as quiet
- X mode), 1, 2, 3, 4. The larger numbers give more
- X and more output. For example, a successful setup
- X returns a string which is the name of the vendor
- X of the X11 server. At level 1, the explicit field
- X giving the length of the string is suppressed
- X since it can be inferred from the string. At
- X level 2 and above the length is explicitly
- X printed.
- X
- XEXAMPLES
- X xscope -v4 -hcleo -d0 -o0 -i1
- X
- X This command would have xscope communicate with an X11
- X server on host `60`60cleo'', display 0; xscope itself would be
- X available on the current host as display 1 (display of 0
- X plus the 1 of -i1). Verbose level 4.
- X
- X xscope -q -d1 -o1 -o3
- X
- X The X11 server for the current host, display 2 (1 for -d1
- X plus 1 for -o1) would be used by xscope which would run as
- X display 4 (1 for -d1 plus 3 for -o3). Quite mode (verbose
- X level 0).
- X
- XSEE ALSO
- X X(1), X11 Protocol document (doc/Protocol/X11.protocol)
- X
- XAUTHOR
- X James L. Peterson (MCC)
- X
- X Copyright 1988, MCC
- X
- XBUGS
- X Code has only been tested on Sun3's.
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- XX Version 11 Last change: 8 Sept 1988 2
- X
- X
- X
- $ CALL UNPACK XSCOPE.TXT;1 2016376814
- $ v=f$verify(v)
- $ EXIT
- --
- Patrick L. Mahan
-
- --- TGV Window Washer ------------------------------- Mahan@TGV.COM ---------
-
- Waking a person unnecessarily should not be considered - Lazarus Long
- a capital crime. For a first offense, that is From the Notebooks of
- Lazarus Long
-
-