Commit 96256265e7c74ac8a821afd8ae6a9eab7d05c37f

Authored by perry.werneck@gmail.com
1 parent f7f4157c

Ajustes para multi-sessao

src/lib3270/globals.h
... ... @@ -345,7 +345,7 @@ enum keytype
345 345  
346 346  
347 347 /* Library internal calls */
348   -LIB3270_INTERNAL void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped);
  348 +LIB3270_INTERNAL void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped);
349 349 LIB3270_INTERNAL void lib3270_initialize(void);
350 350 LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr);
351 351  
... ...
src/lib3270/kybd.c
... ... @@ -117,7 +117,7 @@ static unsigned char pa_xlate[] =
117 117 // static void * unlock_id;
118 118 // static time_t unlock_delay_time;
119 119 #define UNLOCK_MS 350 /* 0.35s after last unlock */
120   -static Boolean key_Character(int code, Boolean with_ge, Boolean pasting,Boolean *skipped);
  120 +static Boolean key_Character(H3270 *hSession, int code, Boolean with_ge, Boolean pasting,Boolean *skipped);
121 121 static int flush_ta(H3270 *hSession);
122 122 static void key_AID(H3270 *session, unsigned char aid_code);
123 123 static void kybdlock_set(H3270 *session, unsigned int bits);
... ... @@ -197,35 +197,35 @@ static const char dxl[] = "0123456789abcdef";
197 197 /*
198 198 * Check if the typeahead queue is available
199 199 */
200   -static int enq_chk(H3270 *session)
  200 +static int enq_chk(H3270 *hSession)
201 201 {
202 202 /* If no connection, forget it. */
203   - if (!lib3270_connected(session))
  203 + if (!lib3270_connected(hSession))
204 204 {
205   - trace_event(" dropped (not connected)\n");
  205 + lib3270_trace_event(hSession," dropped (not connected)\n");
206 206 return -1;
207 207 }
208 208  
209 209 /* If operator error, complain and drop it. */
210   - if (session->kybdlock & KL_OERR_MASK)
  210 + if (hSession->kybdlock & KL_OERR_MASK)
211 211 {
212   - lib3270_ring_bell(session);
213   - trace_event(" dropped (operator error)\n");
  212 + lib3270_ring_bell(hSession);
  213 + lib3270_trace_event(hSession," dropped (operator error)\n");
214 214 return -1;
215 215 }
216 216  
217 217 /* If scroll lock, complain and drop it. */
218   - if (session->kybdlock & KL_SCROLLED)
  218 + if (hSession->kybdlock & KL_SCROLLED)
219 219 {
220   - lib3270_ring_bell(session);
221   - trace_event(" dropped (scrolled)\n");
  220 + lib3270_ring_bell(hSession);
  221 + lib3270_trace_event(hSession," dropped (scrolled)\n");
222 222 return -1;
223 223 }
224 224  
225 225 /* If typeahead disabled, complain and drop it. */
226   - if (!session->typeahead)
  226 + if (!hSession->typeahead)
227 227 {
228   - trace_event(" dropped (no typeahead)\n");
  228 + lib3270_trace_event(hSession," dropped (no typeahead)\n");
229 229 return -1;
230 230 }
231 231  
... ... @@ -612,11 +612,13 @@ LIB3270_ACTION(attn)
612 612 return 0;
613 613 }
614 614  
615   -/*
  615 +/**
616 616 * Prepare for an insert of 'count' bytes.
617   - * Returns True if the insert is legal, False otherwise.
  617 + *
  618 + *
  619 + * @return True if the insert is legal, False otherwise.
618 620 */
619   -static Boolean ins_prep(int faddr, int baddr, int count)
  621 +static Boolean ins_prep(H3270 *hSession, int faddr, int baddr, int count)
620 622 {
621 623 int next_faddr;
622 624 int xaddr;
... ... @@ -626,13 +628,17 @@ static Boolean ins_prep(int faddr, int baddr, int count)
626 628 int copy_len;
627 629  
628 630 /* Find the end of the field. */
629   - if (faddr == -1) {
  631 + if (faddr == -1)
  632 + {
630 633 /* Unformatted. Use the end of the line. */
631   - next_faddr = (((baddr / h3270.cols) + 1) * h3270.cols) % (h3270.rows*h3270.cols);
632   - } else {
  634 + next_faddr = (((baddr / hSession->cols) + 1) * hSession->cols) % (hSession->rows*hSession->cols);
  635 + }
  636 + else
  637 + {
633 638 next_faddr = faddr;
634 639 INC_BA(next_faddr);
635   - while (next_faddr != faddr && !h3270.ea_buf[next_faddr].fa) {
  640 + while (next_faddr != faddr && !hSession->ea_buf[next_faddr].fa)
  641 + {
636 642 INC_BA(next_faddr);
637 643 }
638 644 }
... ... @@ -642,11 +648,11 @@ static Boolean ins_prep(int faddr, int baddr, int count)
642 648 need = count;
643 649 ntb = 0;
644 650 while (need && (xaddr != next_faddr)) {
645   - if (h3270.ea_buf[xaddr].cc == EBC_null)
  651 + if (hSession->ea_buf[xaddr].cc == EBC_null)
646 652 need--;
647   - else if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_BLANK_FILL) &&
648   - ((h3270.ea_buf[xaddr].cc == EBC_space) ||
649   - (h3270.ea_buf[xaddr].cc == EBC_underscore))) {
  653 + else if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_BLANK_FILL) &&
  654 + ((hSession->ea_buf[xaddr].cc == EBC_space) ||
  655 + (hSession->ea_buf[xaddr].cc == EBC_underscore))) {
650 656 if (tb_start == -1)
651 657 tb_start = xaddr;
652 658 ntb++;
... ... @@ -659,8 +665,9 @@ static Boolean ins_prep(int faddr, int baddr, int count)
659 665 #if defined(_ST) /*[*/
660 666 printf("need %d at %d, tb_start at %d\n", count, baddr, tb_start);
661 667 #endif /*]*/
662   - if (need - ntb > 0) {
663   - operator_error(&h3270,KL_OERR_OVERFLOW);
  668 + if (need - ntb > 0)
  669 + {
  670 + operator_error(hSession,KL_OERR_OVERFLOW);
664 671 return False;
665 672 }
666 673  
... ... @@ -675,7 +682,7 @@ static Boolean ins_prep(int faddr, int baddr, int count)
675 682 int first_null = -1;
676 683  
677 684 while (need &&
678   - ((h3270.ea_buf[xaddr].cc == EBC_null) ||
  685 + ((hSession->ea_buf[xaddr].cc == EBC_null) ||
679 686 (tb_start >= 0 && xaddr >= tb_start))) {
680 687 need--;
681 688 n_nulls++;
... ... @@ -689,15 +696,16 @@ static Boolean ins_prep(int faddr, int baddr, int count)
689 696 /* Shift right n_nulls worth. */
690 697 copy_len = first_null - baddr;
691 698 if (copy_len < 0)
692   - copy_len += h3270.rows*h3270.cols;
693   - to = (baddr + n_nulls) % (h3270.rows*h3270.cols);
694   -#if defined(_ST) /*[*/
  699 + copy_len += hSession->rows*hSession->cols;
  700 + to = (baddr + n_nulls) % (hSession->rows*hSession->cols);
  701 +/*
  702 +#if defined(_ST)
695 703 printf("found %d NULLs at %d\n", n_nulls, first_null);
696   - printf("copying %d from %d to %d\n", copy_len, to,
697   - first_null);
698   -#endif /*]*/
  704 + printf("copying %d from %d to %d\n", copy_len, to,first_null);
  705 +#endif
  706 +*/
699 707 if (copy_len)
700   - ctlr_wrapping_memmove(&h3270,to, baddr, copy_len);
  708 + ctlr_wrapping_memmove(hSession,to, baddr, copy_len);
701 709 }
702 710 INC_BA(xaddr);
703 711 }
... ... @@ -709,7 +717,7 @@ static Boolean ins_prep(int faddr, int baddr, int count)
709 717 #define GE_WFLAG 0x100
710 718 #define PASTE_WFLAG 0x200
711 719  
712   -static void key_Character_wrapper(H3270 *param, const char *param1, const char *param2)
  720 +static void key_Character_wrapper(H3270 *hSession, const char *param1, const char *param2)
713 721 {
714 722 int code;
715 723 Boolean with_ge = False;
... ... @@ -731,14 +739,14 @@ static void key_Character_wrapper(H3270 *param, const char *param1, const char *
731 739  
732 740 // trace_event(" %s -> Key(%s\"%s\")\n",ia_name[(int) ia_cause],with_ge ? "GE " : "",ctl_see((int) ebc2asc[code]));
733 741  
734   - (void) key_Character(code, with_ge, pasting, NULL);
  742 + (void) key_Character(hSession, code, with_ge, pasting, NULL);
735 743 }
736 744  
737 745 /*
738 746 * Handle an ordinary displayable character key. Lots of stuff to handle
739 747 * insert-mode, protected fields and etc.
740 748 */
741   -static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean *skipped)
  749 +static Boolean key_Character(H3270 *hSession, int code, Boolean with_ge, Boolean pasting, Boolean *skipped)
742 750 {
743 751 register int baddr, faddr, xaddr;
744 752 register unsigned char fa;
... ... @@ -747,56 +755,61 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
747 755 if (skipped != NULL)
748 756 *skipped = False;
749 757  
750   - if (h3270.kybdlock)
  758 + if (hSession->kybdlock)
751 759 {
752 760 char codename[64];
753 761  
754 762 (void) sprintf(codename, "%d", code |(with_ge ? GE_WFLAG : 0) | (pasting ? PASTE_WFLAG : 0));
755 763  
756 764 #if defined(DEBUG) || defined(ANDROID)
757   - enq_ta(&h3270,key_Character_wrapper, codename, CN, "key_Character_wrapper");
  765 + enq_ta(hSession,key_Character_wrapper, codename, CN, "key_Character_wrapper");
758 766 #else
759   - enq_ta(&h3270,key_Character_wrapper, codename, CN);
  767 + enq_ta(hSession,key_Character_wrapper, codename, CN);
760 768 #endif // DEBUG
761 769  
762 770 return False;
763 771 }
764   - baddr = h3270.cursor_addr;
765   - faddr = find_field_attribute(&h3270,baddr);
766   - fa = get_field_attribute(&h3270,baddr);
767   - if (h3270.ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) {
768   - operator_error(&h3270,KL_OERR_PROTECTED);
  772 + baddr = hSession->cursor_addr;
  773 + faddr = find_field_attribute(hSession,baddr);
  774 + fa = get_field_attribute(hSession,baddr);
  775 + if (hSession->ea_buf[baddr].fa || FA_IS_PROTECTED(fa))
  776 + {
  777 + operator_error(hSession,KL_OERR_PROTECTED);
769 778 return False;
770 779 }
771   - if (h3270.numeric_lock && FA_IS_NUMERIC(fa) &&
  780 + if (hSession->numeric_lock && FA_IS_NUMERIC(fa) &&
772 781 !((code >= EBC_0 && code <= EBC_9) ||
773 782 code == EBC_minus || code == EBC_period)) {
774   - operator_error(&h3270,KL_OERR_NUMERIC);
  783 + operator_error(hSession,KL_OERR_NUMERIC);
775 784 return False;
776 785 }
777 786  
778 787 /* Can't put an SBCS in a DBCS field. */
779   - if (h3270.ea_buf[faddr].cs == CS_DBCS) {
780   - operator_error(&h3270,KL_OERR_DBCS);
  788 + if (hSession->ea_buf[faddr].cs == CS_DBCS) {
  789 + operator_error(hSession,KL_OERR_DBCS);
781 790 return False;
782 791 }
783 792  
784 793 /* If it's an SI (end of DBCS subfield), move over one position. */
785   - if (h3270.ea_buf[baddr].cc == EBC_si) {
  794 + if (hSession->ea_buf[baddr].cc == EBC_si) {
786 795 INC_BA(baddr);
787   - if (baddr == faddr) {
788   - operator_error(&h3270,KL_OERR_OVERFLOW);
  796 + if (baddr == faddr)
  797 + {
  798 + operator_error(hSession,KL_OERR_OVERFLOW);
789 799 return False;
790 800 }
791 801 }
792 802  
793 803 /* Add the character. */
794   - if (h3270.ea_buf[baddr].cc == EBC_so) {
  804 + if (hSession->ea_buf[baddr].cc == EBC_so) {
795 805  
796   - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_INSERT)) {
797   - if (!ins_prep(faddr, baddr, 1))
  806 + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_INSERT))
  807 + {
  808 + if (!ins_prep(hSession,faddr, baddr, 1))
798 809 return False;
799   - } else {
  810 + }
  811 + else
  812 + {
800 813 Boolean was_si = False;
801 814  
802 815 /*
... ... @@ -808,18 +821,19 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
808 821 */
809 822 xaddr = baddr;
810 823 INC_BA(xaddr);
811   - was_si = (h3270.ea_buf[xaddr].cc == EBC_si);
812   - ctlr_add(&h3270,xaddr, EBC_space, CS_BASE);
813   - ctlr_add_fg(&h3270,xaddr, 0);
  824 + was_si = (hSession->ea_buf[xaddr].cc == EBC_si);
  825 + ctlr_add(hSession,xaddr, EBC_space, CS_BASE);
  826 + ctlr_add_fg(hSession,xaddr, 0);
814 827 #if defined(X3270_ANSI) /*[*/
815   - ctlr_add_bg(&h3270,xaddr, 0);
  828 + ctlr_add_bg(hSession,xaddr, 0);
816 829 #endif /*]*/
817   - if (!was_si) {
  830 + if (!was_si)
  831 + {
818 832 INC_BA(xaddr);
819   - ctlr_add(&h3270,xaddr, EBC_so, CS_BASE);
820   - ctlr_add_fg(&h3270,xaddr, 0);
  833 + ctlr_add(hSession,xaddr, EBC_so, CS_BASE);
  834 + ctlr_add_fg(hSession,xaddr, 0);
821 835 #if defined(X3270_ANSI) /*[*/
822   - ctlr_add_bg(&h3270,xaddr, 0);
  836 + ctlr_add_bg(hSession,xaddr, 0);
823 837 #endif /*]*/
824 838 }
825 839 }
... ... @@ -830,8 +844,8 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
830 844 /* fall through... */
831 845 case DBCS_LEFT:
832 846 if (why == DBCS_ATTRIBUTE) {
833   - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_INSERT)) {
834   - if (!ins_prep(faddr, baddr, 1))
  847 + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_INSERT)) {
  848 + if (!ins_prep(hSession,faddr, baddr, 1))
835 849 return False;
836 850 } else {
837 851 /*
... ... @@ -840,14 +854,15 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
840 854 */
841 855 xaddr = baddr;
842 856 INC_BA(xaddr);
843   - ctlr_add(&h3270,xaddr, EBC_space, CS_BASE);
844   - ctlr_add_fg(&h3270,xaddr, 0);
845   - ctlr_add_gr(&h3270,xaddr, 0);
  857 + ctlr_add(hSession,xaddr, EBC_space, CS_BASE);
  858 + ctlr_add_fg(hSession,xaddr, 0);
  859 + ctlr_add_gr(hSession,xaddr, 0);
846 860 }
847 861 } else {
848 862 Boolean was_si;
849 863  
850   - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_INSERT)) {
  864 + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_INSERT))
  865 + {
851 866 /*
852 867 * Inserting SBCS into a DBCS subfield.
853 868 * If this is the first position, we
... ... @@ -859,66 +874,69 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
859 874 */
860 875 xaddr = baddr;
861 876 DEC_BA(xaddr);
862   - if (h3270.ea_buf[xaddr].cc == EBC_so) {
  877 + if (hSession->ea_buf[xaddr].cc == EBC_so) {
863 878 DEC_BA(baddr);
864   - if (!ins_prep(faddr, baddr, 1))
  879 + if (!ins_prep(hSession, faddr, baddr, 1))
865 880 return False;
866 881 } else {
867   - if (!ins_prep(faddr, baddr, 3))
  882 + if (!ins_prep(hSession, faddr, baddr, 3))
868 883 return False;
869 884 xaddr = baddr;
870   - ctlr_add(&h3270,xaddr, EBC_si,CS_BASE);
871   - ctlr_add_fg(&h3270,xaddr, 0);
872   - ctlr_add_gr(&h3270,xaddr, 0);
  885 + ctlr_add(hSession,xaddr, EBC_si,CS_BASE);
  886 + ctlr_add_fg(hSession,xaddr, 0);
  887 + ctlr_add_gr(hSession,xaddr, 0);
873 888 INC_BA(xaddr);
874 889 INC_BA(baddr);
875 890 INC_BA(xaddr);
876   - ctlr_add(&h3270,xaddr, EBC_so,CS_BASE);
877   - ctlr_add_fg(&h3270,xaddr, 0);
878   - ctlr_add_gr(&h3270,xaddr, 0);
  891 + ctlr_add(hSession,xaddr, EBC_so,CS_BASE);
  892 + ctlr_add_fg(hSession,xaddr, 0);
  893 + ctlr_add_gr(hSession,xaddr, 0);
879 894 }
880 895 } else {
881 896 /* Overwriting part of a subfield. */
882 897 xaddr = baddr;
883   - ctlr_add(&h3270,xaddr, EBC_si, CS_BASE);
884   - ctlr_add_fg(&h3270,xaddr, 0);
885   - ctlr_add_gr(&h3270,xaddr, 0);
  898 + ctlr_add(hSession,xaddr, EBC_si, CS_BASE);
  899 + ctlr_add_fg(hSession,xaddr, 0);
  900 + ctlr_add_gr(hSession,xaddr, 0);
886 901 INC_BA(xaddr);
887 902 INC_BA(baddr);
888 903 INC_BA(xaddr);
889   - was_si = (h3270.ea_buf[xaddr].cc == EBC_si);
890   - ctlr_add(&h3270,xaddr, EBC_space, CS_BASE);
891   - ctlr_add_fg(&h3270,xaddr, 0);
892   - ctlr_add_gr(&h3270,xaddr, 0);
893   - if (!was_si) {
  904 + was_si = (hSession->ea_buf[xaddr].cc == EBC_si);
  905 + ctlr_add(hSession,xaddr, EBC_space, CS_BASE);
  906 + ctlr_add_fg(hSession,xaddr, 0);
  907 + ctlr_add_gr(hSession,xaddr, 0);
  908 + if (!was_si)
  909 + {
894 910 INC_BA(xaddr);
895   - ctlr_add(&h3270,xaddr, EBC_so,CS_BASE);
896   - ctlr_add_fg(&h3270,xaddr, 0);
897   - ctlr_add_gr(&h3270,xaddr, 0);
  911 + ctlr_add(hSession,xaddr, EBC_so,CS_BASE);
  912 + ctlr_add_fg(hSession,xaddr, 0);
  913 + ctlr_add_gr(hSession,xaddr, 0);
898 914 }
899 915 }
900 916 }
901 917 break;
902 918 default:
903 919 case DBCS_NONE:
904   - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_INSERT) && !ins_prep(faddr, baddr, 1))
  920 + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_INSERT) && !ins_prep(hSession, faddr, baddr, 1))
905 921 return False;
906 922 break;
907 923 }
908   - ctlr_add(&h3270,baddr, (unsigned char)code,(unsigned char)(with_ge ? CS_GE : 0));
909   - ctlr_add_fg(&h3270,baddr, 0);
910   - ctlr_add_gr(&h3270,baddr, 0);
  924 + ctlr_add(hSession,baddr, (unsigned char)code,(unsigned char)(with_ge ? CS_GE : 0));
  925 + ctlr_add_fg(hSession,baddr, 0);
  926 + ctlr_add_gr(hSession,baddr, 0);
911 927 INC_BA(baddr);
912 928  
913 929 /* Replace leading nulls with blanks, if desired. */
914   - if (h3270.formatted && lib3270_get_toggle(&h3270,LIB3270_TOGGLE_BLANK_FILL)) {
  930 + if (hSession->formatted && lib3270_get_toggle(hSession,LIB3270_TOGGLE_BLANK_FILL))
  931 + {
915 932 register int baddr_fill = baddr;
916 933  
917 934 DEC_BA(baddr_fill);
918 935 while (baddr_fill != faddr) {
919 936  
920 937 /* Check for backward line wrap. */
921   - if ((baddr_fill % h3270.cols) == h3270.cols - 1) {
  938 + if ((baddr_fill % hSession->cols) == hSession->cols - 1)
  939 + {
922 940 Boolean aborted = True;
923 941 register int baddr_scan = baddr_fill;
924 942  
... ... @@ -927,11 +945,12 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
927 945 * for NULLs.
928 946 */
929 947 while (baddr_scan != faddr) {
930   - if (h3270.ea_buf[baddr_scan].cc != EBC_null) {
  948 + if (hSession->ea_buf[baddr_scan].cc != EBC_null)
  949 + {
931 950 aborted = False;
932 951 break;
933 952 }
934   - if (!(baddr_scan % h3270.cols))
  953 + if (!(baddr_scan % hSession->cols))
935 954 break;
936 955 DEC_BA(baddr_scan);
937 956 }
... ... @@ -939,63 +958,66 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
939 958 break;
940 959 }
941 960  
942   - if (h3270.ea_buf[baddr_fill].cc == EBC_null)
943   - ctlr_add(&h3270,baddr_fill, EBC_space, 0);
  961 + if (hSession->ea_buf[baddr_fill].cc == EBC_null)
  962 + ctlr_add(hSession,baddr_fill, EBC_space, 0);
944 963 DEC_BA(baddr_fill);
945 964 }
946 965 }
947 966  
948   - mdt_set(&h3270,h3270.cursor_addr);
  967 + mdt_set(hSession,hSession->cursor_addr);
949 968  
950 969 /*
951 970 * Implement auto-skip, and don't land on attribute bytes.
952 971 * This happens for all pasted data (even DUP), and for all
953 972 * keyboard-generated data except DUP.
954 973 */
955   - if (pasting || (code != EBC_dup)) {
956   - while (h3270.ea_buf[baddr].fa) {
  974 + if (pasting || (code != EBC_dup))
  975 + {
  976 + while (hSession->ea_buf[baddr].fa)
  977 + {
957 978 if (skipped != NULL)
958 979 *skipped = True;
959   - if (FA_IS_SKIP(h3270.ea_buf[baddr].fa))
960   - baddr = next_unprotected(&h3270,baddr);
  980 + if (FA_IS_SKIP(hSession->ea_buf[baddr].fa))
  981 + baddr = next_unprotected(hSession,baddr);
961 982 else
962 983 INC_BA(baddr);
963 984 }
964   - cursor_move(&h3270,baddr);
  985 + cursor_move(hSession,baddr);
965 986 }
966 987  
967 988 (void) ctlr_dbcs_postprocess();
968 989 return True;
969 990 }
970 991  
971   -/*
  992 +/**
972 993 * Handle an ordinary character key, given an ASCII code.
  994 + *
973 995 */
974   -void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped)
  996 +void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped)
975 997 {
976 998 if (skipped != NULL)
977 999 *skipped = False;
978 1000  
979   - trace_event(" %s -> Key(\"%s\")\n",ia_name[(int) cause], ctl_see((int) c));
  1001 + lib3270_trace_event(hSession," %s -> Key(\"%s\")\n",ia_name[(int) cause], ctl_see((int) c));
980 1002  
981 1003 if (IN_3270)
982 1004 {
983 1005 if (c < ' ')
984 1006 {
985   - trace_event(" dropped (control char)\n");
  1007 + lib3270_trace_event(hSession," dropped (control char)\n");
986 1008 return;
987 1009 }
988   - (void) key_Character((int) asc2ebc[c], keytype == KT_GE, False, skipped);
  1010 + (void) key_Character(hSession, (int) asc2ebc[c], keytype == KT_GE, False, skipped);
989 1011 }
990 1012 #if defined(X3270_ANSI) /*[*/
991 1013 else if (IN_ANSI)
992 1014 {
993   - net_sendc(&h3270,(char) c);
  1015 + net_sendc(hSession,(char) c);
994 1016 }
995 1017 #endif /*]*/
996 1018 else
997 1019 {
998   - trace_event(" dropped (not connected)\n");
  1020 + lib3270_trace_event(hSession," dropped (not connected)\n");
999 1021 }
1000 1022 }
1001 1023  
... ... @@ -1847,7 +1869,7 @@ LIB3270_ACTION( dup )
1847 1869 if (IN_ANSI)
1848 1870 return 0;
1849 1871 #endif
1850   - if (key_Character(EBC_dup, False, False, NULL))
  1872 + if (key_Character(hSession, EBC_dup, False, False, NULL))
1851 1873 {
1852 1874 hSession->display(hSession);
1853 1875 cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr));
... ... @@ -1870,7 +1892,7 @@ LIB3270_ACTION( fieldmark )
1870 1892 if (IN_ANSI)
1871 1893 return 0 ;
1872 1894 #endif
1873   - (void) key_Character(EBC_fm, False, False, NULL);
  1895 + (void) key_Character(hSession, EBC_fm, False, False, NULL);
1874 1896  
1875 1897 return 0;
1876 1898 }
... ... @@ -2511,8 +2533,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2511 2533 break;
2512 2534 case '\f':
2513 2535 if (pasting) {
2514   - key_ACharacter((unsigned char) ' ',
2515   - KT_STD, ia, &skipped);
  2536 + key_ACharacter(session,(unsigned char) ' ',KT_STD, ia, &skipped);
2516 2537 } else {
2517 2538 lib3270_clear(session);
2518 2539 skipped = False;
... ... @@ -2544,18 +2565,17 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2544 2565 if (!pasting)
2545 2566 state = BACKSLASH;
2546 2567 else
2547   - key_ACharacter((unsigned char) c,
2548   - KT_STD, ia, &skipped);
  2568 + key_ACharacter(session,(unsigned char) c,KT_STD, ia, &skipped);
2549 2569 break;
2550 2570 case '\033': /* ESC is special only when pasting */
2551 2571 if (pasting)
2552 2572 state = XGE;
2553 2573 break;
2554 2574 case '[': /* APL left bracket */
2555   - key_ACharacter((unsigned char) c, KT_STD, ia, &skipped);
  2575 + key_ACharacter(session,(unsigned char) c, KT_STD, ia, &skipped);
2556 2576 break;
2557 2577 case ']': /* APL right bracket */
2558   - key_ACharacter((unsigned char) c, KT_STD, ia, &skipped);
  2578 + key_ACharacter(session,(unsigned char) c, KT_STD, ia, &skipped);
2559 2579 break;
2560 2580 default:
2561 2581 /*
... ... @@ -2577,14 +2597,14 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2577 2597 break;
2578 2598 }
2579 2599 #endif */
2580   - key_ACharacter((unsigned char) c, KT_STD, ia, &skipped);
  2600 + key_ACharacter(session,(unsigned char) c, KT_STD, ia, &skipped);
2581 2601 break;
2582 2602 }
2583 2603 break;
2584 2604 case BACKSLASH: /* last character was a backslash */
2585 2605 switch (c) {
2586 2606 case 'a':
2587   - popup_an_error(NULL,"%s: Bell not supported",action_name(String_action));
  2607 + popup_an_error(session,"%s: Bell not supported",action_name(String_action));
2588 2608 // cancel_if_idle_command();
2589 2609 state = BASE;
2590 2610 break;
... ... @@ -2640,7 +2660,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2640 2660 state = BACKX;
2641 2661 break;
2642 2662 case '\\':
2643   - key_ACharacter((unsigned char) c, KT_STD, ia,&skipped);
  2663 + key_ACharacter(session,(unsigned char) c, KT_STD, ia,&skipped);
2644 2664 state = BASE;
2645 2665 break;
2646 2666 case '0':
... ... @@ -2723,8 +2743,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2723 2743 nc = 0;
2724 2744 continue;
2725 2745 } else {
2726   - popup_an_error(NULL,"%s: Missing hex digits after \\x",
2727   - action_name(String_action));
  2746 + popup_an_error(session,_( "%s: Missing hex digits after \\x" ),action_name(String_action));
2728 2747 // cancel_if_idle_command();
2729 2748 state = BASE;
2730 2749 continue;
... ... @@ -2735,8 +2754,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2735 2754 nc++;
2736 2755 break;
2737 2756 } else {
2738   - key_ACharacter((unsigned char) literal, KT_STD,
2739   - ia, &skipped);
  2757 + key_ACharacter(session,(unsigned char) literal, KT_STD,ia, &skipped);
2740 2758 state = BASE;
2741 2759 continue;
2742 2760 }
... ... @@ -2746,22 +2764,20 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2746 2764 nc++;
2747 2765 break;
2748 2766 } else {
2749   - key_ACharacter((unsigned char) literal, KT_STD,
2750   - ia, &skipped);
  2767 + key_ACharacter(session,(unsigned char) literal, KT_STD, ia, &skipped);
2751 2768 state = BASE;
2752 2769 continue;
2753 2770 }
2754 2771 case XGE: /* have seen ESC */
2755 2772 switch (c) {
2756 2773 case ';': /* FM */
2757   - key_Character(EBC_fm, False, True, &skipped);
  2774 + key_Character(session, EBC_fm, False, True, &skipped);
2758 2775 break;
2759 2776 case '*': /* DUP */
2760   - key_Character(EBC_dup, False, True, &skipped);
  2777 + key_Character(session, EBC_dup, False, True, &skipped);
2761 2778 break;
2762 2779 default:
2763   - key_ACharacter((unsigned char) c, KT_GE, ia,
2764   - &skipped);
  2780 + key_ACharacter(session,(unsigned char) c, KT_GE, ia,&skipped);
2765 2781 break;
2766 2782 }
2767 2783 state = BASE;
... ... @@ -2773,18 +2789,18 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2773 2789  
2774 2790 switch (state) {
2775 2791 case BASE:
2776   - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) &&
  2792 + if (lib3270_get_toggle(session,LIB3270_TOGGLE_MARGINED_PASTE) &&
2777 2793 BA_TO_COL(session->cursor_addr) < orig_col) {
2778   - (void) remargin(&h3270,orig_col);
  2794 + (void) remargin(session,orig_col);
2779 2795 }
2780 2796 break;
2781 2797 case OCTAL:
2782 2798 case HEX:
2783   - key_ACharacter((unsigned char) literal, KT_STD, ia, &skipped);
  2799 + key_ACharacter(session,(unsigned char) literal, KT_STD, ia, &skipped);
2784 2800 state = BASE;
2785   - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) &&
  2801 + if (lib3270_get_toggle(session,LIB3270_TOGGLE_MARGINED_PASTE) &&
2786 2802 BA_TO_COL(session->cursor_addr) < orig_col) {
2787   - (void) remargin(&h3270,orig_col);
  2803 + (void) remargin(session,orig_col);
2788 2804 }
2789 2805 break;
2790 2806 case BACKPF:
... ...
src/lib3270/paste.c
... ... @@ -143,11 +143,11 @@
143 143 if(FA_IS_PROTECTED(session->ea_buf[faddr].fa))
144 144 session->cursor_addr++;
145 145 else
146   - key_ACharacter(c, KT_STD, IA_PASTE, NULL);
  146 + key_ACharacter(session, c, KT_STD, IA_PASTE, NULL);
147 147 }
148 148 else
149 149 {
150   - key_ACharacter(c, KT_STD, IA_PASTE, NULL);
  150 + key_ACharacter(session, c, KT_STD, IA_PASTE, NULL);
151 151 }
152 152  
153 153 data->qtd++;
... ...