summaryrefslogtreecommitdiff
path: root/decode11.c
diff options
context:
space:
mode:
Diffstat (limited to 'decode11.c')
-rw-r--r--decode11.c56
1 files changed, 49 insertions, 7 deletions
diff --git a/decode11.c b/decode11.c
index 4a163c1..5cf131a 100644
--- a/decode11.c
+++ b/decode11.c
@@ -23,11 +23,44 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* *
+ * *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ *
* ************************************************************ */
#include "scope.h"
#include "x11.h"
+#ifdef SYSV
+#define bzero(s,l) memset(s, 0, l)
+#define bcopy(s,d,l) memmove(d,s,l)
+#endif
+
/*
There are 4 types of things in X11: requests, replies, errors, and events.
@@ -71,7 +104,7 @@ struct QueueEntry
static struct QueueEntry *FreeQEntries = NULL;
/* ************************************************************ */
-struct QueueEntry *NewQEntry (SequenceNumber, Request, RequestMinor)
+static struct QueueEntry *NewQEntry (SequenceNumber, Request, RequestMinor)
long SequenceNumber;
short Request;
short RequestMinor;
@@ -108,10 +141,11 @@ struct QueueHeader
struct QueueEntry *Tail;
};
-struct QueueHeader ReplyQ[StaticMaxFD];
+static struct QueueHeader ReplyQ[StaticMaxFD];
/* ************************************************************ */
+void
InitReplyQ()
{
short i;
@@ -122,6 +156,7 @@ InitReplyQ()
}
}
+void
FlushReplyQ(fd)
FD fd;
{
@@ -142,7 +177,7 @@ FD fd;
ReplyQ[fd].Tail = NULL;
}
-
+static void
DumpReplyQ(fd)
FD fd;
{
@@ -163,6 +198,7 @@ DumpReplyQ(fd)
/* A reply is expected to the type of request given for the fd associated
with this one */
+static void
SequencedReplyExpected(fd, SequenceNumber, RequestType, RequestMinorType)
FD fd;
long SequenceNumber;
@@ -251,6 +287,7 @@ short CheckReplyTable (fd, SequenceNumber, minorp)
/* A reply is expected to the type of request given for the
sequence number associated with this fd */
+void
ReplyExpected(fd, Request)
FD fd;
short Request;
@@ -270,6 +307,7 @@ ExtendedReplyExpected (fd, Request, RequestMinor)
/* another reply is expected for the same reply as we just had */
/* This is only used with ListFontsWithInfo */
+void
KeepLastReplyExpected()
{
SequencedReplyExpected(Lastfd, LastSequenceNumber, LastReplyType,
@@ -333,6 +371,7 @@ extern unsigned char MITSHMEvent;
extern unsigned char LookForBIGREQFlag;
extern unsigned char BIGREQRequest;
+void
DecodeRequest(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -369,7 +408,7 @@ DecodeRequest(fd, buf, n)
return;
}
- if (Verbose > 3)
+ if (Raw || (Verbose > 3))
DumpItem("Request", fd, buf, n);
if (Request < 0 || 127 < Request) {
#ifdef PEX
@@ -833,6 +872,7 @@ DecodeRequest(fd, buf, n)
/* */
/* ************************************************************ */
+void
DecodeReply(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -851,7 +891,7 @@ DecodeReply(fd, buf, n)
SetIndentLevel(PRINTSERVER);
RBf[0] = Request /* for the PrintField in the Reply procedure */ ;
RBf[1] = RequestMinor;
- if (Verbose > 3)
+ if (Raw || (Verbose > 3))
DumpItem("Reply", fd, buf, n);
#ifdef PEX
if (Request == PEXCode)
@@ -1009,6 +1049,7 @@ DecodeReply(fd, buf, n)
/* */
/* ************************************************************ */
+void
DecodeError(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -1027,7 +1068,7 @@ DecodeError(fd, buf, n)
}
SetIndentLevel(PRINTSERVER);
- if (Verbose > 3)
+ if (Raw || (Verbose > 3))
DumpItem("Error", fd, buf, n);
if (Error == LBXError)
@@ -1104,6 +1145,7 @@ DecodeError(fd, buf, n)
/* */
/* ************************************************************ */
+void
DecodeEvent(fd, buf, n)
FD fd;
unsigned char *buf;
@@ -1119,7 +1161,7 @@ DecodeEvent(fd, buf, n)
}
SetIndentLevel(PRINTSERVER);
- if (Verbose > 3)
+ if (Raw || (Verbose > 3))
DumpItem("Event", fd, buf, n);
/* high-order bit means SendEvent generated */
if (Event & 0x80)