changeset 423:76efe8fa29b9

more debugging looking for duplicate transmission
author Carl Byington <carl@five-ten-sg.com>
date Fri, 31 Oct 2014 08:58:00 -0700
parents 651aff5a46c7
children 09c1d3aae3f0
files src/org/tn5250j/framework/tn5250/Screen5250.java
diffstat 1 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java	Thu Oct 30 16:27:31 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/Screen5250.java	Fri Oct 31 08:58:00 2014 -0700
@@ -3443,8 +3443,42 @@
         fireScreenChanged();
     }
 
+    private int xx_position = 0;
+    private int xx_length   = 0;
+    private char[] xx_pending = new char[2048];
+
+    private void xx_flush() {
+        if (xx_length > 0) {
+            char[] p = new char[xx_length];
+            System.arraycopy(xx_pending, 0, p, xx_length);
+            Log.i(TAG, String.format("row %d col %d %s", getRow(xx_position), getCol(xx_position), new String(p)));
+        }
+        xx_length = 0;
+    }
+
+    private void xx_debug(int cByte) {
+        if (cByte == 0) {
+            xx_flush();
+        }
+        else {
+            if (xx_length == 0) {
+                xx_position = lastPos;
+                xx_pending[xx_length++] = (char)cByte;
+            }
+            else if (lastPos == xx_position + xx_length) {
+                xx_pending[xx_length++] = (char)cByte;
+            }
+            else {
+                xx_flush();
+                xx_position = lastPos;
+                xx_pending[xx_length++] = (char)cByte;
+            }
+        }
+    }
+
     protected void setChar(int cByte) {
-        //if (cByte != 0) Log.i(TAG, String.format("%d %c %d", lastPos, cByte, cByte));
+        xx_debug(cByte);
+
         if (lastPos > 0) {
             lastAttr = planes.getCharAttr(lastPos - 1);
         }