Commit 4cd3b38f02252816c529559818c8e240b036e8a5

Authored by perry.werneck@gmail.com
1 parent 711c4c36

Ajustes para multi-sessão

Showing 4 changed files with 40 additions and 41 deletions   Show diff stats
@@ -357,7 +357,7 @@ unsigned char get_field_attribute(H3270 *h, int baddr) @@ -357,7 +357,7 @@ unsigned char get_field_attribute(H3270 *h, int baddr)
357 * buffer address. Return the attribute in a parameter. 357 * buffer address. Return the attribute in a parameter.
358 * 358 *
359 * Returns True if an attribute is found, False if boundary hit. 359 * Returns True if an attribute is found, False if boundary hit.
360 - */ 360 + */ /*
361 Boolean 361 Boolean
362 get_bounded_field_attribute(register int baddr, register int bound, 362 get_bounded_field_attribute(register int baddr, register int bound,
363 unsigned char *fa_out) 363 unsigned char *fa_out)
@@ -378,25 +378,26 @@ get_bounded_field_attribute(register int baddr, register int bound, @@ -378,25 +378,26 @@ get_bounded_field_attribute(register int baddr, register int bound,
378 DEC_BA(baddr); 378 DEC_BA(baddr);
379 } while (baddr != sbaddr && baddr != bound); 379 } while (baddr != sbaddr && baddr != bound);
380 380
381 - /* Screen is unformatted (and 'formatted' is inaccurate). */ 381 + // Screen is unformatted (and 'formatted' is inaccurate).
382 if (baddr == sbaddr) { 382 if (baddr == sbaddr) {
383 *fa_out = h3270.ea_buf[-1].fa; 383 *fa_out = h3270.ea_buf[-1].fa;
384 return True; 384 return True;
385 } 385 }
386 386
387 - /* Wrapped to boundary. */ 387 + // Wrapped to boundary.
388 return False; 388 return False;
389 -} 389 +} */
390 390
391 /* 391 /*
392 * Given the address of a field attribute, return the address of the 392 * Given the address of a field attribute, return the address of the
393 * extended attribute structure. 393 * extended attribute structure.
394 - */ 394 + */ /*
395 struct ea * 395 struct ea *
396 fa2ea(int baddr) 396 fa2ea(int baddr)
397 { 397 {
398 return &h3270.ea_buf[baddr]; 398 return &h3270.ea_buf[baddr];
399 } 399 }
  400 +*/
400 401
401 /* 402 /*
402 * Find the next unprotected field. Returns the address following the 403 * Find the next unprotected field. Returns the address following the
@@ -507,7 +508,7 @@ process_ds(unsigned char *buf, int buflen) @@ -507,7 +508,7 @@ process_ds(unsigned char *buf, int buflen)
507 case CMD_RB: /* read buffer */ 508 case CMD_RB: /* read buffer */
508 case SNA_CMD_RB: 509 case SNA_CMD_RB:
509 trace_ds("ReadBuffer\n"); 510 trace_ds("ReadBuffer\n");
510 - ctlr_read_buffer(h3270.aid); 511 + ctlr_read_buffer(&h3270,h3270.aid);
511 return PDS_OKAY_OUTPUT; 512 return PDS_OKAY_OUTPUT;
512 break; 513 break;
513 case CMD_RM: /* read modifed */ 514 case CMD_RM: /* read modifed */
@@ -777,8 +778,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) @@ -777,8 +778,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all)
777 * Process a 3270 Read-Buffer command and transmit the data back to the 778 * Process a 3270 Read-Buffer command and transmit the data back to the
778 * host. 779 * host.
779 */ 780 */
780 -void  
781 -ctlr_read_buffer(unsigned char aid_byte) 781 +void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte)
782 { 782 {
783 register int baddr; 783 register int baddr;
784 unsigned char fa; 784 unsigned char fa;
@@ -801,13 +801,13 @@ ctlr_read_buffer(unsigned char aid_byte) @@ -801,13 +801,13 @@ ctlr_read_buffer(unsigned char aid_byte)
801 801
802 space3270out(3); 802 space3270out(3);
803 *obptr++ = aid_byte; 803 *obptr++ = aid_byte;
804 - ENCODE_BADDR(obptr, h3270.cursor_addr);  
805 - trace_ds("%s%s", see_aid(aid_byte), rcba(&h3270,h3270.cursor_addr)); 804 + ENCODE_BADDR(obptr, hSession->cursor_addr);
  805 + trace_ds("%s%s", see_aid(aid_byte), rcba(hSession,hSession->cursor_addr));
806 806
807 baddr = 0; 807 baddr = 0;
808 do { 808 do {
809 - if (h3270.ea_buf[baddr].fa) {  
810 - if (h3270.reply_mode == SF_SRM_FIELD) { 809 + if (hSession->ea_buf[baddr].fa) {
  810 + if (hSession->reply_mode == SF_SRM_FIELD) {
811 space3270out(2); 811 space3270out(2);
812 *obptr++ = ORDER_SF; 812 *obptr++ = ORDER_SF;
813 } else { 813 } else {
@@ -817,41 +817,41 @@ ctlr_read_buffer(unsigned char aid_byte) @@ -817,41 +817,41 @@ ctlr_read_buffer(unsigned char aid_byte)
817 *obptr++ = 1; /* for now */ 817 *obptr++ = 1; /* for now */
818 *obptr++ = XA_3270; 818 *obptr++ = XA_3270;
819 } 819 }
820 - fa = h3270.ea_buf[baddr].fa & ~FA_PRINTABLE; 820 + fa = hSession->ea_buf[baddr].fa & ~FA_PRINTABLE;
821 *obptr++ = code_table[fa]; 821 *obptr++ = code_table[fa];
822 if (any) 822 if (any)
823 trace_ds("'"); 823 trace_ds("'");
824 trace_ds(" StartField%s%s%s", 824 trace_ds(" StartField%s%s%s",
825 - (h3270.reply_mode == SF_SRM_FIELD) ? "" : "Extended",  
826 - rcba(&h3270,baddr), see_attr(fa));  
827 - if (h3270.reply_mode != SF_SRM_FIELD) {  
828 - if (h3270.ea_buf[baddr].fg) { 825 + (hSession->reply_mode == SF_SRM_FIELD) ? "" : "Extended",
  826 + rcba(hSession,baddr), see_attr(fa));
  827 + if (hSession->reply_mode != SF_SRM_FIELD) {
  828 + if (hSession->ea_buf[baddr].fg) {
829 space3270out(2); 829 space3270out(2);
830 *obptr++ = XA_FOREGROUND; 830 *obptr++ = XA_FOREGROUND;
831 - *obptr++ = h3270.ea_buf[baddr].fg;  
832 - trace_ds("%s", see_efa(XA_FOREGROUND, h3270.ea_buf[baddr].fg)); 831 + *obptr++ = hSession->ea_buf[baddr].fg;
  832 + trace_ds("%s", see_efa(XA_FOREGROUND, hSession->ea_buf[baddr].fg));
833 (*(obuf + attr_count))++; 833 (*(obuf + attr_count))++;
834 } 834 }
835 - if (h3270.ea_buf[baddr].bg) { 835 + if (hSession->ea_buf[baddr].bg) {
836 space3270out(2); 836 space3270out(2);
837 *obptr++ = XA_BACKGROUND; 837 *obptr++ = XA_BACKGROUND;
838 - *obptr++ = h3270.ea_buf[baddr].bg;  
839 - trace_ds("%s", see_efa(XA_BACKGROUND, h3270.ea_buf[baddr].bg)); 838 + *obptr++ = hSession->ea_buf[baddr].bg;
  839 + trace_ds("%s", see_efa(XA_BACKGROUND, hSession->ea_buf[baddr].bg));
840 (*(obuf + attr_count))++; 840 (*(obuf + attr_count))++;
841 } 841 }
842 - if (h3270.ea_buf[baddr].gr) { 842 + if (hSession->ea_buf[baddr].gr) {
843 space3270out(2); 843 space3270out(2);
844 *obptr++ = XA_HIGHLIGHTING; 844 *obptr++ = XA_HIGHLIGHTING;
845 - *obptr++ = h3270.ea_buf[baddr].gr | 0xf0; 845 + *obptr++ = hSession->ea_buf[baddr].gr | 0xf0;
846 trace_ds("%s", see_efa(XA_HIGHLIGHTING, 846 trace_ds("%s", see_efa(XA_HIGHLIGHTING,
847 - h3270.ea_buf[baddr].gr | 0xf0)); 847 + hSession->ea_buf[baddr].gr | 0xf0));
848 (*(obuf + attr_count))++; 848 (*(obuf + attr_count))++;
849 } 849 }
850 - if (h3270.ea_buf[baddr].cs & CS_MASK) { 850 + if (hSession->ea_buf[baddr].cs & CS_MASK) {
851 space3270out(2); 851 space3270out(2);
852 *obptr++ = XA_CHARSET; 852 *obptr++ = XA_CHARSET;
853 - *obptr++ = host_cs(h3270.ea_buf[baddr].cs);  
854 - trace_ds("%s", see_efa(XA_CHARSET,host_cs(h3270.ea_buf[baddr].cs))); 853 + *obptr++ = host_cs(hSession->ea_buf[baddr].cs);
  854 + trace_ds("%s", see_efa(XA_CHARSET,host_cs(hSession->ea_buf[baddr].cs)));
855 (*(obuf + attr_count))++; 855 (*(obuf + attr_count))++;
856 } 856 }
857 } 857 }
@@ -863,7 +863,7 @@ ctlr_read_buffer(unsigned char aid_byte) @@ -863,7 +863,7 @@ ctlr_read_buffer(unsigned char aid_byte)
863 &current_gr, 863 &current_gr,
864 &current_cs, 864 &current_cs,
865 &any); 865 &any);
866 - if (h3270.ea_buf[baddr].cs & CS_GE) { 866 + if (hSession->ea_buf[baddr].cs & CS_GE) {
867 space3270out(1); 867 space3270out(1);
868 *obptr++ = ORDER_GE; 868 *obptr++ = ORDER_GE;
869 if (any) 869 if (any)
@@ -872,18 +872,18 @@ ctlr_read_buffer(unsigned char aid_byte) @@ -872,18 +872,18 @@ ctlr_read_buffer(unsigned char aid_byte)
872 any = False; 872 any = False;
873 } 873 }
874 space3270out(1); 874 space3270out(1);
875 - *obptr++ = h3270.ea_buf[baddr].cc;  
876 - if (h3270.ea_buf[baddr].cc <= 0x3f ||  
877 - h3270.ea_buf[baddr].cc == 0xff) { 875 + *obptr++ = hSession->ea_buf[baddr].cc;
  876 + if (hSession->ea_buf[baddr].cc <= 0x3f ||
  877 + hSession->ea_buf[baddr].cc == 0xff) {
878 if (any) 878 if (any)
879 trace_ds("'"); 879 trace_ds("'");
880 880
881 - trace_ds(" %s", see_ebc(h3270.ea_buf[baddr].cc)); 881 + trace_ds(" %s", see_ebc(hSession->ea_buf[baddr].cc));
882 any = False; 882 any = False;
883 } else { 883 } else {
884 if (!any) 884 if (!any)
885 trace_ds(" '"); 885 trace_ds(" '");
886 - trace_ds("%s", see_ebc(h3270.ea_buf[baddr].cc)); 886 + trace_ds("%s", see_ebc(hSession->ea_buf[baddr].cc));
887 any = True; 887 any = True;
888 } 888 }
889 } 889 }
@@ -50,10 +50,10 @@ LIB3270_INTERNAL void ctlr_altbuffer(H3270 *session, int alt); @@ -50,10 +50,10 @@ LIB3270_INTERNAL void ctlr_altbuffer(H3270 *session, int alt);
50 LIB3270_INTERNAL int ctlr_any_data(H3270 *session); 50 LIB3270_INTERNAL int ctlr_any_data(H3270 *session);
51 LIB3270_INTERNAL void ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea); 51 LIB3270_INTERNAL void ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea);
52 // LIB3270_INTERNAL void ctlr_changed(int bstart, int bend); 52 // LIB3270_INTERNAL void ctlr_changed(int bstart, int bend);
53 -LIB3270_INTERNAL void ctlr_clear(H3270 *session, Boolean can_snap); 53 +LIB3270_INTERNAL void ctlr_clear(H3270 *hSession, Boolean can_snap);
54 LIB3270_INTERNAL void ctlr_erase_all_unprotected(H3270 *hSession); 54 LIB3270_INTERNAL void ctlr_erase_all_unprotected(H3270 *hSession);
55 LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask); 55 LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask);
56 -LIB3270_INTERNAL void ctlr_read_buffer(unsigned char aid_byte); 56 +LIB3270_INTERNAL void ctlr_read_buffer(H3270 *session, unsigned char aid_byte);
57 LIB3270_INTERNAL void ctlr_read_modified(unsigned char aid_byte, Boolean all); 57 LIB3270_INTERNAL void ctlr_read_modified(unsigned char aid_byte, Boolean all);
58 LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask); 58 LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask);
59 LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession); 59 LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession);
@@ -63,9 +63,9 @@ LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession); @@ -63,9 +63,9 @@ LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession);
63 LIB3270_INTERNAL void ctlr_wrapping_memmove(H3270 *session, int baddr_to, int baddr_from, int count); 63 LIB3270_INTERNAL void ctlr_wrapping_memmove(H3270 *session, int baddr_to, int baddr_from, int count);
64 LIB3270_INTERNAL enum pds ctlr_write(unsigned char buf[], int buflen, Boolean erase); 64 LIB3270_INTERNAL enum pds ctlr_write(unsigned char buf[], int buflen, Boolean erase);
65 LIB3270_INTERNAL void ctlr_write_sscp_lu(H3270 *session, unsigned char buf[], int buflen); 65 LIB3270_INTERNAL void ctlr_write_sscp_lu(H3270 *session, unsigned char buf[], int buflen);
66 -LIB3270_INTERNAL struct ea *fa2ea(int baddr); 66 +// LIB3270_INTERNAL struct ea *fa2ea(int baddr);
67 67
68 -LIB3270_INTERNAL Boolean get_bounded_field_attribute(register int baddr, register int bound, unsigned char *fa_out); 68 +// LIB3270_INTERNAL Boolean get_bounded_field_attribute(register int baddr, register int bound, unsigned char *fa_out);
69 LIB3270_INTERNAL void mdt_clear(int baddr); 69 LIB3270_INTERNAL void mdt_clear(int baddr);
70 LIB3270_INTERNAL void mdt_set(int baddr); 70 LIB3270_INTERNAL void mdt_set(int baddr);
71 LIB3270_INTERNAL int next_unprotected(H3270 *session, int baddr0); 71 LIB3270_INTERNAL int next_unprotected(H3270 *session, int baddr0);
@@ -369,7 +369,7 @@ sf_read_part(unsigned char buf[], unsigned buflen) @@ -369,7 +369,7 @@ sf_read_part(unsigned char buf[], unsigned buflen)
369 return PDS_BAD_CMD; 369 return PDS_BAD_CMD;
370 } 370 }
371 trace_ds("\n"); 371 trace_ds("\n");
372 - ctlr_read_buffer(AID_QREPLY); 372 + ctlr_read_buffer(&h3270,AID_QREPLY);
373 break; 373 break;
374 case SNA_CMD_RM: 374 case SNA_CMD_RM:
375 trace_ds(" ReadModified"); 375 trace_ds(" ReadModified");
@@ -2514,8 +2514,7 @@ store3270in(unsigned char c) @@ -2514,8 +2514,7 @@ store3270in(unsigned char c)
2514 * Allocates the buffer in BUFSIZ chunks. 2514 * Allocates the buffer in BUFSIZ chunks.
2515 * Allocates hidden space at the front of the buffer for TN3270E. 2515 * Allocates hidden space at the front of the buffer for TN3270E.
2516 */ 2516 */
2517 -void  
2518 -space3270out(int n) 2517 +void space3270out(int n)
2519 { 2518 {
2520 unsigned nc = 0; /* amount of data currently in obuf */ 2519 unsigned nc = 0; /* amount of data currently in obuf */
2521 unsigned more = 0; 2520 unsigned more = 0;