SCCS-vsn: usr.bin/tn3270/ctlr/inbound.c 1.16
SCCS-vsn: usr.bin/tn3270/ctlr/outbound.c 1.20
SCCS-vsn: usr.bin/tn3270/ascii/termin.c 1.10
static unsigned char
ourBuffer[100], /* where we store stuff */
*ourPHead = ourBuffer, /* first character in buffer */
static unsigned char
ourBuffer[100], /* where we store stuff */
*ourPHead = ourBuffer, /* first character in buffer */
- *ourPTail = ourBuffer; /* where next character goes */
+ *ourPTail = ourBuffer, /* where next character goes */
+ *TransPointer = 0; /* For transparent mode data */
static int InControl;
static int WaitingForSynch;
static int InControl;
static int WaitingForSynch;
+void
+TransInput(onoff, mode)
+int mode; /* Which KIND of transparent input */
+int onoff; /* Going in, or coming out */
+{
+ if (onoff) {
+ /* Flush pending input */
+ FlushChar();
+ TransPointer = ourBuffer;
+ } else {
+ }
+}
+
extern int bellwinup;
static state *controlPointer;
extern int bellwinup;
static state *controlPointer;
+ if (TransPointer) {
+ int i;
+
+ if ((count+TransPointer) >= (ourBuffer+sizeof ourBuffer)) {
+ i = ourBuffer+sizeof ourBuffer-TransPointer;
+ } else {
+ i = count;
+ }
+ while (i--) {
+ c = (*buffer)&0x7f;
+ *TransPointer++ = c|0x80;
+ if (c == '\r') {
+ SendTransparent(ourBuffer, TransPointer-ourBuffer);
+ TransPointer = 0; /* Done */
+ break;
+ }
+ }
+ return count;
+ }
+
if (bellwinup) {
BellOff();
}
if (bellwinup) {
BellOff();
}
HadAid = 0; /* killed that buffer */
}
}
HadAid = 0; /* killed that buffer */
}
}
+
+/* Send some transparent data to the host */
+
+void
+SendTransparent(buffer, count)
+char *buffer;
+int count;
+{
+ char stuff[3];
+
+ stuff[0] = AID_NONE_PRINTER;
+ stuff[1] = BufferTo3270_0(count);
+ stuff[2] = BufferTo3270_1(count);
+ DataToNetwork(stuff, sizeof stuff, 0);
+ DataToNetwork(buffer, count, 1);
+}
+
+
/* Try to send some data to host */
void
SendToIBM()
{
#if !defined(PURE3274)
/* Try to send some data to host */
void
SendToIBM()
{
#if !defined(PURE3274)
- if (TransparentClock == OutputClock) {
+ if (TransparentClock >= OutputClock) {
if (HadAid) {
AddChar(AidByte);
HadAid = 0;
if (HadAid) {
AddChar(AidByte);
HadAid = 0;
- /* now, either empty, or haven't seen aid yet */
+ /* now, either empty, or haven't seen aid yet */
+ /*
+ * If we are in transparent (output) mode, do something special
+ * with keystrokes.
+ */
if (TransparentClock == OutputClock) {
if (ctlrfcn == FCN_AID) {
UnLocked = 0;
if (TransparentClock == OutputClock) {
if (ctlrfcn == FCN_AID) {
UnLocked = 0;
init_ctlr()
{
LastWasTerminated = 1;
init_ctlr()
{
LastWasTerminated = 1;
-#if !defined(PURE3274)
- OutputClock = TransparentClock = 0;
-#endif /* !defined(PURE3274) */
init_inbound();
init_oia();
}
init_inbound();
init_oia();
}
+ /*
+ * If this is the start of a new data stream, then look
+ * for an op-code and (possibly) a WCC.
+ */
if (LastWasTerminated) {
if (count < 2) {
if (LastWasTerminated) {
if (count < 2) {
count -= 2; /* strip off command and wcc */
buffer += 2;
count -= 2; /* strip off command and wcc */
buffer += 2;
+ } else {
+#if !defined(PURE3274)
+ if (TransparentClock == OutputClock) {
+ TransOut(buffer, count, -1, control);
+ count = 0;
+ }
+#endif /* !defined(PURE3274) */
}
LastWasTerminated = 0; /* then, reset at end... */
}
LastWasTerminated = 0; /* then, reset at end... */
i = buffer[0];
c = buffer[1];
#if !defined(PURE3274)
i = buffer[0];
c = buffer[1];
#if !defined(PURE3274)
- if (!i && !c) { /* transparent write */
- if (!control) {
- return(origCount-(count+1));
- } else {
- TransparentClock = OutputClock; /* clock next */
- TransOut(buffer+2, count-2); /* output */
- SendToIBM(); /* ack block */
- TransparentClock = OutputClock+1; /* clock next */
- buffer += count;
- count -= count;
- }
+ /* Check for transparent write */
+ if ((i == 0) && ((c == 0) || (c == 1) || (c == 5))) {
+ TransparentClock = OutputClock+1;
+ TransOut(buffer+2, count-2, c, control);
+ buffer += count;
+ count -= count;
break;
}
#endif /* !defined(PURE3274) */
break;
}
#endif /* !defined(PURE3274) */
- OutputClock++; /* time rolls on */
+ OutputClock++; /* time rolls on */
#endif /* !defined(PURE3274) */
#endif /* !defined(PURE3274) */
if (Wcc & WCC_RESTORE) {
#if !defined(PURE3274)
if (TransparentClock != OutputClock) {
if (Wcc & WCC_RESTORE) {
#if !defined(PURE3274)
if (TransparentClock != OutputClock) {
Highest = LowestScreen()-1;
CursorAddress = BufferAddress = SetBufferAddress(0,0);
UnLocked = 1;
Highest = LowestScreen()-1;
CursorAddress = BufferAddress = SetBufferAddress(0,0);
UnLocked = 1;
OutputClock = 1;
TransparentClock = -1;
OutputClock = 1;
TransparentClock = -1;
+#endif /* !defined(PURE3274) */
SetOiaReady3274(&OperatorInformationArea);
}
SetOiaReady3274(&OperatorInformationArea);
}