Commit 4cd3b38f02252816c529559818c8e240b036e8a5

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

Ajustes para multi-sessão

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