[EMAIL PROTECTED] schrieb:
> Hello guys, 
> 
> sorry to get back to you so lately. But been so busy here. In the 
> meantime, our company has been takenover. So you can imagine.

;-)

> I have checked the changes and those are probably not commited to CVS. I'm 
> including our changes, as I don't have a project setup for TN development 
> against sourceforge. Is anybody willing to verify the changes and commit 
> them? The class changed for STRPCCMD is of course the tnvt.java. The 
> changes have been made against a reference version 0.5.8a. This surely 
> isn't the latest. 

I just had a first look and merged the changes which looked like related
to STRPCCMD - see attached patch. It builds ok but I havn't done any
testing at all, will hopefully find some time later today or tomorrow.

-- 
Christian
Index: src/org/tn5250j/framework/tn5250/tnvt.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/framework/tn5250/tnvt.java,v
retrieving revision 1.18
diff -u -r1.18 tnvt.java
--- src/org/tn5250j/framework/tn5250/tnvt.java	13 Dec 2005 11:53:00 -0000	1.18
+++ src/org/tn5250j/framework/tn5250/tnvt.java	18 Jul 2006 13:32:54 -0000
@@ -90,6 +90,8 @@
 	// WVL - LDC : TR.000300 : Callback scenario from 5250
 	private boolean scan; // = false;
 	private static int STRSCAN = 1;
+    // WVL - LDC : 05/08/2005 : TFX.006253 - support STRPCCMD
+    private boolean strpccmd; // = false;    
 	private String user;
 	private String password;
 	private String library;
@@ -918,7 +920,61 @@
 
 		invited = true;
 	}
-
+    
+   // WVL - LDC : 05/08/2005 : TFX.006253 - Support STRPCCMD
+   private void strpccmd()
+   {
+      try
+      {
+         int str = 11;
+         char c;
+         ScreenPlanes planes = screen52.getPlanes();
+         c = planes.getChar(str);
+         boolean waitFor = !(c == 'a');
+         
+         StringBuffer command = new StringBuffer();
+         for (int i = str+1; i < 132; i++)
+         {
+            c = planes.getChar(i);
+            if (Character.isISOControl(c))
+               c = ' ';
+            command.append(c);
+         }
+         
+         String cmd = command.toString().trim();
+         
+         run(cmd, waitFor);
+      }
+      finally
+      {
+         strpccmd = false;
+         screen52.sendKeys(screen52.MNEMONIC_ENTER);
+      }
+   }
+   
+   // WVL - LDC : 05/08/2005 : TFX.006253 - Support STRPCCMD
+   private void run(String cmd, boolean waitFor)
+   {
+      try
+      {
+         log.debug("RUN cmd = " + cmd);
+         log.debug("RUN wait = " + waitFor);
+         
+         Runtime r = Runtime.getRuntime();
+         Process p = r.exec(cmd);
+         if (waitFor)
+         {
+            int result = p.waitFor();
+            log.debug("RUN result = " + result);
+         }
+      }
+      catch (Throwable t)
+      {
+         log.error(t);
+      }
+   }
+   
+   
 	// WVL - LDC : TR.000300 : Callback scenario from 5250
 	/**
 	 * Activate or deactivate the command scanning behaviour.
@@ -1137,6 +1193,7 @@
 //			}
 
 			try {
+            if (!strpccmd) {            
 				//               SwingUtilities.invokeAndWait(
 				//                  new Runnable () {
 				//                     public void run() {
@@ -1147,6 +1204,9 @@
 				screen52.updateDirty();
 //				controller.validate();
 //				log.debug("update dirty");
+         } else {
+            strpccmd();
+         }
 			} catch (Exception exd) {
 				log.warn(" tnvt.run: " + exd.getMessage());
 				exd.printStackTrace();
@@ -2061,7 +2121,35 @@
 					screen52.addField(attr, fLength, ffw0, ffw1, fcw1, fcw2);
 
 					break;
-
+            // WVL - LDC : 05/08/2005 : TFX.006253 - Support STRPCCMD
+            case -128: //STRPCCMD
+            if (screen52.getCurrentPos() == 82)
+            {
+               log.debug("STRPCCMD got a -128 command at " + screen52.getCurrentPos());
+               StringBuffer value = new StringBuffer();
+               int b;
+               char c;
+               for (int i = 0; i < 9; i++)
+               {
+                  b = bk.getNextByte();
+                  c = ebcdic2uni(b);
+                  value.append(c);
+               }
+               
+               String pco = value.toString();
+               log.debug("STRPCCMD = " + pco);
+               if ("ÜPCO cØ~Ø".equals(value.toString()))
+                  strpccmd = true;
+               
+               // we return in the stream to have all chars
+               // arrive at the screen for later processing
+               for (int i = 0; i < 9; i++)
+                  bk.setPrevByte();
+            }
+            // no break: so every chars arrives
+            // on the screen for later parsing
+            //break;
+            
 				default: // all others must be output to screen
 					log.debug("all others must be output to screen");
 					byte byte0 = bk.getByteOffset(-1);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Tn5250j-general mailing list
Tn5250j-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tn5250j-general

Reply via email to