New directory structure.
[unix-history] / usr / src / usr.bin / tn3270 / ctlr / outbound.c
index c41a686..34798df 100644 (file)
@@ -31,7 +31,7 @@ static        char    sccsid[] = "@(#)outbound.c      3.1  10/29/86";
 #include "hostctlr.h"
 #include "oia.h"
 #include "screen.h"
 #include "hostctlr.h"
 #include "oia.h"
 #include "screen.h"
-#include "ebc_disp.h"
+#include "../api/ebc_disp.h"
 
 #include "../general/globals.h"
 #include "options.ext"
 
 #include "../general/globals.h"
 #include "options.ext"
@@ -82,9 +82,6 @@ void
 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();
 }
@@ -150,7 +147,6 @@ AddHost(position, character)
 int    position;
 char   character;
 {
 int    position;
 char   character;
 {
-#if    defined(SLOWSCREEN)
 #   define     AddHostA(p,c)                                   \
     {                                                          \
        if (IsStartField(p)) {                                  \
 #   define     AddHostA(p,c)                                   \
     {                                                          \
        if (IsStartField(p)) {                                  \
@@ -168,20 +164,6 @@ char       character;
        }                                                       \
        AddHostA(p,c);                                          \
     }  /* end of macro of AddHost */
        }                                                       \
        AddHostA(p,c);                                          \
     }  /* end of macro of AddHost */
-#else  /* defined(SLOWSCREEN) */
-#   define     AddHost(p,c)                                    \
-    {                                                          \
-       if (IsStartField(p)) {                                  \
-           DeleteField(p);                                     \
-           Highest = HighestScreen();                          \
-           Lowest = LowestScreen();                            \
-           SetHost(p, c);                                      \
-       } else {                                                \
-           SetHost(p, c);                                      \
-           SetHighestLowest(p);                                \
-       }                                                       \
-    }  /* end of macro of AddHost */
-#endif /* defined(SLOWSCREEN) */
 
     AddHost(position, character);
 }
 
     AddHost(position, character);
 }
@@ -201,6 +183,10 @@ int        control;                                /* this buffer ended block? */
 
     origCount = count;
 
 
     origCount = count;
 
+    /*
+     * 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) {
@@ -337,6 +323,13 @@ int        control;                                /* this buffer ended block? */
        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... */
 
@@ -371,17 +364,12 @@ int       control;                                /* this buffer ended block? */
                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) */
@@ -490,41 +478,29 @@ int       control;                                /* this buffer ended block? */
        } else {
            /* Data comes in large clumps - take it all */
            i = BufferAddress;
        } else {
            /* Data comes in large clumps - take it all */
            i = BufferAddress;
-#if    !defined(SLOWSCREEN)
-           AddHost(i, ebc_disp[c]);
-#else  /* !defined(SLOWSCREEN) */
            AddHostA(i, ebc_disp[c]);
            SetHighestLowest(i);
            AddHostA(i, ebc_disp[c]);
            SetHighestLowest(i);
-#endif /* !defined(SLOWSCREEN) */
            i = ScreenInc(i);
            c = *buffer;
            while (count && !IsOrder(c)) {
            i = ScreenInc(i);
            c = *buffer;
            while (count && !IsOrder(c)) {
-#if    !defined(SLOWSCREEN)
-               AddHost(i, ebc_disp[c]);
-#else  /* !defined(SLOWSCREEN) */
                AddHostA(i, ebc_disp[c]);
                AddHostA(i, ebc_disp[c]);
-#endif /* !defined(SLOWSCREEN) */
                i = ScreenInc(i);
                i = ScreenInc(i);
-#if    defined(SLOWSCREEN)
                if (i == LowestScreen()) {
                    SetHighestLowest(HighestScreen());
                }
                if (i == LowestScreen()) {
                    SetHighestLowest(HighestScreen());
                }
-#endif /* defined(SLOWSCREEN) */
                count--;
                buffer++;
                c = *buffer;
            }
                count--;
                buffer++;
                c = *buffer;
            }
-#if    defined(SLOWSCREEN)
            SetHighestLowest(i);
            SetHighestLowest(i);
-#endif /* defined(SLOWSCREEN) */
            BufferAddress = i;
        }
     }
     if (count == 0) {
            BufferAddress = i;
        }
     }
     if (count == 0) {
+       if (control) {
 #if    !defined(PURE3274)
 #if    !defined(PURE3274)
-       OutputClock++;          /* time rolls on */
+           OutputClock++;              /* time rolls on */
 #endif /* !defined(PURE3274) */
 #endif /* !defined(PURE3274) */
-       if (control) {
            if (Wcc & WCC_RESTORE) {
 #if    !defined(PURE3274)
                if (TransparentClock != OutputClock) {
            if (Wcc & WCC_RESTORE) {
 #if    !defined(PURE3274)
                if (TransparentClock != OutputClock) {
@@ -536,6 +512,7 @@ int control;                                /* this buffer ended block? */
                UnLocked = 1;
                ResetOiaSystemLocked(&OperatorInformationArea);
                SetOiaModified();
                UnLocked = 1;
                ResetOiaSystemLocked(&OperatorInformationArea);
                SetOiaModified();
+               SetPsModified();
                TerminalIn();
            }
            if (Wcc & WCC_ALARM) {
                TerminalIn();
            }
            if (Wcc & WCC_ALARM) {
@@ -575,6 +552,16 @@ Init3270()
     Highest = LowestScreen()-1;
     CursorAddress = BufferAddress = SetBufferAddress(0,0);
     UnLocked = 1;
     Highest = LowestScreen()-1;
     CursorAddress = BufferAddress = SetBufferAddress(0,0);
     UnLocked = 1;
+#if    !defined(PURE3274)
     OutputClock = 1;
     TransparentClock = -1;
     OutputClock = 1;
     TransparentClock = -1;
+#endif /* !defined(PURE3274) */
+    SetOiaReady3274(&OperatorInformationArea);
+}
+
+
+void
+Stop3270()
+{
+    ResetOiaReady3274(&OperatorInformationArea);
 }
 }