comparison src/org/tn5250j/framework/tn5250/WTDSFParser.java @ 25:5949eb469a79 tn5250

adding tn5250 files, native android logging
author Carl Byington <carl@five-ten-sg.com>
date Tue, 03 Jun 2014 12:10:21 -0700
parents e8d2a24e85c6
children b29b39f386a4
comparison
equal deleted inserted replaced
24:d1c549560aff 25:5949eb469a79
38 38
39 import java.util.ArrayList; 39 import java.util.ArrayList;
40 import java.util.List; 40 import java.util.List;
41 41
42 import org.tn5250j.encoding.ICodePage; 42 import org.tn5250j.encoding.ICodePage;
43 import org.tn5250j.tools.logging.TN5250jLogFactory; 43 import android.util.Log;
44 import org.tn5250j.tools.logging.TN5250jLogger; 44
45 45
46 /** 46 /**
47 * 47 *
48 * Write To Display Structured Field: 48 * Write To Display Structured Field:
49 * 49 *
60 byte[] segment; 60 byte[] segment;
61 int length; 61 int length;
62 boolean error; 62 boolean error;
63 boolean guiStructsExist; 63 boolean guiStructsExist;
64 64
65 private TN5250jLogger log = TN5250jLogFactory.getLogger(this.getClass()); 65
66 66
67 private final List<Window> guiStructs = new ArrayList<Window>(3); 67 private final List<Window> guiStructs = new ArrayList<Window>(3);
68 private final List<ChoiceField> choices = new ArrayList<ChoiceField>(3); 68 private final List<ChoiceField> choices = new ArrayList<ChoiceField>(3);
69 69
70 70
101 byte[] window; 101 byte[] window;
102 int pos; 102 int pos;
103 103
104 Window(byte[] seg, int pos) { 104 Window(byte[] seg, int pos) {
105 105
106 //log.info("window created at " + pos); 106 //Log.i(TAG,"window created at " + pos);
107 window = seg; 107 window = seg;
108 this.pos = pos; 108 this.pos = pos;
109 guiStructsExist = true; 109 guiStructsExist = true;
110 } 110 }
111 111
359 hfBuffer.append(codePage.ebcdic2uni(segment[pos++])); 359 hfBuffer.append(codePage.ebcdic2uni(segment[pos++]));
360 // hfBuffer.append(getASCIIChar(segment[pos++])); 360 // hfBuffer.append(getASCIIChar(segment[pos++]));
361 361
362 } 362 }
363 363
364 log.debug( 364 Log.d(TAG,
365 " orientation " + Integer.toBinaryString(orientation) + 365 " orientation " + Integer.toBinaryString(orientation) +
366 " mAttr " + mAttr + 366 " mAttr " + mAttr +
367 " cAttr " + cAttr + 367 " cAttr " + cAttr +
368 " Header/Footer " + hfBuffer); 368 " Header/Footer " + hfBuffer);
369 screen52.writeWindowTitle(lastPos, 369 screen52.writeWindowTitle(lastPos,
373 mAttr, 373 mAttr,
374 cAttr, 374 cAttr,
375 hfBuffer); 375 hfBuffer);
376 break; 376 break;
377 default: 377 default:
378 log.warn("Invalid Window minor structure"); 378 Log.w(TAG,"Invalid Window minor structure");
379 length = 0; 379 length = 0;
380 done = true; 380 done = true;
381 } 381 }
382 382
383 } 383 }
429 429
430 done = true; 430 done = true;
431 break; 431 break;
432 432
433 case 0x5F: // Remove All GUI Constructs 433 case 0x5F: // Remove All GUI Constructs
434 log.info("remove all gui contructs"); 434 Log.i(TAG,"remove all gui contructs");
435 clearGuiStructs(); 435 clearGuiStructs();
436 guiStructsExist = false; 436 guiStructsExist = false;
437 int len = 4; 437 int len = 4;
438 int d = 0; 438 int d = 0;
439 length -= s; 439 length -= s;
451 // format table after this command 451 // format table after this command
452 screen52.clearTable(); 452 screen52.clearTable();
453 done = true; 453 done = true;
454 break; 454 break;
455 case 0x59: // remove gui window 455 case 0x59: // remove gui window
456 log.info(" remove window at " + screen52.getCurrentPos()); 456 Log.i(TAG," remove window at " + screen52.getCurrentPos());
457 done = true; 457 done = true;
458 break; 458 break;
459 459
460 case 0x60: // Erase/Draw Grid Lines - not supported 460 case 0x60: // Erase/Draw Grid Lines - not supported
461 // do not know what they are 461 // do not know what they are
756 int cancelAID = segment[pos++]; // byte 20 756 int cancelAID = segment[pos++]; // byte 20
757 757
758 int cnt = 0; 758 int cnt = 0;
759 int minLen = 0; 759 int minLen = 0;
760 majLen -= 21; 760 majLen -= 21;
761 log.debug(" row: " + screen52.getCurrentRow() 761 Log.d(TAG," row: " + screen52.getCurrentRow()
762 + " col: " + screen52.getCurrentCol() 762 + " col: " + screen52.getCurrentCol()
763 + " type " + typeSelection 763 + " type " + typeSelection
764 + " gui " + guiDevice 764 + " gui " + guiDevice
765 + " withMnemonic " + Integer.toHexString(withMnemonic & 0xf0) 765 + " withMnemonic " + Integer.toHexString(withMnemonic & 0xf0)
766 + " noMnemonic " + Integer.toHexString(noMnemonic & 0xf0) 766 + " noMnemonic " + Integer.toHexString(noMnemonic & 0xf0)
837 boolean aid = false; 837 boolean aid = false;
838 boolean selected = false; 838 boolean selected = false;
839 839
840 // is in selected state 840 // is in selected state
841 if ((flagCT1 & 0x40) == 0x40) { 841 if ((flagCT1 & 0x40) == 0x40) {
842 log.debug(" selected "); 842 Log.d(TAG," selected ");
843 selected = true; 843 selected = true;
844 } 844 }
845 845
846 //System.out.println(Integer.toBinaryString((flagCT1 & 0xf0))); 846 //System.out.println(Integer.toBinaryString((flagCT1 & 0xf0)));
847 // is mnemonic offset specified 847 // is mnemonic offset specified
848 if ((flagCT1 & 0x08) == 8) { 848 if ((flagCT1 & 0x08) == 8) {
849 log.debug(" mnemOffset " + mnemOffset); 849 Log.d(TAG," mnemOffset " + mnemOffset);
850 mnemOffset = segment[pos++]; 850 mnemOffset = segment[pos++];
851 cnt++; 851 cnt++;
852 } 852 }
853 853
854 // is aid key specified 854 // is aid key specified
855 if ((flagCT1 & 0x04) == 4) { 855 if ((flagCT1 & 0x04) == 4) {
856 856
857 aid = true; 857 aid = true;
858 log.debug(" aidKey " + aid); 858 Log.d(TAG," aidKey " + aid);
859 // cnt++; 859 // cnt++;
860 } 860 }
861 861
862 // is single digit number specified 862 // is single digit number specified
863 if ((flagCT1 & 0x01) == 0x01) { 863 if ((flagCT1 & 0x01) == 0x01) {
864 log.debug(" single digit " ); 864 Log.d(TAG," single digit " );
865 pos++; 865 pos++;
866 cnt++; 866 cnt++;
867 } 867 }
868 868
869 // is double digint number specified 869 // is double digint number specified
870 if ((flagCT1 & 0x02) == 0x02) { 870 if ((flagCT1 & 0x02) == 0x02) {
871 log.debug(" double digit " ); 871 Log.d(TAG," double digit " );
872 872
873 pos++; 873 pos++;
874 cnt++; 874 cnt++;
875 } 875 }
876 876
900 addChoiceField(chcRowStart,chcColStart,chcRow,chcCol,s); 900 addChoiceField(chcRowStart,chcColStart,chcRow,chcCol,s);
901 } 901 }
902 902
903 // screen52.getScreenFields().getCurrentField().setMDT(); 903 // screen52.getScreenFields().getCurrentField().setMDT();
904 904
905 log.debug(s + " selected " + selected); 905 Log.d(TAG,s + " selected " + selected);
906 // chcRowStart; 906 // chcRowStart;
907 //maxColChoice 907 //maxColChoice
908 colCtr++; 908 colCtr++;
909 // rowCtr++; 909 // rowCtr++;
910 if (colCtr >= maxColChoice) { 910 if (colCtr >= maxColChoice) {
936 majLen -= minLen; 936 majLen -= minLen;
937 937
938 } while (majLen > 0); 938 } while (majLen > 0);
939 } 939 }
940 catch (Exception exc) { 940 catch (Exception exc) {
941 log.warn(" defineSelectionField :", exc); 941 Log.w(TAG," defineSelectionField :", exc);
942 exc.printStackTrace(); 942 exc.printStackTrace();
943 } 943 }
944 } 944 }
945 945
946 // negotiating commands 946 // negotiating commands