Commit 5c34e90015783cacece15417ec829324f01d13a3
1 parent
74c0a9e3
Exists in
master
Movendo tamanhos do terminal para a estrutura de controle de sessao
Showing
12 changed files
with
184 additions
and
183 deletions
Show diff stats
latest/src/include/lib3270/3270ds.h
... | ... | @@ -135,11 +135,11 @@ |
135 | 135 | #define QR_IMP_PART 0xa6 /* implicit partition */ |
136 | 136 | #define QR_NULL 0xff /* null */ |
137 | 137 | |
138 | -#define BA_TO_ROW(ba) ((ba) / COLS) | |
139 | -#define BA_TO_COL(ba) ((ba) % COLS) | |
140 | -#define ROWCOL_TO_BA(r,c) (((r) * COLS) + c) | |
141 | -#define INC_BA(ba) { (ba) = ((ba) + 1) % (COLS * ROWS); } | |
142 | -#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : ((COLS*ROWS) - 1); } | |
138 | +#define BA_TO_ROW(ba) ((ba) / h3270.cols) | |
139 | +#define BA_TO_COL(ba) ((ba) % h3270.cols) | |
140 | +#define ROWCOL_TO_BA(r,c) (((r) * h3270.cols) + c) | |
141 | +#define INC_BA(ba) { (ba) = ((ba) + 1) % (h3270.cols * h3270.rows); } | |
142 | +#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : ((h3270.cols*h3270.rows) - 1); } | |
143 | 143 | |
144 | 144 | /* Field attributes. */ |
145 | 145 | #define FA_PRINTABLE 0xc0 /* these make the character "printable" */ |
... | ... | @@ -313,17 +313,17 @@ |
313 | 313 | #define EBC_dup 0x1c |
314 | 314 | #define EBC_fm 0x1e |
315 | 315 | #define EBC_space 0x40 |
316 | -#define EBC_nobreakspace 0x41 | |
317 | -#define EBC_period 0x4b | |
318 | -#define EBC_ampersand 0x50 | |
316 | +#define EBC_nobreakspace 0x41 | |
317 | +#define EBC_period 0x4b | |
318 | +#define EBC_ampersand 0x50 | |
319 | 319 | #define EBC_underscore 0x6d |
320 | -#define EBC_greater 0x6e | |
321 | -#define EBC_question 0x6f | |
320 | +#define EBC_greater 0x6e | |
321 | +#define EBC_question 0x6f | |
322 | 322 | #define EBC_Yacute 0xad |
323 | 323 | #define EBC_diaeresis 0xbd |
324 | 324 | #define EBC_minus 0xca |
325 | -#define EBC_0 0xf0 | |
326 | -#define EBC_9 0xf9 | |
325 | +#define EBC_0 0xf0 | |
326 | +#define EBC_9 0xf9 | |
327 | 327 | #define EBC_eo 0xff |
328 | 328 | |
329 | 329 | /* BIND definitions. */ | ... | ... |
latest/src/include/lib3270/api.h
latest/src/lib/ansi.c
... | ... | @@ -530,9 +530,9 @@ ansi_newline(int ig1 unused, int ig2 unused) |
530 | 530 | { |
531 | 531 | int nc; |
532 | 532 | |
533 | - cursor_move(cursor_addr - (cursor_addr % COLS)); | |
534 | - nc = cursor_addr + COLS; | |
535 | - if (nc < scroll_bottom * COLS) | |
533 | + cursor_move(cursor_addr - (cursor_addr % h3270.cols)); | |
534 | + nc = cursor_addr + h3270.cols; | |
535 | + if (nc < scroll_bottom * h3270.cols) | |
536 | 536 | cursor_move(nc); |
537 | 537 | else |
538 | 538 | ansi_scroll(); |
... | ... | @@ -547,11 +547,11 @@ ansi_cursor_up(int nn, int ig2 unused) |
547 | 547 | |
548 | 548 | if (nn < 1) |
549 | 549 | nn = 1; |
550 | - rr = cursor_addr / COLS; | |
550 | + rr = cursor_addr / h3270.cols; | |
551 | 551 | if (rr - nn < 0) |
552 | - cursor_move(cursor_addr % COLS); | |
552 | + cursor_move(cursor_addr % h3270.cols); | |
553 | 553 | else |
554 | - cursor_move(cursor_addr - (nn * COLS)); | |
554 | + cursor_move(cursor_addr - (nn * h3270.cols)); | |
555 | 555 | held_wrap = False; |
556 | 556 | return DATA; |
557 | 557 | } |
... | ... | @@ -599,14 +599,14 @@ ansi_reset(int ig1 unused, int ig2 unused) |
599 | 599 | allow_wide_mode = 0; |
600 | 600 | saved_altbuffer = False; |
601 | 601 | scroll_top = 1; |
602 | - scroll_bottom = ROWS; | |
603 | - Replace(tabs, (unsigned char *)Malloc((COLS+7)/8)); | |
604 | - for (i = 0; i < (COLS+7)/8; i++) | |
602 | + scroll_bottom = h3270.rows; | |
603 | + Replace(tabs, (unsigned char *)Malloc((h3270.cols+7)/8)); | |
604 | + for (i = 0; i < (h3270.cols+7)/8; i++) | |
605 | 605 | tabs[i] = 0x01; |
606 | 606 | held_wrap = False; |
607 | 607 | if (!first) { |
608 | 608 | ctlr_altbuffer(True); |
609 | - ctlr_aclear(0, ROWS * COLS, 1); | |
609 | + ctlr_aclear(0, h3270.rows * h3270.cols, 1); | |
610 | 610 | ctlr_altbuffer(False); |
611 | 611 | ctlr_clear(False); |
612 | 612 | screen_80(); |
... | ... | @@ -619,8 +619,8 @@ ansi_reset(int ig1 unused, int ig2 unused) |
619 | 619 | static enum state |
620 | 620 | ansi_insert_chars(int nn, int ig2 unused) |
621 | 621 | { |
622 | - int cc = cursor_addr % COLS; /* current col */ | |
623 | - int mc = COLS - cc; /* max chars that can be inserted */ | |
622 | + int cc = cursor_addr % h3270.cols; /* current col */ | |
623 | + int mc = h3270.cols - cc; /* max chars that can be inserted */ | |
624 | 624 | int ns; /* chars that are shifting */ |
625 | 625 | |
626 | 626 | if (nn < 1) |
... | ... | @@ -645,11 +645,11 @@ ansi_cursor_down(int nn, int ig2 unused) |
645 | 645 | |
646 | 646 | if (nn < 1) |
647 | 647 | nn = 1; |
648 | - rr = cursor_addr / COLS; | |
649 | - if (rr + nn >= ROWS) | |
650 | - cursor_move((ROWS-1)*COLS + (cursor_addr%COLS)); | |
648 | + rr = cursor_addr / h3270.cols; | |
649 | + if (rr + nn >= h3270.cols) | |
650 | + cursor_move((h3270.cols-1)*h3270.cols + (cursor_addr%h3270.cols)); | |
651 | 651 | else |
652 | - cursor_move(cursor_addr + (nn * COLS)); | |
652 | + cursor_move(cursor_addr + (nn * h3270.cols)); | |
653 | 653 | held_wrap = False; |
654 | 654 | return DATA; |
655 | 655 | } |
... | ... | @@ -661,11 +661,11 @@ ansi_cursor_right(int nn, int ig2 unused) |
661 | 661 | |
662 | 662 | if (nn < 1) |
663 | 663 | nn = 1; |
664 | - cc = cursor_addr % COLS; | |
665 | - if (cc == COLS-1) | |
664 | + cc = cursor_addr % h3270.cols; | |
665 | + if (cc == h3270.cols-1) | |
666 | 666 | return DATA; |
667 | - if (cc + nn >= COLS) | |
668 | - nn = COLS - 1 - cc; | |
667 | + if (cc + nn >= h3270.cols) | |
668 | + nn = h3270.cols - 1 - cc; | |
669 | 669 | cursor_move(cursor_addr + nn); |
670 | 670 | held_wrap = False; |
671 | 671 | return DATA; |
... | ... | @@ -682,7 +682,7 @@ ansi_cursor_left(int nn, int ig2 unused) |
682 | 682 | } |
683 | 683 | if (nn < 1) |
684 | 684 | nn = 1; |
685 | - cc = cursor_addr % COLS; | |
685 | + cc = cursor_addr % h3270.cols; | |
686 | 686 | if (!cc) |
687 | 687 | return DATA; |
688 | 688 | if (nn > cc) |
... | ... | @@ -695,10 +695,10 @@ static enum state |
695 | 695 | ansi_cursor_motion(int n1, int n2) |
696 | 696 | { |
697 | 697 | if (n1 < 1) n1 = 1; |
698 | - if (n1 > ROWS) n1 = ROWS; | |
698 | + if (n1 > h3270.rows) n1 = h3270.rows; | |
699 | 699 | if (n2 < 1) n2 = 1; |
700 | - if (n2 > COLS) n2 = COLS; | |
701 | - cursor_move((n1 - 1) * COLS + (n2 - 1)); | |
700 | + if (n2 > h3270.cols) n2 = h3270.cols; | |
701 | + cursor_move((n1 - 1) * h3270.cols + (n2 - 1)); | |
702 | 702 | held_wrap = False; |
703 | 703 | return DATA; |
704 | 704 | } |
... | ... | @@ -708,15 +708,15 @@ ansi_erase_in_display(int nn, int ig2 unused) |
708 | 708 | { |
709 | 709 | switch (nn) { |
710 | 710 | case 0: /* below */ |
711 | - ctlr_aclear(cursor_addr, (ROWS * COLS) - cursor_addr, 1); | |
711 | + ctlr_aclear(cursor_addr, (h3270.rows * h3270.cols) - cursor_addr, 1); | |
712 | 712 | break; |
713 | 713 | case 1: /* above */ |
714 | 714 | ctlr_aclear(0, cursor_addr + 1, 1); |
715 | 715 | break; |
716 | 716 | case 2: /* all (without moving cursor) */ |
717 | 717 | if (cursor_addr == 0 && !is_altbuffer) |
718 | - scroll_save(ROWS, True); | |
719 | - ctlr_aclear(0, ROWS * COLS, 1); | |
718 | + scroll_save(h3270.rows, True); | |
719 | + ctlr_aclear(0, h3270.rows * h3270.cols, 1); | |
720 | 720 | break; |
721 | 721 | } |
722 | 722 | return DATA; |
... | ... | @@ -725,17 +725,17 @@ ansi_erase_in_display(int nn, int ig2 unused) |
725 | 725 | static enum state |
726 | 726 | ansi_erase_in_line(int nn, int ig2 unused) |
727 | 727 | { |
728 | - int nc = cursor_addr % COLS; | |
728 | + int nc = cursor_addr % h3270.cols; | |
729 | 729 | |
730 | 730 | switch (nn) { |
731 | 731 | case 0: /* to right */ |
732 | - ctlr_aclear(cursor_addr, COLS - nc, 1); | |
732 | + ctlr_aclear(cursor_addr, h3270.cols - nc, 1); | |
733 | 733 | break; |
734 | 734 | case 1: /* to left */ |
735 | 735 | ctlr_aclear(cursor_addr - nc, nc+1, 1); |
736 | 736 | break; |
737 | 737 | case 2: /* all */ |
738 | - ctlr_aclear(cursor_addr - nc, COLS, 1); | |
738 | + ctlr_aclear(cursor_addr - nc, h3270.cols, 1); | |
739 | 739 | break; |
740 | 740 | } |
741 | 741 | return DATA; |
... | ... | @@ -744,7 +744,7 @@ ansi_erase_in_line(int nn, int ig2 unused) |
744 | 744 | static enum state |
745 | 745 | ansi_insert_lines(int nn, int ig2 unused) |
746 | 746 | { |
747 | - int rr = cursor_addr / COLS; /* current row */ | |
747 | + int rr = cursor_addr / h3270.cols; /* current row */ | |
748 | 748 | int mr = scroll_bottom - rr; /* rows left at and below this one */ |
749 | 749 | int ns; /* rows that are shifting */ |
750 | 750 | |
... | ... | @@ -760,17 +760,17 @@ ansi_insert_lines(int nn, int ig2 unused) |
760 | 760 | /* Move the victims down */ |
761 | 761 | ns = mr - nn; |
762 | 762 | if (ns) |
763 | - ctlr_bcopy(rr * COLS, (rr + nn) * COLS, ns * COLS, 1); | |
763 | + ctlr_bcopy(rr * h3270.cols, (rr + nn) * h3270.cols, ns * h3270.cols, 1); | |
764 | 764 | |
765 | 765 | /* Clear the middle of the screen */ |
766 | - ctlr_aclear(rr * COLS, nn * COLS, 1); | |
766 | + ctlr_aclear(rr * h3270.cols, nn * h3270.cols, 1); | |
767 | 767 | return DATA; |
768 | 768 | } |
769 | 769 | |
770 | 770 | static enum state |
771 | 771 | ansi_delete_lines(int nn, int ig2 unused) |
772 | 772 | { |
773 | - int rr = cursor_addr / COLS; /* current row */ | |
773 | + int rr = cursor_addr / h3270.cols; /* current row */ | |
774 | 774 | int mr = scroll_bottom - rr; /* max rows that can be deleted */ |
775 | 775 | int ns; /* rows that are shifting */ |
776 | 776 | |
... | ... | @@ -786,18 +786,18 @@ ansi_delete_lines(int nn, int ig2 unused) |
786 | 786 | /* Move the surviving rows up */ |
787 | 787 | ns = mr - nn; |
788 | 788 | if (ns) |
789 | - ctlr_bcopy((rr + nn) * COLS, rr * COLS, ns * COLS, 1); | |
789 | + ctlr_bcopy((rr + nn) * h3270.cols, rr * h3270.cols, ns * h3270.cols, 1); | |
790 | 790 | |
791 | 791 | /* Clear the rest of the screen */ |
792 | - ctlr_aclear((rr + ns) * COLS, nn * COLS, 1); | |
792 | + ctlr_aclear((rr + ns) * h3270.cols, nn * h3270.cols, 1); | |
793 | 793 | return DATA; |
794 | 794 | } |
795 | 795 | |
796 | 796 | static enum state |
797 | 797 | ansi_delete_chars(int nn, int ig2 unused) |
798 | 798 | { |
799 | - int cc = cursor_addr % COLS; /* current col */ | |
800 | - int mc = COLS - cc; /* max chars that can be deleted */ | |
799 | + int cc = cursor_addr % h3270.cols; /* current col */ | |
800 | + int mc = h3270.cols - cc; /* max chars that can be deleted */ | |
801 | 801 | int ns; /* chars that are shifting */ |
802 | 802 | |
803 | 803 | if (nn < 1) |
... | ... | @@ -936,10 +936,10 @@ ansi_backspace(int ig1 unused, int ig2 unused) |
936 | 936 | return DATA; |
937 | 937 | } |
938 | 938 | if (rev_wraparound_mode) { |
939 | - if (cursor_addr > (scroll_top - 1) * COLS) | |
939 | + if (cursor_addr > (scroll_top - 1) * h3270.cols) | |
940 | 940 | cursor_move(cursor_addr - 1); |
941 | 941 | } else { |
942 | - if (cursor_addr % COLS) | |
942 | + if (cursor_addr % h3270.cols) | |
943 | 943 | cursor_move(cursor_addr - 1); |
944 | 944 | } |
945 | 945 | return DATA; |
... | ... | @@ -948,8 +948,8 @@ ansi_backspace(int ig1 unused, int ig2 unused) |
948 | 948 | static enum state |
949 | 949 | ansi_cr(int ig1 unused, int ig2 unused) |
950 | 950 | { |
951 | - if (cursor_addr % COLS) | |
952 | - cursor_move(cursor_addr - (cursor_addr % COLS)); | |
951 | + if (cursor_addr % h3270.cols) | |
952 | + cursor_move(cursor_addr - (cursor_addr % h3270.cols)); | |
953 | 953 | if (auto_newline_mode) |
954 | 954 | (void) ansi_lf(0, 0); |
955 | 955 | held_wrap = False; |
... | ... | @@ -959,18 +959,18 @@ ansi_cr(int ig1 unused, int ig2 unused) |
959 | 959 | static enum state |
960 | 960 | ansi_lf(int ig1 unused, int ig2 unused) |
961 | 961 | { |
962 | - int nc = cursor_addr + COLS; | |
962 | + int nc = cursor_addr + h3270.cols; | |
963 | 963 | |
964 | 964 | held_wrap = False; |
965 | 965 | |
966 | 966 | /* If we're below the scrolling region, don't scroll. */ |
967 | - if ((cursor_addr / COLS) >= scroll_bottom) { | |
968 | - if (nc < ROWS * COLS) | |
967 | + if ((cursor_addr / h3270.cols) >= scroll_bottom) { | |
968 | + if (nc < h3270.rows * h3270.cols) | |
969 | 969 | cursor_move(nc); |
970 | 970 | return DATA; |
971 | 971 | } |
972 | 972 | |
973 | - if (nc < scroll_bottom * COLS) | |
973 | + if (nc < scroll_bottom * h3270.cols) | |
974 | 974 | cursor_move(nc); |
975 | 975 | else |
976 | 976 | ansi_scroll(); |
... | ... | @@ -980,13 +980,13 @@ ansi_lf(int ig1 unused, int ig2 unused) |
980 | 980 | static enum state |
981 | 981 | ansi_htab(int ig1 unused, int ig2 unused) |
982 | 982 | { |
983 | - int col = cursor_addr % COLS; | |
983 | + int col = cursor_addr % h3270.cols; | |
984 | 984 | int i; |
985 | 985 | |
986 | 986 | held_wrap = False; |
987 | - if (col == COLS-1) | |
987 | + if (col == h3270.cols-1) | |
988 | 988 | return DATA; |
989 | - for (i = col+1; i < COLS-1; i++) | |
989 | + for (i = col+1; i < h3270.cols-1; i++) | |
990 | 990 | if (tabs[i/8] & 1<<(i%8)) |
991 | 991 | break; |
992 | 992 | cursor_move(cursor_addr - col + i); |
... | ... | @@ -1007,14 +1007,14 @@ ansi_nop(int ig1 unused, int ig2 unused) |
1007 | 1007 | |
1008 | 1008 | #define PWRAP { \ |
1009 | 1009 | nc = cursor_addr + 1; \ |
1010 | - if (nc < scroll_bottom * COLS) \ | |
1010 | + if (nc < scroll_bottom * h3270.cols) \ | |
1011 | 1011 | cursor_move(nc); \ |
1012 | 1012 | else { \ |
1013 | - if (cursor_addr / COLS >= scroll_bottom) \ | |
1014 | - cursor_move(cursor_addr / COLS * COLS); \ | |
1013 | + if (cursor_addr / h3270.cols >= scroll_bottom) \ | |
1014 | + cursor_move(cursor_addr / h3270.cols * h3270.cols); \ | |
1015 | 1015 | else { \ |
1016 | 1016 | ansi_scroll(); \ |
1017 | - cursor_move(nc - COLS); \ | |
1017 | + cursor_move(nc - h3270.cols); \ | |
1018 | 1018 | } \ |
1019 | 1019 | } \ |
1020 | 1020 | } |
... | ... | @@ -1182,13 +1182,13 @@ ansi_printing(int ig1 unused, int ig2 unused) |
1182 | 1182 | * In my opinion, very strange, but among other things, 'vi' |
1183 | 1183 | * depends on it! |
1184 | 1184 | */ |
1185 | - if (!((cursor_addr + 1) % COLS)) { | |
1185 | + if (!((cursor_addr + 1) % h3270.cols)) { | |
1186 | 1186 | held_wrap = True; |
1187 | 1187 | } else { |
1188 | 1188 | PWRAP; |
1189 | 1189 | } |
1190 | 1190 | } else { |
1191 | - if ((cursor_addr % COLS) != (COLS - 1)) | |
1191 | + if ((cursor_addr % h3270.cols) != (h3270.cols - 1)) | |
1192 | 1192 | cursor_move(cursor_addr + 1); |
1193 | 1193 | } |
1194 | 1194 | return DATA; |
... | ... | @@ -1259,7 +1259,7 @@ ansi_digit(int ig1 unused, int ig2 unused) |
1259 | 1259 | static enum state |
1260 | 1260 | ansi_reverse_index(int ig1 unused, int ig2 unused) |
1261 | 1261 | { |
1262 | - int rr = cursor_addr / COLS; /* current row */ | |
1262 | + int rr = cursor_addr / h3270.cols; /* current row */ | |
1263 | 1263 | int np = (scroll_top - 1) - rr; /* number of rows in the scrolling |
1264 | 1264 | region, above this line */ |
1265 | 1265 | int ns; /* number of rows to scroll */ |
... | ... | @@ -1345,7 +1345,7 @@ ansi_status_report(int nn, int ig2 unused) |
1345 | 1345 | break; |
1346 | 1346 | case 6: |
1347 | 1347 | (void) sprintf(cpr, "\033[%d;%dR", |
1348 | - (cursor_addr/COLS) + 1, (cursor_addr%COLS) + 1); | |
1348 | + (cursor_addr/h3270.cols) + 1, (cursor_addr%h3270.cols) + 1); | |
1349 | 1349 | net_sends(cpr); |
1350 | 1350 | break; |
1351 | 1351 | } |
... | ... | @@ -1550,15 +1550,15 @@ dec_scrolling_region(int top, int bottom) |
1550 | 1550 | { |
1551 | 1551 | if (top < 1) |
1552 | 1552 | top = 1; |
1553 | - if (bottom > ROWS) | |
1554 | - bottom = ROWS; | |
1555 | - if (top <= bottom && (top > 1 || bottom < ROWS)) { | |
1553 | + if (bottom > h3270.rows) | |
1554 | + bottom = h3270.rows; | |
1555 | + if (top <= bottom && (top > 1 || bottom < h3270.rows)) { | |
1556 | 1556 | scroll_top = top; |
1557 | 1557 | scroll_bottom = bottom; |
1558 | 1558 | cursor_move(0); |
1559 | 1559 | } else { |
1560 | 1560 | scroll_top = 1; |
1561 | - scroll_bottom = ROWS; | |
1561 | + scroll_bottom = h3270.rows; | |
1562 | 1562 | } |
1563 | 1563 | return DATA; |
1564 | 1564 | } |
... | ... | @@ -1630,7 +1630,7 @@ xterm_text_do(int ig1 unused, int ig2 unused) |
1630 | 1630 | static enum state |
1631 | 1631 | ansi_htab_set(int ig1 unused, int ig2 unused) |
1632 | 1632 | { |
1633 | - register int col = cursor_addr % COLS; | |
1633 | + register int col = cursor_addr % h3270.cols; | |
1634 | 1634 | |
1635 | 1635 | tabs[col/8] |= 1<<(col%8); |
1636 | 1636 | return DATA; |
... | ... | @@ -1643,11 +1643,11 @@ ansi_htab_clear(int nn, int ig2 unused) |
1643 | 1643 | |
1644 | 1644 | switch (nn) { |
1645 | 1645 | case 0: |
1646 | - col = cursor_addr % COLS; | |
1646 | + col = cursor_addr % h3270.cols; | |
1647 | 1647 | tabs[col/8] &= ~(1<<(col%8)); |
1648 | 1648 | break; |
1649 | 1649 | case 3: |
1650 | - for (i = 0; i < (COLS+7)/8; i++) | |
1650 | + for (i = 0; i < (h3270.cols+7)/8; i++) | |
1651 | 1651 | tabs[i] = 0; |
1652 | 1652 | break; |
1653 | 1653 | } |
... | ... | @@ -1663,7 +1663,7 @@ ansi_scroll(void) |
1663 | 1663 | held_wrap = False; |
1664 | 1664 | |
1665 | 1665 | /* Save the top line */ |
1666 | - if (scroll_top == 1 && scroll_bottom == ROWS) { | |
1666 | + if (scroll_top == 1 && scroll_bottom == h3270.rows) { | |
1667 | 1667 | if (!is_altbuffer) |
1668 | 1668 | scroll_save(1, False); |
1669 | 1669 | ctlr_scroll(); |
... | ... | @@ -1672,13 +1672,13 @@ ansi_scroll(void) |
1672 | 1672 | |
1673 | 1673 | /* Scroll all but the last line up */ |
1674 | 1674 | if (scroll_bottom > scroll_top) |
1675 | - ctlr_bcopy(scroll_top * COLS, | |
1676 | - (scroll_top - 1) * COLS, | |
1677 | - (scroll_bottom - scroll_top) * COLS, | |
1675 | + ctlr_bcopy(scroll_top * h3270.cols, | |
1676 | + (scroll_top - 1) * h3270.cols, | |
1677 | + (scroll_bottom - scroll_top) * h3270.cols, | |
1678 | 1678 | 1); |
1679 | 1679 | |
1680 | 1680 | /* Clear the last line */ |
1681 | - ctlr_aclear((scroll_bottom - 1) * COLS, COLS, 1); | |
1681 | + ctlr_aclear((scroll_bottom - 1) * h3270.cols, h3270.cols, 1); | |
1682 | 1682 | } |
1683 | 1683 | |
1684 | 1684 | /* Callback for when we enter ANSI mode. */ | ... | ... |
latest/src/lib/ctlr.c
... | ... | @@ -71,9 +71,9 @@ |
71 | 71 | extern unsigned char aid; |
72 | 72 | |
73 | 73 | /* Globals */ |
74 | -int ROWS, COLS; | |
75 | -int maxROWS = 0; | |
76 | -int maxCOLS = 0; | |
74 | +// int ROWS, COLS; | |
75 | +//int maxROWS = 0; | |
76 | +//int maxCOLS = 0; | |
77 | 77 | |
78 | 78 | int cursor_addr, buffer_addr; |
79 | 79 | Boolean screen_alt = False; /* alternate screen? */ |
... | ... | @@ -124,7 +124,7 @@ static unsigned char code_table[64] = { |
124 | 124 | #define IsBlank(c) ((c == EBC_null) || (c == EBC_space)) |
125 | 125 | |
126 | 126 | |
127 | -#define ALL_CHANGED if(IN_ANSI) changed(&h3270,0,ROWS*COLS); | |
127 | +#define ALL_CHANGED if(IN_ANSI) changed(&h3270,0,h3270.rows*h3270.cols); | |
128 | 128 | #define REGION_CHANGED(f, l) if(IN_ANSI) changed(&h3270,f,l) |
129 | 129 | #define ONE_CHANGED(n) if(IN_ANSI) changed(&h3270,n,n+1); |
130 | 130 | |
... | ... | @@ -167,16 +167,13 @@ void ctlr_reinit(H3270 *session, unsigned cmask) |
167 | 167 | /* Allocate buffers */ |
168 | 168 | if (real_ea_buf) |
169 | 169 | Free((char *)real_ea_buf); |
170 | - real_ea_buf = (struct ea *)Calloc(sizeof(struct ea), | |
171 | - (maxROWS * maxCOLS) + 1); | |
170 | + real_ea_buf = (struct ea *)Calloc(sizeof(struct ea),(session->maxROWS * session->maxCOLS) + 1); | |
172 | 171 | ea_buf = real_ea_buf + 1; |
173 | 172 | if (real_aea_buf) |
174 | 173 | Free((char *)real_aea_buf); |
175 | - real_aea_buf = (struct ea *)Calloc(sizeof(struct ea), | |
176 | - (maxROWS * maxCOLS) + 1); | |
174 | + real_aea_buf = (struct ea *)Calloc(sizeof(struct ea),(session->maxROWS * session->maxCOLS) + 1); | |
177 | 175 | aea_buf = real_aea_buf + 1; |
178 | - Replace(zero_buf, (unsigned char *)Calloc(sizeof(struct ea), | |
179 | - maxROWS * maxCOLS)); | |
176 | + Replace(zero_buf, (unsigned char *)Calloc(sizeof(struct ea),session->maxROWS * session->maxCOLS)); | |
180 | 177 | cursor_addr = 0; |
181 | 178 | buffer_addr = 0; |
182 | 179 | } |
... | ... | @@ -242,17 +239,17 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) |
242 | 239 | popup_an_error("Invalid %s %dx%d:\nNegative or zero",ResOversize, ovc, ovr); |
243 | 240 | else if (ovc * ovr >= 0x4000) |
244 | 241 | popup_an_error("Invalid %s %dx%d:\nToo big",ResOversize, ovc, ovr); |
245 | - else if (ovc > 0 && ovc < maxCOLS) | |
246 | - popup_an_error("Invalid %s cols (%d):\nLess than model %d cols (%d)",ResOversize, ovc, session->model_num, maxCOLS); | |
247 | - else if (ovr > 0 && ovr < maxROWS) | |
248 | - popup_an_error("Invalid %s rows (%d):\nLess than model %d rows (%d)",ResOversize, ovr, session->model_num, maxROWS); | |
242 | + else if (ovc > 0 && ovc < session->maxCOLS) | |
243 | + popup_an_error("Invalid %s cols (%d):\nLess than model %d cols (%d)",ResOversize, ovc, session->model_num, session->maxCOLS); | |
244 | + else if (ovr > 0 && ovr < session->maxROWS) | |
245 | + popup_an_error("Invalid %s rows (%d):\nLess than model %d rows (%d)",ResOversize, ovr, session->model_num, session->maxROWS); | |
249 | 246 | else |
250 | 247 | update_model_info(session,mn,session->ov_cols = ovc,session->ov_rows = ovr); |
251 | 248 | } |
252 | 249 | |
253 | 250 | // Make sure that the current rows/cols are still 24x80. |
254 | - COLS = 80; | |
255 | - ROWS = 24; | |
251 | + session->cols = 80; | |
252 | + session->rows = 24; | |
256 | 253 | screen_alt = False; |
257 | 254 | |
258 | 255 | } |
... | ... | @@ -462,10 +459,10 @@ ctlr_erase(int alt) |
462 | 459 | if (alt) { |
463 | 460 | /* Going from 24x80 to maximum. */ |
464 | 461 | screen_disp(&h3270); |
465 | - set_viewsize(&h3270,maxROWS,maxCOLS); | |
462 | + set_viewsize(&h3270,h3270.maxROWS,h3270.maxCOLS); | |
466 | 463 | } else { |
467 | 464 | /* Going from maximum to 24x80. */ |
468 | - if (maxROWS > 24 || maxCOLS > 80) { | |
465 | + if (h3270.maxROWS > 24 || h3270.maxCOLS > 80) { | |
469 | 466 | if (visible_control) { |
470 | 467 | ctlr_blanks(); |
471 | 468 | screen_disp(&h3270); |
... | ... | @@ -704,7 +701,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) |
704 | 701 | space3270out(3); |
705 | 702 | *obptr++ = ORDER_SBA; |
706 | 703 | ENCODE_BADDR(obptr, baddr); |
707 | - trace_ds(" SetBufferAddress%s (Cols: %d Rows: %d)", rcba(baddr), COLS, ROWS); | |
704 | + trace_ds(" SetBufferAddress%s (Cols: %d Rows: %d)", rcba(baddr), h3270.cols, h3270.rows); | |
708 | 705 | while (!ea_buf[baddr].fa) { |
709 | 706 | |
710 | 707 | if (send_data && |
... | ... | @@ -1239,7 +1236,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
1239 | 1236 | END_TEXT("SetBufferAddress"); |
1240 | 1237 | previous = SBA; |
1241 | 1238 | trace_ds("%s",rcba(buffer_addr)); |
1242 | - if (buffer_addr >= COLS * ROWS) { | |
1239 | + if (buffer_addr >= h3270.cols * h3270.rows) { | |
1243 | 1240 | ABORT_WRITE("invalid SBA address"); |
1244 | 1241 | } |
1245 | 1242 | current_fa = get_field_attribute(buffer_addr); |
... | ... | @@ -1370,7 +1367,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
1370 | 1367 | if (add_c1) |
1371 | 1368 | trace_ds("'"); |
1372 | 1369 | } |
1373 | - if (baddr >= COLS * ROWS) { | |
1370 | + if (baddr >= h3270.cols * h3270.rows) { | |
1374 | 1371 | ABORT_WRITE("invalid RA address"); |
1375 | 1372 | } |
1376 | 1373 | do { |
... | ... | @@ -1413,7 +1410,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
1413 | 1410 | if (previous != SBA) |
1414 | 1411 | trace_ds("%s",rcba(baddr)); |
1415 | 1412 | previous = ORDER; |
1416 | - if (baddr >= COLS * ROWS) { | |
1413 | + if (baddr >= h3270.cols * h3270.rows) { | |
1417 | 1414 | ABORT_WRITE("invalid EUA address"); |
1418 | 1415 | } |
1419 | 1416 | d = ctlr_lookleft_state(buffer_addr, &why); |
... | ... | @@ -1705,7 +1702,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
1705 | 1702 | DEC_BA(baddr); |
1706 | 1703 | while (!aborted && |
1707 | 1704 | ((fa_addr >= 0 && baddr != fa_addr) || |
1708 | - (fa_addr < 0 && baddr != ROWS*COLS - 1))) { | |
1705 | + (fa_addr < 0 && baddr != h3270.rows*h3270.cols - 1))) { | |
1709 | 1706 | if (ea_buf[baddr].cc == FCORDER_SI) { |
1710 | 1707 | ABORT_WRITE("double SI"); |
1711 | 1708 | } |
... | ... | @@ -1916,8 +1913,8 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) |
1916 | 1913 | * Insert NULLs to the end of the line and advance to |
1917 | 1914 | * the beginning of the next line. |
1918 | 1915 | */ |
1919 | - s_row = buffer_addr / COLS; | |
1920 | - while ((buffer_addr / COLS) == s_row) { | |
1916 | + s_row = buffer_addr / h3270.cols; | |
1917 | + while ((buffer_addr / h3270.cols) == s_row) { | |
1921 | 1918 | ctlr_add(buffer_addr, EBC_null, default_cs); |
1922 | 1919 | ctlr_add_fg(buffer_addr, default_fg); |
1923 | 1920 | ctlr_add_bg(buffer_addr, default_bg); |
... | ... | @@ -2299,7 +2296,7 @@ ctlr_any_data(void) |
2299 | 2296 | { |
2300 | 2297 | register int i; |
2301 | 2298 | |
2302 | - for (i = 0; i < ROWS*COLS; i++) { | |
2299 | + for (i = 0; i < h3270.rows*h3270.cols; i++) { | |
2303 | 2300 | if (!IsBlank(ea_buf[i].cc)) |
2304 | 2301 | return True; |
2305 | 2302 | } |
... | ... | @@ -2326,7 +2323,7 @@ ctlr_clear(Boolean can_snap) |
2326 | 2323 | #endif /*]*/ |
2327 | 2324 | |
2328 | 2325 | /* Clear the screen. */ |
2329 | - (void) memset((char *)ea_buf, 0, ROWS*COLS*sizeof(struct ea)); | |
2326 | + (void) memset((char *)ea_buf, 0, h3270.rows*h3270.cols*sizeof(struct ea)); | |
2330 | 2327 | cursor_move(0); |
2331 | 2328 | buffer_addr = 0; |
2332 | 2329 | // unselect(0, ROWS*COLS); |
... | ... | @@ -2350,7 +2347,7 @@ ctlr_blanks(void) |
2350 | 2347 | { |
2351 | 2348 | int baddr; |
2352 | 2349 | |
2353 | - for (baddr = 0; baddr < ROWS*COLS; baddr++) { | |
2350 | + for (baddr = 0; baddr < h3270.rows*h3270.cols; baddr++) { | |
2354 | 2351 | if (!ea_buf[baddr].fa) |
2355 | 2352 | ea_buf[baddr].cc = EBC_space; |
2356 | 2353 | } |
... | ... | @@ -2510,8 +2507,8 @@ ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count) |
2510 | 2507 | * It's faster to figure out if none of this is true, then do a slow |
2511 | 2508 | * location-at-a-time version only if it happens. |
2512 | 2509 | */ |
2513 | - if (baddr_from + count <= ROWS*COLS && | |
2514 | - baddr_to + count <= ROWS*COLS) { | |
2510 | + if (baddr_from + count <= h3270.rows*h3270.cols && | |
2511 | + baddr_to + count <= h3270.rows*h3270.cols) { | |
2515 | 2512 | ctlr_bcopy(baddr_from, baddr_to, count, True); |
2516 | 2513 | } else { |
2517 | 2514 | int i, from, to; |
... | ... | @@ -2519,12 +2516,12 @@ ctlr_wrapping_memmove(int baddr_to, int baddr_from, int count) |
2519 | 2516 | for (i = 0; i < count; i++) { |
2520 | 2517 | if (baddr_to > baddr_from) { |
2521 | 2518 | /* Shifting right, move left. */ |
2522 | - to = (baddr_to + count - 1 - i) % ROWS*COLS; | |
2523 | - from = (baddr_from + count - 1 - i) % ROWS*COLS; | |
2519 | + to = (baddr_to + count - 1 - i) % h3270.rows*h3270.cols; | |
2520 | + from = (baddr_from + count - 1 - i) % h3270.rows*h3270.cols; | |
2524 | 2521 | } else { |
2525 | 2522 | /* Shifting left, move right. */ |
2526 | - to = (baddr_to + i) % ROWS*COLS; | |
2527 | - from = (baddr_from + i) % ROWS*COLS; | |
2523 | + to = (baddr_to + i) % h3270.rows*h3270.cols; | |
2524 | + from = (baddr_from + i) % h3270.rows*h3270.cols; | |
2528 | 2525 | } |
2529 | 2526 | ctlr_bcopy(from, to, 1, True); |
2530 | 2527 | } |
... | ... | @@ -2588,7 +2585,7 @@ ctlr_aclear(int baddr, int count, int clear_ea) |
2588 | 2585 | */ |
2589 | 2586 | void ctlr_scroll(void) |
2590 | 2587 | { |
2591 | - int qty = (ROWS - 1) * COLS; | |
2588 | + int qty = (h3270.rows - 1) * h3270.cols; | |
2592 | 2589 | |
2593 | 2590 | /* Make sure nothing is selected. (later this can be fixed) */ |
2594 | 2591 | // unselect(0, ROWS*COLS); |
... | ... | @@ -2596,10 +2593,10 @@ void ctlr_scroll(void) |
2596 | 2593 | /* Synchronize pending changes prior to this. */ |
2597 | 2594 | |
2598 | 2595 | /* Move ea_buf. */ |
2599 | - (void) memmove(&ea_buf[0], &ea_buf[COLS],qty * sizeof(struct ea)); | |
2596 | + (void) memmove(&ea_buf[0], &ea_buf[h3270.cols],qty * sizeof(struct ea)); | |
2600 | 2597 | |
2601 | 2598 | /* Clear the last line. */ |
2602 | - (void) memset((char *) &ea_buf[qty], 0, COLS * sizeof(struct ea)); | |
2599 | + (void) memset((char *) &ea_buf[qty], 0, h3270.cols * sizeof(struct ea)); | |
2603 | 2600 | |
2604 | 2601 | screen_disp(&h3270); |
2605 | 2602 | |
... | ... | @@ -2692,7 +2689,7 @@ ctlr_shrink(void) |
2692 | 2689 | { |
2693 | 2690 | int baddr; |
2694 | 2691 | |
2695 | - for (baddr = 0; baddr < ROWS*COLS; baddr++) { | |
2692 | + for (baddr = 0; baddr < h3270.rows*h3270.cols; baddr++) { | |
2696 | 2693 | if (!ea_buf[baddr].fa) |
2697 | 2694 | ea_buf[baddr].cc = |
2698 | 2695 | visible_control? EBC_space : EBC_null; |
... | ... | @@ -2811,11 +2808,11 @@ toggle_nop(struct toggle *t unused, enum toggle_type tt unused) |
2811 | 2808 | |
2812 | 2809 | int ctlr_get_rows(void) |
2813 | 2810 | { |
2814 | - return ROWS; | |
2811 | + return h3270.rows; | |
2815 | 2812 | } |
2816 | 2813 | |
2817 | 2814 | int ctlr_get_cols(void) |
2818 | 2815 | { |
2819 | - return COLS; | |
2816 | + return h3270.cols; | |
2820 | 2817 | } |
2821 | 2818 | ... | ... |
latest/src/lib/globals.h
latest/src/lib/kybd.c
... | ... | @@ -635,7 +635,7 @@ static Boolean ins_prep(int faddr, int baddr, int count) |
635 | 635 | /* Find the end of the field. */ |
636 | 636 | if (faddr == -1) { |
637 | 637 | /* Unformatted. Use the end of the line. */ |
638 | - next_faddr = (((baddr / COLS) + 1) * COLS) % (ROWS*COLS); | |
638 | + next_faddr = (((baddr / h3270.cols) + 1) * h3270.cols) % (h3270.rows*h3270.cols); | |
639 | 639 | } else { |
640 | 640 | next_faddr = faddr; |
641 | 641 | INC_BA(next_faddr); |
... | ... | @@ -696,8 +696,8 @@ static Boolean ins_prep(int faddr, int baddr, int count) |
696 | 696 | /* Shift right n_nulls worth. */ |
697 | 697 | copy_len = first_null - baddr; |
698 | 698 | if (copy_len < 0) |
699 | - copy_len += ROWS*COLS; | |
700 | - to = (baddr + n_nulls) % (ROWS*COLS); | |
699 | + copy_len += h3270.rows*h3270.cols; | |
700 | + to = (baddr + n_nulls) % (h3270.rows*h3270.cols); | |
701 | 701 | #if defined(_ST) /*[*/ |
702 | 702 | printf("found %d NULLs at %d\n", n_nulls, first_null); |
703 | 703 | printf("copying %d from %d to %d\n", copy_len, to, |
... | ... | @@ -926,7 +926,7 @@ key_Character(int code, Boolean with_ge, Boolean pasting, Boolean *skipped) |
926 | 926 | while (baddr_fill != faddr) { |
927 | 927 | |
928 | 928 | /* Check for backward line wrap. */ |
929 | - if ((baddr_fill % COLS) == COLS - 1) { | |
929 | + if ((baddr_fill % h3270.cols) == h3270.cols - 1) { | |
930 | 930 | Boolean aborted = True; |
931 | 931 | register int baddr_scan = baddr_fill; |
932 | 932 | |
... | ... | @@ -939,7 +939,7 @@ key_Character(int code, Boolean with_ge, Boolean pasting, Boolean *skipped) |
939 | 939 | aborted = False; |
940 | 940 | break; |
941 | 941 | } |
942 | - if (!(baddr_scan % COLS)) | |
942 | + if (!(baddr_scan % h3270.cols)) | |
943 | 943 | break; |
944 | 944 | DEC_BA(baddr_scan); |
945 | 945 | } |
... | ... | @@ -1606,7 +1606,7 @@ LIB3270_ACTION( firstfield ) |
1606 | 1606 | cursor_move(0); |
1607 | 1607 | return 0; |
1608 | 1608 | } |
1609 | - cursor_move(next_unprotected(ROWS*COLS-1)); | |
1609 | + cursor_move(next_unprotected(h3270.rows*h3270.cols-1)); | |
1610 | 1610 | |
1611 | 1611 | return 0; |
1612 | 1612 | } |
... | ... | @@ -1726,9 +1726,9 @@ do_delete(void) |
1726 | 1726 | } while (end_baddr != baddr); |
1727 | 1727 | DEC_BA(end_baddr); |
1728 | 1728 | } else { |
1729 | - if ((baddr % COLS) == COLS - ndel) | |
1729 | + if ((baddr % h3270.cols) == h3270.cols - ndel) | |
1730 | 1730 | return True; |
1731 | - end_baddr = baddr + (COLS - (baddr % COLS)) - 1; | |
1731 | + end_baddr = baddr + (h3270.cols - (baddr % h3270.cols)) - 1; | |
1732 | 1732 | } |
1733 | 1733 | |
1734 | 1734 | /* Shift the remainder of the field left. */ |
... | ... | @@ -1738,8 +1738,8 @@ do_delete(void) |
1738 | 1738 | } else if (end_baddr != baddr) { |
1739 | 1739 | /* XXX: Need to verify this. */ |
1740 | 1740 | ctlr_bcopy(baddr + ndel, baddr, |
1741 | - ((ROWS * COLS) - 1) - (baddr + ndel) + 1, 0); | |
1742 | - ctlr_bcopy(0, (ROWS * COLS) - ndel, ndel, 0); | |
1741 | + ((h3270.rows * h3270.cols) - 1) - (baddr + ndel) + 1, 0); | |
1742 | + ctlr_bcopy(0, (h3270.rows * h3270.cols) - ndel, ndel, 0); | |
1743 | 1743 | ctlr_bcopy(ndel, 0, end_baddr - ndel + 1, 0); |
1744 | 1744 | } |
1745 | 1745 | |
... | ... | @@ -2231,9 +2231,9 @@ LIB3270_CURSOR_ACTION( up ) |
2231 | 2231 | return 0; |
2232 | 2232 | } |
2233 | 2233 | #endif /*]*/ |
2234 | - baddr = cursor_addr - COLS; | |
2234 | + baddr = cursor_addr - h3270.cols; | |
2235 | 2235 | if (baddr < 0) |
2236 | - baddr = (cursor_addr + (ROWS * COLS)) - COLS; | |
2236 | + baddr = (cursor_addr + (h3270.rows * h3270.cols)) - h3270.cols; | |
2237 | 2237 | cursor_move(baddr); |
2238 | 2238 | return 0; |
2239 | 2239 | } |
... | ... | @@ -2280,7 +2280,7 @@ LIB3270_CURSOR_ACTION( down ) |
2280 | 2280 | return 0; |
2281 | 2281 | } |
2282 | 2282 | #endif /*]*/ |
2283 | - baddr = (cursor_addr + COLS) % (COLS * ROWS); | |
2283 | + baddr = (cursor_addr + h3270.cols) % (h3270.cols * h3270.rows); | |
2284 | 2284 | cursor_move(baddr); |
2285 | 2285 | return 0; |
2286 | 2286 | } |
... | ... | @@ -2308,8 +2308,8 @@ LIB3270_CURSOR_ACTION( newline ) |
2308 | 2308 | return 0; |
2309 | 2309 | } |
2310 | 2310 | #endif /*]*/ |
2311 | - baddr = (cursor_addr + COLS) % (COLS * ROWS); /* down */ | |
2312 | - baddr = (baddr / COLS) * COLS; /* 1st col */ | |
2311 | + baddr = (cursor_addr + h3270.cols) % (h3270.cols * h3270.rows); /* down */ | |
2312 | + baddr = (baddr / h3270.cols) * h3270.cols; /* 1st col */ | |
2313 | 2313 | faddr = find_field_attribute(baddr); |
2314 | 2314 | fa = ea_buf[faddr].fa; |
2315 | 2315 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) | ... | ... |
latest/src/lib/paste.c
... | ... | @@ -192,8 +192,8 @@ LIB3270_EXPORT int lib3270_paste_string(const unsigned char *str) |
192 | 192 | case '\n': |
193 | 193 | if(last != '\n') |
194 | 194 | { |
195 | - baddr = (cursor_addr + COLS) % (COLS * ROWS); /* down */ | |
196 | - baddr = (baddr / COLS) * COLS; /* 1st col */ | |
195 | + baddr = (cursor_addr + h3270.cols) % (h3270.cols * h3270.rows); /* down */ | |
196 | + baddr = (baddr / h3270.cols) * h3270.cols; /* 1st col */ | |
197 | 197 | faddr = find_field_attribute(baddr); |
198 | 198 | fa = ea_buf[faddr].fa; |
199 | 199 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) | ... | ... |
latest/src/lib/print.c
1 | -/* | |
1 | +/* | |
2 | 2 | * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 |
3 | 3 | * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a |
4 | 4 | * aplicativos mainframe. Registro no INPI sob o nome G3270. |
5 | - * | |
5 | + * | |
6 | 6 | * Copyright (C) <2008> <Banco do Brasil S.A.> |
7 | - * | |
7 | + * | |
8 | 8 | * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob |
9 | 9 | * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela |
10 | 10 | * Free Software Foundation. |
11 | - * | |
11 | + * | |
12 | 12 | * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER |
13 | 13 | * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO |
14 | 14 | * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para |
15 | 15 | * obter mais detalhes. |
16 | - * | |
16 | + * | |
17 | 17 | * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este |
18 | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple |
19 | 19 | * Place, Suite 330, Boston, MA, 02111-1307, USA |
20 | - * | |
20 | + * | |
21 | 21 | * Este programa está nomeado como print.c e possui 748 linhas de código. |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | 25 | * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) |
26 | 26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) |
27 | 27 | * licinio@bb.com.br (Licínio Luis Branco) |
... | ... | @@ -73,7 +73,7 @@ |
73 | 73 | /* Statics */ |
74 | 74 | |
75 | 75 | /* |
76 | -#if defined(X3270_DISPLAY) | |
76 | +#if defined(X3270_DISPLAY) | |
77 | 77 | static Widget print_text_shell = (Widget)NULL; |
78 | 78 | static Widget save_text_shell = (Widget)NULL; |
79 | 79 | static Widget print_window_shell = (Widget)NULL; |
... | ... | @@ -171,13 +171,13 @@ fprint_screen(FILE *f, Boolean even_if_empty, Boolean use_html) |
171 | 171 | fa_high = FA_IS_HIGH(fa); |
172 | 172 | current_high = fa_high; |
173 | 173 | |
174 | - for (i = 0; i < ROWS*COLS; i++) { | |
174 | + for (i = 0; i < h3270.rows*h3270.cols; i++) { | |
175 | 175 | #if defined(X3270_DBCS) /*[*/ |
176 | 176 | char mb[16]; |
177 | 177 | Boolean is_dbcs = False; |
178 | 178 | #endif /*]*/ |
179 | 179 | |
180 | - if (i && !(i % COLS)) { | |
180 | + if (i && !(i % h3270.cols)) { | |
181 | 181 | nr++; |
182 | 182 | ns = 0; |
183 | 183 | } |
... | ... | @@ -522,7 +522,7 @@ PrintText_action(Widget w unused, XEvent *event, String *params, |
522 | 522 | if (!use_file && (filter == CN || !*filter)) |
523 | 523 | filter = "lpr"; |
524 | 524 | |
525 | -#if defined(X3270_DISPLAY) | |
525 | +#if defined(X3270_DISPLAY) | |
526 | 526 | if (secure || |
527 | 527 | ia_cause == IA_COMMAND || |
528 | 528 | ia_cause == IA_MACRO || |
... | ... | @@ -532,7 +532,7 @@ PrintText_action(Widget w unused, XEvent *event, String *params, |
532 | 532 | FILE *f; |
533 | 533 | int fd = -1; |
534 | 534 | |
535 | - // Invoked non-interactively. | |
535 | + // Invoked non-interactively. | |
536 | 536 | if (use_file) { |
537 | 537 | if (use_string) { |
538 | 538 | char temp_name[15]; | ... | ... |
latest/src/lib/screen.c
... | ... | @@ -303,22 +303,22 @@ void screen_erase(H3270 *session) |
303 | 303 | } |
304 | 304 | |
305 | 305 | /* No callback, just redraw */ |
306 | - screen_update(session,0,ROWS*cCOLS); | |
306 | + screen_update(session,0,session->rows * session->cols); | |
307 | 307 | } |
308 | 308 | |
309 | 309 | LIB3270_EXPORT void lib3270_get_screen_size(H3270 *h, int *r, int *c) |
310 | 310 | { |
311 | - *r = ROWS; | |
312 | - *c = cCOLS; | |
311 | + *r = h->rows; | |
312 | + *c = h->cols; | |
313 | 313 | } |
314 | 314 | |
315 | 315 | void update_model_info(H3270 *session, int model, int cols, int rows) |
316 | 316 | { |
317 | - if(model == session->model_num && maxROWS == rows && maxCOLS == cols) | |
317 | + if(model == session->model_num && session->maxROWS == rows && session->maxCOLS == cols) | |
318 | 318 | return; |
319 | 319 | |
320 | - maxCOLS = cols; | |
321 | - maxROWS = rows; | |
320 | + session->maxCOLS = cols; | |
321 | + session->maxROWS = rows; | |
322 | 322 | session->model_num = model; |
323 | 323 | |
324 | 324 | /* Update the model name. */ |
... | ... | @@ -332,7 +332,7 @@ void update_model_info(H3270 *session, int model, int cols, int rows) |
332 | 332 | int screen_read(char *dest, int baddr, int count) |
333 | 333 | { |
334 | 334 | unsigned char fa = get_field_attribute(baddr); |
335 | - int max = (maxROWS * maxCOLS); | |
335 | + int max = (h3270.maxROWS * h3270.maxCOLS); | |
336 | 336 | |
337 | 337 | *dest = 0; |
338 | 338 | |
... | ... | @@ -376,8 +376,8 @@ void screen_update(H3270 *session, int bstart, int bend) |
376 | 376 | a = color_from_fa(fa); |
377 | 377 | fa_addr = find_field_attribute(bstart); // may be -1, that's okay |
378 | 378 | |
379 | - row = bstart/cCOLS; | |
380 | - col = bstart%cCOLS; | |
379 | + row = bstart/session->cols; | |
380 | + col = bstart%session->cols; | |
381 | 381 | |
382 | 382 | Trace("Update@%d-%d (%d,%d): [%c]",bstart,bend,row,col,ebc2asc[ea_buf[bstart].cc]); |
383 | 383 | |
... | ... | @@ -431,7 +431,7 @@ void screen_update(H3270 *session, int bstart, int bend) |
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
434 | - if(++col >= cCOLS) | |
434 | + if(++col >= session->cols) | |
435 | 435 | { |
436 | 436 | row++; |
437 | 437 | col=0; |
... | ... | @@ -445,7 +445,7 @@ void screen_disp(H3270 *session) |
445 | 445 | session->first_changed = -1; |
446 | 446 | session->last_changed = -1; |
447 | 447 | |
448 | - screen_update(session,0,ROWS*cCOLS); | |
448 | + screen_update(session,0,session->rows*session->cols); | |
449 | 449 | |
450 | 450 | |
451 | 451 | /* |
... | ... | @@ -547,7 +547,7 @@ int cursor_set_addr(int baddr) |
547 | 547 | cursor_addr = baddr; |
548 | 548 | |
549 | 549 | if(callbacks && callbacks->move_cursor) |
550 | - callbacks->move_cursor(baddr/cCOLS, baddr%cCOLS); | |
550 | + callbacks->move_cursor(baddr/h3270.cols, baddr%h3270.cols); | |
551 | 551 | |
552 | 552 | // Trace("%s: baddr=%d cc=%04x",__FUNCTION__,baddr, ea_buf[baddr].cc); |
553 | 553 | |
... | ... | @@ -682,11 +682,11 @@ LIB3270_EXPORT void status_typeahead(int on) |
682 | 682 | |
683 | 683 | void set_viewsize(H3270 *session, int rows, int cols) |
684 | 684 | { |
685 | - if(rows == ROWS && COLS == cols) | |
685 | + if(rows == session->rows && session->cols == cols) | |
686 | 686 | return; |
687 | 687 | |
688 | - ROWS = rows; | |
689 | - COLS = cols; | |
688 | + session->rows = rows; | |
689 | + session->cols = cols; | |
690 | 690 | |
691 | 691 | if(callbacks && callbacks->set_viewsize) |
692 | 692 | callbacks->set_viewsize(session,rows,cols); |
... | ... | @@ -954,7 +954,7 @@ LIB3270_EXPORT void popup_system_error(const char *title, const char *message, c |
954 | 954 | LIB3270_EXPORT int set_device_buffer(struct ea *src, int el) |
955 | 955 | { |
956 | 956 | |
957 | - if(el > (maxROWS * maxCOLS)) | |
957 | + if(el > (h3270.maxROWS * h3270.maxCOLS)) | |
958 | 958 | return EINVAL; |
959 | 959 | |
960 | 960 | memcpy(ea_buf,src,sizeof(struct ea) * el); |
... | ... | @@ -1018,7 +1018,7 @@ LIB3270_ACTION( testpattern ) |
1018 | 1018 | }; |
1019 | 1019 | |
1020 | 1020 | int row = 0; |
1021 | - int max = (maxROWS * maxCOLS); | |
1021 | + int max = (h3270.maxROWS * h3270.maxCOLS); | |
1022 | 1022 | int pos = 0; |
1023 | 1023 | int f; |
1024 | 1024 | |
... | ... | @@ -1045,11 +1045,11 @@ LIB3270_ACTION( testpattern ) |
1045 | 1045 | |
1046 | 1046 | LIB3270_EXPORT struct ea * copy_device_buffer(int *el) |
1047 | 1047 | { |
1048 | - int sz = sizeof(struct ea) * (maxROWS * maxCOLS); | |
1048 | + int sz = sizeof(struct ea) * (h3270.maxROWS * h3270.maxCOLS); | |
1049 | 1049 | struct ea *ret = malloc(sz); |
1050 | 1050 | memcpy(ret,ea_buf,sz); |
1051 | 1051 | if(el) |
1052 | - *el = (maxROWS * maxCOLS); | |
1052 | + *el = (h3270.maxROWS * h3270.maxCOLS); | |
1053 | 1053 | return ret; |
1054 | 1054 | } |
1055 | 1055 | ... | ... |
latest/src/lib/sf.c
... | ... | @@ -734,8 +734,8 @@ do_qr_usable_area(void) |
734 | 734 | space3270out(19); |
735 | 735 | *obptr++ = 0x01; /* 12/14-bit addressing */ |
736 | 736 | *obptr++ = 0x00; /* no special character features */ |
737 | - SET16(obptr, maxCOLS); /* usable width */ | |
738 | - SET16(obptr, maxROWS); /* usable height */ | |
737 | + SET16(obptr, h3270.maxCOLS); /* usable width */ | |
738 | + SET16(obptr, h3270.maxROWS); /* usable height */ | |
739 | 739 | *obptr++ = 0x01; /* units (mm) */ |
740 | 740 | num = display_widthMM(); |
741 | 741 | denom = display_width(); |
... | ... | @@ -755,7 +755,7 @@ do_qr_usable_area(void) |
755 | 755 | SET16(obptr, (int)denom); /* Yr denominator */ |
756 | 756 | *obptr++ = *char_width; /* AW */ |
757 | 757 | *obptr++ = *char_height;/* AH */ |
758 | - SET16(obptr, maxCOLS*maxROWS); /* buffer, questionable */ | |
758 | + SET16(obptr, h3270.maxCOLS * h3270.maxROWS); /* buffer, questionable */ | |
759 | 759 | } |
760 | 760 | |
761 | 761 | static void |
... | ... | @@ -846,7 +846,7 @@ do_qr_alpha_part(void) |
846 | 846 | trace_ds("> QueryReply(AlphanumericPartitions)\n"); |
847 | 847 | space3270out(4); |
848 | 848 | *obptr++ = 0; /* 1 partition */ |
849 | - SET16(obptr, maxROWS*maxCOLS); /* buffer space */ | |
849 | + SET16(obptr, h3270.maxROWS * h3270.maxCOLS); /* buffer space */ | |
850 | 850 | *obptr++ = 0; /* no special features */ |
851 | 851 | } |
852 | 852 | |
... | ... | @@ -959,8 +959,8 @@ do_qr_imp_part(void) |
959 | 959 | *obptr++ = 0x00; /* reserved */ |
960 | 960 | SET16(obptr, 80); /* implicit partition width */ |
961 | 961 | SET16(obptr, 24); /* implicit partition height */ |
962 | - SET16(obptr, maxCOLS); /* alternate height */ | |
963 | - SET16(obptr, maxROWS); /* alternate width */ | |
962 | + SET16(obptr, h3270.maxCOLS); /* alternate height */ | |
963 | + SET16(obptr, h3270.maxROWS); /* alternate width */ | |
964 | 964 | } |
965 | 965 | |
966 | 966 | static void | ... | ... |
latest/src/lib/telnet.c
... | ... | @@ -301,8 +301,8 @@ static const char *trsp_flag[2] = { "POSITIVE-RESPONSE", "NEGATIVE-RESPONSE" }; |
301 | 301 | // #define XMIT_ROWS ((appres.altscreen != CN)? 24: maxROWS) |
302 | 302 | // #define XMIT_COLS ((appres.altscreen != CN)? 80: maxCOLS) |
303 | 303 | // #else /*][*/ |
304 | -#define XMIT_ROWS maxROWS | |
305 | -#define XMIT_COLS maxCOLS | |
304 | +#define XMIT_ROWS h3270.maxROWS | |
305 | +#define XMIT_COLS h3270.maxCOLS | |
306 | 306 | // #endif /*]*/ |
307 | 307 | |
308 | 308 | #if defined(HAVE_LIBSSL) /*[*/ | ... | ... |
latest/src/lib/trace_ds.c
... | ... | @@ -119,7 +119,7 @@ rcba(int baddr) |
119 | 119 | { |
120 | 120 | static char buf[16]; |
121 | 121 | |
122 | - (void) sprintf(buf, "(%d,%d)", baddr/COLS + 1, baddr%COLS + 1); | |
122 | + (void) sprintf(buf, "(%d,%d)", baddr/h3270.cols + 1, baddr%h3270.cols + 1); | |
123 | 123 | return buf; |
124 | 124 | } |
125 | 125 | |
... | ... | @@ -791,7 +791,7 @@ do_screentrace(void) |
791 | 791 | register int i; |
792 | 792 | |
793 | 793 | if (fprint_screen(screentracef, False, False)) { |
794 | - for (i = 0; i < COLS; i++) | |
794 | + for (i = 0; i < h3270.cols; i++) | |
795 | 795 | (void) fputc('=', screentracef); |
796 | 796 | (void) fputc('\n', screentracef); |
797 | 797 | } |
... | ... | @@ -828,7 +828,7 @@ trace_ansi_disc(void) |
828 | 828 | int i; |
829 | 829 | |
830 | 830 | (void) fputc('\n', screentracef); |
831 | - for (i = 0; i < COLS; i++) | |
831 | + for (i = 0; i < h3270.cols; i++) | |
832 | 832 | (void) fputc('=', screentracef); |
833 | 833 | (void) fputc('\n', screentracef); |
834 | 834 | ... | ... |