Commit 711c4c36ba68b81b6f8468ce3617a0c9bc2f7925

Authored by perry.werneck@gmail.com
1 parent 144ad4e8

Ajustes para multi-sessao

@@ -606,7 +606,7 @@ ansi_reset(int ig1 unused, int ig2 unused) @@ -606,7 +606,7 @@ ansi_reset(int ig1 unused, int ig2 unused)
606 held_wrap = False; 606 held_wrap = False;
607 if (!first) { 607 if (!first) {
608 ctlr_altbuffer(&h3270,True); 608 ctlr_altbuffer(&h3270,True);
609 - ctlr_aclear(0, h3270.rows * h3270.cols, 1); 609 + ctlr_aclear(&h3270, 0, h3270.rows * h3270.cols, 1);
610 ctlr_altbuffer(&h3270,False); 610 ctlr_altbuffer(&h3270,False);
611 ctlr_clear(&h3270,False); 611 ctlr_clear(&h3270,False);
612 screen_80(); 612 screen_80();
@@ -634,7 +634,7 @@ ansi_insert_chars(int nn, int ig2 unused) @@ -634,7 +634,7 @@ ansi_insert_chars(int nn, int ig2 unused)
634 ctlr_bcopy(h3270.cursor_addr, h3270.cursor_addr + nn, ns, 1); 634 ctlr_bcopy(h3270.cursor_addr, h3270.cursor_addr + nn, ns, 1);
635 635
636 /* Clear the middle of the line */ 636 /* Clear the middle of the line */
637 - ctlr_aclear(h3270.cursor_addr, nn, 1); 637 + ctlr_aclear(&h3270, h3270.cursor_addr, nn, 1);
638 return DATA; 638 return DATA;
639 } 639 }
640 640
@@ -708,14 +708,14 @@ ansi_erase_in_display(int nn, int ig2 unused) @@ -708,14 +708,14 @@ ansi_erase_in_display(int nn, int ig2 unused)
708 { 708 {
709 switch (nn) { 709 switch (nn) {
710 case 0: /* below */ 710 case 0: /* below */
711 - ctlr_aclear(h3270.cursor_addr, (h3270.rows * h3270.cols) - h3270.cursor_addr, 1); 711 + ctlr_aclear(&h3270, h3270.cursor_addr, (h3270.rows * h3270.cols) - h3270.cursor_addr, 1);
712 break; 712 break;
713 case 1: /* above */ 713 case 1: /* above */
714 - ctlr_aclear(0, h3270.cursor_addr + 1, 1); 714 + ctlr_aclear(&h3270, 0, h3270.cursor_addr + 1, 1);
715 break; 715 break;
716 case 2: /* all (without moving cursor) */ 716 case 2: /* all (without moving cursor) */
717 // if (h3270.cursor_addr == 0 && !h3270.is_altbuffer) scroll_save(h3270.rows, True); 717 // if (h3270.cursor_addr == 0 && !h3270.is_altbuffer) scroll_save(h3270.rows, True);
718 - ctlr_aclear(0, h3270.rows * h3270.cols, 1); 718 + ctlr_aclear(&h3270, 0, h3270.rows * h3270.cols, 1);
719 break; 719 break;
720 } 720 }
721 return DATA; 721 return DATA;
@@ -728,13 +728,13 @@ ansi_erase_in_line(int nn, int ig2 unused) @@ -728,13 +728,13 @@ ansi_erase_in_line(int nn, int ig2 unused)
728 728
729 switch (nn) { 729 switch (nn) {
730 case 0: /* to right */ 730 case 0: /* to right */
731 - ctlr_aclear(h3270.cursor_addr, h3270.cols - nc, 1); 731 + ctlr_aclear(&h3270, h3270.cursor_addr, h3270.cols - nc, 1);
732 break; 732 break;
733 case 1: /* to left */ 733 case 1: /* to left */
734 - ctlr_aclear(h3270.cursor_addr - nc, nc+1, 1); 734 + ctlr_aclear(&h3270, h3270.cursor_addr - nc, nc+1, 1);
735 break; 735 break;
736 case 2: /* all */ 736 case 2: /* all */
737 - ctlr_aclear(h3270.cursor_addr - nc, h3270.cols, 1); 737 + ctlr_aclear(&h3270, h3270.cursor_addr - nc, h3270.cols, 1);
738 break; 738 break;
739 } 739 }
740 return DATA; 740 return DATA;
@@ -762,7 +762,7 @@ ansi_insert_lines(int nn, int ig2 unused) @@ -762,7 +762,7 @@ ansi_insert_lines(int nn, int ig2 unused)
762 ctlr_bcopy(rr * h3270.cols, (rr + nn) * h3270.cols, ns * h3270.cols, 1); 762 ctlr_bcopy(rr * h3270.cols, (rr + nn) * h3270.cols, ns * h3270.cols, 1);
763 763
764 /* Clear the middle of the screen */ 764 /* Clear the middle of the screen */
765 - ctlr_aclear(rr * h3270.cols, nn * h3270.cols, 1); 765 + ctlr_aclear(&h3270, rr * h3270.cols, nn * h3270.cols, 1);
766 return DATA; 766 return DATA;
767 } 767 }
768 768
@@ -788,7 +788,7 @@ ansi_delete_lines(int nn, int ig2 unused) @@ -788,7 +788,7 @@ ansi_delete_lines(int nn, int ig2 unused)
788 ctlr_bcopy((rr + nn) * h3270.cols, rr * h3270.cols, ns * h3270.cols, 1); 788 ctlr_bcopy((rr + nn) * h3270.cols, rr * h3270.cols, ns * h3270.cols, 1);
789 789
790 /* Clear the rest of the screen */ 790 /* Clear the rest of the screen */
791 - ctlr_aclear((rr + ns) * h3270.cols, nn * h3270.cols, 1); 791 + ctlr_aclear(&h3270, (rr + ns) * h3270.cols, nn * h3270.cols, 1);
792 return DATA; 792 return DATA;
793 } 793 }
794 794
@@ -810,7 +810,7 @@ ansi_delete_chars(int nn, int ig2 unused) @@ -810,7 +810,7 @@ ansi_delete_chars(int nn, int ig2 unused)
810 ctlr_bcopy(h3270.cursor_addr + nn, h3270.cursor_addr, ns, 1); 810 ctlr_bcopy(h3270.cursor_addr + nn, h3270.cursor_addr, ns, 1);
811 811
812 /* Clear the end of the line */ 812 /* Clear the end of the line */
813 - ctlr_aclear(h3270.cursor_addr + ns, nn, 1); 813 + ctlr_aclear(&h3270, h3270.cursor_addr + ns, nn, 1);
814 return DATA; 814 return DATA;
815 } 815 }
816 816
@@ -1069,16 +1069,15 @@ ansi_printing(int ig1 unused, int ig2 unused) @@ -1069,16 +1069,15 @@ ansi_printing(int ig1 unused, int ig2 unused)
1069 switch (csd[(once_cset != -1) ? once_cset : cset]) { 1069 switch (csd[(once_cset != -1) ? once_cset : cset]) {
1070 case CSD_LD: /* line drawing "0" */ 1070 case CSD_LD: /* line drawing "0" */
1071 if (ansi_ch >= 0x5f && ansi_ch <= 0x7e) 1071 if (ansi_ch >= 0x5f && ansi_ch <= 0x7e)
1072 - ctlr_add(h3270.cursor_addr, (unsigned char)(ansi_ch - 0x5f),  
1073 - CS_LINEDRAW); 1072 + ctlr_add(&h3270,h3270.cursor_addr, (unsigned char)(ansi_ch - 0x5f),CS_LINEDRAW);
1074 else 1073 else
1075 - ctlr_add(h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE); 1074 + ctlr_add(&h3270,h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE);
1076 break; 1075 break;
1077 case CSD_UK: /* UK "A" */ 1076 case CSD_UK: /* UK "A" */
1078 if (ansi_ch == '#') 1077 if (ansi_ch == '#')
1079 - ctlr_add(h3270.cursor_addr, 0x1e, CS_LINEDRAW); 1078 + ctlr_add(&h3270,h3270.cursor_addr, 0x1e, CS_LINEDRAW);
1080 else 1079 else
1081 - ctlr_add(h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE); 1080 + ctlr_add(&h3270,h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE);
1082 break; 1081 break;
1083 case CSD_US: /* US "B" */ 1082 case CSD_US: /* US "B" */
1084 ebc_ch = asc2ebc[ansi_ch]; 1083 ebc_ch = asc2ebc[ansi_ch];
@@ -1156,7 +1155,7 @@ ansi_printing(int ig1 unused, int ig2 unused) @@ -1156,7 +1155,7 @@ ansi_printing(int ig1 unused, int ig2 unused)
1156 ea_buf[cursor_addr].db = DBCS_NONE; 1155 ea_buf[cursor_addr].db = DBCS_NONE;
1157 } 1156 }
1158 #endif /*]*/ 1157 #endif /*]*/
1159 - ctlr_add(h3270.cursor_addr, ebc_ch, default_cs); 1158 + ctlr_add(&h3270,h3270.cursor_addr, ebc_ch, default_cs);
1160 #if defined(X3270_DBCS) /*[*/ 1159 #if defined(X3270_DBCS) /*[*/
1161 if (default_cs == CS_DBCS) 1160 if (default_cs == CS_DBCS)
1162 (void) ctlr_dbcs_postprocess(); 1161 (void) ctlr_dbcs_postprocess();
@@ -1164,9 +1163,9 @@ ansi_printing(int ig1 unused, int ig2 unused) @@ -1164,9 +1163,9 @@ ansi_printing(int ig1 unused, int ig2 unused)
1164 break; 1163 break;
1165 } 1164 }
1166 once_cset = -1; 1165 once_cset = -1;
1167 - ctlr_add_gr(h3270.cursor_addr, gr);  
1168 - ctlr_add_fg(h3270.cursor_addr, fg);  
1169 - ctlr_add_bg(h3270.cursor_addr, bg); 1166 + ctlr_add_gr(&h3270,h3270.cursor_addr, gr);
  1167 + ctlr_add_fg(&h3270,h3270.cursor_addr, fg);
  1168 + ctlr_add_bg(&h3270,h3270.cursor_addr, bg);
1170 if (wraparound_mode) { 1169 if (wraparound_mode) {
1171 /* 1170 /*
1172 * There is a fascinating behavior of xterm which we will 1171 * There is a fascinating behavior of xterm which we will
@@ -1588,40 +1587,43 @@ xterm_text(int ig1 unused, int ig2 unused) @@ -1588,40 +1587,43 @@ xterm_text(int ig1 unused, int ig2 unused)
1588 static enum state 1587 static enum state
1589 xterm_text_do(int ig1 unused, int ig2 unused) 1588 xterm_text_do(int ig1 unused, int ig2 unused)
1590 { 1589 {
1591 -#if defined(X3270_DISPLAY) || defined(WC3270) /*[*/ 1590 +/*
  1591 +#if defined(X3270_DISPLAY) || defined(WC3270)
1592 text[tx] = '\0'; 1592 text[tx] = '\0';
1593 -#endif /*]*/ 1593 +#endif
1594 1594
1595 -#if defined(X3270_DISPLAY) /*[*/ 1595 +#if defined(X3270_DISPLAY)
1596 switch (n[0]) { 1596 switch (n[0]) {
1597 - case 0: /* icon name and window title */ 1597 + case 0: // icon name and window title
1598 XtVaSetValues(toplevel, XtNiconName, text, NULL); 1598 XtVaSetValues(toplevel, XtNiconName, text, NULL);
1599 XtVaSetValues(toplevel, XtNtitle, text, NULL); 1599 XtVaSetValues(toplevel, XtNtitle, text, NULL);
1600 break; 1600 break;
1601 - case 1: /* icon name */ 1601 + case 1: // icon name
1602 XtVaSetValues(toplevel, XtNiconName, text, NULL); 1602 XtVaSetValues(toplevel, XtNiconName, text, NULL);
1603 break; 1603 break;
1604 - case 2: /* window_title */ 1604 + case 2: // window_title
1605 XtVaSetValues(toplevel, XtNtitle, text, NULL); 1605 XtVaSetValues(toplevel, XtNtitle, text, NULL);
1606 break; 1606 break;
1607 - case 50: /* font */ 1607 + case 50: // font
1608 screen_newfont(text, False, False); 1608 screen_newfont(text, False, False);
1609 break; 1609 break;
1610 default: 1610 default:
1611 break; 1611 break;
1612 } 1612 }
1613 -#endif /*]*/ 1613 +#endif
1614 1614
1615 -#if defined(WC3270) /*[*/ 1615 +
  1616 +#if defined(WC3270)
1616 switch (n[0]) { 1617 switch (n[0]) {
1617 - case 0: /* icon name and window title */  
1618 - case 2: /* window_title */ 1618 + case 0: // icon name and window title
  1619 + case 2: // window_title
1619 screen_title(text); 1620 screen_title(text);
1620 break; 1621 break;
1621 default: 1622 default:
1622 break; 1623 break;
1623 } 1624 }
1624 -#endif /*]*/ 1625 +#endif
  1626 +*/
1625 1627
1626 return DATA; 1628 return DATA;
1627 } 1629 }
@@ -1678,7 +1680,7 @@ ansi_scroll(void) @@ -1678,7 +1680,7 @@ ansi_scroll(void)
1678 1); 1680 1);
1679 1681
1680 /* Clear the last line */ 1682 /* Clear the last line */
1681 - ctlr_aclear((scroll_bottom - 1) * h3270.cols, h3270.cols, 1); 1683 + ctlr_aclear(&h3270, (scroll_bottom - 1) * h3270.cols, h3270.cols, 1);
1682 } 1684 }
1683 1685
1684 /* Callback for when we enter ANSI mode. */ 1686 /* Callback for when we enter ANSI mode. */
@@ -73,7 +73,7 @@ static void ctlr_blanks(H3270 *session); @@ -73,7 +73,7 @@ static void ctlr_blanks(H3270 *session);
73 static void ctlr_half_connect(H3270 *session, int ignored, void *dunno); 73 static void ctlr_half_connect(H3270 *session, int ignored, void *dunno);
74 static void ctlr_connect(H3270 *session, int ignored, void *dunno); 74 static void ctlr_connect(H3270 *session, int ignored, void *dunno);
75 static void ticking_stop(H3270 *session); 75 static void ticking_stop(H3270 *session);
76 -static void ctlr_add_ic(int baddr, unsigned char ic); 76 +static void ctlr_add_ic(H3270 *session, int baddr, unsigned char ic);
77 77
78 /* 78 /*
79 * code_table is used to translate buffer addresses and attributes to the 3270 79 * code_table is used to translate buffer addresses and attributes to the 3270
@@ -478,7 +478,7 @@ process_ds(unsigned char *buf, int buflen) @@ -478,7 +478,7 @@ process_ds(unsigned char *buf, int buflen)
478 case CMD_EAU: /* erase all unprotected */ 478 case CMD_EAU: /* erase all unprotected */
479 case SNA_CMD_EAU: 479 case SNA_CMD_EAU:
480 trace_ds("EraseAllUnprotected\n"); 480 trace_ds("EraseAllUnprotected\n");
481 - ctlr_erase_all_unprotected(); 481 + ctlr_erase_all_unprotected(&h3270);
482 return PDS_OKAY_NO_OUTPUT; 482 return PDS_OKAY_NO_OUTPUT;
483 break; 483 break;
484 case CMD_EWA: /* erase/write alternate */ 484 case CMD_EWA: /* erase/write alternate */
@@ -899,7 +899,7 @@ ctlr_read_buffer(unsigned char aid_byte) @@ -899,7 +899,7 @@ ctlr_read_buffer(unsigned char aid_byte)
899 #if defined(X3270_TRACE) /*[*/ 899 #if defined(X3270_TRACE) /*[*/
900 /* 900 /*
901 * Construct a 3270 command to reproduce the current state of the display. 901 * Construct a 3270 command to reproduce the current state of the display.
902 - */ 902 + */ /*
903 void 903 void
904 ctlr_snap_buffer(void) 904 ctlr_snap_buffer(void)
905 { 905 {
@@ -920,7 +920,7 @@ ctlr_snap_buffer(void) @@ -920,7 +920,7 @@ ctlr_snap_buffer(void)
920 space3270out(4); 920 space3270out(4);
921 *obptr++ = ORDER_SFE; 921 *obptr++ = ORDER_SFE;
922 attr_count = obptr - obuf; 922 attr_count = obptr - obuf;
923 - *obptr++ = 1; /* for now */ 923 + *obptr++ = 1; // for now
924 *obptr++ = XA_3270; 924 *obptr++ = XA_3270;
925 *obptr++ = code_table[h3270.ea_buf[baddr].fa & ~FA_PRINTABLE]; 925 *obptr++ = code_table[h3270.ea_buf[baddr].fa & ~FA_PRINTABLE];
926 if (h3270.ea_buf[baddr].fg) { 926 if (h3270.ea_buf[baddr].fg) {
@@ -998,12 +998,12 @@ ctlr_snap_buffer(void) @@ -998,12 +998,12 @@ ctlr_snap_buffer(void)
998 *obptr++ = ORDER_SBA; 998 *obptr++ = ORDER_SBA;
999 ENCODE_BADDR(obptr, h3270.cursor_addr); 999 ENCODE_BADDR(obptr, h3270.cursor_addr);
1000 *obptr++ = ORDER_IC; 1000 *obptr++ = ORDER_IC;
1001 -} 1001 +} */
1002 1002
1003 /* 1003 /*
1004 * Construct a 3270 command to reproduce the reply mode. 1004 * Construct a 3270 command to reproduce the reply mode.
1005 * Returns a Boolean indicating if one is necessary. 1005 * Returns a Boolean indicating if one is necessary.
1006 - */ 1006 + */ /*
1007 Boolean 1007 Boolean
1008 ctlr_snap_modes(void) 1008 ctlr_snap_modes(void)
1009 { 1009 {
@@ -1014,70 +1014,69 @@ ctlr_snap_modes(void) @@ -1014,70 +1014,69 @@ ctlr_snap_modes(void)
1014 1014
1015 space3270out(6 + h3270.crm_nattr); 1015 space3270out(6 + h3270.crm_nattr);
1016 *obptr++ = CMD_WSF; 1016 *obptr++ = CMD_WSF;
1017 - *obptr++ = 0x00; /* implicit length */ 1017 + *obptr++ = 0x00; // implicit length
1018 *obptr++ = 0x00; 1018 *obptr++ = 0x00;
1019 *obptr++ = SF_SET_REPLY_MODE; 1019 *obptr++ = SF_SET_REPLY_MODE;
1020 - *obptr++ = 0x00; /* partition 0 */ 1020 + *obptr++ = 0x00; // partition 0
1021 *obptr++ = h3270.reply_mode; 1021 *obptr++ = h3270.reply_mode;
1022 if (h3270.reply_mode == SF_SRM_CHAR) 1022 if (h3270.reply_mode == SF_SRM_CHAR)
1023 for (i = 0; i < h3270.crm_nattr; i++) 1023 for (i = 0; i < h3270.crm_nattr; i++)
1024 *obptr++ = h3270.crm_attr[i]; 1024 *obptr++ = h3270.crm_attr[i];
1025 return True; 1025 return True;
1026 -}  
1027 -#endif /*]*/ 1026 +} */
  1027 +#endif
1028 1028
1029 1029
1030 /* 1030 /*
1031 * Process a 3270 Erase All Unprotected command. 1031 * Process a 3270 Erase All Unprotected command.
1032 */ 1032 */
1033 -void  
1034 -ctlr_erase_all_unprotected(void) 1033 +void ctlr_erase_all_unprotected(H3270 *hSession)
1035 { 1034 {
1036 register int baddr, sbaddr; 1035 register int baddr, sbaddr;
1037 unsigned char fa; 1036 unsigned char fa;
1038 Boolean f; 1037 Boolean f;
1039 1038
1040 - kybd_inhibit(&h3270,False); 1039 + kybd_inhibit(hSession,False);
1041 1040
1042 - if (h3270.formatted) { 1041 + if (hSession->formatted) {
1043 /* find first field attribute */ 1042 /* find first field attribute */
1044 baddr = 0; 1043 baddr = 0;
1045 do { 1044 do {
1046 - if (h3270.ea_buf[baddr].fa) 1045 + if (hSession->ea_buf[baddr].fa)
1047 break; 1046 break;
1048 INC_BA(baddr); 1047 INC_BA(baddr);
1049 } while (baddr != 0); 1048 } while (baddr != 0);
1050 sbaddr = baddr; 1049 sbaddr = baddr;
1051 f = False; 1050 f = False;
1052 do { 1051 do {
1053 - fa = h3270.ea_buf[baddr].fa; 1052 + fa = hSession->ea_buf[baddr].fa;
1054 if (!FA_IS_PROTECTED(fa)) { 1053 if (!FA_IS_PROTECTED(fa)) {
1055 mdt_clear(baddr); 1054 mdt_clear(baddr);
1056 do { 1055 do {
1057 INC_BA(baddr); 1056 INC_BA(baddr);
1058 if (!f) { 1057 if (!f) {
1059 - cursor_move(&h3270,baddr); 1058 + cursor_move(hSession,baddr);
1060 f = True; 1059 f = True;
1061 } 1060 }
1062 - if (!h3270.ea_buf[baddr].fa) {  
1063 - ctlr_add(baddr, EBC_null, 0); 1061 + if (!hSession->ea_buf[baddr].fa) {
  1062 + ctlr_add(hSession,baddr, EBC_null, 0);
1064 } 1063 }
1065 - } while (!h3270.ea_buf[baddr].fa); 1064 + } while (!hSession->ea_buf[baddr].fa);
1066 } 1065 }
1067 else { 1066 else {
1068 do { 1067 do {
1069 INC_BA(baddr); 1068 INC_BA(baddr);
1070 - } while (!h3270.ea_buf[baddr].fa); 1069 + } while (!hSession->ea_buf[baddr].fa);
1071 } 1070 }
1072 } while (baddr != sbaddr); 1071 } while (baddr != sbaddr);
1073 if (!f) 1072 if (!f)
1074 - cursor_move(&h3270,0); 1073 + cursor_move(hSession,0);
1075 } else { 1074 } else {
1076 - ctlr_clear(&h3270,True); 1075 + ctlr_clear(hSession,True);
1077 } 1076 }
1078 - h3270.aid = AID_NO;  
1079 - do_reset(&h3270,False);  
1080 - ALL_CHANGED(&h3270); 1077 + hSession->aid = AID_NO;
  1078 + do_reset(hSession,False);
  1079 + ALL_CHANGED(hSession);
1081 } 1080 }
1082 1081
1083 1082
@@ -1122,12 +1121,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1122,12 +1121,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1122 /* XXX: Should there be a ctlr_add_cs call here? */ 1121 /* XXX: Should there be a ctlr_add_cs call here? */
1123 #define START_FIELD(fa) { \ 1122 #define START_FIELD(fa) { \
1124 current_fa = fa; \ 1123 current_fa = fa; \
1125 - ctlr_add_fa(h3270.buffer_addr, fa, 0); \  
1126 - ctlr_add_cs(h3270.buffer_addr, 0); \  
1127 - ctlr_add_fg(h3270.buffer_addr, 0); \  
1128 - ctlr_add_bg(h3270.buffer_addr, 0); \  
1129 - ctlr_add_gr(h3270.buffer_addr, 0); \  
1130 - ctlr_add_ic(h3270.buffer_addr, 0); \ 1124 + ctlr_add_fa(&h3270,h3270.buffer_addr, fa, 0); \
  1125 + ctlr_add_cs(&h3270,h3270.buffer_addr, 0); \
  1126 + ctlr_add_fg(&h3270,h3270.buffer_addr, 0); \
  1127 + ctlr_add_bg(&h3270,h3270.buffer_addr, 0); \
  1128 + ctlr_add_gr(&h3270,h3270.buffer_addr, 0); \
  1129 + ctlr_add_ic(&h3270,h3270.buffer_addr, 0); \
1131 trace_ds("%s",see_attr(fa)); \ 1130 trace_ds("%s",see_attr(fa)); \
1132 h3270.formatted = True; \ 1131 h3270.formatted = True; \
1133 } 1132 }
@@ -1203,8 +1202,8 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1203,8 +1202,8 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1203 previous = ORDER; 1202 previous = ORDER;
1204 cp++; /* skip field attribute */ 1203 cp++; /* skip field attribute */
1205 START_FIELD(*cp); 1204 START_FIELD(*cp);
1206 - ctlr_add_fg(h3270.buffer_addr, 0);  
1207 - ctlr_add_bg(h3270.buffer_addr, 0); 1205 + ctlr_add_fg(&h3270,h3270.buffer_addr, 0);
  1206 + ctlr_add_bg(&h3270,h3270.buffer_addr, 0);
1208 INC_BA(h3270.buffer_addr); 1207 INC_BA(h3270.buffer_addr);
1209 last_cmd = True; 1208 last_cmd = True;
1210 last_zpt = False; 1209 last_zpt = False;
@@ -1265,12 +1264,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1265,12 +1264,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1265 trace_ds("(nulling)"); 1264 trace_ds("(nulling)");
1266 while ((h3270.buffer_addr != baddr) && 1265 while ((h3270.buffer_addr != baddr) &&
1267 (!h3270.ea_buf[h3270.buffer_addr].fa)) { 1266 (!h3270.ea_buf[h3270.buffer_addr].fa)) {
1268 - ctlr_add(h3270.buffer_addr, EBC_null, 0);  
1269 - ctlr_add_cs(h3270.buffer_addr, 0);  
1270 - ctlr_add_fg(h3270.buffer_addr, 0);  
1271 - ctlr_add_bg(h3270.buffer_addr, 0);  
1272 - ctlr_add_gr(h3270.buffer_addr, 0);  
1273 - ctlr_add_ic(h3270.buffer_addr, 0); 1267 + ctlr_add(&h3270,h3270.buffer_addr, EBC_null, 0);
  1268 + ctlr_add_cs(&h3270,h3270.buffer_addr, 0);
  1269 + ctlr_add_fg(&h3270,h3270.buffer_addr, 0);
  1270 + ctlr_add_bg(&h3270,h3270.buffer_addr, 0);
  1271 + ctlr_add_gr(&h3270,h3270.buffer_addr, 0);
  1272 + ctlr_add_ic(&h3270,h3270.buffer_addr, 0);
1274 INC_BA(h3270.buffer_addr); 1273 INC_BA(h3270.buffer_addr);
1275 } 1274 }
1276 if (baddr == 0) 1275 if (baddr == 0)
@@ -1352,25 +1351,25 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1352,25 +1351,25 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1352 } 1351 }
1353 do { 1352 do {
1354 if (add_dbcs) { 1353 if (add_dbcs) {
1355 - ctlr_add(h3270.buffer_addr, add_c1,h3270.default_cs); 1354 + ctlr_add(&h3270,h3270.buffer_addr, add_c1,h3270.default_cs);
1356 } else { 1355 } else {
1357 if (ra_ge) 1356 if (ra_ge)
1358 - ctlr_add(h3270.buffer_addr, add_c1,CS_GE); 1357 + ctlr_add(&h3270,h3270.buffer_addr, add_c1,CS_GE);
1359 else if (h3270.default_cs) 1358 else if (h3270.default_cs)
1360 - ctlr_add(h3270.buffer_addr, add_c1,h3270.default_cs); 1359 + ctlr_add(&h3270,h3270.buffer_addr, add_c1,h3270.default_cs);
1361 else 1360 else
1362 - ctlr_add(h3270.buffer_addr, add_c1,0); 1361 + ctlr_add(&h3270,h3270.buffer_addr, add_c1,0);
1363 } 1362 }
1364 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1365 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1366 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1363 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1364 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1365 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1367 INC_BA(h3270.buffer_addr); 1366 INC_BA(h3270.buffer_addr);
1368 if (add_dbcs) { 1367 if (add_dbcs) {
1369 - ctlr_add(h3270.buffer_addr, add_c2,h3270.default_cs);  
1370 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1371 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1372 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1373 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1368 + ctlr_add(&h3270,h3270.buffer_addr, add_c2,h3270.default_cs);
  1369 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1370 + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
  1371 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1372 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1374 INC_BA(h3270.buffer_addr); 1373 INC_BA(h3270.buffer_addr);
1375 } 1374 }
1376 } while (h3270.buffer_addr != baddr); 1375 } while (h3270.buffer_addr != baddr);
@@ -1400,7 +1399,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1400,7 +1399,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1400 if (h3270.ea_buf[h3270.buffer_addr].fa) 1399 if (h3270.ea_buf[h3270.buffer_addr].fa)
1401 current_fa = h3270.ea_buf[h3270.buffer_addr].fa; 1400 current_fa = h3270.ea_buf[h3270.buffer_addr].fa;
1402 else if (!FA_IS_PROTECTED(current_fa)) { 1401 else if (!FA_IS_PROTECTED(current_fa)) {
1403 - ctlr_add(h3270.buffer_addr, EBC_null, 1402 + ctlr_add(&h3270,h3270.buffer_addr, EBC_null,
1404 CS_BASE); 1403 CS_BASE);
1405 } 1404 }
1406 INC_BA(h3270.buffer_addr); 1405 INC_BA(h3270.buffer_addr);
@@ -1419,11 +1418,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1419,11 +1418,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1419 trace_ds("%s", see_ebc(*cp)); 1418 trace_ds("%s", see_ebc(*cp));
1420 if (*cp) 1419 if (*cp)
1421 trace_ds("'"); 1420 trace_ds("'");
1422 - ctlr_add(h3270.buffer_addr, *cp, CS_GE);  
1423 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1424 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1425 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1426 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1421 + ctlr_add(&h3270,h3270.buffer_addr, *cp, CS_GE);
  1422 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1423 + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
  1424 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1425 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1427 INC_BA(h3270.buffer_addr); 1426 INC_BA(h3270.buffer_addr);
1428 current_fa = get_field_attribute(&h3270,h3270.buffer_addr); 1427 current_fa = get_field_attribute(&h3270,h3270.buffer_addr);
1429 last_cmd = False; 1428 last_cmd = False;
@@ -1442,7 +1441,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1442,7 +1441,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1442 if (*cp == XA_3270) { 1441 if (*cp == XA_3270) {
1443 trace_ds(" 3270"); 1442 trace_ds(" 3270");
1444 cp++; 1443 cp++;
1445 - ctlr_add_fa(h3270.buffer_addr, *cp, 1444 + ctlr_add_fa(&h3270,h3270.buffer_addr, *cp,
1446 h3270.ea_buf[h3270.buffer_addr].cs); 1445 h3270.ea_buf[h3270.buffer_addr].cs);
1447 trace_ds("%s",see_attr(*cp)); 1446 trace_ds("%s",see_attr(*cp));
1448 } else if (*cp == XA_FOREGROUND) { 1447 } else if (*cp == XA_FOREGROUND) {
@@ -1451,20 +1450,20 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1451,20 +1450,20 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1451 *(cp + 1))); 1450 *(cp + 1)));
1452 cp++; 1451 cp++;
1453 if (h3270.m3279) 1452 if (h3270.m3279)
1454 - ctlr_add_fg(h3270.buffer_addr, *cp); 1453 + ctlr_add_fg(&h3270,h3270.buffer_addr, *cp);
1455 } else if (*cp == XA_BACKGROUND) { 1454 } else if (*cp == XA_BACKGROUND) {
1456 trace_ds("%s", 1455 trace_ds("%s",
1457 see_efa(*cp, 1456 see_efa(*cp,
1458 *(cp + 1))); 1457 *(cp + 1)));
1459 cp++; 1458 cp++;
1460 if (h3270.m3279) 1459 if (h3270.m3279)
1461 - ctlr_add_bg(h3270.buffer_addr, *cp); 1460 + ctlr_add_bg(&h3270,h3270.buffer_addr, *cp);
1462 } else if (*cp == XA_HIGHLIGHTING) { 1461 } else if (*cp == XA_HIGHLIGHTING) {
1463 trace_ds("%s", 1462 trace_ds("%s",
1464 see_efa(*cp, 1463 see_efa(*cp,
1465 *(cp + 1))); 1464 *(cp + 1)));
1466 cp++; 1465 cp++;
1467 - ctlr_add_gr(h3270.buffer_addr, *cp & 0x0f); 1466 + ctlr_add_gr(&h3270,h3270.buffer_addr, *cp & 0x0f);
1468 } else if (*cp == XA_CHARSET) { 1467 } else if (*cp == XA_CHARSET) {
1469 int cs = 0; 1468 int cs = 0;
1470 1469
@@ -1476,7 +1475,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1476,7 +1475,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1476 cs = CS_APL; 1475 cs = CS_APL;
1477 else if (*cp == 0xf8) 1476 else if (*cp == 0xf8)
1478 cs = CS_DBCS; 1477 cs = CS_DBCS;
1479 - ctlr_add_cs(h3270.buffer_addr, cs); 1478 + ctlr_add_cs(&h3270,h3270.buffer_addr, cs);
1480 } else if (*cp == XA_ALL) { 1479 } else if (*cp == XA_ALL) {
1481 trace_ds("%s", 1480 trace_ds("%s",
1482 see_efa(*cp, 1481 see_efa(*cp,
@@ -1486,7 +1485,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1486,7 +1485,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1486 trace_ds("%s", 1485 trace_ds("%s",
1487 see_efa(*cp, 1486 see_efa(*cp,
1488 *(cp + 1))); 1487 *(cp + 1)));
1489 - ctlr_add_ic(h3270.buffer_addr, 1488 + ctlr_add_ic(&h3270,h3270.buffer_addr,
1490 (*(cp + 1) == 1)); 1489 (*(cp + 1) == 1));
1491 cp++; 1490 cp++;
1492 } else { 1491 } else {
@@ -1558,11 +1557,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1558,11 +1557,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1558 } 1557 }
1559 if (!any_fa) 1558 if (!any_fa)
1560 START_FIELD(0); 1559 START_FIELD(0);
1561 - ctlr_add_cs(h3270.buffer_addr, efa_cs);  
1562 - ctlr_add_fg(h3270.buffer_addr, efa_fg);  
1563 - ctlr_add_bg(h3270.buffer_addr, efa_bg);  
1564 - ctlr_add_gr(h3270.buffer_addr, efa_gr);  
1565 - ctlr_add_ic(h3270.buffer_addr, efa_ic); 1560 + ctlr_add_cs(&h3270,h3270.buffer_addr, efa_cs);
  1561 + ctlr_add_fg(&h3270,h3270.buffer_addr, efa_fg);
  1562 + ctlr_add_bg(&h3270,h3270.buffer_addr, efa_bg);
  1563 + ctlr_add_gr(&h3270,h3270.buffer_addr, efa_gr);
  1564 + ctlr_add_ic(&h3270,h3270.buffer_addr, efa_ic);
1566 INC_BA(h3270.buffer_addr); 1565 INC_BA(h3270.buffer_addr);
1567 last_cmd = True; 1566 last_cmd = True;
1568 last_zpt = False; 1567 last_zpt = False;
@@ -1629,11 +1628,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1629,11 +1628,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1629 if (h3270.default_cs == CS_DBCS || d != DBCS_NONE) { 1628 if (h3270.default_cs == CS_DBCS || d != DBCS_NONE) {
1630 ABORT_WRITE("invalid format control order in DBCS field"); 1629 ABORT_WRITE("invalid format control order in DBCS field");
1631 } 1630 }
1632 - ctlr_add(h3270.buffer_addr, *cp, h3270.default_cs);  
1633 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1634 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1635 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1636 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1631 + ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs);
  1632 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1633 + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
  1634 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1635 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1637 INC_BA(h3270.buffer_addr); 1636 INC_BA(h3270.buffer_addr);
1638 last_cmd = True; 1637 last_cmd = True;
1639 last_zpt = False; 1638 last_zpt = False;
@@ -1653,11 +1652,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1653,11 +1652,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1653 } 1652 }
1654 /* All is well. */ 1653 /* All is well. */
1655 previous = ORDER; 1654 previous = ORDER;
1656 - ctlr_add(h3270.buffer_addr, *cp, h3270.default_cs);  
1657 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1658 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1659 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1660 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1655 + ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs);
  1656 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1657 + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
  1658 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1659 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1661 INC_BA(h3270.buffer_addr); 1660 INC_BA(h3270.buffer_addr);
1662 last_cmd = True; 1661 last_cmd = True;
1663 last_zpt = False; 1662 last_zpt = False;
@@ -1692,11 +1691,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1692,11 +1691,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1692 } 1691 }
1693 /* All is well. */ 1692 /* All is well. */
1694 previous = ORDER; 1693 previous = ORDER;
1695 - ctlr_add(h3270.buffer_addr, *cp, h3270.default_cs);  
1696 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1697 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1698 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1699 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1694 + ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs);
  1695 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1696 + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
  1697 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1698 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1700 INC_BA(h3270.buffer_addr); 1699 INC_BA(h3270.buffer_addr);
1701 last_cmd = True; 1700 last_cmd = True;
1702 last_zpt = False; 1701 last_zpt = False;
@@ -1745,18 +1744,18 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1745,18 +1744,18 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1745 END_TEXT("NULL"); 1744 END_TEXT("NULL");
1746 add_c1 = *cp; 1745 add_c1 = *cp;
1747 } 1746 }
1748 - ctlr_add(h3270.buffer_addr, add_c1, h3270.default_cs);  
1749 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1750 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1751 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1752 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1747 + ctlr_add(&h3270,h3270.buffer_addr, add_c1, h3270.default_cs);
  1748 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1749 + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
  1750 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1751 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1753 INC_BA(h3270.buffer_addr); 1752 INC_BA(h3270.buffer_addr);
1754 if (add_dbcs) { 1753 if (add_dbcs) {
1755 - ctlr_add(h3270.buffer_addr, add_c2, h3270.default_cs);  
1756 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1757 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1758 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1759 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1754 + ctlr_add(&h3270,h3270.buffer_addr, add_c2, h3270.default_cs);
  1755 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1756 + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
  1757 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1758 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1760 INC_BA(h3270.buffer_addr); 1759 INC_BA(h3270.buffer_addr);
1761 } 1760 }
1762 last_cmd = False; 1761 last_cmd = False;
@@ -1803,19 +1802,19 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1803,19 +1802,19 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1803 #if defined(X3270_DBCS) /*[*/ 1802 #if defined(X3270_DBCS) /*[*/
1804 } 1803 }
1805 #endif /*]*/ 1804 #endif /*]*/
1806 - ctlr_add(h3270.buffer_addr, add_c1, h3270.default_cs);  
1807 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1808 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1809 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1810 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1805 + ctlr_add(&h3270,h3270.buffer_addr, add_c1, h3270.default_cs);
  1806 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1807 + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
  1808 + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
  1809 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1811 INC_BA(h3270.buffer_addr); 1810 INC_BA(h3270.buffer_addr);
1812 #if defined(X3270_DBCS) /*[*/ 1811 #if defined(X3270_DBCS) /*[*/
1813 if (add_dbcs) { 1812 if (add_dbcs) {
1814 ctlr_add(h3270.buffer_addr, add_c2, h3270.default_cs); 1813 ctlr_add(h3270.buffer_addr, add_c2, h3270.default_cs);
1815 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); 1814 + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
1816 ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); 1815 ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);
1817 ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); 1816 ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);
1818 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); 1817 + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
1819 INC_BA(h3270.buffer_addr); 1818 INC_BA(h3270.buffer_addr);
1820 } 1819 }
1821 #endif /*]*/ 1820 #endif /*]*/
@@ -1864,8 +1863,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1864,8 +1863,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1864 * Write SSCP-LU data, which is quite a bit dumber than regular 3270 1863 * Write SSCP-LU data, which is quite a bit dumber than regular 3270
1865 * output. 1864 * output.
1866 */ 1865 */
1867 -void  
1868 -ctlr_write_sscp_lu(unsigned char buf[], int buflen) 1866 +void ctlr_write_sscp_lu(H3270 *hSession, unsigned char buf[], int buflen)
1869 { 1867 {
1870 int i; 1868 int i;
1871 unsigned char *cp = buf; 1869 unsigned char *cp = buf;
@@ -1888,14 +1886,15 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) @@ -1888,14 +1886,15 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen)
1888 * Insert NULLs to the end of the line and advance to 1886 * Insert NULLs to the end of the line and advance to
1889 * the beginning of the next line. 1887 * the beginning of the next line.
1890 */ 1888 */
1891 - s_row = h3270.buffer_addr / h3270.cols;  
1892 - while ((h3270.buffer_addr / h3270.cols) == s_row) {  
1893 - ctlr_add(h3270.buffer_addr, EBC_null, h3270.default_cs);  
1894 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1895 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1896 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1897 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic);  
1898 - INC_BA(h3270.buffer_addr); 1889 + s_row = hSession->buffer_addr / hSession->cols;
  1890 + while ((hSession->buffer_addr / hSession->cols) == s_row)
  1891 + {
  1892 + ctlr_add(hSession,hSession->buffer_addr, EBC_null, hSession->default_cs);
  1893 + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg);
  1894 + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg);
  1895 + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr);
  1896 + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic);
  1897 + INC_BA(hSession->buffer_addr);
1899 } 1898 }
1900 break; 1899 break;
1901 1900
@@ -1903,21 +1902,22 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) @@ -1903,21 +1902,22 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen)
1903 /* Some hosts forget they're talking SSCP-LU. */ 1902 /* Some hosts forget they're talking SSCP-LU. */
1904 cp++; 1903 cp++;
1905 i++; 1904 i++;
1906 - trace_ds(" StartField%s %s [translated to space]\n",rcba(&h3270,h3270.buffer_addr), see_attr(*cp));  
1907 - ctlr_add(h3270.buffer_addr, EBC_space, h3270.default_cs);  
1908 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1909 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1910 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1911 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic);  
1912 - INC_BA(h3270.buffer_addr); 1905 + trace_ds(" StartField%s %s [translated to space]\n",rcba(hSession,hSession->buffer_addr), see_attr(*cp));
  1906 + ctlr_add(hSession,hSession->buffer_addr, EBC_space, hSession->default_cs);
  1907 + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg);
  1908 + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg);
  1909 + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr);
  1910 + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic);
  1911 + INC_BA(hSession->buffer_addr);
1913 break; 1912 break;
  1913 +
1914 case ORDER_IC: 1914 case ORDER_IC:
1915 - trace_ds(" InsertCursor%s [ignored]\n",  
1916 - rcba(&h3270,h3270.buffer_addr)); 1915 + trace_ds(" InsertCursor%s [ignored]\n",rcba(hSession,hSession->buffer_addr));
1917 break; 1916 break;
  1917 +
1918 case ORDER_SBA: 1918 case ORDER_SBA:
1919 // baddr = DECODE_BADDR(*(cp+1), *(cp+2)); 1919 // baddr = DECODE_BADDR(*(cp+1), *(cp+2));
1920 - trace_ds(" SetBufferAddress%s [ignored]\n", rcba(&h3270,DECODE_BADDR(*(cp+1), *(cp+2)))); 1920 + trace_ds(" SetBufferAddress%s [ignored]\n", rcba(hSession,DECODE_BADDR(*(cp+1), *(cp+2))));
1921 cp += 2; 1921 cp += 2;
1922 i += 2; 1922 i += 2;
1923 break; 1923 break;
@@ -1926,34 +1926,36 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) @@ -1926,34 +1926,36 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen)
1926 cp++; 1926 cp++;
1927 if (++i >= buflen) 1927 if (++i >= buflen)
1928 break; 1928 break;
  1929 +
1929 if (*cp <= 0x40) 1930 if (*cp <= 0x40)
1930 c = EBC_space; 1931 c = EBC_space;
1931 else 1932 else
1932 c = *cp; 1933 c = *cp;
1933 - ctlr_add(h3270.buffer_addr, c, CS_GE);  
1934 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1935 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1936 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1937 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic);  
1938 - INC_BA(h3270.buffer_addr); 1934 +
  1935 + ctlr_add(hSession,hSession->buffer_addr, c, CS_GE);
  1936 + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg);
  1937 + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg);
  1938 + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr);
  1939 + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic);
  1940 + INC_BA(hSession->buffer_addr);
1939 break; 1941 break;
1940 1942
1941 default: 1943 default:
1942 - ctlr_add(h3270.buffer_addr, *cp, h3270.default_cs);  
1943 - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg);  
1944 - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);  
1945 - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);  
1946 - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic);  
1947 - INC_BA(h3270.buffer_addr); 1944 + ctlr_add(hSession,hSession->buffer_addr, *cp, hSession->default_cs);
  1945 + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg);
  1946 + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg);
  1947 + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr);
  1948 + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic);
  1949 + INC_BA(hSession->buffer_addr);
1948 break; 1950 break;
1949 } 1951 }
1950 } 1952 }
1951 - cursor_move(&h3270,h3270.buffer_addr);  
1952 - h3270.sscp_start = h3270.buffer_addr; 1953 + cursor_move(hSession,hSession->buffer_addr);
  1954 + hSession->sscp_start = hSession->buffer_addr;
1953 1955
1954 /* Unlock the keyboard. */ 1956 /* Unlock the keyboard. */
1955 - h3270.aid = AID_NO;  
1956 - do_reset(&h3270,False); 1957 + hSession->aid = AID_NO;
  1958 + do_reset(hSession,False);
1957 1959
1958 } 1960 }
1959 1961
@@ -2263,16 +2265,16 @@ ps_process(void) @@ -2263,16 +2265,16 @@ ps_process(void)
2263 /* 2265 /*
2264 * Tell me if there is any data on the screen. 2266 * Tell me if there is any data on the screen.
2265 */ 2267 */
2266 -Boolean  
2267 -ctlr_any_data(void) 2268 +int ctlr_any_data(H3270 *session)
2268 { 2269 {
2269 register int i; 2270 register int i;
2270 2271
2271 - for (i = 0; i < h3270.rows*h3270.cols; i++) {  
2272 - if (!IsBlank(h3270.ea_buf[i].cc))  
2273 - return True; 2272 + for(i = 0; i < session->rows*session->cols; i++)
  2273 + {
  2274 + if (!IsBlank(session->ea_buf[i].cc))
  2275 + return 1;
2274 } 2276 }
2275 - return False; 2277 + return 0;
2276 } 2278 }
2277 2279
2278 /* 2280 /*
@@ -2283,7 +2285,7 @@ void @@ -2283,7 +2285,7 @@ void
2283 ctlr_clear(H3270 *session, Boolean can_snap) 2285 ctlr_clear(H3270 *session, Boolean can_snap)
2284 { 2286 {
2285 /* Snap any data that is about to be lost into the trace file. */ 2287 /* Snap any data that is about to be lost into the trace file. */
2286 - if (ctlr_any_data()) { 2288 + if (ctlr_any_data(session)) {
2287 #if defined(X3270_TRACE) /*[*/ 2289 #if defined(X3270_TRACE) /*[*/
2288 if (can_snap && !trace_skipping && lib3270_get_toggle(session,LIB3270_TOGGLE_SCREEN_TRACE)) 2290 if (can_snap && !trace_skipping && lib3270_get_toggle(session,LIB3270_TOGGLE_SCREEN_TRACE))
2289 trace_screen(session); 2291 trace_screen(session);
@@ -2337,124 +2339,122 @@ static void ctlr_blanks(H3270 *session) @@ -2337,124 +2339,122 @@ static void ctlr_blanks(H3270 *session)
2337 * Change a character in the 3270 buffer. 2339 * Change a character in the 3270 buffer.
2338 * Removes any field attribute defined at that location. 2340 * Removes any field attribute defined at that location.
2339 */ 2341 */
2340 -void ctlr_add(int baddr, unsigned char c, unsigned char cs) 2342 +void ctlr_add(H3270 *hSession, int baddr, unsigned char c, unsigned char cs)
2341 { 2343 {
2342 unsigned char oc = 0; 2344 unsigned char oc = 0;
2343 2345
2344 - if(h3270.ea_buf[baddr].fa || ((oc = h3270.ea_buf[baddr].cc) != c || h3270.ea_buf[baddr].cs != cs)) 2346 + if(hSession->ea_buf[baddr].fa || ((oc = hSession->ea_buf[baddr].cc) != c || hSession->ea_buf[baddr].cs != cs))
2345 { 2347 {
2346 - if (h3270.trace_primed && !IsBlank(oc)) 2348 + if (hSession->trace_primed && !IsBlank(oc))
2347 { 2349 {
2348 #if defined(X3270_TRACE) /*[*/ 2350 #if defined(X3270_TRACE) /*[*/
2349 - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_SCREEN_TRACE))  
2350 - trace_screen(&h3270); 2351 + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_SCREEN_TRACE))
  2352 + trace_screen(hSession);
2351 #endif /*]*/ 2353 #endif /*]*/
2352 - h3270.trace_primed = 0; 2354 + hSession->trace_primed = 0;
2353 } 2355 }
2354 2356
2355 - h3270.ea_buf[baddr].cc = c;  
2356 - h3270.ea_buf[baddr].cs = cs;  
2357 - h3270.ea_buf[baddr].fa = 0;  
2358 - ONE_CHANGED(&h3270,baddr); 2357 + hSession->ea_buf[baddr].cc = c;
  2358 + hSession->ea_buf[baddr].cs = cs;
  2359 + hSession->ea_buf[baddr].fa = 0;
  2360 + ONE_CHANGED(hSession,baddr);
2359 } 2361 }
2360 } 2362 }
2361 2363
2362 /* 2364 /*
2363 * Set a field attribute in the 3270 buffer. 2365 * Set a field attribute in the 3270 buffer.
2364 */ 2366 */
2365 -void  
2366 -ctlr_add_fa(int baddr, unsigned char fa, unsigned char cs) 2367 +void ctlr_add_fa(H3270 *hSession, int baddr, unsigned char fa, unsigned char cs)
2367 { 2368 {
2368 /* Put a null in the display buffer. */ 2369 /* Put a null in the display buffer. */
2369 - ctlr_add(baddr, EBC_null, cs); 2370 + ctlr_add(hSession, baddr, EBC_null, cs);
2370 2371
2371 /* 2372 /*
2372 * Store the new attribute, setting the 'printable' bits so that the 2373 * Store the new attribute, setting the 'printable' bits so that the
2373 * value will be non-zero. 2374 * value will be non-zero.
2374 */ 2375 */
2375 - h3270.ea_buf[baddr].fa = FA_PRINTABLE | (fa & FA_MASK); 2376 + hSession->ea_buf[baddr].fa = FA_PRINTABLE | (fa & FA_MASK);
2376 } 2377 }
2377 2378
2378 /* 2379 /*
2379 * Change the character set for a field in the 3270 buffer. 2380 * Change the character set for a field in the 3270 buffer.
2380 */ 2381 */
2381 void 2382 void
2382 -ctlr_add_cs(int baddr, unsigned char cs) 2383 +ctlr_add_cs(H3270 *hSession, int baddr, unsigned char cs)
2383 { 2384 {
2384 - if (h3270.ea_buf[baddr].cs != cs) 2385 + if (hSession->ea_buf[baddr].cs != cs)
2385 { 2386 {
2386 /* 2387 /*
2387 if (SELECTED(baddr)) 2388 if (SELECTED(baddr))
2388 unselect(baddr, 1); 2389 unselect(baddr, 1);
2389 */ 2390 */
2390 - h3270.ea_buf[baddr].cs = cs;  
2391 - ONE_CHANGED(&h3270,baddr); 2391 + hSession->ea_buf[baddr].cs = cs;
  2392 + ONE_CHANGED(hSession,baddr);
2392 } 2393 }
2393 } 2394 }
2394 2395
2395 /* 2396 /*
2396 * Change the graphic rendition of a character in the 3270 buffer. 2397 * Change the graphic rendition of a character in the 3270 buffer.
2397 */ 2398 */
2398 -void  
2399 -ctlr_add_gr(int baddr, unsigned char gr) 2399 +void ctlr_add_gr(H3270 *hSession, int baddr, unsigned char gr)
2400 { 2400 {
2401 - if (h3270.ea_buf[baddr].gr != gr) 2401 + if (hSession->ea_buf[baddr].gr != gr)
2402 { 2402 {
2403 - h3270.ea_buf[baddr].gr = gr;  
2404 - if (gr & GR_BLINK)  
2405 - blink_start();  
2406 - ONE_CHANGED(&h3270,baddr); 2403 + hSession->ea_buf[baddr].gr = gr;
  2404 +// if (gr & GR_BLINK)
  2405 +// blink_start();
  2406 + ONE_CHANGED(hSession,baddr);
2407 } 2407 }
2408 } 2408 }
2409 2409
2410 /* 2410 /*
2411 * Change the foreground color for a character in the 3270 buffer. 2411 * Change the foreground color for a character in the 3270 buffer.
2412 */ 2412 */
2413 -void  
2414 -ctlr_add_fg(int baddr, unsigned char color) 2413 +void ctlr_add_fg(H3270 *hSession, int baddr, unsigned char color)
2415 { 2414 {
2416 - if (!h3270.m3279) 2415 + if (!hSession->m3279)
2417 return; 2416 return;
  2417 +
2418 if ((color & 0xf0) != 0xf0) 2418 if ((color & 0xf0) != 0xf0)
2419 color = 0; 2419 color = 0;
2420 - if (h3270.ea_buf[baddr].fg != color) 2420 +
  2421 + if (hSession->ea_buf[baddr].fg != color)
2421 { 2422 {
2422 - h3270.ea_buf[baddr].fg = color;  
2423 - ONE_CHANGED(&h3270,baddr); 2423 + hSession->ea_buf[baddr].fg = color;
  2424 + ONE_CHANGED(hSession,baddr);
2424 } 2425 }
2425 } 2426 }
2426 2427
2427 /* 2428 /*
2428 * Change the background color for a character in the 3270 buffer. 2429 * Change the background color for a character in the 3270 buffer.
2429 */ 2430 */
2430 -void  
2431 -ctlr_add_bg(int baddr, unsigned char color) 2431 +void ctlr_add_bg(H3270 *hSession, int baddr, unsigned char color)
2432 { 2432 {
2433 - if (!h3270.m3279) 2433 + if (!hSession->m3279)
2434 return; 2434 return;
  2435 +
2435 if ((color & 0xf0) != 0xf0) 2436 if ((color & 0xf0) != 0xf0)
2436 color = 0; 2437 color = 0;
2437 - if (h3270.ea_buf[baddr].bg != color) 2438 +
  2439 + if (hSession->ea_buf[baddr].bg != color)
2438 { 2440 {
2439 - h3270.ea_buf[baddr].bg = color;  
2440 - ONE_CHANGED(&h3270,baddr); 2441 + hSession->ea_buf[baddr].bg = color;
  2442 + ONE_CHANGED(hSession,baddr);
2441 } 2443 }
2442 } 2444 }
2443 2445
2444 /* 2446 /*
2445 * Change the input control bit for a character in the 3270 buffer. 2447 * Change the input control bit for a character in the 3270 buffer.
2446 */ 2448 */
2447 -static void  
2448 -ctlr_add_ic(int baddr, unsigned char ic) 2449 +static void ctlr_add_ic(H3270 *hSession, int baddr, unsigned char ic)
2449 { 2450 {
2450 - h3270.ea_buf[baddr].ic = ic; 2451 + hSession->ea_buf[baddr].ic = ic;
2451 } 2452 }
2452 2453
2453 /* 2454 /*
2454 * Wrapping bersion of ctlr_bcopy. 2455 * Wrapping bersion of ctlr_bcopy.
2455 */ 2456 */
2456 -void  
2457 -ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count) 2457 +void ctlr_wrapping_memmove(H3270 *hSession, int baddr_to, int baddr_from, int count)
2458 { 2458 {
2459 /* 2459 /*
2460 * The 'to' region, the 'from' region, or both can wrap the screen, 2460 * The 'to' region, the 'from' region, or both can wrap the screen,
@@ -2464,8 +2464,8 @@ ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count) @@ -2464,8 +2464,8 @@ ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count)
2464 * It's faster to figure out if none of this is true, then do a slow 2464 * It's faster to figure out if none of this is true, then do a slow
2465 * location-at-a-time version only if it happens. 2465 * location-at-a-time version only if it happens.
2466 */ 2466 */
2467 - if (baddr_from + count <= h3270.rows*h3270.cols &&  
2468 - baddr_to + count <= h3270.rows*h3270.cols) { 2467 + if (baddr_from + count <= hSession->rows*hSession->cols &&
  2468 + baddr_to + count <= hSession->rows*hSession->cols) {
2469 ctlr_bcopy(baddr_from, baddr_to, count, True); 2469 ctlr_bcopy(baddr_from, baddr_to, count, True);
2470 } else { 2470 } else {
2471 int i, from, to; 2471 int i, from, to;
@@ -2473,12 +2473,12 @@ ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count) @@ -2473,12 +2473,12 @@ ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count)
2473 for (i = 0; i < count; i++) { 2473 for (i = 0; i < count; i++) {
2474 if (baddr_to > baddr_from) { 2474 if (baddr_to > baddr_from) {
2475 /* Shifting right, move left. */ 2475 /* Shifting right, move left. */
2476 - to = (baddr_to + count - 1 - i) % h3270.rows*h3270.cols;  
2477 - from = (baddr_from + count - 1 - i) % h3270.rows*h3270.cols; 2476 + to = (baddr_to + count - 1 - i) % hSession->rows*hSession->cols;
  2477 + from = (baddr_from + count - 1 - i) % hSession->rows*hSession->cols;
2478 } else { 2478 } else {
2479 /* Shifting left, move right. */ 2479 /* Shifting left, move right. */
2480 - to = (baddr_to + i) % h3270.rows*h3270.cols;  
2481 - from = (baddr_from + i) % h3270.rows*h3270.cols; 2480 + to = (baddr_to + i) % hSession->rows*hSession->cols;
  2481 + from = (baddr_from + i) % hSession->rows*hSession->cols;
2482 } 2482 }
2483 ctlr_bcopy(from, to, 1, True); 2483 ctlr_bcopy(from, to, 1, True);
2484 } 2484 }
@@ -2509,13 +2509,13 @@ ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea) @@ -2509,13 +2509,13 @@ ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea)
2509 * Erase a region of the 3270 buffer, optionally clearing extended attributes 2509 * Erase a region of the 3270 buffer, optionally clearing extended attributes
2510 * as well. 2510 * as well.
2511 */ 2511 */
2512 -void ctlr_aclear(int baddr, int count, int clear_ea) 2512 +void ctlr_aclear(H3270 *session, int baddr, int count, int clear_ea)
2513 { 2513 {
2514 - if (memcmp((char *) &h3270.ea_buf[baddr], (char *) h3270.zero_buf, 2514 + if (memcmp((char *) &session->ea_buf[baddr], (char *) session->zero_buf,
2515 count * sizeof(struct ea))) { 2515 count * sizeof(struct ea))) {
2516 - (void) memset((char *) &h3270.ea_buf[baddr], 0, 2516 + (void) memset((char *) &session->ea_buf[baddr], 0,
2517 count * sizeof(struct ea)); 2517 count * sizeof(struct ea));
2518 - REGION_CHANGED(&h3270,baddr, baddr + count); 2518 + REGION_CHANGED(session,baddr, baddr + count);
2519 } 2519 }
2520 /* XXX: What about clear_ea? */ 2520 /* XXX: What about clear_ea? */
2521 } 2521 }
@@ -2591,7 +2591,7 @@ void ctlr_altbuffer(H3270 *session, int alt) @@ -2591,7 +2591,7 @@ void ctlr_altbuffer(H3270 *session, int alt)
2591 * There may be blinkers on the alternate screen; schedule one 2591 * There may be blinkers on the alternate screen; schedule one
2592 * iteration just in case. 2592 * iteration just in case.
2593 */ 2593 */
2594 - blink_start(); 2594 +// blink_start();
2595 } 2595 }
2596 } 2596 }
2597 2597
@@ -2628,9 +2628,8 @@ mdt_clear(int baddr) @@ -2628,9 +2628,8 @@ mdt_clear(int baddr)
2628 2628
2629 /* 2629 /*
2630 * Support for screen-size swapping for scrolling 2630 * Support for screen-size swapping for scrolling
2631 - */  
2632 -void  
2633 -ctlr_shrink(void) 2631 + */ /*
  2632 +void ctlr_shrink(void)
2634 { 2633 {
2635 int baddr; 2634 int baddr;
2636 2635
@@ -2642,6 +2641,7 @@ ctlr_shrink(void) @@ -2642,6 +2641,7 @@ ctlr_shrink(void)
2642 ALL_CHANGED(&h3270); 2641 ALL_CHANGED(&h3270);
2643 h3270.display(&h3270); 2642 h3270.display(&h3270);
2644 } 2643 }
  2644 +*/
2645 2645
2646 #if defined(X3270_DBCS) /*[*/ 2646 #if defined(X3270_DBCS) /*[*/
2647 /* 2647 /*
@@ -2754,11 +2754,3 @@ static void ticking_stop(H3270 *session) @@ -2754,11 +2754,3 @@ static void ticking_stop(H3270 *session)
2754 status_timing(session,&t_start, &t1); 2754 status_timing(session,&t_start, &t1);
2755 } 2755 }
2756 } 2756 }
2757 -  
2758 -/*  
2759 - * No-op toggle.  
2760 - */  
2761 -void toggle_nop(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused)  
2762 -{  
2763 -}  
2764 -  
1 /* 1 /*
2 - * Copyright 1995, 1999, 2000, 2002, 2003, 2005 by Paul Mattes.  
3 - * Permission to use, copy, modify, and distribute this software and its  
4 - * documentation for any purpose and without fee is hereby granted,  
5 - * provided that the above copyright notice appear in all copies and that  
6 - * both that copyright notice and this permission notice appear in  
7 - * supporting documentation. 2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
  19 + * Place, Suite 330, Boston, MA, 02111-1307, USA
  20 + *
  21 + * Este programa está nomeado como ctlrc.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
8 * 27 *
9 - * x3270, c3270, s3270 and tcl3270 are distributed in the hope that they will  
10 - * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of  
11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE  
12 - * for more details.  
13 */ 28 */
14 29
15 /* 30 /*
@@ -24,30 +39,30 @@ enum pds { @@ -24,30 +39,30 @@ enum pds {
24 PDS_BAD_ADDR = -2 /* command contained a bad address */ 39 PDS_BAD_ADDR = -2 /* command contained a bad address */
25 }; 40 };
26 41
27 -LIB3270_INTERNAL void ctlr_aclear(int baddr, int count, int clear_ea);  
28 -LIB3270_INTERNAL void ctlr_add(int baddr, unsigned char c, unsigned char cs);  
29 -LIB3270_INTERNAL void ctlr_add_bg(int baddr, unsigned char color);  
30 -LIB3270_INTERNAL void ctlr_add_cs(int baddr, unsigned char cs);  
31 -LIB3270_INTERNAL void ctlr_add_fa(int baddr, unsigned char fa, unsigned char cs);  
32 -LIB3270_INTERNAL void ctlr_add_fg(int baddr, unsigned char color);  
33 -LIB3270_INTERNAL void ctlr_add_gr(int baddr, unsigned char gr); 42 +LIB3270_INTERNAL void ctlr_aclear(H3270 *session, int baddr, int count, int clear_ea);
  43 +LIB3270_INTERNAL void ctlr_add(H3270 *hSession, int baddr, unsigned char c, unsigned char cs);
  44 +LIB3270_INTERNAL void ctlr_add_bg(H3270 *hSession, int baddr, unsigned char color);
  45 +LIB3270_INTERNAL void ctlr_add_cs(H3270 *hSession, int baddr, unsigned char cs);
  46 +LIB3270_INTERNAL void ctlr_add_fa(H3270 *hSession, int baddr, unsigned char fa, unsigned char cs);
  47 +LIB3270_INTERNAL void ctlr_add_fg(H3270 *hSession, int baddr, unsigned char color);
  48 +LIB3270_INTERNAL void ctlr_add_gr(H3270 *hSession, int baddr, unsigned char gr);
34 LIB3270_INTERNAL void ctlr_altbuffer(H3270 *session, int alt); 49 LIB3270_INTERNAL void ctlr_altbuffer(H3270 *session, int alt);
35 -LIB3270_INTERNAL Boolean ctlr_any_data(void); 50 +LIB3270_INTERNAL int ctlr_any_data(H3270 *session);
36 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);
37 // LIB3270_INTERNAL void ctlr_changed(int bstart, int bend); 52 // LIB3270_INTERNAL void ctlr_changed(int bstart, int bend);
38 LIB3270_INTERNAL void ctlr_clear(H3270 *session, Boolean can_snap); 53 LIB3270_INTERNAL void ctlr_clear(H3270 *session, Boolean can_snap);
39 -LIB3270_INTERNAL void ctlr_erase_all_unprotected(void); 54 +LIB3270_INTERNAL void ctlr_erase_all_unprotected(H3270 *hSession);
40 LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask); 55 LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask);
41 LIB3270_INTERNAL void ctlr_read_buffer(unsigned char aid_byte); 56 LIB3270_INTERNAL void ctlr_read_buffer(unsigned char aid_byte);
42 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);
43 LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask); 58 LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask);
44 LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession); 59 LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession);
45 -LIB3270_INTERNAL void ctlr_shrink(void);  
46 -LIB3270_INTERNAL void ctlr_snap_buffer(void);  
47 -LIB3270_INTERNAL Boolean ctlr_snap_modes(void);  
48 -LIB3270_INTERNAL void ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count); 60 +// LIB3270_INTERNAL void ctlr_shrink(void);
  61 +// LIB3270_INTERNAL void ctlr_snap_buffer(void);
  62 +// LIB3270_INTERNAL Boolean ctlr_snap_modes(void);
  63 +LIB3270_INTERNAL void ctlr_wrapping_memmove(H3270 *session, int baddr_to, int baddr_from, int count);
49 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);
50 -LIB3270_INTERNAL void ctlr_write_sscp_lu(unsigned char buf[], int buflen); 65 +LIB3270_INTERNAL void ctlr_write_sscp_lu(H3270 *session, unsigned char buf[], int buflen);
51 LIB3270_INTERNAL struct ea *fa2ea(int baddr); 66 LIB3270_INTERNAL struct ea *fa2ea(int baddr);
52 67
53 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);
@@ -62,8 +77,8 @@ LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ov @@ -62,8 +77,8 @@ LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ov
62 LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); 77 LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt);
63 78
64 LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); 79 LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway);
65 -LIB3270_INTERNAL void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);  
66 -LIB3270_INTERNAL void toggle_showTiming(struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); 80 +// LIB3270_INTERNAL void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);
  81 +// LIB3270_INTERNAL void toggle_showTiming(struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);
67 82
68 enum dbcs_state { 83 enum dbcs_state {
69 DBCS_NONE = 0, /* position is not DBCS */ 84 DBCS_NONE = 0, /* position is not DBCS */
@@ -392,7 +392,7 @@ cut_data_request(void) @@ -392,7 +392,7 @@ cut_data_request(void)
392 /* Copy data into the screen buffer. */ 392 /* Copy data into the screen buffer. */
393 count = 0; 393 count = 0;
394 while (count < O_UP_MAX && (c = xlate_getc()) != EOF) { 394 while (count < O_UP_MAX && (c = xlate_getc()) != EOF) {
395 - ctlr_add(O_UP_DATA + count, c, 0); 395 + ctlr_add(&h3270,O_UP_DATA + count, c, 0);
396 count++; 396 count++;
397 } 397 }
398 398
@@ -402,7 +402,7 @@ cut_data_request(void) @@ -402,7 +402,7 @@ cut_data_request(void)
402 402
403 /* Clean out any data we may have written. */ 403 /* Clean out any data we may have written. */
404 for (j = 0; j < count; j++) 404 for (j = 0; j < count; j++)
405 - ctlr_add(O_UP_DATA + j, 0, 0); 405 + ctlr_add(&h3270,O_UP_DATA + j, 0, 0);
406 406
407 /* Abort the transfer. */ 407 /* Abort the transfer. */
408 cut_abort(SC_ABORT_FILE,_( "Error \"%s\" reading from local file (rc=%d)" ), strerror(errno), errno); 408 cut_abort(SC_ABORT_FILE,_( "Error \"%s\" reading from local file (rc=%d)" ), strerror(errno), errno);
@@ -411,24 +411,24 @@ cut_data_request(void) @@ -411,24 +411,24 @@ cut_data_request(void)
411 411
412 /* Send special data for EOF. */ 412 /* Send special data for EOF. */
413 if (!count && feof(((H3270FT *) h3270.ft)->local_file)) { 413 if (!count && feof(((H3270FT *) h3270.ft)->local_file)) {
414 - ctlr_add(O_UP_DATA, EOF_DATA1, 0);  
415 - ctlr_add(O_UP_DATA+1, EOF_DATA2, 0); 414 + ctlr_add(&h3270,O_UP_DATA, EOF_DATA1, 0);
  415 + ctlr_add(&h3270,O_UP_DATA+1, EOF_DATA2, 0);
416 count = 2; 416 count = 2;
417 } 417 }
418 418
419 /* Compute the other fields. */ 419 /* Compute the other fields. */
420 - ctlr_add(O_UP_FRAME_SEQ, seq, 0); 420 + ctlr_add(&h3270,O_UP_FRAME_SEQ, seq, 0);
421 cs = 0; 421 cs = 0;
422 for (i = 0; i < count; i++) 422 for (i = 0; i < count; i++)
423 cs ^= h3270.ea_buf[O_UP_DATA + i].cc; 423 cs ^= h3270.ea_buf[O_UP_DATA + i].cc;
424 - ctlr_add(O_UP_CSUM, asc2ebc[(int)table6[cs & 0x3f]], 0);  
425 - ctlr_add(O_UP_LEN, asc2ebc[(int)table6[(count >> 6) & 0x3f]], 0);  
426 - ctlr_add(O_UP_LEN+1, asc2ebc[(int)table6[count & 0x3f]], 0); 424 + ctlr_add(&h3270,O_UP_CSUM, asc2ebc[(int)table6[cs & 0x3f]], 0);
  425 + ctlr_add(&h3270,O_UP_LEN, asc2ebc[(int)table6[(count >> 6) & 0x3f]], 0);
  426 + ctlr_add(&h3270,O_UP_LEN+1, asc2ebc[(int)table6[count & 0x3f]], 0);
427 427
428 /* XXX: Change the data field attribute so it doesn't display. */ 428 /* XXX: Change the data field attribute so it doesn't display. */
429 attr = h3270.ea_buf[O_DR_SF].fa; 429 attr = h3270.ea_buf[O_DR_SF].fa;
430 attr = (attr & ~FA_INTENSITY) | FA_INT_ZERO_NSEL; 430 attr = (attr & ~FA_INTENSITY) | FA_INT_ZERO_NSEL;
431 - ctlr_add_fa(O_DR_SF, attr, 0); 431 + ctlr_add_fa(&h3270,O_DR_SF, attr, 0);
432 432
433 /* Send it up to the host. */ 433 /* Send it up to the host. */
434 trace_ds("> FT DATA %u\n", from6(seq)); 434 trace_ds("> FT DATA %u\n", from6(seq));
@@ -535,10 +535,10 @@ static void cut_abort(unsigned short reason, const char *fmt, ...) @@ -535,10 +535,10 @@ static void cut_abort(unsigned short reason, const char *fmt, ...)
535 va_end(args); 535 va_end(args);
536 536
537 /* Send the abort sequence. */ 537 /* Send the abort sequence. */
538 - ctlr_add(RO_FRAME_TYPE, RFT_CONTROL_CODE, 0);  
539 - ctlr_add(RO_FRAME_SEQ, h3270.ea_buf[O_DT_FRAME_SEQ].cc, 0);  
540 - ctlr_add(RO_REASON_CODE, HIGH8(reason), 0);  
541 - ctlr_add(RO_REASON_CODE+1, LOW8(reason), 0); 538 + ctlr_add(&h3270,RO_FRAME_TYPE, RFT_CONTROL_CODE, 0);
  539 + ctlr_add(&h3270,RO_FRAME_SEQ, h3270.ea_buf[O_DT_FRAME_SEQ].cc, 0);
  540 + ctlr_add(&h3270,RO_REASON_CODE, HIGH8(reason), 0);
  541 + ctlr_add(&h3270,RO_REASON_CODE+1, LOW8(reason), 0);
542 trace_ds("> FT CONTROL_CODE ABORT\n"); 542 trace_ds("> FT CONTROL_CODE ABORT\n");
543 543
544 lib3270_pfkey(&h3270,2); 544 lib3270_pfkey(&h3270,2);
@@ -718,7 +718,7 @@ static Boolean ins_prep(int faddr, int baddr, int count) @@ -718,7 +718,7 @@ static Boolean ins_prep(int faddr, int baddr, int count)
718 first_null); 718 first_null);
719 #endif /*]*/ 719 #endif /*]*/
720 if (copy_len) 720 if (copy_len)
721 - ctlr_wrapping_memmove(to, baddr, copy_len); 721 + ctlr_wrapping_memmove(&h3270,to, baddr, copy_len);
722 } 722 }
723 INC_BA(xaddr); 723 INC_BA(xaddr);
724 } 724 }
@@ -824,17 +824,17 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -824,17 +824,17 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
824 xaddr = baddr; 824 xaddr = baddr;
825 INC_BA(xaddr); 825 INC_BA(xaddr);
826 was_si = (h3270.ea_buf[xaddr].cc == EBC_si); 826 was_si = (h3270.ea_buf[xaddr].cc == EBC_si);
827 - ctlr_add(xaddr, EBC_space, CS_BASE);  
828 - ctlr_add_fg(xaddr, 0); 827 + ctlr_add(&h3270,xaddr, EBC_space, CS_BASE);
  828 + ctlr_add_fg(&h3270,xaddr, 0);
829 #if defined(X3270_ANSI) /*[*/ 829 #if defined(X3270_ANSI) /*[*/
830 - ctlr_add_bg(xaddr, 0); 830 + ctlr_add_bg(&h3270,xaddr, 0);
831 #endif /*]*/ 831 #endif /*]*/
832 if (!was_si) { 832 if (!was_si) {
833 INC_BA(xaddr); 833 INC_BA(xaddr);
834 - ctlr_add(xaddr, EBC_so, CS_BASE);  
835 - ctlr_add_fg(xaddr, 0); 834 + ctlr_add(&h3270,xaddr, EBC_so, CS_BASE);
  835 + ctlr_add_fg(&h3270,xaddr, 0);
836 #if defined(X3270_ANSI) /*[*/ 836 #if defined(X3270_ANSI) /*[*/
837 - ctlr_add_bg(xaddr, 0); 837 + ctlr_add_bg(&h3270,xaddr, 0);
838 #endif /*]*/ 838 #endif /*]*/
839 } 839 }
840 } 840 }
@@ -855,9 +855,9 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -855,9 +855,9 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
855 */ 855 */
856 xaddr = baddr; 856 xaddr = baddr;
857 INC_BA(xaddr); 857 INC_BA(xaddr);
858 - ctlr_add(xaddr, EBC_space, CS_BASE);  
859 - ctlr_add_fg(xaddr, 0);  
860 - ctlr_add_gr(xaddr, 0); 858 + ctlr_add(&h3270,xaddr, EBC_space, CS_BASE);
  859 + ctlr_add_fg(&h3270,xaddr, 0);
  860 + ctlr_add_gr(&h3270,xaddr, 0);
861 } 861 }
862 } else { 862 } else {
863 Boolean was_si; 863 Boolean was_si;
@@ -882,37 +882,34 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -882,37 +882,34 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
882 if (!ins_prep(faddr, baddr, 3)) 882 if (!ins_prep(faddr, baddr, 3))
883 return False; 883 return False;
884 xaddr = baddr; 884 xaddr = baddr;
885 - ctlr_add(xaddr, EBC_si,  
886 - CS_BASE);  
887 - ctlr_add_fg(xaddr, 0);  
888 - ctlr_add_gr(xaddr, 0); 885 + ctlr_add(&h3270,xaddr, EBC_si,CS_BASE);
  886 + ctlr_add_fg(&h3270,xaddr, 0);
  887 + ctlr_add_gr(&h3270,xaddr, 0);
889 INC_BA(xaddr); 888 INC_BA(xaddr);
890 INC_BA(baddr); 889 INC_BA(baddr);
891 INC_BA(xaddr); 890 INC_BA(xaddr);
892 - ctlr_add(xaddr, EBC_so,  
893 - CS_BASE);  
894 - ctlr_add_fg(xaddr, 0);  
895 - ctlr_add_gr(xaddr, 0); 891 + ctlr_add(&h3270,xaddr, EBC_so,CS_BASE);
  892 + ctlr_add_fg(&h3270,xaddr, 0);
  893 + ctlr_add_gr(&h3270,xaddr, 0);
896 } 894 }
897 } else { 895 } else {
898 /* Overwriting part of a subfield. */ 896 /* Overwriting part of a subfield. */
899 xaddr = baddr; 897 xaddr = baddr;
900 - ctlr_add(xaddr, EBC_si, CS_BASE);  
901 - ctlr_add_fg(xaddr, 0);  
902 - ctlr_add_gr(xaddr, 0); 898 + ctlr_add(&h3270,xaddr, EBC_si, CS_BASE);
  899 + ctlr_add_fg(&h3270,xaddr, 0);
  900 + ctlr_add_gr(&h3270,xaddr, 0);
903 INC_BA(xaddr); 901 INC_BA(xaddr);
904 INC_BA(baddr); 902 INC_BA(baddr);
905 INC_BA(xaddr); 903 INC_BA(xaddr);
906 was_si = (h3270.ea_buf[xaddr].cc == EBC_si); 904 was_si = (h3270.ea_buf[xaddr].cc == EBC_si);
907 - ctlr_add(xaddr, EBC_space, CS_BASE);  
908 - ctlr_add_fg(xaddr, 0);  
909 - ctlr_add_gr(xaddr, 0); 905 + ctlr_add(&h3270,xaddr, EBC_space, CS_BASE);
  906 + ctlr_add_fg(&h3270,xaddr, 0);
  907 + ctlr_add_gr(&h3270,xaddr, 0);
910 if (!was_si) { 908 if (!was_si) {
911 INC_BA(xaddr); 909 INC_BA(xaddr);
912 - ctlr_add(xaddr, EBC_so,  
913 - CS_BASE);  
914 - ctlr_add_fg(xaddr, 0);  
915 - ctlr_add_gr(xaddr, 0); 910 + ctlr_add(&h3270,xaddr, EBC_so,CS_BASE);
  911 + ctlr_add_fg(&h3270,xaddr, 0);
  912 + ctlr_add_gr(&h3270,xaddr, 0);
916 } 913 }
917 } 914 }
918 } 915 }
@@ -923,9 +920,9 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -923,9 +920,9 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
923 return False; 920 return False;
924 break; 921 break;
925 } 922 }
926 - ctlr_add(baddr, (unsigned char)code,(unsigned char)(with_ge ? CS_GE : 0));  
927 - ctlr_add_fg(baddr, 0);  
928 - ctlr_add_gr(baddr, 0); 923 + ctlr_add(&h3270,baddr, (unsigned char)code,(unsigned char)(with_ge ? CS_GE : 0));
  924 + ctlr_add_fg(&h3270,baddr, 0);
  925 + ctlr_add_gr(&h3270,baddr, 0);
929 INC_BA(baddr); 926 INC_BA(baddr);
930 927
931 /* Replace leading nulls with blanks, if desired. */ 928 /* Replace leading nulls with blanks, if desired. */
@@ -958,7 +955,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -958,7 +955,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
958 } 955 }
959 956
960 if (h3270.ea_buf[baddr_fill].cc == EBC_null) 957 if (h3270.ea_buf[baddr_fill].cc == EBC_null)
961 - ctlr_add(baddr_fill, EBC_space, 0); 958 + ctlr_add(&h3270,baddr_fill, EBC_space, 0);
962 DEC_BA(baddr_fill); 959 DEC_BA(baddr_fill);
963 } 960 }
964 } 961 }
@@ -1693,7 +1690,7 @@ do_delete(void) @@ -1693,7 +1690,7 @@ do_delete(void)
1693 1690
1694 /* NULL fill at the end. */ 1691 /* NULL fill at the end. */
1695 for (i = 0; i < ndel; i++) 1692 for (i = 0; i < ndel; i++)
1696 - ctlr_add(end_baddr - i, EBC_null, 0); 1693 + ctlr_add(&h3270,end_baddr - i, EBC_null, 0);
1697 1694
1698 /* Set the MDT for this field. */ 1695 /* Set the MDT for this field. */
1699 mdt_set(h3270.cursor_addr); 1696 mdt_set(h3270.cursor_addr);
@@ -2431,7 +2428,7 @@ LIB3270_ACTION( eraseeol ) @@ -2431,7 +2428,7 @@ LIB3270_ACTION( eraseeol )
2431 /* erase to next field attribute or current line */ 2428 /* erase to next field attribute or current line */
2432 do 2429 do
2433 { 2430 {
2434 - ctlr_add(baddr, EBC_null, 0); 2431 + ctlr_add(&h3270,baddr, EBC_null, 0);
2435 INC_BA(baddr); 2432 INC_BA(baddr);
2436 } while (!h3270.ea_buf[baddr].fa && BA_TO_COL(baddr) > 0); 2433 } while (!h3270.ea_buf[baddr].fa && BA_TO_COL(baddr) > 0);
2437 2434
@@ -2442,7 +2439,7 @@ LIB3270_ACTION( eraseeol ) @@ -2442,7 +2439,7 @@ LIB3270_ACTION( eraseeol )
2442 /* erase to end of current line */ 2439 /* erase to end of current line */
2443 do 2440 do
2444 { 2441 {
2445 - ctlr_add(baddr, EBC_null, 0); 2442 + ctlr_add(&h3270,baddr, EBC_null, 0);
2446 INC_BA(baddr); 2443 INC_BA(baddr);
2447 } while(baddr != 0 && BA_TO_COL(baddr) > 0); 2444 } while(baddr != 0 && BA_TO_COL(baddr) > 0);
2448 } 2445 }
@@ -2491,13 +2488,13 @@ LIB3270_ACTION( eraseeof ) @@ -2491,13 +2488,13 @@ LIB3270_ACTION( eraseeof )
2491 } 2488 }
2492 if (hSession->formatted) { /* erase to next field attribute */ 2489 if (hSession->formatted) { /* erase to next field attribute */
2493 do { 2490 do {
2494 - ctlr_add(baddr, EBC_null, 0); 2491 + ctlr_add(&h3270,baddr, EBC_null, 0);
2495 INC_BA(baddr); 2492 INC_BA(baddr);
2496 } while (!h3270.ea_buf[baddr].fa); 2493 } while (!h3270.ea_buf[baddr].fa);
2497 mdt_set(hSession->cursor_addr); 2494 mdt_set(hSession->cursor_addr);
2498 } else { /* erase to end of screen */ 2495 } else { /* erase to end of screen */
2499 do { 2496 do {
2500 - ctlr_add(baddr, EBC_null, 0); 2497 + ctlr_add(&h3270,baddr, EBC_null, 0);
2501 INC_BA(baddr); 2498 INC_BA(baddr);
2502 } while (baddr != 0); 2499 } while (baddr != 0);
2503 } 2500 }
@@ -2553,7 +2550,7 @@ LIB3270_ACTION( eraseinput ) @@ -2553,7 +2550,7 @@ LIB3270_ACTION( eraseinput )
2553 f = True; 2550 f = True;
2554 } 2551 }
2555 if (!hSession->ea_buf[baddr].fa) { 2552 if (!hSession->ea_buf[baddr].fa) {
2556 - ctlr_add(baddr, EBC_null, 0); 2553 + ctlr_add(&h3270,baddr, EBC_null, 0);
2557 } 2554 }
2558 } while (!hSession->ea_buf[baddr].fa); 2555 } while (!hSession->ea_buf[baddr].fa);
2559 } else { /* skip protected */ 2556 } else { /* skip protected */
@@ -2680,7 +2677,7 @@ LIB3270_ACTION( deletefield ) @@ -2680,7 +2677,7 @@ LIB3270_ACTION( deletefield )
2680 mdt_set(hSession->cursor_addr); 2677 mdt_set(hSession->cursor_addr);
2681 cursor_move(hSession,baddr); 2678 cursor_move(hSession,baddr);
2682 while (!hSession->ea_buf[baddr].fa) { 2679 while (!hSession->ea_buf[baddr].fa) {
2683 - ctlr_add(baddr, EBC_null, 0); 2680 + ctlr_add(hSession,baddr, EBC_null, 0);
2684 INC_BA(baddr); 2681 INC_BA(baddr);
2685 } 2682 }
2686 hSession->display(hSession); 2683 hSession->display(hSession);
@@ -3304,7 +3301,7 @@ kybd_prime(void) @@ -3304,7 +3301,7 @@ kybd_prime(void)
3304 3301
3305 /* Erase it. */ 3302 /* Erase it. */
3306 while (!h3270.ea_buf[baddr].fa) { 3303 while (!h3270.ea_buf[baddr].fa) {
3307 - ctlr_add(baddr, 0, 0); 3304 + ctlr_add(&h3270,baddr, 0, 0);
3308 len++; 3305 len++;
3309 INC_BA(baddr); 3306 INC_BA(baddr);
3310 } 3307 }
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 #define SCREENC_H_INCLUDED 1 16 #define SCREENC_H_INCLUDED 1
17 /* c3270 version of screenc.h */ 17 /* c3270 version of screenc.h */
18 18
19 -#define blink_start() 19 +// #define blink_start()
20 #define display_heightMM() 100 20 #define display_heightMM() 100
21 #define display_height() 1 21 #define display_height() 1
22 #define display_widthMM() 100 22 #define display_widthMM() 100
@@ -26,32 +26,20 @@ @@ -26,32 +26,20 @@
26 #define screen_132() /* */ 26 #define screen_132() /* */
27 #define screen_80() /* */ 27 #define screen_80() /* */
28 28
29 -// #define screen_erase(x) x->erase(x)  
30 -// LIB3270_INTERNAL void screen_erase(H3270 *session);  
31 -  
32 -// LIB3270_INTERNAL void screen_changed(H3270 *session, int bstart, int bend);  
33 -LIB3270_INTERNAL int screen_init(H3270 *session);  
34 -// LIB3270_INTERNAL void screen_flip(void);  
35 -// LIB3270_INTERNAL FILE *start_pager(void);  
36 -LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname);  
37 -  
38 -LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m); 29 +LIB3270_INTERNAL int screen_init(H3270 *session);
  30 +LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname);
  31 +LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m);
39 32
40 #define mcursor_locked(x) mcursor_set(x,CURSOR_MODE_LOCKED) 33 #define mcursor_locked(x) mcursor_set(x,CURSOR_MODE_LOCKED)
41 #define mcursor_normal(x) mcursor_set(x,CURSOR_MODE_NORMAL) 34 #define mcursor_normal(x) mcursor_set(x,CURSOR_MODE_NORMAL)
42 #define mcursor_waiting(x) mcursor_set(x,CURSOR_MODE_WAITING) 35 #define mcursor_waiting(x) mcursor_set(x,CURSOR_MODE_WAITING)
43 36
44 -  
45 -//LIB3270_INTERNAL void mcursor_locked(H3270 *session);  
46 -//LIB3270_INTERNAL void mcursor_normal(H3270 *session);  
47 -//LIB3270_INTERNAL void mcursor_waiting(H3270 *session);  
48 -  
49 LIB3270_INTERNAL void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason); 37 LIB3270_INTERNAL void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason);
50 LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols); 38 LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols);
51 39
52 -LIB3270_INTERNAL Boolean escaped; 40 +// LIB3270_INTERNAL Boolean escaped;
53 41
54 42
55 -LIB3270_INTERNAL void screen_title(char *text); 43 +// LIB3270_INTERNAL void screen_title(char *text);
56 44
57 #endif // SCREENC_H_INCLUDED 45 #endif // SCREENC_H_INCLUDED
@@ -641,7 +641,7 @@ sf_outbound_ds(unsigned char buf[], int buflen) @@ -641,7 +641,7 @@ sf_outbound_ds(unsigned char buf[], int buflen)
641 break; 641 break;
642 case SNA_CMD_EAU: 642 case SNA_CMD_EAU:
643 trace_ds(" EraseAllUnprotected\n"); 643 trace_ds(" EraseAllUnprotected\n");
644 - ctlr_erase_all_unprotected(); 644 + ctlr_erase_all_unprotected(&h3270);
645 break; 645 break;
646 default: 646 default:
647 trace_ds(" unknown type 0x%02x\n", buf[4]); 647 trace_ds(" unknown type 0x%02x\n", buf[4]);
@@ -1923,8 +1923,7 @@ process_eor(void) @@ -1923,8 +1923,7 @@ process_eor(void)
1923 return 0; 1923 return 0;
1924 tn3270e_submode = E_SSCP; 1924 tn3270e_submode = E_SSCP;
1925 check_in3270(&h3270); 1925 check_in3270(&h3270);
1926 - ctlr_write_sscp_lu(h3270.ibuf + EH_SIZE,  
1927 - (ibptr - h3270.ibuf) - EH_SIZE); 1926 + ctlr_write_sscp_lu(&h3270, h3270.ibuf + EH_SIZE,(ibptr - h3270.ibuf) - EH_SIZE);
1928 return 0; 1927 return 0;
1929 default: 1928 default:
1930 /* Should do something more extraordinary here. */ 1929 /* Should do something more extraordinary here. */
@@ -145,6 +145,13 @@ static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TO @@ -145,6 +145,13 @@ static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TO
145 } 145 }
146 146
147 /* 147 /*
  148 + * No-op toggle.
  149 + */
  150 +static void toggle_nop(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused)
  151 +{
  152 +}
  153 +
  154 +/*
148 * Called from system initialization code to handle initial toggle settings. 155 * Called from system initialization code to handle initial toggle settings.
149 */ 156 */
150 void initialize_toggles(H3270 *session) 157 void initialize_toggles(H3270 *session)