Commit 041020ccfa4f8b11bb11fbeab37c4fc1ff08a63a

Authored by perry.werneck@gmail.com
1 parent 3ec6fb96

Mais ajustes em multi-sessão

src/include/lib3270/session.h
... ... @@ -182,10 +182,16 @@
182 182 unsigned char default_ic;
183 183 char reply_mode;
184 184 int trace_primed : 1;
  185 + int ticking : 1;
  186 + int mticking : 1;
185 187 int crm_nattr;
186 188 unsigned char crm_attr[16];
187 189 unsigned char * zero_buf; /**< empty buffer, for area clears */
188 190  
  191 + struct timeval t_start;
  192 + void * tick_id;
  193 + struct timeval t_want;
  194 +
189 195 // Telnet.c
190 196 unsigned char * ibuf;
191 197 int ibuf_size; /**< size of ibuf */
... ...
src/lib3270/ctlr.c
... ... @@ -1401,7 +1401,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1401 1401 case ORDER_SFE: /* start field extended */
1402 1402 END_TEXT("StartFieldExtended");
1403 1403 if (previous != SBA)
1404   - trace_ds(hSession,"%s",rcba(&h3270,h3270.buffer_addr));
  1404 + trace_ds(hSession,"%s",rcba(hSession,h3270.buffer_addr));
1405 1405 previous = ORDER;
1406 1406 cp++; /* skip order */
1407 1407 na = *cp;
... ... @@ -1526,11 +1526,11 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1526 1526 if (h3270.default_cs == CS_DBCS || d != DBCS_NONE) {
1527 1527 ABORT_WRITE("invalid format control order in DBCS field");
1528 1528 }
1529   - ctlr_add(&h3270,hSession->buffer_addr, *cp, hSession->default_cs);
1530   - ctlr_add_fg(&h3270,hSession->buffer_addr, hSession->default_fg);
1531   - ctlr_add_bg(&h3270,hSession->buffer_addr, hSession->default_bg);
1532   - ctlr_add_gr(&h3270,hSession->buffer_addr, hSession->default_gr);
1533   - ctlr_add_ic(&h3270,hSession->buffer_addr, hSession->default_ic);
  1529 + ctlr_add(hSession,hSession->buffer_addr, *cp, hSession->default_cs);
  1530 + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg);
  1531 + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg);
  1532 + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr);
  1533 + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic);
1534 1534 INC_BA(hSession->buffer_addr);
1535 1535 last_cmd = True;
1536 1536 last_zpt = False;
... ... @@ -1550,11 +1550,11 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1550 1550 }
1551 1551 /* All is well. */
1552 1552 previous = ORDER;
1553   - ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs);
1554   - ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
1555   - ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
1556   - ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
1557   - ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
  1553 + ctlr_add(hSession,h3270.buffer_addr, *cp, h3270.default_cs);
  1554 + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg);
  1555 + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg);
  1556 + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr);
  1557 + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic);
1558 1558 INC_BA(hSession->buffer_addr);
1559 1559 last_cmd = True;
1560 1560 last_zpt = False;
... ... @@ -1569,7 +1569,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1569 1569 if (d != DBCS_NONE && why == DBCS_FIELD) {
1570 1570 ABORT_WRITE("SI in DBCS field");
1571 1571 }
1572   - fa_addr = find_field_attribute(&h3270,h3270.buffer_addr);
  1572 + fa_addr = find_field_attribute(hSession,h3270.buffer_addr);
1573 1573 baddr = h3270.buffer_addr;
1574 1574 DEC_BA(baddr);
1575 1575 while (!aborted &&
... ... @@ -1589,11 +1589,11 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1589 1589 }
1590 1590 /* All is well. */
1591 1591 previous = ORDER;
1592   - ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs);
1593   - ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
1594   - ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
1595   - ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
1596   - ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
  1592 + ctlr_add(hSession,h3270.buffer_addr, *cp, h3270.default_cs);
  1593 + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg);
  1594 + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg);
  1595 + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr);
  1596 + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic);
1597 1597 INC_BA(hSession->buffer_addr);
1598 1598 last_cmd = True;
1599 1599 last_zpt = False;
... ... @@ -1641,18 +1641,19 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1641 1641 END_TEXT("NULL");
1642 1642 add_c1 = *cp;
1643 1643 }
1644   - ctlr_add(&h3270,h3270.buffer_addr, add_c1, h3270.default_cs);
1645   - ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
1646   - ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
1647   - ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
1648   - ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
  1644 + ctlr_add(hSession,h3270.buffer_addr, add_c1, h3270.default_cs);
  1645 + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg);
  1646 + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg);
  1647 + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr);
  1648 + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic);
1649 1649 INC_BA(hSession->buffer_addr);
1650   - if (add_dbcs) {
1651   - ctlr_add(&h3270,h3270.buffer_addr, add_c2, h3270.default_cs);
1652   - ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
1653   - ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
1654   - ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
1655   - ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
  1650 + if (add_dbcs)
  1651 + {
  1652 + ctlr_add(hSession,h3270.buffer_addr, add_c2, h3270.default_cs);
  1653 + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg);
  1654 + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg);
  1655 + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr);
  1656 + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic);
1656 1657 INC_BA(hSession->buffer_addr);
1657 1658 }
1658 1659 last_cmd = False;
... ... @@ -1690,7 +1691,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1690 1691 }
1691 1692 add_dbcs = True;
1692 1693 dbcs_to_mb(add_c1, add_c2, mb);
1693   - trace_ds_nb(&h3270,"%s", mb);
  1694 + trace_ds_nb(hSession,"%s", mb);
1694 1695 } else {
1695 1696 #endif /*]*/
1696 1697 add_c1 = *cp;
... ... @@ -1698,19 +1699,19 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1698 1699 #if defined(X3270_DBCS) /*[*/
1699 1700 }
1700 1701 #endif /*]*/
1701   - ctlr_add(&h3270,h3270.buffer_addr, add_c1, h3270.default_cs);
1702   - ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
1703   - ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg);
1704   - ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr);
1705   - ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
  1702 + ctlr_add(hSession,h3270.buffer_addr, add_c1, h3270.default_cs);
  1703 + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg);
  1704 + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg);
  1705 + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr);
  1706 + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic);
1706 1707 INC_BA(hSession->buffer_addr);
1707 1708 #if defined(X3270_DBCS) /*[*/
1708 1709 if (add_dbcs) {
1709 1710 ctlr_add(h3270.buffer_addr, add_c2, h3270.default_cs);
1710   - ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg);
  1711 + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg);
1711 1712 ctlr_add_bg(h3270.buffer_addr, h3270.default_bg);
1712 1713 ctlr_add_gr(h3270.buffer_addr, h3270.default_gr);
1713   - ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic);
  1714 + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic);
1714 1715 INC_BA(hSession->buffer_addr);
1715 1716 }
1716 1717 #endif /*]*/
... ... @@ -1724,10 +1725,10 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1724 1725 trace_ds(hSession,"\n");
1725 1726 if (wcc_keyboard_restore) {
1726 1727 h3270.aid = AID_NO;
1727   - do_reset(&h3270,False);
  1728 + do_reset(hSession,False);
1728 1729 } else if (h3270.kybdlock & KL_OIA_TWAIT) {
1729   - lib3270_kybdlock_clear(&h3270,KL_OIA_TWAIT);
1730   - status_changed(&h3270,LIB3270_STATUS_SYSWAIT);
  1730 + lib3270_kybdlock_clear(hSession,KL_OIA_TWAIT);
  1731 + status_changed(hSession,LIB3270_STATUS_SYSWAIT);
1731 1732 }
1732 1733 if (wcc_sound_alarm)
1733 1734 lib3270_ring_bell(hSession);
... ... @@ -2518,24 +2519,6 @@ void mdt_clear(H3270 *hSession, int baddr)
2518 2519 }
2519 2520 }
2520 2521  
2521   -
2522   -/*
2523   - * Support for screen-size swapping for scrolling
2524   - */ /*
2525   -void ctlr_shrink(void)
2526   -{
2527   - int baddr;
2528   -
2529   - for (baddr = 0; baddr < h3270.rows*h3270.cols; baddr++)
2530   - {
2531   - if (!h3270.ea_buf[baddr].fa)
2532   - h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null;
2533   - }
2534   - ALL_CHANGED(&h3270);
2535   - h3270.display(&h3270);
2536   -}
2537   -*/
2538   -
2539 2522 #if defined(X3270_DBCS) /*[*/
2540 2523 /*
2541 2524 * DBCS state query.
... ... @@ -2564,11 +2547,11 @@ ctlr_dbcs_state(int baddr)
2564 2547 * to an accuracy of 0.1 seconds. If we don't repaint the screen before we see
2565 2548 * the unlock, the time should be fairly accurate.
2566 2549 */
2567   -static struct timeval t_start;
2568   -static Boolean ticking = False;
2569   -static Boolean mticking = False;
2570   -static void * tick_id;
2571   -static struct timeval t_want;
  2550 +//static struct timeval t_start;
  2551 +// static Boolean ticking = False;
  2552 +//static Boolean mticking = False;
  2553 +//static void * tick_id;
  2554 +//static struct timeval t_want;
2572 2555  
2573 2556 /* Return the difference in milliseconds between two timevals. */
2574 2557 static long
... ... @@ -2578,7 +2561,7 @@ delta_msec(struct timeval *t1, struct timeval *t0)
2578 2561 (t1->tv_usec - t0->tv_usec + 500) / 1000;
2579 2562 }
2580 2563  
2581   -static void keep_ticking(H3270 *session)
  2564 +static void keep_ticking(H3270 *hSession)
2582 2565 {
2583 2566 struct timeval t1;
2584 2567 long msec;
... ... @@ -2586,64 +2569,64 @@ static void keep_ticking(H3270 *session)
2586 2569 do
2587 2570 {
2588 2571 (void) gettimeofday(&t1, (struct timezone *) 0);
2589   - t_want.tv_sec++;
2590   - msec = delta_msec(&t_want, &t1);
  2572 + hSession->t_want.tv_sec++;
  2573 + msec = delta_msec(&hSession->t_want, &t1);
2591 2574 } while (msec <= 0);
2592 2575  
2593   - tick_id = AddTimeOut(msec, session, keep_ticking);
2594   - status_timing(session,&t_start, &t1);
  2576 + hSession->tick_id = AddTimeOut(msec, hSession, keep_ticking);
  2577 + status_timing(hSession,&hSession->t_start, &t1);
2595 2578 }
2596 2579  
2597   -void ticking_start(H3270 *session, Boolean anyway)
  2580 +void ticking_start(H3270 *hSession, Boolean anyway)
2598 2581 {
2599   - CHECK_SESSION_HANDLE(session);
  2582 + CHECK_SESSION_HANDLE(hSession);
2600 2583  
2601   - if(session->set_timer)
  2584 + if(hSession->set_timer)
2602 2585 {
2603   - if(lib3270_get_toggle(&h3270,LIB3270_TOGGLE_SHOW_TIMING) || anyway)
2604   - session->set_timer(session,1);
  2586 + if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SHOW_TIMING) || anyway)
  2587 + hSession->set_timer(hSession,1);
2605 2588 }
2606 2589 else
2607 2590 {
2608   - (void) gettimeofday(&t_start, (struct timezone *) 0);
  2591 + (void) gettimeofday(&hSession->t_start, (struct timezone *) 0);
2609 2592  
2610   - mticking = True;
  2593 + hSession->mticking = 1;
2611 2594  
2612   - if (!lib3270_get_toggle(&h3270,LIB3270_TOGGLE_SHOW_TIMING) && !anyway)
  2595 + if (!lib3270_get_toggle(hSession,LIB3270_TOGGLE_SHOW_TIMING) && !anyway)
2613 2596 return;
2614 2597  
2615   - status_untiming(session);
2616   - if (ticking)
2617   - RemoveTimeOut(tick_id);
2618   - ticking = True;
2619   - tick_id = AddTimeOut(1000, session, keep_ticking);
2620   - t_want = t_start;
  2598 + status_untiming(hSession);
  2599 + if (hSession->ticking)
  2600 + RemoveTimeOut(hSession->tick_id);
  2601 + hSession->ticking = 1;
  2602 + hSession->tick_id = AddTimeOut(1000, hSession, keep_ticking);
  2603 + hSession->t_want = hSession->t_start;
2621 2604 }
2622 2605  
2623 2606 }
2624 2607  
2625   -static void ticking_stop(H3270 *session)
  2608 +static void ticking_stop(H3270 *hSession)
2626 2609 {
2627   - CHECK_SESSION_HANDLE(session);
  2610 + CHECK_SESSION_HANDLE(hSession);
2628 2611  
2629   - if(session->set_timer)
  2612 + if(hSession->set_timer)
2630 2613 {
2631   - session->set_timer(session,0);
  2614 + hSession->set_timer(hSession,0);
2632 2615 }
2633 2616 else
2634 2617 {
2635 2618 struct timeval t1;
2636 2619  
2637 2620 (void) gettimeofday(&t1, (struct timezone *) 0);
2638   - if (mticking)
2639   - mticking = False;
  2621 + if (hSession->mticking)
  2622 + hSession->mticking = 0;
2640 2623 else
2641 2624 return;
2642 2625  
2643   - if (!ticking)
  2626 + if (!hSession->ticking)
2644 2627 return;
2645   - RemoveTimeOut(tick_id);
2646   - ticking = False;
2647   - status_timing(session,&t_start, &t1);
  2628 + RemoveTimeOut(hSession->tick_id);
  2629 + hSession->ticking = 0;
  2630 + status_timing(hSession,&hSession->t_start, &t1);
2648 2631 }
2649 2632 }
... ...
src/lib3270/sf.c
... ... @@ -88,9 +88,9 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl
88 88 static enum pds sf_erase_reset(H3270 *hSession, unsigned char buf[], int buflen);
89 89 static enum pds sf_set_reply_mode(H3270 *hSession, unsigned char buf[], int buflen);
90 90 static enum pds sf_create_partition(H3270 *hSession, unsigned char buf[], int buflen);
91   -static enum pds sf_outbound_ds(unsigned char buf[], int buflen);
  91 +static enum pds sf_outbound_ds(H3270 *hSession, unsigned char buf[], int buflen);
92 92 static void query_reply_start(H3270 *hSession);
93   -static void do_query_reply(unsigned char code);
  93 +static void do_query_reply(H3270 *hSession, unsigned char code);
94 94 static void query_reply_end(H3270 *hSession);
95 95  
96 96 typedef Boolean qr_multi_fn_t(H3270 *hSession, unsigned *subindex, Boolean *more);
... ... @@ -215,7 +215,7 @@ enum pds write_structured_field(H3270 *hSession, unsigned char buf[], int buflen
215 215  
216 216 case SF_OUTBOUND_DS:
217 217 trace_ds(hSession,"OutboundDS");
218   - rv_this = sf_outbound_ds(cp, (int)fieldlen);
  218 + rv_this = sf_outbound_ds(hSession, cp, (int)fieldlen);
219 219 break;
220 220  
221 221 #if defined(X3270_FT)
... ... @@ -285,7 +285,7 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl
285 285 #if defined(X3270_DBCS) /*[*/
286 286 if (dbcs || replies[i].code != QR_DBCS_ASIA)
287 287 #endif /*]*/
288   - do_query_reply(replies[i].code);
  288 + do_query_reply(hSession, replies[i].code);
289 289 }
290 290 query_reply_end(hSession);
291 291 break;
... ... @@ -305,7 +305,7 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl
305 305 trace_ds(hSession,"List(");
306 306 if (buflen < 7) {
307 307 trace_ds(hSession,")\n");
308   - do_query_reply(QR_NULL);
  308 + do_query_reply(hSession, QR_NULL);
309 309 } else {
310 310 for (i = 6; i < buflen; i++) {
311 311 trace_ds(hSession,"%s%s", comma,see_qcode(buf[i]));
... ... @@ -321,12 +321,12 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl
321 321 replies[i].code != QR_DBCS_ASIA)
322 322 #endif /*]*/
323 323 ) {
324   - do_query_reply(replies[i].code);
  324 + do_query_reply(hSession, replies[i].code);
325 325 any++;
326 326 }
327 327 }
328 328 if (!any) {
329   - do_query_reply(QR_NULL);
  329 + do_query_reply(hSession, QR_NULL);
330 330 }
331 331 }
332 332 break;
... ... @@ -341,7 +341,7 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl
341 341 #if defined(X3270_DBCS) /*[*/
342 342 if (dbcs || replies[i].code != QR_DBCS_ASIA)
343 343 #endif /*]*/
344   - do_query_reply(replies[i].code);
  344 + do_query_reply(hSession, replies[i].code);
345 345 break;
346 346 case SF_RPQ_ALL:
347 347 trace_ds(hSession,"All\n");
... ... @@ -349,7 +349,7 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl
349 349 #if defined(X3270_DBCS) /*[*/
350 350 if (dbcs || replies[i].code != QR_DBCS_ASIA)
351 351 #endif /*]*/
352   - do_query_reply(replies[i].code);
  352 + do_query_reply(hSession, replies[i].code);
353 353 break;
354 354 default:
355 355 trace_ds(hSession,"unknown request type 0x%02x\n", buf[5]);
... ... @@ -627,55 +627,64 @@ static enum pds sf_create_partition(H3270 *hSession, unsigned char buf[], int bu
627 627 return PDS_OKAY_NO_OUTPUT;
628 628 }
629 629  
630   -static enum pds
631   -sf_outbound_ds(unsigned char buf[], int buflen)
  630 +static enum pds sf_outbound_ds(H3270 *hSession, unsigned char buf[], int buflen)
632 631 {
633 632 enum pds rv;
634 633  
635   - if (buflen < 5) {
636   - trace_ds(&h3270," error: field length %d too short\n", buflen);
  634 + if (buflen < 5)
  635 + {
  636 + trace_ds(hSession," error: field length %d too short\n", buflen);
637 637 return PDS_BAD_CMD;
638 638 }
639 639  
640   - trace_ds(&h3270,"(0x%02x)", buf[3]);
641   - if (buf[3] != 0x00) {
642   - trace_ds(&h3270," error: illegal partition 0x%0x\n", buf[3]);
  640 + trace_ds(hSession,"(0x%02x)", buf[3]);
  641 + if (buf[3] != 0x00)
  642 + {
  643 + trace_ds(hSession," error: illegal partition 0x%0x\n", buf[3]);
643 644 return PDS_BAD_CMD;
644 645 }
645 646  
646   - switch (buf[4]) {
647   - case SNA_CMD_W:
648   - trace_ds(&h3270," Write");
649   - if (buflen > 5) {
650   - if ((rv = ctlr_write(&h3270,&buf[4], buflen-4, False)) < 0)
  647 + switch (buf[4])
  648 + {
  649 + case SNA_CMD_W:
  650 + trace_ds(hSession," Write");
  651 + if (buflen > 5)
  652 + {
  653 + if ((rv = ctlr_write(hSession,&buf[4], buflen-4, False)) < 0)
651 654 return rv;
652 655 } else
653   - trace_ds(&h3270,"\n");
  656 + trace_ds(hSession,"\n");
654 657 break;
655   - case SNA_CMD_EW:
656   - trace_ds(&h3270," EraseWrite");
657   - ctlr_erase(&h3270,h3270.screen_alt);
658   - if (buflen > 5) {
659   - if ((rv = ctlr_write(&h3270,&buf[4], buflen-4, True)) < 0)
  658 +
  659 + case SNA_CMD_EW:
  660 + trace_ds(hSession," EraseWrite");
  661 + ctlr_erase(hSession,hSession->screen_alt);
  662 + if (buflen > 5)
  663 + {
  664 + if ((rv = ctlr_write(hSession,&buf[4], buflen-4, True)) < 0)
660 665 return rv;
661 666 } else
662   - trace_ds(&h3270,"\n");
  667 + trace_ds(hSession,"\n");
663 668 break;
664   - case SNA_CMD_EWA:
665   - trace_ds(&h3270," EraseWriteAlternate");
666   - ctlr_erase(&h3270,h3270.screen_alt);
667   - if (buflen > 5) {
668   - if ((rv = ctlr_write(&h3270,&buf[4], buflen-4, True)) < 0)
  669 +
  670 + case SNA_CMD_EWA:
  671 + trace_ds(hSession," EraseWriteAlternate");
  672 + ctlr_erase(hSession,hSession->screen_alt);
  673 + if (buflen > 5)
  674 + {
  675 + if ((rv = ctlr_write(hSession,&buf[4], buflen-4, True)) < 0)
669 676 return rv;
670 677 } else
671   - trace_ds(&h3270,"\n");
  678 + trace_ds(hSession,"\n");
672 679 break;
673   - case SNA_CMD_EAU:
674   - trace_ds(&h3270," EraseAllUnprotected\n");
675   - ctlr_erase_all_unprotected(&h3270);
  680 +
  681 + case SNA_CMD_EAU:
  682 + trace_ds(hSession," EraseAllUnprotected\n");
  683 + ctlr_erase_all_unprotected(hSession);
676 684 break;
677   - default:
678   - trace_ds(&h3270," unknown type 0x%02x\n", buf[4]);
  685 +
  686 + default:
  687 + trace_ds(hSession," unknown type 0x%02x\n", buf[4]);
679 688 return PDS_BAD_CMD;
680 689 }
681 690 return PDS_OKAY_NO_OUTPUT;
... ... @@ -689,8 +698,7 @@ static void query_reply_start(H3270 *hSession)
689 698 qr_in_progress = True;
690 699 }
691 700  
692   -static void
693   -do_query_reply(unsigned char code)
  701 +static void do_query_reply(H3270 *hSession, unsigned char code)
694 702 {
695 703 int i;
696 704 unsigned subindex = 0;
... ... @@ -705,37 +713,40 @@ do_query_reply(unsigned char code)
705 713 (replies[i].single_fn == NULL && replies[i].multi_fn == NULL))
706 714 return;
707 715  
708   - if (qr_in_progress) {
709   - trace_ds(&h3270,"> StructuredField\n");
  716 + if (qr_in_progress)
  717 + {
  718 + trace_ds(hSession,"> StructuredField\n");
710 719 qr_in_progress = False;
711 720 }
712 721  
713   - do {
714   - int obptr0 = h3270.obptr - h3270.obuf;
  722 + do
  723 + {
  724 + int obptr0 = hSession->obptr - hSession->obuf;
715 725 Boolean full = True;
716 726  
717   - space3270out(&h3270,4);
718   - h3270.obptr += 2; /* skip length for now */
719   - *h3270.obptr++ = SFID_QREPLY;
720   - *h3270.obptr++ = code;
  727 + space3270out(hSession,4);
  728 + hSession->obptr += 2; /* skip length for now */
  729 + *hSession->obptr++ = SFID_QREPLY;
  730 + *hSession->obptr++ = code;
721 731  
722 732 more = False;
723 733 if (replies[i].single_fn)
724   - replies[i].single_fn(&h3270);
  734 + replies[i].single_fn(hSession);
725 735 else
726   - full = replies[i].multi_fn(&h3270,&subindex, &more);
  736 + full = replies[i].multi_fn(hSession,&subindex, &more);
727 737  
728   - if (full) {
  738 + if (full)
  739 + {
729 740 int len;
730 741 unsigned char *obptr_len;
731 742  
732 743 /* Fill in the length. */
733   - obptr_len = h3270.obuf + obptr0;
734   - len = (h3270.obptr - h3270.obuf) - obptr0;
  744 + obptr_len = hSession->obuf + obptr0;
  745 + len = (hSession->obptr - hSession->obuf) - obptr0;
735 746 SET16(obptr_len, len);
736 747 } else {
737 748 /* Back over the header. */
738   - h3270.obptr -= 4;
  749 + hSession->obptr -= 4;
739 750 }
740 751 } while (more);
741 752 }
... ... @@ -828,12 +839,12 @@ static void do_qr_color(H3270 *hSession)
828 839 /*
829 840 #if !defined(X3270_DISPLAY)
830 841 // Add background color.
831   - if (h3270.m3279) {
  842 + if (hSession->m3279) {
832 843 space3270out(4);
833   - *obptr++ = 4; // length
834   - *obptr++ = 0x02; // background color
835   - *obptr++ = 0x00; // attribute
836   - *obptr++ = 0xf0; // default color
  844 + *hSession->obptr++ = 4; // length
  845 + *hSession->obptr++ = 0x02; // background color
  846 + *hSession->obptr++ = 0x00; // attribute
  847 + *hSession->obptr++ = 0xf0; // default color
837 848 }
838 849 #endif
839 850 */
... ... @@ -892,82 +903,85 @@ static void do_qr_alpha_part(H3270 *hSession)
892 903  
893 904 static void do_qr_charsets(H3270 *hSession)
894 905 {
895   - trace_ds(&h3270,"> QueryReply(CharacterSets)\n");
896   - space3270out(&h3270,64);
  906 + trace_ds(hSession,"> QueryReply(CharacterSets)\n");
  907 + space3270out(hSession,64);
897 908 #if defined(X3270_DBCS) /*[*/
898 909 if (dbcs)
899   - *h3270.obptr++ = 0x8e; /* flags: GE, CGCSGID, DBCS */
  910 + *hSession->obptr++ = 0x8e; /* flags: GE, CGCSGID, DBCS */
900 911 else
901 912 #endif /*]*/
902   - *h3270.obptr++ = 0x82; /* flags: GE, CGCSGID present */
903   -
904   - *h3270.obptr++ = 0x00; /* more flags */
905   - *h3270.obptr++ = *char_width; /* SDW */
906   - *h3270.obptr++ = *char_height; /* SDW */
907   - *h3270.obptr++ = 0x00; /* no load PS */
908   - *h3270.obptr++ = 0x00;
909   - *h3270.obptr++ = 0x00;
910   - *h3270.obptr++ = 0x00;
  913 + *hSession->obptr++ = 0x82; /* flags: GE, CGCSGID present */
  914 +
  915 + *hSession->obptr++ = 0x00; /* more flags */
  916 + *hSession->obptr++ = *char_width; /* SDW */
  917 + *hSession->obptr++ = *char_height; /* SDW */
  918 + *hSession->obptr++ = 0x00; /* no load PS */
  919 + *hSession->obptr++ = 0x00;
  920 + *hSession->obptr++ = 0x00;
  921 + *hSession->obptr++ = 0x00;
911 922 #if defined(X3270_DBCS) /*[*/
912 923 if (dbcs)
913   - *h3270.obptr++ = 0x0b; /* DL (11 bytes) */
  924 + *hSession->obptr++ = 0x0b; /* DL (11 bytes) */
914 925 else
915 926 #endif /*]*/
916   - *h3270.obptr++ = 0x07; /* DL (7 bytes) */
  927 + *hSession->obptr++ = 0x07; /* DL (7 bytes) */
917 928  
918   - *h3270.obptr++ = 0x00; /* SET 0: */
  929 + *hSession->obptr++ = 0x00; /* SET 0: */
919 930 #if defined(X3270_DBCS) /*[*/
920 931 if (dbcs)
921   - *h3270.obptr++ = 0x00; /* FLAGS: non-load, single-
  932 + *hSession->obptr++ = 0x00; /* FLAGS: non-load, single-
922 933 plane, single-bute */
923 934 else
924 935 #endif /*]*/
925   - *h3270.obptr++ = 0x10; /* FLAGS: non-loadable,
  936 + *hSession->obptr++ = 0x10; /* FLAGS: non-loadable,
926 937 single-plane, single-byte,
927 938 no compare */
928   - *h3270.obptr++ = 0x00; /* LCID 0 */
  939 + *hSession->obptr++ = 0x00; /* LCID 0 */
929 940 #if defined(X3270_DBCS) /*[*/
930 941 if (dbcs) {
931   - *obptr++ = 0x00; /* SW 0 */
932   - *obptr++ = 0x00; /* SH 0 */
933   - *obptr++ = 0x00; /* SUBSN */
934   - *obptr++ = 0x00; /* SUBSN */
  942 + *hSession->obptr++ = 0x00; /* SW 0 */
  943 + *hSession->obptr++ = 0x00; /* SH 0 */
  944 + *hSession->obptr++ = 0x00; /* SUBSN */
  945 + *hSession->obptr++ = 0x00; /* SUBSN */
935 946 }
936 947 #endif /*]*/
937   - SET32(h3270.obptr, cgcsgid); /* CGCSGID */
938   - if (!*standard_font) {
  948 + SET32(hSession->obptr, cgcsgid); /* CGCSGID */
  949 + if (!*standard_font)
  950 + {
939 951 /* special 3270 font, includes APL */
940   - *h3270.obptr++ = 0x01;/* SET 1: */
941   - if (h3270.apl_mode)
942   - *h3270.obptr++ = 0x00;/* FLAGS: non-loadable, single-plane,
  952 + *hSession->obptr++ = 0x01;/* SET 1: */
  953 + if (hSession->apl_mode)
  954 + *hSession->obptr++ = 0x00;/* FLAGS: non-loadable, single-plane,
943 955 single-byte, no compare */
944 956 else
945   - *h3270.obptr++ = 0x10;/* FLAGS: non-loadable, single-plane,
  957 + *hSession->obptr++ = 0x10;/* FLAGS: non-loadable, single-plane,
946 958 single-byte, no compare */
947   - *h3270.obptr++ = 0xf1;/* LCID */
  959 + *hSession->obptr++ = 0xf1;/* LCID */
948 960 #if defined(X3270_DBCS) /*[*/
949   - if (dbcs) {
950   - *obptr++ = 0x00;/* SW 0 */
951   - *obptr++ = 0x00;/* SH 0 */
952   - *obptr++ = 0x00;/* SUBSN */
953   - *obptr++ = 0x00;/* SUBSN */
  961 + if (dbcs)
  962 + {
  963 + *hSession->obptr++ = 0x00;/* SW 0 */
  964 + *hSession->obptr++ = 0x00;/* SH 0 */
  965 + *hSession->obptr++ = 0x00;/* SUBSN */
  966 + *hSession->obptr++ = 0x00;/* SUBSN */
954 967 }
955 968 #endif /*]*/
956   - *h3270.obptr++ = 0x03;/* CGCSGID: 3179-style APL2 */
957   - *h3270.obptr++ = 0xc3;
958   - *h3270.obptr++ = 0x01;
959   - *h3270.obptr++ = 0x36;
  969 + *hSession->obptr++ = 0x03;/* CGCSGID: 3179-style APL2 */
  970 + *hSession->obptr++ = 0xc3;
  971 + *hSession->obptr++ = 0x01;
  972 + *hSession->obptr++ = 0x36;
960 973 }
961 974 #if defined(X3270_DBCS) /*[*/
962   - if (dbcs) {
963   - *obptr++ = 0x80; /* SET 0x80: */
964   - *obptr++ = 0x20; /* FLAGS: DBCS */
965   - *obptr++ = 0xf8; /* LCID: 0xf8 */
966   - *obptr++ = *char_width * 2; /* SW */
967   - *obptr++ = *char_height; /* SH */
968   - *obptr++ = 0x41; /* SUBSN */
969   - *obptr++ = 0x7f; /* SUBSN */
970   - SET32(obptr, cgcsgid_dbcs); /* CGCSGID */
  975 + if (dbcs)
  976 + {
  977 + *hSession->obptr++ = 0x80; /* SET 0x80: */
  978 + *hSession->obptr++ = 0x20; /* FLAGS: DBCS */
  979 + *hSession->obptr++ = 0xf8; /* LCID: 0xf8 */
  980 + *hSession->obptr++ = *char_width * 2; /* SW */
  981 + *hSession->obptr++ = *char_height; /* SH */
  982 + *hSession->obptr++ = 0x41; /* SUBSN */
  983 + *hSession->obptr++ = 0x7f; /* SUBSN */
  984 + SET32(hSession->obptr, cgcsgid_dbcs); /* CGCSGID */
971 985 }
972 986 #endif /*]*/
973 987 }
... ...