Commit 0f63e4adfe4d747a0647ec43d9bc6f070aa81f17
1 parent
276af5ac
Exists in
master
and in
3 other branches
Incluindo estruturas de sessão em mais chamadas
Showing
1 changed file
with
57 additions
and
63 deletions
Show diff stats
ctlr.c
@@ -542,16 +542,15 @@ process_ds(unsigned char *buf, int buflen) | @@ -542,16 +542,15 @@ process_ds(unsigned char *buf, int buflen) | ||
542 | /* | 542 | /* |
543 | * Functions to insert SA attributes into the inbound data stream. | 543 | * Functions to insert SA attributes into the inbound data stream. |
544 | */ | 544 | */ |
545 | -static void | ||
546 | -insert_sa1(unsigned char attr, unsigned char value, unsigned char *currentp, Boolean *anyp) | 545 | +static void insert_sa1(H3270 *hSession, unsigned char attr, unsigned char value, unsigned char *currentp, Boolean *anyp) |
547 | { | 546 | { |
548 | if (value == *currentp) | 547 | if (value == *currentp) |
549 | return; | 548 | return; |
550 | *currentp = value; | 549 | *currentp = value; |
551 | space3270out(3); | 550 | space3270out(3); |
552 | - *h3270.obptr++ = ORDER_SA; | ||
553 | - *h3270.obptr++ = attr; | ||
554 | - *h3270.obptr++ = value; | 551 | + *hSession->obptr++ = ORDER_SA; |
552 | + *hSession->obptr++ = attr; | ||
553 | + *hSession->obptr++ = value; | ||
555 | if (*anyp) | 554 | if (*anyp) |
556 | trace_ds("'"); | 555 | trace_ds("'"); |
557 | trace_ds(" SetAttribute(%s)", see_efa(attr, value)); | 556 | trace_ds(" SetAttribute(%s)", see_efa(attr, value)); |
@@ -575,27 +574,30 @@ host_cs(unsigned char cs) | @@ -575,27 +574,30 @@ host_cs(unsigned char cs) | ||
575 | } | 574 | } |
576 | } | 575 | } |
577 | 576 | ||
578 | -static void | ||
579 | -insert_sa(int baddr, unsigned char *current_fgp, unsigned char *current_bgp, | ||
580 | - unsigned char *current_grp, unsigned char *current_csp, Boolean *anyp) | 577 | +static void insert_sa(H3270 *hSession, int baddr, unsigned char *current_fgp, unsigned char *current_bgp,unsigned char *current_grp, unsigned char *current_csp, Boolean *anyp) |
581 | { | 578 | { |
582 | - if (h3270.reply_mode != SF_SRM_CHAR) | 579 | + if (hSession->reply_mode != SF_SRM_CHAR) |
583 | return; | 580 | return; |
584 | 581 | ||
585 | - if (memchr((char *) h3270.crm_attr, XA_FOREGROUND, h3270.crm_nattr)) | ||
586 | - insert_sa1(XA_FOREGROUND, h3270.ea_buf[baddr].fg, current_fgp, anyp); | ||
587 | - if (memchr((char *) h3270.crm_attr, XA_BACKGROUND, h3270.crm_nattr)) | ||
588 | - insert_sa1(XA_BACKGROUND, h3270.ea_buf[baddr].bg, current_bgp, anyp); | ||
589 | - if (memchr((char *) h3270.crm_attr, XA_HIGHLIGHTING, h3270.crm_nattr)) { | 582 | + if (memchr((char *) hSession->crm_attr, XA_FOREGROUND, hSession->crm_nattr)) |
583 | + insert_sa1(hSession, XA_FOREGROUND, hSession->ea_buf[baddr].fg, current_fgp, anyp); | ||
584 | + | ||
585 | + if (memchr((char *) hSession->crm_attr, XA_BACKGROUND, hSession->crm_nattr)) | ||
586 | + insert_sa1(hSession, XA_BACKGROUND, hSession->ea_buf[baddr].bg, current_bgp, anyp); | ||
587 | + | ||
588 | + if (memchr((char *) hSession->crm_attr, XA_HIGHLIGHTING, hSession->crm_nattr)) | ||
589 | + { | ||
590 | unsigned char gr; | 590 | unsigned char gr; |
591 | 591 | ||
592 | - gr = h3270.ea_buf[baddr].gr; | 592 | + gr = hSession->ea_buf[baddr].gr; |
593 | if (gr) | 593 | if (gr) |
594 | gr |= 0xf0; | 594 | gr |= 0xf0; |
595 | - insert_sa1(XA_HIGHLIGHTING, gr, current_grp, anyp); | 595 | + insert_sa1(hSession, XA_HIGHLIGHTING, gr, current_grp, anyp); |
596 | } | 596 | } |
597 | - if (memchr((char *) h3270.crm_attr, XA_CHARSET, h3270.crm_nattr)) { | ||
598 | - insert_sa1(XA_CHARSET, host_cs(h3270.ea_buf[baddr].cs), current_csp,anyp); | 597 | + |
598 | + if (memchr((char *) hSession->crm_attr, XA_CHARSET, hSession->crm_nattr)) | ||
599 | + { | ||
600 | + insert_sa1(hSession, XA_CHARSET, host_cs(hSession->ea_buf[baddr].cs), current_csp,anyp); | ||
599 | } | 601 | } |
600 | } | 602 | } |
601 | 603 | ||
@@ -689,12 +691,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | @@ -689,12 +691,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | ||
689 | 691 | ||
690 | if (send_data && | 692 | if (send_data && |
691 | h3270.ea_buf[baddr].cc) { | 693 | h3270.ea_buf[baddr].cc) { |
692 | - insert_sa(baddr, | ||
693 | - ¤t_fg, | ||
694 | - ¤t_bg, | ||
695 | - ¤t_gr, | ||
696 | - ¤t_cs, | ||
697 | - &any); | 694 | + insert_sa(&h3270,baddr,¤t_fg,¤t_bg,¤t_gr,¤t_cs,&any); |
698 | if (h3270.ea_buf[baddr].cs & CS_GE) { | 695 | if (h3270.ea_buf[baddr].cs & CS_GE) { |
699 | space3270out(1); | 696 | space3270out(1); |
700 | *h3270.obptr++ = ORDER_GE; | 697 | *h3270.obptr++ = ORDER_GE; |
@@ -734,12 +731,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | @@ -734,12 +731,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | ||
734 | 731 | ||
735 | do { | 732 | do { |
736 | if (h3270.ea_buf[baddr].cc) { | 733 | if (h3270.ea_buf[baddr].cc) { |
737 | - insert_sa(baddr, | ||
738 | - ¤t_fg, | ||
739 | - ¤t_bg, | ||
740 | - ¤t_gr, | ||
741 | - ¤t_cs, | ||
742 | - &any); | 734 | + insert_sa(&h3270,baddr,¤t_fg,¤t_bg,¤t_gr,¤t_cs,&any); |
743 | if (h3270.ea_buf[baddr].cs & CS_GE) { | 735 | if (h3270.ea_buf[baddr].cs & CS_GE) { |
744 | space3270out(1); | 736 | space3270out(1); |
745 | *h3270.obptr++ = ORDER_GE; | 737 | *h3270.obptr++ = ORDER_GE; |
@@ -797,82 +789,84 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | @@ -797,82 +789,84 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | ||
797 | #endif /*]*/ | 789 | #endif /*]*/ |
798 | 790 | ||
799 | trace_ds("> "); | 791 | trace_ds("> "); |
800 | - h3270.obptr = h3270.obuf; | 792 | + hSession->obptr = hSession->obuf; |
801 | 793 | ||
802 | space3270out(3); | 794 | space3270out(3); |
803 | - *h3270.obptr++ = aid_byte; | ||
804 | - ENCODE_BADDR(h3270.obptr, hSession->cursor_addr); | 795 | + *hSession->obptr++ = aid_byte; |
796 | + ENCODE_BADDR(hSession->obptr, hSession->cursor_addr); | ||
805 | trace_ds("%s%s", see_aid(aid_byte), rcba(hSession,hSession->cursor_addr)); | 797 | trace_ds("%s%s", see_aid(aid_byte), rcba(hSession,hSession->cursor_addr)); |
806 | 798 | ||
807 | baddr = 0; | 799 | baddr = 0; |
808 | do { | 800 | do { |
809 | - if (hSession->ea_buf[baddr].fa) { | ||
810 | - if (hSession->reply_mode == SF_SRM_FIELD) { | 801 | + if (hSession->ea_buf[baddr].fa) |
802 | + { | ||
803 | + if (hSession->reply_mode == SF_SRM_FIELD) | ||
804 | + { | ||
811 | space3270out(2); | 805 | space3270out(2); |
812 | - *h3270.obptr++ = ORDER_SF; | ||
813 | - } else { | 806 | + *hSession->obptr++ = ORDER_SF; |
807 | + } | ||
808 | + else | ||
809 | + { | ||
814 | space3270out(4); | 810 | space3270out(4); |
815 | - *h3270.obptr++ = ORDER_SFE; | ||
816 | - attr_count = h3270.obptr - h3270.obuf; | ||
817 | - *h3270.obptr++ = 1; /* for now */ | ||
818 | - *h3270.obptr++ = XA_3270; | 811 | + *hSession->obptr++ = ORDER_SFE; |
812 | + attr_count = hSession->obptr - hSession->obuf; | ||
813 | + *hSession->obptr++ = 1; /* for now */ | ||
814 | + *hSession->obptr++ = XA_3270; | ||
819 | } | 815 | } |
820 | fa = hSession->ea_buf[baddr].fa & ~FA_PRINTABLE; | 816 | fa = hSession->ea_buf[baddr].fa & ~FA_PRINTABLE; |
821 | - *h3270.obptr++ = code_table[fa]; | 817 | + *hSession->obptr++ = code_table[fa]; |
818 | + | ||
822 | if (any) | 819 | if (any) |
823 | trace_ds("'"); | 820 | trace_ds("'"); |
824 | trace_ds(" StartField%s%s%s", | 821 | trace_ds(" StartField%s%s%s", |
825 | (hSession->reply_mode == SF_SRM_FIELD) ? "" : "Extended", | 822 | (hSession->reply_mode == SF_SRM_FIELD) ? "" : "Extended", |
826 | rcba(hSession,baddr), see_attr(fa)); | 823 | rcba(hSession,baddr), see_attr(fa)); |
827 | - if (hSession->reply_mode != SF_SRM_FIELD) { | 824 | + |
825 | + if (hSession->reply_mode != SF_SRM_FIELD) | ||
826 | + { | ||
828 | if (hSession->ea_buf[baddr].fg) { | 827 | if (hSession->ea_buf[baddr].fg) { |
829 | space3270out(2); | 828 | space3270out(2); |
830 | - *h3270.obptr++ = XA_FOREGROUND; | ||
831 | - *h3270.obptr++ = hSession->ea_buf[baddr].fg; | 829 | + *hSession->obptr++ = XA_FOREGROUND; |
830 | + *hSession->obptr++ = hSession->ea_buf[baddr].fg; | ||
832 | trace_ds("%s", see_efa(XA_FOREGROUND, hSession->ea_buf[baddr].fg)); | 831 | trace_ds("%s", see_efa(XA_FOREGROUND, hSession->ea_buf[baddr].fg)); |
833 | - (*(h3270.obuf + attr_count))++; | 832 | + (*(hSession->obuf + attr_count))++; |
834 | } | 833 | } |
835 | if (hSession->ea_buf[baddr].bg) { | 834 | if (hSession->ea_buf[baddr].bg) { |
836 | space3270out(2); | 835 | space3270out(2); |
837 | - *h3270.obptr++ = XA_BACKGROUND; | ||
838 | - *h3270.obptr++ = hSession->ea_buf[baddr].bg; | 836 | + *hSession->obptr++ = XA_BACKGROUND; |
837 | + *hSession->obptr++ = hSession->ea_buf[baddr].bg; | ||
839 | trace_ds("%s", see_efa(XA_BACKGROUND, hSession->ea_buf[baddr].bg)); | 838 | trace_ds("%s", see_efa(XA_BACKGROUND, hSession->ea_buf[baddr].bg)); |
840 | - (*(h3270.obuf + attr_count))++; | 839 | + (*(hSession->obuf + attr_count))++; |
841 | } | 840 | } |
842 | if (hSession->ea_buf[baddr].gr) { | 841 | if (hSession->ea_buf[baddr].gr) { |
843 | space3270out(2); | 842 | space3270out(2); |
844 | - *h3270.obptr++ = XA_HIGHLIGHTING; | ||
845 | - *h3270.obptr++ = hSession->ea_buf[baddr].gr | 0xf0; | 843 | + *hSession->obptr++ = XA_HIGHLIGHTING; |
844 | + *hSession->obptr++ = hSession->ea_buf[baddr].gr | 0xf0; | ||
846 | trace_ds("%s", see_efa(XA_HIGHLIGHTING, | 845 | trace_ds("%s", see_efa(XA_HIGHLIGHTING, |
847 | hSession->ea_buf[baddr].gr | 0xf0)); | 846 | hSession->ea_buf[baddr].gr | 0xf0)); |
848 | - (*(h3270.obuf + attr_count))++; | 847 | + (*(hSession->obuf + attr_count))++; |
849 | } | 848 | } |
850 | if (hSession->ea_buf[baddr].cs & CS_MASK) { | 849 | if (hSession->ea_buf[baddr].cs & CS_MASK) { |
851 | space3270out(2); | 850 | space3270out(2); |
852 | - *h3270.obptr++ = XA_CHARSET; | ||
853 | - *h3270.obptr++ = host_cs(hSession->ea_buf[baddr].cs); | 851 | + *hSession->obptr++ = XA_CHARSET; |
852 | + *hSession->obptr++ = host_cs(hSession->ea_buf[baddr].cs); | ||
854 | trace_ds("%s", see_efa(XA_CHARSET,host_cs(hSession->ea_buf[baddr].cs))); | 853 | trace_ds("%s", see_efa(XA_CHARSET,host_cs(hSession->ea_buf[baddr].cs))); |
855 | - (*(h3270.obuf + attr_count))++; | 854 | + (*(hSession->obuf + attr_count))++; |
856 | } | 855 | } |
857 | } | 856 | } |
858 | any = False; | 857 | any = False; |
859 | } else { | 858 | } else { |
860 | - insert_sa(baddr, | ||
861 | - ¤t_fg, | ||
862 | - ¤t_bg, | ||
863 | - ¤t_gr, | ||
864 | - ¤t_cs, | ||
865 | - &any); | 859 | + insert_sa(hSession,baddr,¤t_fg,¤t_bg,¤t_gr,¤t_cs,&any); |
866 | if (hSession->ea_buf[baddr].cs & CS_GE) { | 860 | if (hSession->ea_buf[baddr].cs & CS_GE) { |
867 | space3270out(1); | 861 | space3270out(1); |
868 | - *h3270.obptr++ = ORDER_GE; | 862 | + *hSession->obptr++ = ORDER_GE; |
869 | if (any) | 863 | if (any) |
870 | trace_ds("'"); | 864 | trace_ds("'"); |
871 | trace_ds(" GraphicEscape"); | 865 | trace_ds(" GraphicEscape"); |
872 | any = False; | 866 | any = False; |
873 | } | 867 | } |
874 | space3270out(1); | 868 | space3270out(1); |
875 | - *h3270.obptr++ = hSession->ea_buf[baddr].cc; | 869 | + *hSession->obptr++ = hSession->ea_buf[baddr].cc; |
876 | if (hSession->ea_buf[baddr].cc <= 0x3f || | 870 | if (hSession->ea_buf[baddr].cc <= 0x3f || |
877 | hSession->ea_buf[baddr].cc == 0xff) { | 871 | hSession->ea_buf[baddr].cc == 0xff) { |
878 | if (any) | 872 | if (any) |