From 041020ccfa4f8b11bb11fbeab37c4fc1ff08a63a Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Fri, 3 Aug 2012 20:05:41 +0000 Subject: [PATCH] Mais ajustes em multi-sessão --- src/include/lib3270/session.h | 6 ++++++ src/lib3270/ctlr.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------- src/lib3270/sf.c | 228 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------- 3 files changed, 201 insertions(+), 198 deletions(-) diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h index 67d4adf..16dacf6 100644 --- a/src/include/lib3270/session.h +++ b/src/include/lib3270/session.h @@ -182,10 +182,16 @@ unsigned char default_ic; char reply_mode; int trace_primed : 1; + int ticking : 1; + int mticking : 1; int crm_nattr; unsigned char crm_attr[16]; unsigned char * zero_buf; /**< empty buffer, for area clears */ + struct timeval t_start; + void * tick_id; + struct timeval t_want; + // Telnet.c unsigned char * ibuf; int ibuf_size; /**< size of ibuf */ diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c index a7112ef..927cfa5 100644 --- a/src/lib3270/ctlr.c +++ b/src/lib3270/ctlr.c @@ -1401,7 +1401,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er case ORDER_SFE: /* start field extended */ END_TEXT("StartFieldExtended"); if (previous != SBA) - trace_ds(hSession,"%s",rcba(&h3270,h3270.buffer_addr)); + trace_ds(hSession,"%s",rcba(hSession,h3270.buffer_addr)); previous = ORDER; cp++; /* skip order */ na = *cp; @@ -1526,11 +1526,11 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er if (h3270.default_cs == CS_DBCS || d != DBCS_NONE) { ABORT_WRITE("invalid format control order in DBCS field"); } - ctlr_add(&h3270,hSession->buffer_addr, *cp, hSession->default_cs); - ctlr_add_fg(&h3270,hSession->buffer_addr, hSession->default_fg); - ctlr_add_bg(&h3270,hSession->buffer_addr, hSession->default_bg); - ctlr_add_gr(&h3270,hSession->buffer_addr, hSession->default_gr); - ctlr_add_ic(&h3270,hSession->buffer_addr, hSession->default_ic); + 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); last_cmd = True; last_zpt = False; @@ -1550,11 +1550,11 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er } /* All is well. */ previous = ORDER; - 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); + ctlr_add(hSession,h3270.buffer_addr, *cp, h3270.default_cs); + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); INC_BA(hSession->buffer_addr); last_cmd = True; last_zpt = False; @@ -1569,7 +1569,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er if (d != DBCS_NONE && why == DBCS_FIELD) { ABORT_WRITE("SI in DBCS field"); } - fa_addr = find_field_attribute(&h3270,h3270.buffer_addr); + fa_addr = find_field_attribute(hSession,h3270.buffer_addr); baddr = h3270.buffer_addr; DEC_BA(baddr); while (!aborted && @@ -1589,11 +1589,11 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er } /* All is well. */ previous = ORDER; - 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); + ctlr_add(hSession,h3270.buffer_addr, *cp, h3270.default_cs); + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); INC_BA(hSession->buffer_addr); last_cmd = True; last_zpt = False; @@ -1641,18 +1641,19 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er END_TEXT("NULL"); add_c1 = *cp; } - 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); + ctlr_add(hSession,h3270.buffer_addr, add_c1, h3270.default_cs); + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); INC_BA(hSession->buffer_addr); - if (add_dbcs) { - 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); + if (add_dbcs) + { + ctlr_add(hSession,h3270.buffer_addr, add_c2, h3270.default_cs); + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); INC_BA(hSession->buffer_addr); } last_cmd = False; @@ -1690,7 +1691,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er } add_dbcs = True; dbcs_to_mb(add_c1, add_c2, mb); - trace_ds_nb(&h3270,"%s", mb); + trace_ds_nb(hSession,"%s", mb); } else { #endif /*]*/ add_c1 = *cp; @@ -1698,19 +1699,19 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er #if defined(X3270_DBCS) /*[*/ } #endif /*]*/ - 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); + ctlr_add(hSession,h3270.buffer_addr, add_c1, h3270.default_cs); + ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg); + ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg); + ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr); + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); INC_BA(hSession->buffer_addr); #if defined(X3270_DBCS) /*[*/ if (add_dbcs) { ctlr_add(h3270.buffer_addr, add_c2, h3270.default_cs); - ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); + ctlr_add_fg(hSession,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,h3270.buffer_addr, h3270.default_ic); + ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); INC_BA(hSession->buffer_addr); } #endif /*]*/ @@ -1724,10 +1725,10 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er trace_ds(hSession,"\n"); if (wcc_keyboard_restore) { h3270.aid = AID_NO; - do_reset(&h3270,False); + do_reset(hSession,False); } else if (h3270.kybdlock & KL_OIA_TWAIT) { - lib3270_kybdlock_clear(&h3270,KL_OIA_TWAIT); - status_changed(&h3270,LIB3270_STATUS_SYSWAIT); + lib3270_kybdlock_clear(hSession,KL_OIA_TWAIT); + status_changed(hSession,LIB3270_STATUS_SYSWAIT); } if (wcc_sound_alarm) lib3270_ring_bell(hSession); @@ -2518,24 +2519,6 @@ void mdt_clear(H3270 *hSession, int baddr) } } - -/* - * Support for screen-size swapping for scrolling - */ /* -void ctlr_shrink(void) -{ - int baddr; - - for (baddr = 0; baddr < h3270.rows*h3270.cols; baddr++) - { - if (!h3270.ea_buf[baddr].fa) - h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null; - } - ALL_CHANGED(&h3270); - h3270.display(&h3270); -} -*/ - #if defined(X3270_DBCS) /*[*/ /* * DBCS state query. @@ -2564,11 +2547,11 @@ ctlr_dbcs_state(int baddr) * to an accuracy of 0.1 seconds. If we don't repaint the screen before we see * the unlock, the time should be fairly accurate. */ -static struct timeval t_start; -static Boolean ticking = False; -static Boolean mticking = False; -static void * tick_id; -static struct timeval t_want; +//static struct timeval t_start; +// static Boolean ticking = False; +//static Boolean mticking = False; +//static void * tick_id; +//static struct timeval t_want; /* Return the difference in milliseconds between two timevals. */ static long @@ -2578,7 +2561,7 @@ delta_msec(struct timeval *t1, struct timeval *t0) (t1->tv_usec - t0->tv_usec + 500) / 1000; } -static void keep_ticking(H3270 *session) +static void keep_ticking(H3270 *hSession) { struct timeval t1; long msec; @@ -2586,64 +2569,64 @@ static void keep_ticking(H3270 *session) do { (void) gettimeofday(&t1, (struct timezone *) 0); - t_want.tv_sec++; - msec = delta_msec(&t_want, &t1); + hSession->t_want.tv_sec++; + msec = delta_msec(&hSession->t_want, &t1); } while (msec <= 0); - tick_id = AddTimeOut(msec, session, keep_ticking); - status_timing(session,&t_start, &t1); + hSession->tick_id = AddTimeOut(msec, hSession, keep_ticking); + status_timing(hSession,&hSession->t_start, &t1); } -void ticking_start(H3270 *session, Boolean anyway) +void ticking_start(H3270 *hSession, Boolean anyway) { - CHECK_SESSION_HANDLE(session); + CHECK_SESSION_HANDLE(hSession); - if(session->set_timer) + if(hSession->set_timer) { - if(lib3270_get_toggle(&h3270,LIB3270_TOGGLE_SHOW_TIMING) || anyway) - session->set_timer(session,1); + if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SHOW_TIMING) || anyway) + hSession->set_timer(hSession,1); } else { - (void) gettimeofday(&t_start, (struct timezone *) 0); + (void) gettimeofday(&hSession->t_start, (struct timezone *) 0); - mticking = True; + hSession->mticking = 1; - if (!lib3270_get_toggle(&h3270,LIB3270_TOGGLE_SHOW_TIMING) && !anyway) + if (!lib3270_get_toggle(hSession,LIB3270_TOGGLE_SHOW_TIMING) && !anyway) return; - status_untiming(session); - if (ticking) - RemoveTimeOut(tick_id); - ticking = True; - tick_id = AddTimeOut(1000, session, keep_ticking); - t_want = t_start; + status_untiming(hSession); + if (hSession->ticking) + RemoveTimeOut(hSession->tick_id); + hSession->ticking = 1; + hSession->tick_id = AddTimeOut(1000, hSession, keep_ticking); + hSession->t_want = hSession->t_start; } } -static void ticking_stop(H3270 *session) +static void ticking_stop(H3270 *hSession) { - CHECK_SESSION_HANDLE(session); + CHECK_SESSION_HANDLE(hSession); - if(session->set_timer) + if(hSession->set_timer) { - session->set_timer(session,0); + hSession->set_timer(hSession,0); } else { struct timeval t1; (void) gettimeofday(&t1, (struct timezone *) 0); - if (mticking) - mticking = False; + if (hSession->mticking) + hSession->mticking = 0; else return; - if (!ticking) + if (!hSession->ticking) return; - RemoveTimeOut(tick_id); - ticking = False; - status_timing(session,&t_start, &t1); + RemoveTimeOut(hSession->tick_id); + hSession->ticking = 0; + status_timing(hSession,&hSession->t_start, &t1); } } diff --git a/src/lib3270/sf.c b/src/lib3270/sf.c index 2b2f381..244a315 100644 --- a/src/lib3270/sf.c +++ b/src/lib3270/sf.c @@ -88,9 +88,9 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl static enum pds sf_erase_reset(H3270 *hSession, unsigned char buf[], int buflen); static enum pds sf_set_reply_mode(H3270 *hSession, unsigned char buf[], int buflen); static enum pds sf_create_partition(H3270 *hSession, unsigned char buf[], int buflen); -static enum pds sf_outbound_ds(unsigned char buf[], int buflen); +static enum pds sf_outbound_ds(H3270 *hSession, unsigned char buf[], int buflen); static void query_reply_start(H3270 *hSession); -static void do_query_reply(unsigned char code); +static void do_query_reply(H3270 *hSession, unsigned char code); static void query_reply_end(H3270 *hSession); 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 case SF_OUTBOUND_DS: trace_ds(hSession,"OutboundDS"); - rv_this = sf_outbound_ds(cp, (int)fieldlen); + rv_this = sf_outbound_ds(hSession, cp, (int)fieldlen); break; #if defined(X3270_FT) @@ -285,7 +285,7 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl #if defined(X3270_DBCS) /*[*/ if (dbcs || replies[i].code != QR_DBCS_ASIA) #endif /*]*/ - do_query_reply(replies[i].code); + do_query_reply(hSession, replies[i].code); } query_reply_end(hSession); break; @@ -305,7 +305,7 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl trace_ds(hSession,"List("); if (buflen < 7) { trace_ds(hSession,")\n"); - do_query_reply(QR_NULL); + do_query_reply(hSession, QR_NULL); } else { for (i = 6; i < buflen; i++) { 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 replies[i].code != QR_DBCS_ASIA) #endif /*]*/ ) { - do_query_reply(replies[i].code); + do_query_reply(hSession, replies[i].code); any++; } } if (!any) { - do_query_reply(QR_NULL); + do_query_reply(hSession, QR_NULL); } } break; @@ -341,7 +341,7 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl #if defined(X3270_DBCS) /*[*/ if (dbcs || replies[i].code != QR_DBCS_ASIA) #endif /*]*/ - do_query_reply(replies[i].code); + do_query_reply(hSession, replies[i].code); break; case SF_RPQ_ALL: trace_ds(hSession,"All\n"); @@ -349,7 +349,7 @@ static enum pds sf_read_part(H3270 *hSession, unsigned char buf[], unsigned bufl #if defined(X3270_DBCS) /*[*/ if (dbcs || replies[i].code != QR_DBCS_ASIA) #endif /*]*/ - do_query_reply(replies[i].code); + do_query_reply(hSession, replies[i].code); break; default: 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 return PDS_OKAY_NO_OUTPUT; } -static enum pds -sf_outbound_ds(unsigned char buf[], int buflen) +static enum pds sf_outbound_ds(H3270 *hSession, unsigned char buf[], int buflen) { enum pds rv; - if (buflen < 5) { - trace_ds(&h3270," error: field length %d too short\n", buflen); + if (buflen < 5) + { + trace_ds(hSession," error: field length %d too short\n", buflen); return PDS_BAD_CMD; } - trace_ds(&h3270,"(0x%02x)", buf[3]); - if (buf[3] != 0x00) { - trace_ds(&h3270," error: illegal partition 0x%0x\n", buf[3]); + trace_ds(hSession,"(0x%02x)", buf[3]); + if (buf[3] != 0x00) + { + trace_ds(hSession," error: illegal partition 0x%0x\n", buf[3]); return PDS_BAD_CMD; } - switch (buf[4]) { - case SNA_CMD_W: - trace_ds(&h3270," Write"); - if (buflen > 5) { - if ((rv = ctlr_write(&h3270,&buf[4], buflen-4, False)) < 0) + switch (buf[4]) + { + case SNA_CMD_W: + trace_ds(hSession," Write"); + if (buflen > 5) + { + if ((rv = ctlr_write(hSession,&buf[4], buflen-4, False)) < 0) return rv; } else - trace_ds(&h3270,"\n"); + trace_ds(hSession,"\n"); break; - case SNA_CMD_EW: - trace_ds(&h3270," EraseWrite"); - ctlr_erase(&h3270,h3270.screen_alt); - if (buflen > 5) { - if ((rv = ctlr_write(&h3270,&buf[4], buflen-4, True)) < 0) + + case SNA_CMD_EW: + trace_ds(hSession," EraseWrite"); + ctlr_erase(hSession,hSession->screen_alt); + if (buflen > 5) + { + if ((rv = ctlr_write(hSession,&buf[4], buflen-4, True)) < 0) return rv; } else - trace_ds(&h3270,"\n"); + trace_ds(hSession,"\n"); break; - case SNA_CMD_EWA: - trace_ds(&h3270," EraseWriteAlternate"); - ctlr_erase(&h3270,h3270.screen_alt); - if (buflen > 5) { - if ((rv = ctlr_write(&h3270,&buf[4], buflen-4, True)) < 0) + + case SNA_CMD_EWA: + trace_ds(hSession," EraseWriteAlternate"); + ctlr_erase(hSession,hSession->screen_alt); + if (buflen > 5) + { + if ((rv = ctlr_write(hSession,&buf[4], buflen-4, True)) < 0) return rv; } else - trace_ds(&h3270,"\n"); + trace_ds(hSession,"\n"); break; - case SNA_CMD_EAU: - trace_ds(&h3270," EraseAllUnprotected\n"); - ctlr_erase_all_unprotected(&h3270); + + case SNA_CMD_EAU: + trace_ds(hSession," EraseAllUnprotected\n"); + ctlr_erase_all_unprotected(hSession); break; - default: - trace_ds(&h3270," unknown type 0x%02x\n", buf[4]); + + default: + trace_ds(hSession," unknown type 0x%02x\n", buf[4]); return PDS_BAD_CMD; } return PDS_OKAY_NO_OUTPUT; @@ -689,8 +698,7 @@ static void query_reply_start(H3270 *hSession) qr_in_progress = True; } -static void -do_query_reply(unsigned char code) +static void do_query_reply(H3270 *hSession, unsigned char code) { int i; unsigned subindex = 0; @@ -705,37 +713,40 @@ do_query_reply(unsigned char code) (replies[i].single_fn == NULL && replies[i].multi_fn == NULL)) return; - if (qr_in_progress) { - trace_ds(&h3270,"> StructuredField\n"); + if (qr_in_progress) + { + trace_ds(hSession,"> StructuredField\n"); qr_in_progress = False; } - do { - int obptr0 = h3270.obptr - h3270.obuf; + do + { + int obptr0 = hSession->obptr - hSession->obuf; Boolean full = True; - space3270out(&h3270,4); - h3270.obptr += 2; /* skip length for now */ - *h3270.obptr++ = SFID_QREPLY; - *h3270.obptr++ = code; + space3270out(hSession,4); + hSession->obptr += 2; /* skip length for now */ + *hSession->obptr++ = SFID_QREPLY; + *hSession->obptr++ = code; more = False; if (replies[i].single_fn) - replies[i].single_fn(&h3270); + replies[i].single_fn(hSession); else - full = replies[i].multi_fn(&h3270,&subindex, &more); + full = replies[i].multi_fn(hSession,&subindex, &more); - if (full) { + if (full) + { int len; unsigned char *obptr_len; /* Fill in the length. */ - obptr_len = h3270.obuf + obptr0; - len = (h3270.obptr - h3270.obuf) - obptr0; + obptr_len = hSession->obuf + obptr0; + len = (hSession->obptr - hSession->obuf) - obptr0; SET16(obptr_len, len); } else { /* Back over the header. */ - h3270.obptr -= 4; + hSession->obptr -= 4; } } while (more); } @@ -828,12 +839,12 @@ static void do_qr_color(H3270 *hSession) /* #if !defined(X3270_DISPLAY) // Add background color. - if (h3270.m3279) { + if (hSession->m3279) { space3270out(4); - *obptr++ = 4; // length - *obptr++ = 0x02; // background color - *obptr++ = 0x00; // attribute - *obptr++ = 0xf0; // default color + *hSession->obptr++ = 4; // length + *hSession->obptr++ = 0x02; // background color + *hSession->obptr++ = 0x00; // attribute + *hSession->obptr++ = 0xf0; // default color } #endif */ @@ -892,82 +903,85 @@ static void do_qr_alpha_part(H3270 *hSession) static void do_qr_charsets(H3270 *hSession) { - trace_ds(&h3270,"> QueryReply(CharacterSets)\n"); - space3270out(&h3270,64); + trace_ds(hSession,"> QueryReply(CharacterSets)\n"); + space3270out(hSession,64); #if defined(X3270_DBCS) /*[*/ if (dbcs) - *h3270.obptr++ = 0x8e; /* flags: GE, CGCSGID, DBCS */ + *hSession->obptr++ = 0x8e; /* flags: GE, CGCSGID, DBCS */ else #endif /*]*/ - *h3270.obptr++ = 0x82; /* flags: GE, CGCSGID present */ - - *h3270.obptr++ = 0x00; /* more flags */ - *h3270.obptr++ = *char_width; /* SDW */ - *h3270.obptr++ = *char_height; /* SDW */ - *h3270.obptr++ = 0x00; /* no load PS */ - *h3270.obptr++ = 0x00; - *h3270.obptr++ = 0x00; - *h3270.obptr++ = 0x00; + *hSession->obptr++ = 0x82; /* flags: GE, CGCSGID present */ + + *hSession->obptr++ = 0x00; /* more flags */ + *hSession->obptr++ = *char_width; /* SDW */ + *hSession->obptr++ = *char_height; /* SDW */ + *hSession->obptr++ = 0x00; /* no load PS */ + *hSession->obptr++ = 0x00; + *hSession->obptr++ = 0x00; + *hSession->obptr++ = 0x00; #if defined(X3270_DBCS) /*[*/ if (dbcs) - *h3270.obptr++ = 0x0b; /* DL (11 bytes) */ + *hSession->obptr++ = 0x0b; /* DL (11 bytes) */ else #endif /*]*/ - *h3270.obptr++ = 0x07; /* DL (7 bytes) */ + *hSession->obptr++ = 0x07; /* DL (7 bytes) */ - *h3270.obptr++ = 0x00; /* SET 0: */ + *hSession->obptr++ = 0x00; /* SET 0: */ #if defined(X3270_DBCS) /*[*/ if (dbcs) - *h3270.obptr++ = 0x00; /* FLAGS: non-load, single- + *hSession->obptr++ = 0x00; /* FLAGS: non-load, single- plane, single-bute */ else #endif /*]*/ - *h3270.obptr++ = 0x10; /* FLAGS: non-loadable, + *hSession->obptr++ = 0x10; /* FLAGS: non-loadable, single-plane, single-byte, no compare */ - *h3270.obptr++ = 0x00; /* LCID 0 */ + *hSession->obptr++ = 0x00; /* LCID 0 */ #if defined(X3270_DBCS) /*[*/ if (dbcs) { - *obptr++ = 0x00; /* SW 0 */ - *obptr++ = 0x00; /* SH 0 */ - *obptr++ = 0x00; /* SUBSN */ - *obptr++ = 0x00; /* SUBSN */ + *hSession->obptr++ = 0x00; /* SW 0 */ + *hSession->obptr++ = 0x00; /* SH 0 */ + *hSession->obptr++ = 0x00; /* SUBSN */ + *hSession->obptr++ = 0x00; /* SUBSN */ } #endif /*]*/ - SET32(h3270.obptr, cgcsgid); /* CGCSGID */ - if (!*standard_font) { + SET32(hSession->obptr, cgcsgid); /* CGCSGID */ + if (!*standard_font) + { /* special 3270 font, includes APL */ - *h3270.obptr++ = 0x01;/* SET 1: */ - if (h3270.apl_mode) - *h3270.obptr++ = 0x00;/* FLAGS: non-loadable, single-plane, + *hSession->obptr++ = 0x01;/* SET 1: */ + if (hSession->apl_mode) + *hSession->obptr++ = 0x00;/* FLAGS: non-loadable, single-plane, single-byte, no compare */ else - *h3270.obptr++ = 0x10;/* FLAGS: non-loadable, single-plane, + *hSession->obptr++ = 0x10;/* FLAGS: non-loadable, single-plane, single-byte, no compare */ - *h3270.obptr++ = 0xf1;/* LCID */ + *hSession->obptr++ = 0xf1;/* LCID */ #if defined(X3270_DBCS) /*[*/ - if (dbcs) { - *obptr++ = 0x00;/* SW 0 */ - *obptr++ = 0x00;/* SH 0 */ - *obptr++ = 0x00;/* SUBSN */ - *obptr++ = 0x00;/* SUBSN */ + if (dbcs) + { + *hSession->obptr++ = 0x00;/* SW 0 */ + *hSession->obptr++ = 0x00;/* SH 0 */ + *hSession->obptr++ = 0x00;/* SUBSN */ + *hSession->obptr++ = 0x00;/* SUBSN */ } #endif /*]*/ - *h3270.obptr++ = 0x03;/* CGCSGID: 3179-style APL2 */ - *h3270.obptr++ = 0xc3; - *h3270.obptr++ = 0x01; - *h3270.obptr++ = 0x36; + *hSession->obptr++ = 0x03;/* CGCSGID: 3179-style APL2 */ + *hSession->obptr++ = 0xc3; + *hSession->obptr++ = 0x01; + *hSession->obptr++ = 0x36; } #if defined(X3270_DBCS) /*[*/ - if (dbcs) { - *obptr++ = 0x80; /* SET 0x80: */ - *obptr++ = 0x20; /* FLAGS: DBCS */ - *obptr++ = 0xf8; /* LCID: 0xf8 */ - *obptr++ = *char_width * 2; /* SW */ - *obptr++ = *char_height; /* SH */ - *obptr++ = 0x41; /* SUBSN */ - *obptr++ = 0x7f; /* SUBSN */ - SET32(obptr, cgcsgid_dbcs); /* CGCSGID */ + if (dbcs) + { + *hSession->obptr++ = 0x80; /* SET 0x80: */ + *hSession->obptr++ = 0x20; /* FLAGS: DBCS */ + *hSession->obptr++ = 0xf8; /* LCID: 0xf8 */ + *hSession->obptr++ = *char_width * 2; /* SW */ + *hSession->obptr++ = *char_height; /* SH */ + *hSession->obptr++ = 0x41; /* SUBSN */ + *hSession->obptr++ = 0x7f; /* SUBSN */ + SET32(hSession->obptr, cgcsgid_dbcs); /* CGCSGID */ } #endif /*]*/ } -- libgit2 0.21.2