From 711c4c36ba68b81b6f8468ce3617a0c9bc2f7925 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Tue, 5 Jun 2012 19:33:37 +0000 Subject: [PATCH] Ajustes para multi-sessao --- ansi.c | 68 +++++++++++++++++++++++++++++++++++--------------------------------- ctlr.c | 408 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ctlrc.h | 67 +++++++++++++++++++++++++++++++++++++++++-------------------------- ft_cut.c | 26 +++++++++++++------------- kybd.c | 77 +++++++++++++++++++++++++++++++++++++---------------------------------------- screenc.h | 24 ++++++------------------ sf.c | 2 +- telnet.c | 3 +-- toggles.c | 7 +++++++ 9 files changed, 341 insertions(+), 341 deletions(-) diff --git a/ansi.c b/ansi.c index f3ee326..90f974e 100644 --- a/ansi.c +++ b/ansi.c @@ -606,7 +606,7 @@ ansi_reset(int ig1 unused, int ig2 unused) held_wrap = False; if (!first) { ctlr_altbuffer(&h3270,True); - ctlr_aclear(0, h3270.rows * h3270.cols, 1); + ctlr_aclear(&h3270, 0, h3270.rows * h3270.cols, 1); ctlr_altbuffer(&h3270,False); ctlr_clear(&h3270,False); screen_80(); @@ -634,7 +634,7 @@ ansi_insert_chars(int nn, int ig2 unused) ctlr_bcopy(h3270.cursor_addr, h3270.cursor_addr + nn, ns, 1); /* Clear the middle of the line */ - ctlr_aclear(h3270.cursor_addr, nn, 1); + ctlr_aclear(&h3270, h3270.cursor_addr, nn, 1); return DATA; } @@ -708,14 +708,14 @@ ansi_erase_in_display(int nn, int ig2 unused) { switch (nn) { case 0: /* below */ - ctlr_aclear(h3270.cursor_addr, (h3270.rows * h3270.cols) - h3270.cursor_addr, 1); + ctlr_aclear(&h3270, h3270.cursor_addr, (h3270.rows * h3270.cols) - h3270.cursor_addr, 1); break; case 1: /* above */ - ctlr_aclear(0, h3270.cursor_addr + 1, 1); + ctlr_aclear(&h3270, 0, h3270.cursor_addr + 1, 1); break; case 2: /* all (without moving cursor) */ // if (h3270.cursor_addr == 0 && !h3270.is_altbuffer) scroll_save(h3270.rows, True); - ctlr_aclear(0, h3270.rows * h3270.cols, 1); + ctlr_aclear(&h3270, 0, h3270.rows * h3270.cols, 1); break; } return DATA; @@ -728,13 +728,13 @@ ansi_erase_in_line(int nn, int ig2 unused) switch (nn) { case 0: /* to right */ - ctlr_aclear(h3270.cursor_addr, h3270.cols - nc, 1); + ctlr_aclear(&h3270, h3270.cursor_addr, h3270.cols - nc, 1); break; case 1: /* to left */ - ctlr_aclear(h3270.cursor_addr - nc, nc+1, 1); + ctlr_aclear(&h3270, h3270.cursor_addr - nc, nc+1, 1); break; case 2: /* all */ - ctlr_aclear(h3270.cursor_addr - nc, h3270.cols, 1); + ctlr_aclear(&h3270, h3270.cursor_addr - nc, h3270.cols, 1); break; } return DATA; @@ -762,7 +762,7 @@ ansi_insert_lines(int nn, int ig2 unused) ctlr_bcopy(rr * h3270.cols, (rr + nn) * h3270.cols, ns * h3270.cols, 1); /* Clear the middle of the screen */ - ctlr_aclear(rr * h3270.cols, nn * h3270.cols, 1); + ctlr_aclear(&h3270, rr * h3270.cols, nn * h3270.cols, 1); return DATA; } @@ -788,7 +788,7 @@ ansi_delete_lines(int nn, int ig2 unused) ctlr_bcopy((rr + nn) * h3270.cols, rr * h3270.cols, ns * h3270.cols, 1); /* Clear the rest of the screen */ - ctlr_aclear((rr + ns) * h3270.cols, nn * h3270.cols, 1); + ctlr_aclear(&h3270, (rr + ns) * h3270.cols, nn * h3270.cols, 1); return DATA; } @@ -810,7 +810,7 @@ ansi_delete_chars(int nn, int ig2 unused) ctlr_bcopy(h3270.cursor_addr + nn, h3270.cursor_addr, ns, 1); /* Clear the end of the line */ - ctlr_aclear(h3270.cursor_addr + ns, nn, 1); + ctlr_aclear(&h3270, h3270.cursor_addr + ns, nn, 1); return DATA; } @@ -1069,16 +1069,15 @@ ansi_printing(int ig1 unused, int ig2 unused) switch (csd[(once_cset != -1) ? once_cset : cset]) { case CSD_LD: /* line drawing "0" */ if (ansi_ch >= 0x5f && ansi_ch <= 0x7e) - ctlr_add(h3270.cursor_addr, (unsigned char)(ansi_ch - 0x5f), - CS_LINEDRAW); + ctlr_add(&h3270,h3270.cursor_addr, (unsigned char)(ansi_ch - 0x5f),CS_LINEDRAW); else - ctlr_add(h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE); + ctlr_add(&h3270,h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE); break; case CSD_UK: /* UK "A" */ if (ansi_ch == '#') - ctlr_add(h3270.cursor_addr, 0x1e, CS_LINEDRAW); + ctlr_add(&h3270,h3270.cursor_addr, 0x1e, CS_LINEDRAW); else - ctlr_add(h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE); + ctlr_add(&h3270,h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE); break; case CSD_US: /* US "B" */ ebc_ch = asc2ebc[ansi_ch]; @@ -1156,7 +1155,7 @@ ansi_printing(int ig1 unused, int ig2 unused) ea_buf[cursor_addr].db = DBCS_NONE; } #endif /*]*/ - ctlr_add(h3270.cursor_addr, ebc_ch, default_cs); + ctlr_add(&h3270,h3270.cursor_addr, ebc_ch, default_cs); #if defined(X3270_DBCS) /*[*/ if (default_cs == CS_DBCS) (void) ctlr_dbcs_postprocess(); @@ -1164,9 +1163,9 @@ ansi_printing(int ig1 unused, int ig2 unused) break; } once_cset = -1; - ctlr_add_gr(h3270.cursor_addr, gr); - ctlr_add_fg(h3270.cursor_addr, fg); - ctlr_add_bg(h3270.cursor_addr, bg); + ctlr_add_gr(&h3270,h3270.cursor_addr, gr); + ctlr_add_fg(&h3270,h3270.cursor_addr, fg); + ctlr_add_bg(&h3270,h3270.cursor_addr, bg); if (wraparound_mode) { /* * There is a fascinating behavior of xterm which we will @@ -1588,40 +1587,43 @@ xterm_text(int ig1 unused, int ig2 unused) static enum state xterm_text_do(int ig1 unused, int ig2 unused) { -#if defined(X3270_DISPLAY) || defined(WC3270) /*[*/ +/* +#if defined(X3270_DISPLAY) || defined(WC3270) text[tx] = '\0'; -#endif /*]*/ +#endif -#if defined(X3270_DISPLAY) /*[*/ +#if defined(X3270_DISPLAY) switch (n[0]) { - case 0: /* icon name and window title */ + case 0: // icon name and window title XtVaSetValues(toplevel, XtNiconName, text, NULL); XtVaSetValues(toplevel, XtNtitle, text, NULL); break; - case 1: /* icon name */ + case 1: // icon name XtVaSetValues(toplevel, XtNiconName, text, NULL); break; - case 2: /* window_title */ + case 2: // window_title XtVaSetValues(toplevel, XtNtitle, text, NULL); break; - case 50: /* font */ + case 50: // font screen_newfont(text, False, False); break; default: break; } -#endif /*]*/ +#endif -#if defined(WC3270) /*[*/ + +#if defined(WC3270) switch (n[0]) { - case 0: /* icon name and window title */ - case 2: /* window_title */ + case 0: // icon name and window title + case 2: // window_title screen_title(text); break; default: break; } -#endif /*]*/ +#endif +*/ return DATA; } @@ -1678,7 +1680,7 @@ ansi_scroll(void) 1); /* Clear the last line */ - ctlr_aclear((scroll_bottom - 1) * h3270.cols, h3270.cols, 1); + ctlr_aclear(&h3270, (scroll_bottom - 1) * h3270.cols, h3270.cols, 1); } /* Callback for when we enter ANSI mode. */ diff --git a/ctlr.c b/ctlr.c index fc7fb6d..89170ab 100644 --- a/ctlr.c +++ b/ctlr.c @@ -73,7 +73,7 @@ static void ctlr_blanks(H3270 *session); static void ctlr_half_connect(H3270 *session, int ignored, void *dunno); static void ctlr_connect(H3270 *session, int ignored, void *dunno); static void ticking_stop(H3270 *session); -static void ctlr_add_ic(int baddr, unsigned char ic); +static void ctlr_add_ic(H3270 *session, int baddr, unsigned char ic); /* * code_table is used to translate buffer addresses and attributes to the 3270 @@ -478,7 +478,7 @@ process_ds(unsigned char *buf, int buflen) case CMD_EAU: /* erase all unprotected */ case SNA_CMD_EAU: trace_ds("EraseAllUnprotected\n"); - ctlr_erase_all_unprotected(); + ctlr_erase_all_unprotected(&h3270); return PDS_OKAY_NO_OUTPUT; break; case CMD_EWA: /* erase/write alternate */ @@ -899,7 +899,7 @@ ctlr_read_buffer(unsigned char aid_byte) #if defined(X3270_TRACE) /*[*/ /* * Construct a 3270 command to reproduce the current state of the display. - */ + */ /* void ctlr_snap_buffer(void) { @@ -920,7 +920,7 @@ ctlr_snap_buffer(void) space3270out(4); *obptr++ = ORDER_SFE; attr_count = obptr - obuf; - *obptr++ = 1; /* for now */ + *obptr++ = 1; // for now *obptr++ = XA_3270; *obptr++ = code_table[h3270.ea_buf[baddr].fa & ~FA_PRINTABLE]; if (h3270.ea_buf[baddr].fg) { @@ -998,12 +998,12 @@ ctlr_snap_buffer(void) *obptr++ = ORDER_SBA; ENCODE_BADDR(obptr, h3270.cursor_addr); *obptr++ = ORDER_IC; -} +} */ /* * Construct a 3270 command to reproduce the reply mode. * Returns a Boolean indicating if one is necessary. - */ + */ /* Boolean ctlr_snap_modes(void) { @@ -1014,70 +1014,69 @@ ctlr_snap_modes(void) space3270out(6 + h3270.crm_nattr); *obptr++ = CMD_WSF; - *obptr++ = 0x00; /* implicit length */ + *obptr++ = 0x00; // implicit length *obptr++ = 0x00; *obptr++ = SF_SET_REPLY_MODE; - *obptr++ = 0x00; /* partition 0 */ + *obptr++ = 0x00; // partition 0 *obptr++ = h3270.reply_mode; if (h3270.reply_mode == SF_SRM_CHAR) for (i = 0; i < h3270.crm_nattr; i++) *obptr++ = h3270.crm_attr[i]; return True; -} -#endif /*]*/ +} */ +#endif /* * Process a 3270 Erase All Unprotected command. */ -void -ctlr_erase_all_unprotected(void) +void ctlr_erase_all_unprotected(H3270 *hSession) { register int baddr, sbaddr; unsigned char fa; Boolean f; - kybd_inhibit(&h3270,False); + kybd_inhibit(hSession,False); - if (h3270.formatted) { + if (hSession->formatted) { /* find first field attribute */ baddr = 0; do { - if (h3270.ea_buf[baddr].fa) + if (hSession->ea_buf[baddr].fa) break; INC_BA(baddr); } while (baddr != 0); sbaddr = baddr; f = False; do { - fa = h3270.ea_buf[baddr].fa; + fa = hSession->ea_buf[baddr].fa; if (!FA_IS_PROTECTED(fa)) { mdt_clear(baddr); do { INC_BA(baddr); if (!f) { - cursor_move(&h3270,baddr); + cursor_move(hSession,baddr); f = True; } - if (!h3270.ea_buf[baddr].fa) { - ctlr_add(baddr, EBC_null, 0); + if (!hSession->ea_buf[baddr].fa) { + ctlr_add(hSession,baddr, EBC_null, 0); } - } while (!h3270.ea_buf[baddr].fa); + } while (!hSession->ea_buf[baddr].fa); } else { do { INC_BA(baddr); - } while (!h3270.ea_buf[baddr].fa); + } while (!hSession->ea_buf[baddr].fa); } } while (baddr != sbaddr); if (!f) - cursor_move(&h3270,0); + cursor_move(hSession,0); } else { - ctlr_clear(&h3270,True); + ctlr_clear(hSession,True); } - h3270.aid = AID_NO; - do_reset(&h3270,False); - ALL_CHANGED(&h3270); + hSession->aid = AID_NO; + do_reset(hSession,False); + ALL_CHANGED(hSession); } @@ -1122,12 +1121,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) /* XXX: Should there be a ctlr_add_cs call here? */ #define START_FIELD(fa) { \ current_fa = fa; \ - ctlr_add_fa(h3270.buffer_addr, fa, 0); \ - ctlr_add_cs(h3270.buffer_addr, 0); \ - ctlr_add_fg(h3270.buffer_addr, 0); \ - ctlr_add_bg(h3270.buffer_addr, 0); \ - ctlr_add_gr(h3270.buffer_addr, 0); \ - ctlr_add_ic(h3270.buffer_addr, 0); \ + ctlr_add_fa(&h3270,h3270.buffer_addr, fa, 0); \ + ctlr_add_cs(&h3270,h3270.buffer_addr, 0); \ + ctlr_add_fg(&h3270,h3270.buffer_addr, 0); \ + ctlr_add_bg(&h3270,h3270.buffer_addr, 0); \ + ctlr_add_gr(&h3270,h3270.buffer_addr, 0); \ + ctlr_add_ic(&h3270,h3270.buffer_addr, 0); \ trace_ds("%s",see_attr(fa)); \ h3270.formatted = True; \ } @@ -1203,8 +1202,8 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) previous = ORDER; cp++; /* skip field attribute */ START_FIELD(*cp); - ctlr_add_fg(h3270.buffer_addr, 0); - ctlr_add_bg(h3270.buffer_addr, 0); + ctlr_add_fg(&h3270,h3270.buffer_addr, 0); + ctlr_add_bg(&h3270,h3270.buffer_addr, 0); INC_BA(h3270.buffer_addr); last_cmd = True; last_zpt = False; @@ -1265,12 +1264,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) trace_ds("(nulling)"); while ((h3270.buffer_addr != baddr) && (!h3270.ea_buf[h3270.buffer_addr].fa)) { - ctlr_add(h3270.buffer_addr, EBC_null, 0); - ctlr_add_cs(h3270.buffer_addr, 0); - ctlr_add_fg(h3270.buffer_addr, 0); - ctlr_add_bg(h3270.buffer_addr, 0); - ctlr_add_gr(h3270.buffer_addr, 0); - ctlr_add_ic(h3270.buffer_addr, 0); + ctlr_add(&h3270,h3270.buffer_addr, EBC_null, 0); + ctlr_add_cs(&h3270,h3270.buffer_addr, 0); + ctlr_add_fg(&h3270,h3270.buffer_addr, 0); + ctlr_add_bg(&h3270,h3270.buffer_addr, 0); + ctlr_add_gr(&h3270,h3270.buffer_addr, 0); + ctlr_add_ic(&h3270,h3270.buffer_addr, 0); INC_BA(h3270.buffer_addr); } if (baddr == 0) @@ -1352,25 +1351,25 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) } do { if (add_dbcs) { - ctlr_add(h3270.buffer_addr, add_c1,h3270.default_cs); + ctlr_add(&h3270,h3270.buffer_addr, add_c1,h3270.default_cs); } else { if (ra_ge) - ctlr_add(h3270.buffer_addr, add_c1,CS_GE); + ctlr_add(&h3270,h3270.buffer_addr, add_c1,CS_GE); else if (h3270.default_cs) - ctlr_add(h3270.buffer_addr, add_c1,h3270.default_cs); + ctlr_add(&h3270,h3270.buffer_addr, add_c1,h3270.default_cs); else - ctlr_add(h3270.buffer_addr, add_c1,0); + ctlr_add(&h3270,h3270.buffer_addr, add_c1,0); } - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); if (add_dbcs) { - ctlr_add(h3270.buffer_addr, add_c2,h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add(&h3270,h3270.buffer_addr, add_c2,h3270.default_cs); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); } } while (h3270.buffer_addr != baddr); @@ -1400,7 +1399,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) if (h3270.ea_buf[h3270.buffer_addr].fa) current_fa = h3270.ea_buf[h3270.buffer_addr].fa; else if (!FA_IS_PROTECTED(current_fa)) { - ctlr_add(h3270.buffer_addr, EBC_null, + ctlr_add(&h3270,h3270.buffer_addr, EBC_null, CS_BASE); } INC_BA(h3270.buffer_addr); @@ -1419,11 +1418,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) trace_ds("%s", see_ebc(*cp)); if (*cp) trace_ds("'"); - ctlr_add(h3270.buffer_addr, *cp, CS_GE); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add(&h3270,h3270.buffer_addr, *cp, CS_GE); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); current_fa = get_field_attribute(&h3270,h3270.buffer_addr); last_cmd = False; @@ -1442,7 +1441,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) if (*cp == XA_3270) { trace_ds(" 3270"); cp++; - ctlr_add_fa(h3270.buffer_addr, *cp, + ctlr_add_fa(&h3270,h3270.buffer_addr, *cp, h3270.ea_buf[h3270.buffer_addr].cs); trace_ds("%s",see_attr(*cp)); } else if (*cp == XA_FOREGROUND) { @@ -1451,20 +1450,20 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) *(cp + 1))); cp++; if (h3270.m3279) - ctlr_add_fg(h3270.buffer_addr, *cp); + ctlr_add_fg(&h3270,h3270.buffer_addr, *cp); } else if (*cp == XA_BACKGROUND) { trace_ds("%s", see_efa(*cp, *(cp + 1))); cp++; if (h3270.m3279) - ctlr_add_bg(h3270.buffer_addr, *cp); + ctlr_add_bg(&h3270,h3270.buffer_addr, *cp); } else if (*cp == XA_HIGHLIGHTING) { trace_ds("%s", see_efa(*cp, *(cp + 1))); cp++; - ctlr_add_gr(h3270.buffer_addr, *cp & 0x0f); + ctlr_add_gr(&h3270,h3270.buffer_addr, *cp & 0x0f); } else if (*cp == XA_CHARSET) { int cs = 0; @@ -1476,7 +1475,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) cs = CS_APL; else if (*cp == 0xf8) cs = CS_DBCS; - ctlr_add_cs(h3270.buffer_addr, cs); + ctlr_add_cs(&h3270,h3270.buffer_addr, cs); } else if (*cp == XA_ALL) { trace_ds("%s", see_efa(*cp, @@ -1486,7 +1485,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) trace_ds("%s", see_efa(*cp, *(cp + 1))); - ctlr_add_ic(h3270.buffer_addr, + ctlr_add_ic(&h3270,h3270.buffer_addr, (*(cp + 1) == 1)); cp++; } else { @@ -1558,11 +1557,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) } if (!any_fa) START_FIELD(0); - ctlr_add_cs(h3270.buffer_addr, efa_cs); - ctlr_add_fg(h3270.buffer_addr, efa_fg); - ctlr_add_bg(h3270.buffer_addr, efa_bg); - ctlr_add_gr(h3270.buffer_addr, efa_gr); - ctlr_add_ic(h3270.buffer_addr, efa_ic); + ctlr_add_cs(&h3270,h3270.buffer_addr, efa_cs); + ctlr_add_fg(&h3270,h3270.buffer_addr, efa_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, efa_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, efa_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, efa_ic); INC_BA(h3270.buffer_addr); last_cmd = True; last_zpt = False; @@ -1629,11 +1628,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) if (h3270.default_cs == CS_DBCS || d != DBCS_NONE) { ABORT_WRITE("invalid format control order in DBCS field"); } - ctlr_add(h3270.buffer_addr, *cp, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); last_cmd = True; last_zpt = False; @@ -1653,11 +1652,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) } /* All is well. */ previous = ORDER; - ctlr_add(h3270.buffer_addr, *cp, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); last_cmd = True; last_zpt = False; @@ -1692,11 +1691,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) } /* All is well. */ previous = ORDER; - ctlr_add(h3270.buffer_addr, *cp, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); last_cmd = True; last_zpt = False; @@ -1745,18 +1744,18 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) END_TEXT("NULL"); add_c1 = *cp; } - ctlr_add(h3270.buffer_addr, add_c1, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add(&h3270,h3270.buffer_addr, add_c1, h3270.default_cs); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); if (add_dbcs) { - ctlr_add(h3270.buffer_addr, add_c2, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add(&h3270,h3270.buffer_addr, add_c2, h3270.default_cs); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); } last_cmd = False; @@ -1803,19 +1802,19 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) #if defined(X3270_DBCS) /*[*/ } #endif /*]*/ - ctlr_add(h3270.buffer_addr, add_c1, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add(&h3270,h3270.buffer_addr, add_c1, h3270.default_cs); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); #if defined(X3270_DBCS) /*[*/ if (add_dbcs) { ctlr_add(h3270.buffer_addr, add_c2, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); + ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); + ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); INC_BA(h3270.buffer_addr); } #endif /*]*/ @@ -1864,8 +1863,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) * Write SSCP-LU data, which is quite a bit dumber than regular 3270 * output. */ -void -ctlr_write_sscp_lu(unsigned char buf[], int buflen) +void ctlr_write_sscp_lu(H3270 *hSession, unsigned char buf[], int buflen) { int i; unsigned char *cp = buf; @@ -1888,14 +1886,15 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) * Insert NULLs to the end of the line and advance to * the beginning of the next line. */ - s_row = h3270.buffer_addr / h3270.cols; - while ((h3270.buffer_addr / h3270.cols) == s_row) { - ctlr_add(h3270.buffer_addr, EBC_null, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); - INC_BA(h3270.buffer_addr); + s_row = hSession->buffer_addr / hSession->cols; + while ((hSession->buffer_addr / hSession->cols) == s_row) + { + ctlr_add(hSession,hSession->buffer_addr, EBC_null, hSession->default_cs); + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg); + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg); + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr); + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic); + INC_BA(hSession->buffer_addr); } break; @@ -1903,21 +1902,22 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) /* Some hosts forget they're talking SSCP-LU. */ cp++; i++; - trace_ds(" StartField%s %s [translated to space]\n",rcba(&h3270,h3270.buffer_addr), see_attr(*cp)); - ctlr_add(h3270.buffer_addr, EBC_space, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); - INC_BA(h3270.buffer_addr); + trace_ds(" StartField%s %s [translated to space]\n",rcba(hSession,hSession->buffer_addr), see_attr(*cp)); + ctlr_add(hSession,hSession->buffer_addr, EBC_space, hSession->default_cs); + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg); + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg); + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr); + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic); + INC_BA(hSession->buffer_addr); break; + case ORDER_IC: - trace_ds(" InsertCursor%s [ignored]\n", - rcba(&h3270,h3270.buffer_addr)); + trace_ds(" InsertCursor%s [ignored]\n",rcba(hSession,hSession->buffer_addr)); break; + case ORDER_SBA: // baddr = DECODE_BADDR(*(cp+1), *(cp+2)); - trace_ds(" SetBufferAddress%s [ignored]\n", rcba(&h3270,DECODE_BADDR(*(cp+1), *(cp+2)))); + trace_ds(" SetBufferAddress%s [ignored]\n", rcba(hSession,DECODE_BADDR(*(cp+1), *(cp+2)))); cp += 2; i += 2; break; @@ -1926,34 +1926,36 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) cp++; if (++i >= buflen) break; + if (*cp <= 0x40) c = EBC_space; else c = *cp; - ctlr_add(h3270.buffer_addr, c, CS_GE); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); - INC_BA(h3270.buffer_addr); + + ctlr_add(hSession,hSession->buffer_addr, c, CS_GE); + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg); + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg); + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr); + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic); + INC_BA(hSession->buffer_addr); break; default: - ctlr_add(h3270.buffer_addr, *cp, h3270.default_cs); - ctlr_add_fg(h3270.buffer_addr, h3270.default_fg); - ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); - ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); - ctlr_add_ic(h3270.buffer_addr, h3270.default_ic); - INC_BA(h3270.buffer_addr); + ctlr_add(hSession,hSession->buffer_addr, *cp, hSession->default_cs); + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg); + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg); + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr); + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic); + INC_BA(hSession->buffer_addr); break; } } - cursor_move(&h3270,h3270.buffer_addr); - h3270.sscp_start = h3270.buffer_addr; + cursor_move(hSession,hSession->buffer_addr); + hSession->sscp_start = hSession->buffer_addr; /* Unlock the keyboard. */ - h3270.aid = AID_NO; - do_reset(&h3270,False); + hSession->aid = AID_NO; + do_reset(hSession,False); } @@ -2263,16 +2265,16 @@ ps_process(void) /* * Tell me if there is any data on the screen. */ -Boolean -ctlr_any_data(void) +int ctlr_any_data(H3270 *session) { register int i; - for (i = 0; i < h3270.rows*h3270.cols; i++) { - if (!IsBlank(h3270.ea_buf[i].cc)) - return True; + for(i = 0; i < session->rows*session->cols; i++) + { + if (!IsBlank(session->ea_buf[i].cc)) + return 1; } - return False; + return 0; } /* @@ -2283,7 +2285,7 @@ void ctlr_clear(H3270 *session, Boolean can_snap) { /* Snap any data that is about to be lost into the trace file. */ - if (ctlr_any_data()) { + if (ctlr_any_data(session)) { #if defined(X3270_TRACE) /*[*/ if (can_snap && !trace_skipping && lib3270_get_toggle(session,LIB3270_TOGGLE_SCREEN_TRACE)) trace_screen(session); @@ -2337,124 +2339,122 @@ static void ctlr_blanks(H3270 *session) * Change a character in the 3270 buffer. * Removes any field attribute defined at that location. */ -void ctlr_add(int baddr, unsigned char c, unsigned char cs) +void ctlr_add(H3270 *hSession, int baddr, unsigned char c, unsigned char cs) { unsigned char oc = 0; - if(h3270.ea_buf[baddr].fa || ((oc = h3270.ea_buf[baddr].cc) != c || h3270.ea_buf[baddr].cs != cs)) + if(hSession->ea_buf[baddr].fa || ((oc = hSession->ea_buf[baddr].cc) != c || hSession->ea_buf[baddr].cs != cs)) { - if (h3270.trace_primed && !IsBlank(oc)) + if (hSession->trace_primed && !IsBlank(oc)) { #if defined(X3270_TRACE) /*[*/ - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_SCREEN_TRACE)) - trace_screen(&h3270); + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_SCREEN_TRACE)) + trace_screen(hSession); #endif /*]*/ - h3270.trace_primed = 0; + hSession->trace_primed = 0; } - h3270.ea_buf[baddr].cc = c; - h3270.ea_buf[baddr].cs = cs; - h3270.ea_buf[baddr].fa = 0; - ONE_CHANGED(&h3270,baddr); + hSession->ea_buf[baddr].cc = c; + hSession->ea_buf[baddr].cs = cs; + hSession->ea_buf[baddr].fa = 0; + ONE_CHANGED(hSession,baddr); } } /* * Set a field attribute in the 3270 buffer. */ -void -ctlr_add_fa(int baddr, unsigned char fa, unsigned char cs) +void ctlr_add_fa(H3270 *hSession, int baddr, unsigned char fa, unsigned char cs) { /* Put a null in the display buffer. */ - ctlr_add(baddr, EBC_null, cs); + ctlr_add(hSession, baddr, EBC_null, cs); /* * Store the new attribute, setting the 'printable' bits so that the * value will be non-zero. */ - h3270.ea_buf[baddr].fa = FA_PRINTABLE | (fa & FA_MASK); + hSession->ea_buf[baddr].fa = FA_PRINTABLE | (fa & FA_MASK); } /* * Change the character set for a field in the 3270 buffer. */ void -ctlr_add_cs(int baddr, unsigned char cs) +ctlr_add_cs(H3270 *hSession, int baddr, unsigned char cs) { - if (h3270.ea_buf[baddr].cs != cs) + if (hSession->ea_buf[baddr].cs != cs) { /* if (SELECTED(baddr)) unselect(baddr, 1); */ - h3270.ea_buf[baddr].cs = cs; - ONE_CHANGED(&h3270,baddr); + hSession->ea_buf[baddr].cs = cs; + ONE_CHANGED(hSession,baddr); } } /* * Change the graphic rendition of a character in the 3270 buffer. */ -void -ctlr_add_gr(int baddr, unsigned char gr) +void ctlr_add_gr(H3270 *hSession, int baddr, unsigned char gr) { - if (h3270.ea_buf[baddr].gr != gr) + if (hSession->ea_buf[baddr].gr != gr) { - h3270.ea_buf[baddr].gr = gr; - if (gr & GR_BLINK) - blink_start(); - ONE_CHANGED(&h3270,baddr); + hSession->ea_buf[baddr].gr = gr; +// if (gr & GR_BLINK) +// blink_start(); + ONE_CHANGED(hSession,baddr); } } /* * Change the foreground color for a character in the 3270 buffer. */ -void -ctlr_add_fg(int baddr, unsigned char color) +void ctlr_add_fg(H3270 *hSession, int baddr, unsigned char color) { - if (!h3270.m3279) + if (!hSession->m3279) return; + if ((color & 0xf0) != 0xf0) color = 0; - if (h3270.ea_buf[baddr].fg != color) + + if (hSession->ea_buf[baddr].fg != color) { - h3270.ea_buf[baddr].fg = color; - ONE_CHANGED(&h3270,baddr); + hSession->ea_buf[baddr].fg = color; + ONE_CHANGED(hSession,baddr); } } /* * Change the background color for a character in the 3270 buffer. */ -void -ctlr_add_bg(int baddr, unsigned char color) +void ctlr_add_bg(H3270 *hSession, int baddr, unsigned char color) { - if (!h3270.m3279) + if (!hSession->m3279) return; + if ((color & 0xf0) != 0xf0) color = 0; - if (h3270.ea_buf[baddr].bg != color) + + if (hSession->ea_buf[baddr].bg != color) { - h3270.ea_buf[baddr].bg = color; - ONE_CHANGED(&h3270,baddr); + hSession->ea_buf[baddr].bg = color; + ONE_CHANGED(hSession,baddr); } } /* * Change the input control bit for a character in the 3270 buffer. */ -static void -ctlr_add_ic(int baddr, unsigned char ic) +static void ctlr_add_ic(H3270 *hSession, int baddr, unsigned char ic) { - h3270.ea_buf[baddr].ic = ic; + hSession->ea_buf[baddr].ic = ic; } /* * Wrapping bersion of ctlr_bcopy. */ -void -ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count) +void ctlr_wrapping_memmove(H3270 *hSession, int baddr_to, int baddr_from, int count) { /* * 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) * It's faster to figure out if none of this is true, then do a slow * location-at-a-time version only if it happens. */ - if (baddr_from + count <= h3270.rows*h3270.cols && - baddr_to + count <= h3270.rows*h3270.cols) { + if (baddr_from + count <= hSession->rows*hSession->cols && + baddr_to + count <= hSession->rows*hSession->cols) { ctlr_bcopy(baddr_from, baddr_to, count, True); } else { int i, from, to; @@ -2473,12 +2473,12 @@ ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count) for (i = 0; i < count; i++) { if (baddr_to > baddr_from) { /* Shifting right, move left. */ - to = (baddr_to + count - 1 - i) % h3270.rows*h3270.cols; - from = (baddr_from + count - 1 - i) % h3270.rows*h3270.cols; + to = (baddr_to + count - 1 - i) % hSession->rows*hSession->cols; + from = (baddr_from + count - 1 - i) % hSession->rows*hSession->cols; } else { /* Shifting left, move right. */ - to = (baddr_to + i) % h3270.rows*h3270.cols; - from = (baddr_from + i) % h3270.rows*h3270.cols; + to = (baddr_to + i) % hSession->rows*hSession->cols; + from = (baddr_from + i) % hSession->rows*hSession->cols; } ctlr_bcopy(from, to, 1, True); } @@ -2509,13 +2509,13 @@ ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea) * Erase a region of the 3270 buffer, optionally clearing extended attributes * as well. */ -void ctlr_aclear(int baddr, int count, int clear_ea) +void ctlr_aclear(H3270 *session, int baddr, int count, int clear_ea) { - if (memcmp((char *) &h3270.ea_buf[baddr], (char *) h3270.zero_buf, + if (memcmp((char *) &session->ea_buf[baddr], (char *) session->zero_buf, count * sizeof(struct ea))) { - (void) memset((char *) &h3270.ea_buf[baddr], 0, + (void) memset((char *) &session->ea_buf[baddr], 0, count * sizeof(struct ea)); - REGION_CHANGED(&h3270,baddr, baddr + count); + REGION_CHANGED(session,baddr, baddr + count); } /* XXX: What about clear_ea? */ } @@ -2591,7 +2591,7 @@ void ctlr_altbuffer(H3270 *session, int alt) * There may be blinkers on the alternate screen; schedule one * iteration just in case. */ - blink_start(); +// blink_start(); } } @@ -2628,9 +2628,8 @@ mdt_clear(int baddr) /* * Support for screen-size swapping for scrolling - */ -void -ctlr_shrink(void) + */ /* +void ctlr_shrink(void) { int baddr; @@ -2642,6 +2641,7 @@ ctlr_shrink(void) ALL_CHANGED(&h3270); h3270.display(&h3270); } +*/ #if defined(X3270_DBCS) /*[*/ /* @@ -2754,11 +2754,3 @@ static void ticking_stop(H3270 *session) status_timing(session,&t_start, &t1); } } - -/* - * No-op toggle. - */ -void toggle_nop(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) -{ -} - diff --git a/ctlrc.h b/ctlrc.h index d16b244..97c577b 100644 --- a/ctlrc.h +++ b/ctlrc.h @@ -1,15 +1,30 @@ /* - * Copyright 1995, 1999, 2000, 2002, 2003, 2005 by Paul Mattes. - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation. + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA, 02111-1307, USA + * + * Este programa está nomeado como ctlrc.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) * - * x3270, c3270, s3270 and tcl3270 are distributed in the hope that they will - * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE - * for more details. */ /* @@ -24,30 +39,30 @@ enum pds { PDS_BAD_ADDR = -2 /* command contained a bad address */ }; -LIB3270_INTERNAL void ctlr_aclear(int baddr, int count, int clear_ea); -LIB3270_INTERNAL void ctlr_add(int baddr, unsigned char c, unsigned char cs); -LIB3270_INTERNAL void ctlr_add_bg(int baddr, unsigned char color); -LIB3270_INTERNAL void ctlr_add_cs(int baddr, unsigned char cs); -LIB3270_INTERNAL void ctlr_add_fa(int baddr, unsigned char fa, unsigned char cs); -LIB3270_INTERNAL void ctlr_add_fg(int baddr, unsigned char color); -LIB3270_INTERNAL void ctlr_add_gr(int baddr, unsigned char gr); +LIB3270_INTERNAL void ctlr_aclear(H3270 *session, int baddr, int count, int clear_ea); +LIB3270_INTERNAL void ctlr_add(H3270 *hSession, int baddr, unsigned char c, unsigned char cs); +LIB3270_INTERNAL void ctlr_add_bg(H3270 *hSession, int baddr, unsigned char color); +LIB3270_INTERNAL void ctlr_add_cs(H3270 *hSession, int baddr, unsigned char cs); +LIB3270_INTERNAL void ctlr_add_fa(H3270 *hSession, int baddr, unsigned char fa, unsigned char cs); +LIB3270_INTERNAL void ctlr_add_fg(H3270 *hSession, int baddr, unsigned char color); +LIB3270_INTERNAL void ctlr_add_gr(H3270 *hSession, int baddr, unsigned char gr); LIB3270_INTERNAL void ctlr_altbuffer(H3270 *session, int alt); -LIB3270_INTERNAL Boolean ctlr_any_data(void); +LIB3270_INTERNAL int ctlr_any_data(H3270 *session); LIB3270_INTERNAL void ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea); // LIB3270_INTERNAL void ctlr_changed(int bstart, int bend); LIB3270_INTERNAL void ctlr_clear(H3270 *session, Boolean can_snap); -LIB3270_INTERNAL void ctlr_erase_all_unprotected(void); +LIB3270_INTERNAL void ctlr_erase_all_unprotected(H3270 *hSession); LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask); LIB3270_INTERNAL void ctlr_read_buffer(unsigned char aid_byte); LIB3270_INTERNAL void ctlr_read_modified(unsigned char aid_byte, Boolean all); LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask); LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession); -LIB3270_INTERNAL void ctlr_shrink(void); -LIB3270_INTERNAL void ctlr_snap_buffer(void); -LIB3270_INTERNAL Boolean ctlr_snap_modes(void); -LIB3270_INTERNAL void ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count); +// LIB3270_INTERNAL void ctlr_shrink(void); +// LIB3270_INTERNAL void ctlr_snap_buffer(void); +// LIB3270_INTERNAL Boolean ctlr_snap_modes(void); +LIB3270_INTERNAL void ctlr_wrapping_memmove(H3270 *session, int baddr_to, int baddr_from, int count); LIB3270_INTERNAL enum pds ctlr_write(unsigned char buf[], int buflen, Boolean erase); -LIB3270_INTERNAL void ctlr_write_sscp_lu(unsigned char buf[], int buflen); +LIB3270_INTERNAL void ctlr_write_sscp_lu(H3270 *session, unsigned char buf[], int buflen); LIB3270_INTERNAL struct ea *fa2ea(int baddr); 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 LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); -LIB3270_INTERNAL void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); -LIB3270_INTERNAL void toggle_showTiming(struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); +// LIB3270_INTERNAL void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); +// LIB3270_INTERNAL void toggle_showTiming(struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); enum dbcs_state { DBCS_NONE = 0, /* position is not DBCS */ diff --git a/ft_cut.c b/ft_cut.c index 079f1a6..f95e4fe 100644 --- a/ft_cut.c +++ b/ft_cut.c @@ -392,7 +392,7 @@ cut_data_request(void) /* Copy data into the screen buffer. */ count = 0; while (count < O_UP_MAX && (c = xlate_getc()) != EOF) { - ctlr_add(O_UP_DATA + count, c, 0); + ctlr_add(&h3270,O_UP_DATA + count, c, 0); count++; } @@ -402,7 +402,7 @@ cut_data_request(void) /* Clean out any data we may have written. */ for (j = 0; j < count; j++) - ctlr_add(O_UP_DATA + j, 0, 0); + ctlr_add(&h3270,O_UP_DATA + j, 0, 0); /* Abort the transfer. */ cut_abort(SC_ABORT_FILE,_( "Error \"%s\" reading from local file (rc=%d)" ), strerror(errno), errno); @@ -411,24 +411,24 @@ cut_data_request(void) /* Send special data for EOF. */ if (!count && feof(((H3270FT *) h3270.ft)->local_file)) { - ctlr_add(O_UP_DATA, EOF_DATA1, 0); - ctlr_add(O_UP_DATA+1, EOF_DATA2, 0); + ctlr_add(&h3270,O_UP_DATA, EOF_DATA1, 0); + ctlr_add(&h3270,O_UP_DATA+1, EOF_DATA2, 0); count = 2; } /* Compute the other fields. */ - ctlr_add(O_UP_FRAME_SEQ, seq, 0); + ctlr_add(&h3270,O_UP_FRAME_SEQ, seq, 0); cs = 0; for (i = 0; i < count; i++) cs ^= h3270.ea_buf[O_UP_DATA + i].cc; - ctlr_add(O_UP_CSUM, asc2ebc[(int)table6[cs & 0x3f]], 0); - ctlr_add(O_UP_LEN, asc2ebc[(int)table6[(count >> 6) & 0x3f]], 0); - ctlr_add(O_UP_LEN+1, asc2ebc[(int)table6[count & 0x3f]], 0); + ctlr_add(&h3270,O_UP_CSUM, asc2ebc[(int)table6[cs & 0x3f]], 0); + ctlr_add(&h3270,O_UP_LEN, asc2ebc[(int)table6[(count >> 6) & 0x3f]], 0); + ctlr_add(&h3270,O_UP_LEN+1, asc2ebc[(int)table6[count & 0x3f]], 0); /* XXX: Change the data field attribute so it doesn't display. */ attr = h3270.ea_buf[O_DR_SF].fa; attr = (attr & ~FA_INTENSITY) | FA_INT_ZERO_NSEL; - ctlr_add_fa(O_DR_SF, attr, 0); + ctlr_add_fa(&h3270,O_DR_SF, attr, 0); /* Send it up to the host. */ trace_ds("> FT DATA %u\n", from6(seq)); @@ -535,10 +535,10 @@ static void cut_abort(unsigned short reason, const char *fmt, ...) va_end(args); /* Send the abort sequence. */ - ctlr_add(RO_FRAME_TYPE, RFT_CONTROL_CODE, 0); - ctlr_add(RO_FRAME_SEQ, h3270.ea_buf[O_DT_FRAME_SEQ].cc, 0); - ctlr_add(RO_REASON_CODE, HIGH8(reason), 0); - ctlr_add(RO_REASON_CODE+1, LOW8(reason), 0); + ctlr_add(&h3270,RO_FRAME_TYPE, RFT_CONTROL_CODE, 0); + ctlr_add(&h3270,RO_FRAME_SEQ, h3270.ea_buf[O_DT_FRAME_SEQ].cc, 0); + ctlr_add(&h3270,RO_REASON_CODE, HIGH8(reason), 0); + ctlr_add(&h3270,RO_REASON_CODE+1, LOW8(reason), 0); trace_ds("> FT CONTROL_CODE ABORT\n"); lib3270_pfkey(&h3270,2); diff --git a/kybd.c b/kybd.c index bcc7c7a..8ad8dfc 100644 --- a/kybd.c +++ b/kybd.c @@ -718,7 +718,7 @@ static Boolean ins_prep(int faddr, int baddr, int count) first_null); #endif /*]*/ if (copy_len) - ctlr_wrapping_memmove(to, baddr, copy_len); + ctlr_wrapping_memmove(&h3270,to, baddr, copy_len); } INC_BA(xaddr); } @@ -824,17 +824,17 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean xaddr = baddr; INC_BA(xaddr); was_si = (h3270.ea_buf[xaddr].cc == EBC_si); - ctlr_add(xaddr, EBC_space, CS_BASE); - ctlr_add_fg(xaddr, 0); + ctlr_add(&h3270,xaddr, EBC_space, CS_BASE); + ctlr_add_fg(&h3270,xaddr, 0); #if defined(X3270_ANSI) /*[*/ - ctlr_add_bg(xaddr, 0); + ctlr_add_bg(&h3270,xaddr, 0); #endif /*]*/ if (!was_si) { INC_BA(xaddr); - ctlr_add(xaddr, EBC_so, CS_BASE); - ctlr_add_fg(xaddr, 0); + ctlr_add(&h3270,xaddr, EBC_so, CS_BASE); + ctlr_add_fg(&h3270,xaddr, 0); #if defined(X3270_ANSI) /*[*/ - ctlr_add_bg(xaddr, 0); + ctlr_add_bg(&h3270,xaddr, 0); #endif /*]*/ } } @@ -855,9 +855,9 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean */ xaddr = baddr; INC_BA(xaddr); - ctlr_add(xaddr, EBC_space, CS_BASE); - ctlr_add_fg(xaddr, 0); - ctlr_add_gr(xaddr, 0); + ctlr_add(&h3270,xaddr, EBC_space, CS_BASE); + ctlr_add_fg(&h3270,xaddr, 0); + ctlr_add_gr(&h3270,xaddr, 0); } } else { Boolean was_si; @@ -882,37 +882,34 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean if (!ins_prep(faddr, baddr, 3)) return False; xaddr = baddr; - ctlr_add(xaddr, EBC_si, - CS_BASE); - ctlr_add_fg(xaddr, 0); - ctlr_add_gr(xaddr, 0); + ctlr_add(&h3270,xaddr, EBC_si,CS_BASE); + ctlr_add_fg(&h3270,xaddr, 0); + ctlr_add_gr(&h3270,xaddr, 0); INC_BA(xaddr); INC_BA(baddr); INC_BA(xaddr); - ctlr_add(xaddr, EBC_so, - CS_BASE); - ctlr_add_fg(xaddr, 0); - ctlr_add_gr(xaddr, 0); + ctlr_add(&h3270,xaddr, EBC_so,CS_BASE); + ctlr_add_fg(&h3270,xaddr, 0); + ctlr_add_gr(&h3270,xaddr, 0); } } else { /* Overwriting part of a subfield. */ xaddr = baddr; - ctlr_add(xaddr, EBC_si, CS_BASE); - ctlr_add_fg(xaddr, 0); - ctlr_add_gr(xaddr, 0); + ctlr_add(&h3270,xaddr, EBC_si, CS_BASE); + ctlr_add_fg(&h3270,xaddr, 0); + ctlr_add_gr(&h3270,xaddr, 0); INC_BA(xaddr); INC_BA(baddr); INC_BA(xaddr); was_si = (h3270.ea_buf[xaddr].cc == EBC_si); - ctlr_add(xaddr, EBC_space, CS_BASE); - ctlr_add_fg(xaddr, 0); - ctlr_add_gr(xaddr, 0); + ctlr_add(&h3270,xaddr, EBC_space, CS_BASE); + ctlr_add_fg(&h3270,xaddr, 0); + ctlr_add_gr(&h3270,xaddr, 0); if (!was_si) { INC_BA(xaddr); - ctlr_add(xaddr, EBC_so, - CS_BASE); - ctlr_add_fg(xaddr, 0); - ctlr_add_gr(xaddr, 0); + ctlr_add(&h3270,xaddr, EBC_so,CS_BASE); + ctlr_add_fg(&h3270,xaddr, 0); + ctlr_add_gr(&h3270,xaddr, 0); } } } @@ -923,9 +920,9 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean return False; break; } - ctlr_add(baddr, (unsigned char)code,(unsigned char)(with_ge ? CS_GE : 0)); - ctlr_add_fg(baddr, 0); - ctlr_add_gr(baddr, 0); + ctlr_add(&h3270,baddr, (unsigned char)code,(unsigned char)(with_ge ? CS_GE : 0)); + ctlr_add_fg(&h3270,baddr, 0); + ctlr_add_gr(&h3270,baddr, 0); INC_BA(baddr); /* Replace leading nulls with blanks, if desired. */ @@ -958,7 +955,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean } if (h3270.ea_buf[baddr_fill].cc == EBC_null) - ctlr_add(baddr_fill, EBC_space, 0); + ctlr_add(&h3270,baddr_fill, EBC_space, 0); DEC_BA(baddr_fill); } } @@ -1693,7 +1690,7 @@ do_delete(void) /* NULL fill at the end. */ for (i = 0; i < ndel; i++) - ctlr_add(end_baddr - i, EBC_null, 0); + ctlr_add(&h3270,end_baddr - i, EBC_null, 0); /* Set the MDT for this field. */ mdt_set(h3270.cursor_addr); @@ -2431,7 +2428,7 @@ LIB3270_ACTION( eraseeol ) /* erase to next field attribute or current line */ do { - ctlr_add(baddr, EBC_null, 0); + ctlr_add(&h3270,baddr, EBC_null, 0); INC_BA(baddr); } while (!h3270.ea_buf[baddr].fa && BA_TO_COL(baddr) > 0); @@ -2442,7 +2439,7 @@ LIB3270_ACTION( eraseeol ) /* erase to end of current line */ do { - ctlr_add(baddr, EBC_null, 0); + ctlr_add(&h3270,baddr, EBC_null, 0); INC_BA(baddr); } while(baddr != 0 && BA_TO_COL(baddr) > 0); } @@ -2491,13 +2488,13 @@ LIB3270_ACTION( eraseeof ) } if (hSession->formatted) { /* erase to next field attribute */ do { - ctlr_add(baddr, EBC_null, 0); + ctlr_add(&h3270,baddr, EBC_null, 0); INC_BA(baddr); } while (!h3270.ea_buf[baddr].fa); mdt_set(hSession->cursor_addr); } else { /* erase to end of screen */ do { - ctlr_add(baddr, EBC_null, 0); + ctlr_add(&h3270,baddr, EBC_null, 0); INC_BA(baddr); } while (baddr != 0); } @@ -2553,7 +2550,7 @@ LIB3270_ACTION( eraseinput ) f = True; } if (!hSession->ea_buf[baddr].fa) { - ctlr_add(baddr, EBC_null, 0); + ctlr_add(&h3270,baddr, EBC_null, 0); } } while (!hSession->ea_buf[baddr].fa); } else { /* skip protected */ @@ -2680,7 +2677,7 @@ LIB3270_ACTION( deletefield ) mdt_set(hSession->cursor_addr); cursor_move(hSession,baddr); while (!hSession->ea_buf[baddr].fa) { - ctlr_add(baddr, EBC_null, 0); + ctlr_add(hSession,baddr, EBC_null, 0); INC_BA(baddr); } hSession->display(hSession); @@ -3304,7 +3301,7 @@ kybd_prime(void) /* Erase it. */ while (!h3270.ea_buf[baddr].fa) { - ctlr_add(baddr, 0, 0); + ctlr_add(&h3270,baddr, 0, 0); len++; INC_BA(baddr); } diff --git a/screenc.h b/screenc.h index ab6cf68..60d8f8f 100644 --- a/screenc.h +++ b/screenc.h @@ -16,7 +16,7 @@ #define SCREENC_H_INCLUDED 1 /* c3270 version of screenc.h */ -#define blink_start() +// #define blink_start() #define display_heightMM() 100 #define display_height() 1 #define display_widthMM() 100 @@ -26,32 +26,20 @@ #define screen_132() /* */ #define screen_80() /* */ -// #define screen_erase(x) x->erase(x) -// LIB3270_INTERNAL void screen_erase(H3270 *session); - -// LIB3270_INTERNAL void screen_changed(H3270 *session, int bstart, int bend); -LIB3270_INTERNAL int screen_init(H3270 *session); -// LIB3270_INTERNAL void screen_flip(void); -// LIB3270_INTERNAL FILE *start_pager(void); -LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname); - -LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m); +LIB3270_INTERNAL int screen_init(H3270 *session); +LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname); +LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m); #define mcursor_locked(x) mcursor_set(x,CURSOR_MODE_LOCKED) #define mcursor_normal(x) mcursor_set(x,CURSOR_MODE_NORMAL) #define mcursor_waiting(x) mcursor_set(x,CURSOR_MODE_WAITING) - -//LIB3270_INTERNAL void mcursor_locked(H3270 *session); -//LIB3270_INTERNAL void mcursor_normal(H3270 *session); -//LIB3270_INTERNAL void mcursor_waiting(H3270 *session); - LIB3270_INTERNAL void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason); LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols); -LIB3270_INTERNAL Boolean escaped; +// LIB3270_INTERNAL Boolean escaped; -LIB3270_INTERNAL void screen_title(char *text); +// LIB3270_INTERNAL void screen_title(char *text); #endif // SCREENC_H_INCLUDED diff --git a/sf.c b/sf.c index cb96ffb..78488f5 100644 --- a/sf.c +++ b/sf.c @@ -641,7 +641,7 @@ sf_outbound_ds(unsigned char buf[], int buflen) break; case SNA_CMD_EAU: trace_ds(" EraseAllUnprotected\n"); - ctlr_erase_all_unprotected(); + ctlr_erase_all_unprotected(&h3270); break; default: trace_ds(" unknown type 0x%02x\n", buf[4]); diff --git a/telnet.c b/telnet.c index c29b7e4..e89e26b 100644 --- a/telnet.c +++ b/telnet.c @@ -1923,8 +1923,7 @@ process_eor(void) return 0; tn3270e_submode = E_SSCP; check_in3270(&h3270); - ctlr_write_sscp_lu(h3270.ibuf + EH_SIZE, - (ibptr - h3270.ibuf) - EH_SIZE); + ctlr_write_sscp_lu(&h3270, h3270.ibuf + EH_SIZE,(ibptr - h3270.ibuf) - EH_SIZE); return 0; default: /* Should do something more extraordinary here. */ diff --git a/toggles.c b/toggles.c index 0821927..6244c99 100644 --- a/toggles.c +++ b/toggles.c @@ -145,6 +145,13 @@ static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TO } /* + * No-op toggle. + */ +static void toggle_nop(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) +{ +} + +/* * Called from system initialization code to handle initial toggle settings. */ void initialize_toggles(H3270 *session) -- libgit2 0.21.2