Commit 144ad4e8258b28b73690074c8a7594b14f6e5758
1 parent
311e8470
Exists in
master
and in
3 other branches
Corrigindo erro no commit anterior
Showing
1 changed file
with
20 additions
and
52 deletions
Show diff stats
ctlr.c
@@ -65,47 +65,15 @@ | @@ -65,47 +65,15 @@ | ||
65 | #include "widec.h" | 65 | #include "widec.h" |
66 | #include "screenc.h" | 66 | #include "screenc.h" |
67 | 67 | ||
68 | -/* Externals: kybd.c */ | ||
69 | -// extern unsigned char aid; | ||
70 | - | ||
71 | -/* Globals */ | ||
72 | -// int ROWS, COLS; | ||
73 | -//int maxROWS = 0; | ||
74 | -//int maxCOLS = 0; | ||
75 | -// int cursor_addr; | ||
76 | - | ||
77 | -// int buffer_addr; | ||
78 | -// Boolean screen_alt = False; /* alternate screen? */ | ||
79 | -// Boolean is_altbuffer = False; | ||
80 | - | ||
81 | -// struct ea *ea_buf = NULL; /* 3270 device buffer */ | ||
82 | -// /* ea_buf[-1] is the dummy default field attribute */ | ||
83 | - | ||
84 | -// Boolean formatted = False; /* set in screen_disp */ | ||
85 | -// unsigned char reply_mode = SF_SRM_FIELD; | ||
86 | -// int crm_nattr = 0; | ||
87 | -// unsigned char crm_attr[16]; | ||
88 | -Boolean dbcs = False; | 68 | +// Boolean dbcs = False; |
89 | 69 | ||
90 | /* Statics */ | 70 | /* Statics */ |
91 | -// static struct ea *aea_buf; /* alternate 3270 extended attribute buffer */ | ||
92 | -// static unsigned char *zero_buf; // empty buffer, for area clears | ||
93 | static void set_formatted(H3270 *session); | 71 | static void set_formatted(H3270 *session); |
94 | static void ctlr_blanks(H3270 *session); | 72 | static void ctlr_blanks(H3270 *session); |
95 | -// static Boolean trace_primed = False; | ||
96 | - | ||
97 | -//static unsigned char default_fg; | ||
98 | -//static unsigned char default_bg; | ||
99 | -//static unsigned char default_gr; | ||
100 | -//static unsigned char default_cs; | ||
101 | -//static unsigned char default_ic; | ||
102 | - | ||
103 | static void ctlr_half_connect(H3270 *session, int ignored, void *dunno); | 73 | static void ctlr_half_connect(H3270 *session, int ignored, void *dunno); |
104 | static void ctlr_connect(H3270 *session, int ignored, void *dunno); | 74 | static void ctlr_connect(H3270 *session, int ignored, void *dunno); |
105 | -// static int sscp_start; | ||
106 | static void ticking_stop(H3270 *session); | 75 | static void ticking_stop(H3270 *session); |
107 | static void ctlr_add_ic(int baddr, unsigned char ic); | 76 | static void ctlr_add_ic(int baddr, unsigned char ic); |
108 | -// static void changed(H3270 *session, int bstart, int bend); | ||
109 | 77 | ||
110 | /* | 78 | /* |
111 | * code_table is used to translate buffer addresses and attributes to the 3270 | 79 | * code_table is used to translate buffer addresses and attributes to the 3270 |
@@ -125,9 +93,9 @@ static unsigned char code_table[64] = { | @@ -125,9 +93,9 @@ static unsigned char code_table[64] = { | ||
125 | #define IsBlank(c) ((c == EBC_null) || (c == EBC_space)) | 93 | #define IsBlank(c) ((c == EBC_null) || (c == EBC_space)) |
126 | 94 | ||
127 | 95 | ||
128 | -#define ALL_CHANGED if(IN_ANSI) changed(&h3270,0,h3270.rows*h3270.cols); | ||
129 | -#define REGION_CHANGED(f, l) if(IN_ANSI) changed(&h3270,f,l) | ||
130 | -#define ONE_CHANGED(n) if(IN_ANSI) changed(&h3270,n,n+1); | 96 | +#define ALL_CHANGED(h) if(lib3270_in_ansi(h)) (h)->changed(h,0,(h)->rows*(h)->cols); |
97 | +#define REGION_CHANGED(h, f, l) if(lib3270_in_ansi(h)) (h)->changed(h,f,l) | ||
98 | +#define ONE_CHANGED(h,n) if(lib3270_in_ansi(h)) (h)->changed(h,n,n+1); | ||
131 | 99 | ||
132 | #define DECODE_BADDR(c1, c2) \ | 100 | #define DECODE_BADDR(c1, c2) \ |
133 | ((((c1) & 0xC0) == 0x00) ? \ | 101 | ((((c1) & 0xC0) == 0x00) ? \ |
@@ -1109,7 +1077,7 @@ ctlr_erase_all_unprotected(void) | @@ -1109,7 +1077,7 @@ ctlr_erase_all_unprotected(void) | ||
1109 | } | 1077 | } |
1110 | h3270.aid = AID_NO; | 1078 | h3270.aid = AID_NO; |
1111 | do_reset(&h3270,False); | 1079 | do_reset(&h3270,False); |
1112 | - ALL_CHANGED; | 1080 | + ALL_CHANGED(&h3270); |
1113 | } | 1081 | } |
1114 | 1082 | ||
1115 | 1083 | ||
@@ -1201,7 +1169,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1201,7 +1169,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1201 | paren = ","; | 1169 | paren = ","; |
1202 | baddr = 0; | 1170 | baddr = 0; |
1203 | if (h3270.modified_sel) | 1171 | if (h3270.modified_sel) |
1204 | - ALL_CHANGED; | 1172 | + ALL_CHANGED(&h3270); |
1205 | do { | 1173 | do { |
1206 | if (h3270.ea_buf[baddr].fa) { | 1174 | if (h3270.ea_buf[baddr].fa) { |
1207 | mdt_clear(baddr); | 1175 | mdt_clear(baddr); |
@@ -1571,7 +1539,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1571,7 +1539,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1571 | cp++; | 1539 | cp++; |
1572 | if (*cp == 0xf1) | 1540 | if (*cp == 0xf1) |
1573 | efa_cs = CS_APL; | 1541 | efa_cs = CS_APL; |
1574 | - else if (dbcs && (*cp == 0xf8)) | 1542 | + else if (h3270.dbcs && (*cp == 0xf8)) |
1575 | efa_cs = CS_DBCS; | 1543 | efa_cs = CS_DBCS; |
1576 | else | 1544 | else |
1577 | efa_cs = CS_BASE; | 1545 | efa_cs = CS_BASE; |
@@ -1580,7 +1548,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1580,7 +1548,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1580 | cp++; | 1548 | cp++; |
1581 | } else if (*cp == XA_INPUT_CONTROL) { | 1549 | } else if (*cp == XA_INPUT_CONTROL) { |
1582 | trace_ds("%s", see_efa(*cp, *(cp + 1))); | 1550 | trace_ds("%s", see_efa(*cp, *(cp + 1))); |
1583 | - if (dbcs) | 1551 | + if (h3270.dbcs) |
1584 | efa_ic = (*(cp + 1) == 1); | 1552 | efa_ic = (*(cp + 1) == 1); |
1585 | cp++; | 1553 | cp++; |
1586 | } else { | 1554 | } else { |
@@ -2361,7 +2329,7 @@ static void ctlr_blanks(H3270 *session) | @@ -2361,7 +2329,7 @@ static void ctlr_blanks(H3270 *session) | ||
2361 | session->buffer_addr = 0; | 2329 | session->buffer_addr = 0; |
2362 | lib3270_unselect(session); | 2330 | lib3270_unselect(session); |
2363 | session->formatted = False; | 2331 | session->formatted = False; |
2364 | - ALL_CHANGED; | 2332 | + ALL_CHANGED(session); |
2365 | } | 2333 | } |
2366 | 2334 | ||
2367 | 2335 | ||
@@ -2387,7 +2355,7 @@ void ctlr_add(int baddr, unsigned char c, unsigned char cs) | @@ -2387,7 +2355,7 @@ void ctlr_add(int baddr, unsigned char c, unsigned char cs) | ||
2387 | h3270.ea_buf[baddr].cc = c; | 2355 | h3270.ea_buf[baddr].cc = c; |
2388 | h3270.ea_buf[baddr].cs = cs; | 2356 | h3270.ea_buf[baddr].cs = cs; |
2389 | h3270.ea_buf[baddr].fa = 0; | 2357 | h3270.ea_buf[baddr].fa = 0; |
2390 | - ONE_CHANGED(baddr); | 2358 | + ONE_CHANGED(&h3270,baddr); |
2391 | } | 2359 | } |
2392 | } | 2360 | } |
2393 | 2361 | ||
@@ -2420,7 +2388,7 @@ ctlr_add_cs(int baddr, unsigned char cs) | @@ -2420,7 +2388,7 @@ ctlr_add_cs(int baddr, unsigned char cs) | ||
2420 | unselect(baddr, 1); | 2388 | unselect(baddr, 1); |
2421 | */ | 2389 | */ |
2422 | h3270.ea_buf[baddr].cs = cs; | 2390 | h3270.ea_buf[baddr].cs = cs; |
2423 | - ONE_CHANGED(baddr); | 2391 | + ONE_CHANGED(&h3270,baddr); |
2424 | } | 2392 | } |
2425 | } | 2393 | } |
2426 | 2394 | ||
@@ -2435,7 +2403,7 @@ ctlr_add_gr(int baddr, unsigned char gr) | @@ -2435,7 +2403,7 @@ ctlr_add_gr(int baddr, unsigned char gr) | ||
2435 | h3270.ea_buf[baddr].gr = gr; | 2403 | h3270.ea_buf[baddr].gr = gr; |
2436 | if (gr & GR_BLINK) | 2404 | if (gr & GR_BLINK) |
2437 | blink_start(); | 2405 | blink_start(); |
2438 | - ONE_CHANGED(baddr); | 2406 | + ONE_CHANGED(&h3270,baddr); |
2439 | } | 2407 | } |
2440 | } | 2408 | } |
2441 | 2409 | ||
@@ -2452,7 +2420,7 @@ ctlr_add_fg(int baddr, unsigned char color) | @@ -2452,7 +2420,7 @@ ctlr_add_fg(int baddr, unsigned char color) | ||
2452 | if (h3270.ea_buf[baddr].fg != color) | 2420 | if (h3270.ea_buf[baddr].fg != color) |
2453 | { | 2421 | { |
2454 | h3270.ea_buf[baddr].fg = color; | 2422 | h3270.ea_buf[baddr].fg = color; |
2455 | - ONE_CHANGED(baddr); | 2423 | + ONE_CHANGED(&h3270,baddr); |
2456 | } | 2424 | } |
2457 | } | 2425 | } |
2458 | 2426 | ||
@@ -2469,7 +2437,7 @@ ctlr_add_bg(int baddr, unsigned char color) | @@ -2469,7 +2437,7 @@ ctlr_add_bg(int baddr, unsigned char color) | ||
2469 | if (h3270.ea_buf[baddr].bg != color) | 2437 | if (h3270.ea_buf[baddr].bg != color) |
2470 | { | 2438 | { |
2471 | h3270.ea_buf[baddr].bg = color; | 2439 | h3270.ea_buf[baddr].bg = color; |
2472 | - ONE_CHANGED(baddr); | 2440 | + ONE_CHANGED(&h3270,baddr); |
2473 | } | 2441 | } |
2474 | } | 2442 | } |
2475 | 2443 | ||
@@ -2531,7 +2499,7 @@ ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea) | @@ -2531,7 +2499,7 @@ ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea) | ||
2531 | count * sizeof(struct ea))) { | 2499 | count * sizeof(struct ea))) { |
2532 | (void) memmove(&h3270.ea_buf[baddr_to], &h3270.ea_buf[baddr_from], | 2500 | (void) memmove(&h3270.ea_buf[baddr_to], &h3270.ea_buf[baddr_from], |
2533 | count * sizeof(struct ea)); | 2501 | count * sizeof(struct ea)); |
2534 | - REGION_CHANGED(baddr_to, baddr_to + count); | 2502 | + REGION_CHANGED(&h3270,baddr_to, baddr_to + count); |
2535 | } | 2503 | } |
2536 | /* XXX: What about move_ea? */ | 2504 | /* XXX: What about move_ea? */ |
2537 | } | 2505 | } |
@@ -2547,7 +2515,7 @@ void ctlr_aclear(int baddr, int count, int clear_ea) | @@ -2547,7 +2515,7 @@ void ctlr_aclear(int baddr, int count, int clear_ea) | ||
2547 | count * sizeof(struct ea))) { | 2515 | count * sizeof(struct ea))) { |
2548 | (void) memset((char *) &h3270.ea_buf[baddr], 0, | 2516 | (void) memset((char *) &h3270.ea_buf[baddr], 0, |
2549 | count * sizeof(struct ea)); | 2517 | count * sizeof(struct ea)); |
2550 | - REGION_CHANGED(baddr, baddr + count); | 2518 | + REGION_CHANGED(&h3270,baddr, baddr + count); |
2551 | } | 2519 | } |
2552 | /* XXX: What about clear_ea? */ | 2520 | /* XXX: What about clear_ea? */ |
2553 | } | 2521 | } |
@@ -2617,7 +2585,7 @@ void ctlr_altbuffer(H3270 *session, int alt) | @@ -2617,7 +2585,7 @@ void ctlr_altbuffer(H3270 *session, int alt) | ||
2617 | session->is_altbuffer = alt; | 2585 | session->is_altbuffer = alt; |
2618 | lib3270_unselect(session); | 2586 | lib3270_unselect(session); |
2619 | 2587 | ||
2620 | - ALL_CHANGED; | 2588 | + ALL_CHANGED(session); |
2621 | 2589 | ||
2622 | /* | 2590 | /* |
2623 | * There may be blinkers on the alternate screen; schedule one | 2591 | * There may be blinkers on the alternate screen; schedule one |
@@ -2640,7 +2608,7 @@ mdt_set(int baddr) | @@ -2640,7 +2608,7 @@ mdt_set(int baddr) | ||
2640 | if (faddr >= 0 && !(h3270.ea_buf[faddr].fa & FA_MODIFY)) { | 2608 | if (faddr >= 0 && !(h3270.ea_buf[faddr].fa & FA_MODIFY)) { |
2641 | h3270.ea_buf[faddr].fa |= FA_MODIFY; | 2609 | h3270.ea_buf[faddr].fa |= FA_MODIFY; |
2642 | if (h3270.modified_sel) | 2610 | if (h3270.modified_sel) |
2643 | - ALL_CHANGED; | 2611 | + ALL_CHANGED(&h3270); |
2644 | } | 2612 | } |
2645 | } | 2613 | } |
2646 | 2614 | ||
@@ -2653,7 +2621,7 @@ mdt_clear(int baddr) | @@ -2653,7 +2621,7 @@ mdt_clear(int baddr) | ||
2653 | if (faddr >= 0 && (h3270.ea_buf[faddr].fa & FA_MODIFY)) { | 2621 | if (faddr >= 0 && (h3270.ea_buf[faddr].fa & FA_MODIFY)) { |
2654 | h3270.ea_buf[faddr].fa &= ~FA_MODIFY; | 2622 | h3270.ea_buf[faddr].fa &= ~FA_MODIFY; |
2655 | if (h3270.modified_sel) | 2623 | if (h3270.modified_sel) |
2656 | - ALL_CHANGED; | 2624 | + ALL_CHANGED(&h3270); |
2657 | } | 2625 | } |
2658 | } | 2626 | } |
2659 | 2627 | ||
@@ -2671,7 +2639,7 @@ ctlr_shrink(void) | @@ -2671,7 +2639,7 @@ ctlr_shrink(void) | ||
2671 | if (!h3270.ea_buf[baddr].fa) | 2639 | if (!h3270.ea_buf[baddr].fa) |
2672 | h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null; | 2640 | h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null; |
2673 | } | 2641 | } |
2674 | - ALL_CHANGED; | 2642 | + ALL_CHANGED(&h3270); |
2675 | h3270.display(&h3270); | 2643 | h3270.display(&h3270); |
2676 | } | 2644 | } |
2677 | 2645 |