Commit b48cbcf080279591000b7c0a864acb22c28127a7
1 parent
ae2663cf
Exists in
master
Implementação de multi-sessões: Movendo mais campos de controle do terminal para…
… a estrutura de sessão
Showing
13 changed files
with
178 additions
and
165 deletions
Show diff stats
latest/src/gtk2/main.c
@@ -90,7 +90,7 @@ static void connect_main(H3270 *session, int status, void *dunno) | @@ -90,7 +90,7 @@ static void connect_main(H3270 *session, int status, void *dunno) | ||
90 | { | 90 | { |
91 | SetStatusCode(STATUS_CODE_DISCONNECTED); | 91 | SetStatusCode(STATUS_CODE_DISCONNECTED); |
92 | cMode &= ~CURSOR_MODE_ENABLED; | 92 | cMode &= ~CURSOR_MODE_ENABLED; |
93 | - ctlr_erase(1); | 93 | +// ctlr_erase(1); |
94 | online = FALSE; | 94 | online = FALSE; |
95 | #ifdef X3270_FT | 95 | #ifdef X3270_FT |
96 | action_group_set_sensitive(ACTION_GROUP_FT,status); | 96 | action_group_set_sensitive(ACTION_GROUP_FT,status); |
latest/src/include/lib3270/api.h
@@ -230,6 +230,10 @@ | @@ -230,6 +230,10 @@ | ||
230 | int cols; | 230 | int cols; |
231 | int cursor_addr; | 231 | int cursor_addr; |
232 | char flipped; | 232 | char flipped; |
233 | + int screen_alt; /**< alternate screen? */ | ||
234 | + int is_altbuffer; | ||
235 | + | ||
236 | + int formatted; /**< set in screen_disp */ | ||
233 | 237 | ||
234 | // Widget info | 238 | // Widget info |
235 | void * widget; | 239 | void * widget; |
@@ -522,9 +526,9 @@ | @@ -522,9 +526,9 @@ | ||
522 | LIB3270_EXPORT void show_3270_popup_dialog(H3270 *session, PW3270_DIALOG type, const char *title, const char *msg, const char *fmt, ...); | 526 | LIB3270_EXPORT void show_3270_popup_dialog(H3270 *session, PW3270_DIALOG type, const char *title, const char *msg, const char *fmt, ...); |
523 | 527 | ||
524 | /* Set/Get screen contents */ | 528 | /* Set/Get screen contents */ |
525 | - LIB3270_EXPORT int find_field_attribute(int baddr); | ||
526 | - LIB3270_EXPORT int find_field_length(int baddr); | ||
527 | - LIB3270_EXPORT unsigned char get_field_attribute(int baddr); | 529 | + LIB3270_EXPORT int find_field_attribute(H3270 *session, int baddr); |
530 | + LIB3270_EXPORT int find_field_length(H3270 *session, int baddr); | ||
531 | + LIB3270_EXPORT unsigned char get_field_attribute(H3270 *session, int baddr); | ||
528 | LIB3270_EXPORT int screen_read(char *dest, int baddr, int count); | 532 | LIB3270_EXPORT int screen_read(char *dest, int baddr, int count); |
529 | LIB3270_EXPORT void Input_String(const unsigned char *str); | 533 | LIB3270_EXPORT void Input_String(const unsigned char *str); |
530 | LIB3270_EXPORT void screen_size(int *rows, int *cols); | 534 | LIB3270_EXPORT void screen_size(int *rows, int *cols); |
@@ -561,9 +565,8 @@ | @@ -561,9 +565,8 @@ | ||
561 | LIB3270_EXPORT void RunPendingEvents(int wait); | 565 | LIB3270_EXPORT void RunPendingEvents(int wait); |
562 | LIB3270_EXPORT int Wait(int seconds); | 566 | LIB3270_EXPORT int Wait(int seconds); |
563 | 567 | ||
564 | - LIB3270_EXPORT void ctlr_erase(int alt); | ||
565 | - LIB3270_EXPORT int ctlr_get_cols(void); | ||
566 | - LIB3270_EXPORT int ctlr_get_rows(void); | 568 | + LIB3270_EXPORT int ctlr_get_cols(void) __attribute__ ((deprecated)); |
569 | + LIB3270_EXPORT int ctlr_get_rows(void) __attribute__ ((deprecated)); | ||
567 | 570 | ||
568 | /* Screen calls */ | 571 | /* Screen calls */ |
569 | LIB3270_EXPORT void screen_resume(void); | 572 | LIB3270_EXPORT void screen_resume(void); |
latest/src/lib/ansi.c
@@ -605,10 +605,10 @@ ansi_reset(int ig1 unused, int ig2 unused) | @@ -605,10 +605,10 @@ ansi_reset(int ig1 unused, int ig2 unused) | ||
605 | tabs[i] = 0x01; | 605 | tabs[i] = 0x01; |
606 | held_wrap = False; | 606 | held_wrap = False; |
607 | if (!first) { | 607 | if (!first) { |
608 | - ctlr_altbuffer(True); | 608 | + ctlr_altbuffer(&h3270,True); |
609 | ctlr_aclear(0, h3270.rows * h3270.cols, 1); | 609 | ctlr_aclear(0, h3270.rows * h3270.cols, 1); |
610 | - ctlr_altbuffer(False); | ||
611 | - ctlr_clear(False); | 610 | + ctlr_altbuffer(&h3270,False); |
611 | + ctlr_clear(&h3270,False); | ||
612 | screen_80(); | 612 | screen_80(); |
613 | } | 613 | } |
614 | first = False; | 614 | first = False; |
@@ -714,7 +714,7 @@ ansi_erase_in_display(int nn, int ig2 unused) | @@ -714,7 +714,7 @@ ansi_erase_in_display(int nn, int ig2 unused) | ||
714 | ctlr_aclear(0, h3270.cursor_addr + 1, 1); | 714 | ctlr_aclear(0, h3270.cursor_addr + 1, 1); |
715 | break; | 715 | break; |
716 | case 2: /* all (without moving cursor) */ | 716 | case 2: /* all (without moving cursor) */ |
717 | - if (cursor_addr == 0 && !is_altbuffer) | 717 | + if (cursor_addr == 0 && !h3270.is_altbuffer) |
718 | scroll_save(h3270.rows, True); | 718 | scroll_save(h3270.rows, True); |
719 | ctlr_aclear(0, h3270.rows * h3270.cols, 1); | 719 | ctlr_aclear(0, h3270.rows * h3270.cols, 1); |
720 | break; | 720 | break; |
@@ -924,7 +924,7 @@ ansi_bell(int ig1 unused, int ig2 unused) | @@ -924,7 +924,7 @@ ansi_bell(int ig1 unused, int ig2 unused) | ||
924 | static enum state | 924 | static enum state |
925 | ansi_newpage(int ig1 unused, int ig2 unused) | 925 | ansi_newpage(int ig1 unused, int ig2 unused) |
926 | { | 926 | { |
927 | - ctlr_clear(False); | 927 | + ctlr_clear(&h3270,False); |
928 | return DATA; | 928 | return DATA; |
929 | } | 929 | } |
930 | 930 | ||
@@ -1443,7 +1443,7 @@ dec_set(int ig1 unused, int ig2 unused) | @@ -1443,7 +1443,7 @@ dec_set(int ig1 unused, int ig2 unused) | ||
1443 | rev_wraparound_mode = 1; | 1443 | rev_wraparound_mode = 1; |
1444 | break; | 1444 | break; |
1445 | case 47: /* alt buffer */ | 1445 | case 47: /* alt buffer */ |
1446 | - ctlr_altbuffer(True); | 1446 | + ctlr_altbuffer(&h3270,True); |
1447 | break; | 1447 | break; |
1448 | } | 1448 | } |
1449 | return DATA; | 1449 | return DATA; |
@@ -1475,7 +1475,7 @@ dec_reset(int ig1 unused, int ig2 unused) | @@ -1475,7 +1475,7 @@ dec_reset(int ig1 unused, int ig2 unused) | ||
1475 | rev_wraparound_mode = 0; | 1475 | rev_wraparound_mode = 0; |
1476 | break; | 1476 | break; |
1477 | case 47: /* alt buffer */ | 1477 | case 47: /* alt buffer */ |
1478 | - ctlr_altbuffer(False); | 1478 | + ctlr_altbuffer(&h3270,False); |
1479 | break; | 1479 | break; |
1480 | } | 1480 | } |
1481 | return DATA; | 1481 | return DATA; |
@@ -1504,7 +1504,7 @@ dec_save(int ig1 unused, int ig2 unused) | @@ -1504,7 +1504,7 @@ dec_save(int ig1 unused, int ig2 unused) | ||
1504 | saved_rev_wraparound_mode = rev_wraparound_mode; | 1504 | saved_rev_wraparound_mode = rev_wraparound_mode; |
1505 | break; | 1505 | break; |
1506 | case 47: /* alt buffer */ | 1506 | case 47: /* alt buffer */ |
1507 | - saved_altbuffer = is_altbuffer; | 1507 | + saved_altbuffer = h3270.is_altbuffer; |
1508 | break; | 1508 | break; |
1509 | } | 1509 | } |
1510 | return DATA; | 1510 | return DATA; |
@@ -1539,7 +1539,7 @@ dec_restore(int ig1 unused, int ig2 unused) | @@ -1539,7 +1539,7 @@ dec_restore(int ig1 unused, int ig2 unused) | ||
1539 | rev_wraparound_mode = saved_rev_wraparound_mode; | 1539 | rev_wraparound_mode = saved_rev_wraparound_mode; |
1540 | break; | 1540 | break; |
1541 | case 47: /* alt buffer */ | 1541 | case 47: /* alt buffer */ |
1542 | - ctlr_altbuffer(saved_altbuffer); | 1542 | + ctlr_altbuffer(&h3270,saved_altbuffer); |
1543 | break; | 1543 | break; |
1544 | } | 1544 | } |
1545 | return DATA; | 1545 | return DATA; |
@@ -1664,7 +1664,7 @@ ansi_scroll(void) | @@ -1664,7 +1664,7 @@ ansi_scroll(void) | ||
1664 | 1664 | ||
1665 | /* Save the top line */ | 1665 | /* Save the top line */ |
1666 | if (scroll_top == 1 && scroll_bottom == h3270.rows) { | 1666 | if (scroll_top == 1 && scroll_bottom == h3270.rows) { |
1667 | - if (!is_altbuffer) | 1667 | + if (!h3270.is_altbuffer) |
1668 | scroll_save(1, False); | 1668 | scroll_save(1, False); |
1669 | ctlr_scroll(); | 1669 | ctlr_scroll(); |
1670 | return; | 1670 | return; |
latest/src/lib/ctlr.c
@@ -77,13 +77,13 @@ extern unsigned char aid; | @@ -77,13 +77,13 @@ extern unsigned char aid; | ||
77 | // int cursor_addr; | 77 | // int cursor_addr; |
78 | 78 | ||
79 | int buffer_addr; | 79 | int buffer_addr; |
80 | -Boolean screen_alt = False; /* alternate screen? */ | ||
81 | -Boolean is_altbuffer = False; | 80 | +// Boolean screen_alt = False; /* alternate screen? */ |
81 | +// Boolean is_altbuffer = False; | ||
82 | 82 | ||
83 | struct ea *ea_buf = NULL; /* 3270 device buffer */ | 83 | struct ea *ea_buf = NULL; /* 3270 device buffer */ |
84 | /* ea_buf[-1] is the dummy default field attribute */ | 84 | /* ea_buf[-1] is the dummy default field attribute */ |
85 | 85 | ||
86 | -Boolean formatted = False; /* set in screen_disp */ | 86 | +// Boolean formatted = False; /* set in screen_disp */ |
87 | unsigned char reply_mode = SF_SRM_FIELD; | 87 | unsigned char reply_mode = SF_SRM_FIELD; |
88 | int crm_nattr = 0; | 88 | int crm_nattr = 0; |
89 | unsigned char crm_attr[16]; | 89 | unsigned char crm_attr[16]; |
@@ -92,7 +92,7 @@ Boolean dbcs = False; | @@ -92,7 +92,7 @@ Boolean dbcs = False; | ||
92 | /* Statics */ | 92 | /* Statics */ |
93 | static struct ea *aea_buf; /* alternate 3270 extended attribute buffer */ | 93 | static struct ea *aea_buf; /* alternate 3270 extended attribute buffer */ |
94 | static unsigned char *zero_buf; /* empty buffer, for area clears */ | 94 | static unsigned char *zero_buf; /* empty buffer, for area clears */ |
95 | -static void set_formatted(void); | 95 | +static void set_formatted(H3270 *session); |
96 | static void ctlr_blanks(void); | 96 | static void ctlr_blanks(void); |
97 | static Boolean trace_primed = False; | 97 | static Boolean trace_primed = False; |
98 | static unsigned char default_fg; | 98 | static unsigned char default_fg; |
@@ -251,7 +251,7 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) | @@ -251,7 +251,7 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) | ||
251 | // Make sure that the current rows/cols are still 24x80. | 251 | // Make sure that the current rows/cols are still 24x80. |
252 | session->cols = 80; | 252 | session->cols = 80; |
253 | session->rows = 24; | 253 | session->rows = 24; |
254 | - screen_alt = False; | 254 | + session->screen_alt = False; |
255 | 255 | ||
256 | } | 256 | } |
257 | 257 | ||
@@ -260,16 +260,19 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) | @@ -260,16 +260,19 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) | ||
260 | * Set the formatted screen flag. A formatted screen is a screen that | 260 | * Set the formatted screen flag. A formatted screen is a screen that |
261 | * has at least one field somewhere on it. | 261 | * has at least one field somewhere on it. |
262 | */ | 262 | */ |
263 | -static void | ||
264 | -set_formatted(void) | 263 | +static void set_formatted(H3270 *session) |
265 | { | 264 | { |
266 | - register int baddr; | 265 | + register int baddr; |
267 | 266 | ||
268 | - formatted = False; | 267 | + CHECK_SESSION_HANDLE(session); |
268 | + | ||
269 | + session->formatted = False; | ||
269 | baddr = 0; | 270 | baddr = 0; |
270 | - do { | ||
271 | - if (ea_buf[baddr].fa) { | ||
272 | - formatted = True; | 271 | + do |
272 | + { | ||
273 | + if (ea_buf[baddr].fa) | ||
274 | + { | ||
275 | + session->formatted = True; | ||
273 | break; | 276 | break; |
274 | } | 277 | } |
275 | INC_BA(baddr); | 278 | INC_BA(baddr); |
@@ -288,8 +291,7 @@ static void ctlr_half_connect(H3270 *session, int ignored unused, void *dunno) | @@ -288,8 +291,7 @@ static void ctlr_half_connect(H3270 *session, int ignored unused, void *dunno) | ||
288 | /* | 291 | /* |
289 | * Called when a host connects, disconnects, or changes ANSI/3270 modes. | 292 | * Called when a host connects, disconnects, or changes ANSI/3270 modes. |
290 | */ | 293 | */ |
291 | -static void | ||
292 | -ctlr_connect(H3270 *session, int ignored unused, void *dunno) | 294 | +static void ctlr_connect(H3270 *session, int ignored unused, void *dunno) |
293 | { | 295 | { |
294 | ticking_stop(session); | 296 | ticking_stop(session); |
295 | status_untiming(session); | 297 | status_untiming(session); |
@@ -318,12 +320,13 @@ ctlr_connect(H3270 *session, int ignored unused, void *dunno) | @@ -318,12 +320,13 @@ ctlr_connect(H3270 *session, int ignored unused, void *dunno) | ||
318 | * Find the buffer address of the field attribute for a given buffer address. | 320 | * Find the buffer address of the field attribute for a given buffer address. |
319 | * Returns -1 if the screen isn't formatted. | 321 | * Returns -1 if the screen isn't formatted. |
320 | */ | 322 | */ |
321 | -int | ||
322 | -find_field_attribute(int baddr) | 323 | +int find_field_attribute(H3270 *h, int baddr) |
323 | { | 324 | { |
324 | int sbaddr; | 325 | int sbaddr; |
325 | 326 | ||
326 | - if (!formatted) | 327 | + CHECK_SESSION_HANDLE(h); |
328 | + | ||
329 | + if (!h->formatted) | ||
327 | return -1; | 330 | return -1; |
328 | 331 | ||
329 | sbaddr = baddr; | 332 | sbaddr = baddr; |
@@ -338,12 +341,16 @@ find_field_attribute(int baddr) | @@ -338,12 +341,16 @@ find_field_attribute(int baddr) | ||
338 | /* | 341 | /* |
339 | * Get Field width | 342 | * Get Field width |
340 | */ | 343 | */ |
341 | -int find_field_length(int baddr) | 344 | +int find_field_length(H3270 *h, int baddr) |
342 | { | 345 | { |
343 | int saddr; | 346 | int saddr; |
344 | - int addr = find_field_attribute(baddr); | 347 | + int addr; |
345 | int width = 0; | 348 | int width = 0; |
346 | 349 | ||
350 | + CHECK_SESSION_HANDLE(h); | ||
351 | + | ||
352 | + addr = find_field_attribute(h,baddr); | ||
353 | + | ||
347 | if(addr < 0) | 354 | if(addr < 0) |
348 | return -1; | 355 | return -1; |
349 | 356 | ||
@@ -364,10 +371,10 @@ int find_field_length(int baddr) | @@ -364,10 +371,10 @@ int find_field_length(int baddr) | ||
364 | * Find the field attribute for the given buffer address. Return its address | 371 | * Find the field attribute for the given buffer address. Return its address |
365 | * rather than its value. | 372 | * rather than its value. |
366 | */ | 373 | */ |
367 | -unsigned char | ||
368 | -get_field_attribute(int baddr) | 374 | +unsigned char get_field_attribute(H3270 *h, int baddr) |
369 | { | 375 | { |
370 | - return ea_buf[find_field_attribute(baddr)].fa; | 376 | + CHECK_SESSION_HANDLE(h); |
377 | + return ea_buf[find_field_attribute(h,baddr)].fa; | ||
371 | } | 378 | } |
372 | 379 | ||
373 | /* | 380 | /* |
@@ -382,7 +389,7 @@ get_bounded_field_attribute(register int baddr, register int bound, | @@ -382,7 +389,7 @@ get_bounded_field_attribute(register int baddr, register int bound, | ||
382 | { | 389 | { |
383 | int sbaddr; | 390 | int sbaddr; |
384 | 391 | ||
385 | - if (!formatted) { | 392 | + if (!h3270.formatted) { |
386 | *fa_out = ea_buf[-1].fa; | 393 | *fa_out = ea_buf[-1].fa; |
387 | return True; | 394 | return True; |
388 | } | 395 | } |
@@ -442,36 +449,39 @@ next_unprotected(int baddr0) | @@ -442,36 +449,39 @@ next_unprotected(int baddr0) | ||
442 | * Perform an erase command, which may include changing the (virtual) screen | 449 | * Perform an erase command, which may include changing the (virtual) screen |
443 | * size. | 450 | * size. |
444 | */ | 451 | */ |
445 | -void | ||
446 | -ctlr_erase(int alt) | 452 | +void ctlr_erase(H3270 *session, int alt) |
447 | { | 453 | { |
448 | - kybd_inhibit(False); | 454 | + CHECK_SESSION_HANDLE(session); |
449 | 455 | ||
450 | - ctlr_clear(True); | ||
451 | - screen_erase(&h3270); | 456 | + kybd_inhibit(False); |
452 | 457 | ||
453 | - /* Let a script go. */ | ||
454 | -// sms_host_output(); | 458 | + ctlr_clear(session,True); |
459 | + screen_erase(session); | ||
455 | 460 | ||
456 | - if (alt == screen_alt) | 461 | + if(alt == session->screen_alt) |
457 | return; | 462 | return; |
458 | 463 | ||
459 | - if (alt) { | 464 | + if (alt) |
465 | + { | ||
460 | /* Going from 24x80 to maximum. */ | 466 | /* Going from 24x80 to maximum. */ |
461 | - screen_disp(&h3270); | ||
462 | - set_viewsize(&h3270,h3270.maxROWS,h3270.maxCOLS); | ||
463 | - } else { | 467 | + screen_disp(session); |
468 | + set_viewsize(session,session->maxROWS,session->maxCOLS); | ||
469 | + } | ||
470 | + else | ||
471 | + { | ||
464 | /* Going from maximum to 24x80. */ | 472 | /* Going from maximum to 24x80. */ |
465 | - if (h3270.maxROWS > 24 || h3270.maxCOLS > 80) { | ||
466 | - if (visible_control) { | 473 | + if (session->maxROWS > 24 || session->maxCOLS > 80) |
474 | + { | ||
475 | + if (visible_control) | ||
476 | + { | ||
467 | ctlr_blanks(); | 477 | ctlr_blanks(); |
468 | - screen_disp(&h3270); | 478 | + screen_disp(session); |
469 | } | 479 | } |
470 | - set_viewsize(&h3270,24,80); | 480 | + set_viewsize(session,24,80); |
471 | } | 481 | } |
472 | } | 482 | } |
473 | 483 | ||
474 | - screen_alt = alt; | 484 | + session->screen_alt = alt; |
475 | } | 485 | } |
476 | 486 | ||
477 | 487 | ||
@@ -500,7 +510,7 @@ process_ds(unsigned char *buf, int buflen) | @@ -500,7 +510,7 @@ process_ds(unsigned char *buf, int buflen) | ||
500 | case CMD_EWA: /* erase/write alternate */ | 510 | case CMD_EWA: /* erase/write alternate */ |
501 | case SNA_CMD_EWA: | 511 | case SNA_CMD_EWA: |
502 | trace_ds("EraseWriteAlternate"); | 512 | trace_ds("EraseWriteAlternate"); |
503 | - ctlr_erase(True); | 513 | + ctlr_erase(NULL,True); |
504 | if ((rv = ctlr_write(buf, buflen, True)) < 0) | 514 | if ((rv = ctlr_write(buf, buflen, True)) < 0) |
505 | return rv; | 515 | return rv; |
506 | return PDS_OKAY_NO_OUTPUT; | 516 | return PDS_OKAY_NO_OUTPUT; |
@@ -508,7 +518,7 @@ process_ds(unsigned char *buf, int buflen) | @@ -508,7 +518,7 @@ process_ds(unsigned char *buf, int buflen) | ||
508 | case CMD_EW: /* erase/write */ | 518 | case CMD_EW: /* erase/write */ |
509 | case SNA_CMD_EW: | 519 | case SNA_CMD_EW: |
510 | trace_ds("EraseWrite"); | 520 | trace_ds("EraseWrite"); |
511 | - ctlr_erase(False); | 521 | + ctlr_erase(NULL,False); |
512 | if ((rv = ctlr_write(buf, buflen, True)) < 0) | 522 | if ((rv = ctlr_write(buf, buflen, True)) < 0) |
513 | return rv; | 523 | return rv; |
514 | return PDS_OKAY_NO_OUTPUT; | 524 | return PDS_OKAY_NO_OUTPUT; |
@@ -685,7 +695,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | @@ -685,7 +695,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | ||
685 | } | 695 | } |
686 | 696 | ||
687 | baddr = 0; | 697 | baddr = 0; |
688 | - if (formatted) { | 698 | + if (h3270.formatted) { |
689 | /* find first field attribute */ | 699 | /* find first field attribute */ |
690 | do { | 700 | do { |
691 | if (ea_buf[baddr].fa) | 701 | if (ea_buf[baddr].fa) |
@@ -934,7 +944,7 @@ ctlr_snap_buffer(void) | @@ -934,7 +944,7 @@ ctlr_snap_buffer(void) | ||
934 | unsigned char av; | 944 | unsigned char av; |
935 | 945 | ||
936 | space3270out(2); | 946 | space3270out(2); |
937 | - *obptr++ = screen_alt ? CMD_EWA : CMD_EW; | 947 | + *obptr++ = h3270.screen_alt ? CMD_EWA : CMD_EW; |
938 | *obptr++ = code_table[0]; | 948 | *obptr++ = code_table[0]; |
939 | 949 | ||
940 | do { | 950 | do { |
@@ -1061,7 +1071,7 @@ ctlr_erase_all_unprotected(void) | @@ -1061,7 +1071,7 @@ ctlr_erase_all_unprotected(void) | ||
1061 | 1071 | ||
1062 | kybd_inhibit(False); | 1072 | kybd_inhibit(False); |
1063 | 1073 | ||
1064 | - if (formatted) { | 1074 | + if (h3270.formatted) { |
1065 | /* find first field attribute */ | 1075 | /* find first field attribute */ |
1066 | baddr = 0; | 1076 | baddr = 0; |
1067 | do { | 1077 | do { |
@@ -1095,7 +1105,7 @@ ctlr_erase_all_unprotected(void) | @@ -1095,7 +1105,7 @@ ctlr_erase_all_unprotected(void) | ||
1095 | if (!f) | 1105 | if (!f) |
1096 | cursor_move(0); | 1106 | cursor_move(0); |
1097 | } else { | 1107 | } else { |
1098 | - ctlr_clear(True); | 1108 | + ctlr_clear(&h3270,True); |
1099 | } | 1109 | } |
1100 | aid = AID_NO; | 1110 | aid = AID_NO; |
1101 | do_reset(False); | 1111 | do_reset(False); |
@@ -1151,7 +1161,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1151,7 +1161,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1151 | ctlr_add_gr(buffer_addr, 0); \ | 1161 | ctlr_add_gr(buffer_addr, 0); \ |
1152 | ctlr_add_ic(buffer_addr, 0); \ | 1162 | ctlr_add_ic(buffer_addr, 0); \ |
1153 | trace_ds("%s",see_attr(fa)); \ | 1163 | trace_ds("%s",see_attr(fa)); \ |
1154 | - formatted = True; \ | 1164 | + h3270.formatted = True; \ |
1155 | } | 1165 | } |
1156 | 1166 | ||
1157 | kybd_inhibit(False); | 1167 | kybd_inhibit(False); |
@@ -1203,7 +1213,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1203,7 +1213,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1203 | 1213 | ||
1204 | last_cmd = True; | 1214 | last_cmd = True; |
1205 | last_zpt = False; | 1215 | last_zpt = False; |
1206 | - current_fa = get_field_attribute(buffer_addr); | 1216 | + current_fa = get_field_attribute(&h3270,buffer_addr); |
1207 | 1217 | ||
1208 | #define ABORT_WRITEx { \ | 1218 | #define ABORT_WRITEx { \ |
1209 | rv = PDS_BAD_ADDR; \ | 1219 | rv = PDS_BAD_ADDR; \ |
@@ -1239,7 +1249,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1239,7 +1249,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1239 | if (buffer_addr >= h3270.cols * h3270.rows) { | 1249 | if (buffer_addr >= h3270.cols * h3270.rows) { |
1240 | ABORT_WRITE("invalid SBA address"); | 1250 | ABORT_WRITE("invalid SBA address"); |
1241 | } | 1251 | } |
1242 | - current_fa = get_field_attribute(buffer_addr); | 1252 | + current_fa = get_field_attribute(&h3270,buffer_addr); |
1243 | last_cmd = True; | 1253 | last_cmd = True; |
1244 | last_zpt = False; | 1254 | last_zpt = False; |
1245 | break; | 1255 | break; |
@@ -1399,7 +1409,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1399,7 +1409,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1399 | INC_BA(buffer_addr); | 1409 | INC_BA(buffer_addr); |
1400 | } | 1410 | } |
1401 | } while (buffer_addr != baddr); | 1411 | } while (buffer_addr != baddr); |
1402 | - current_fa = get_field_attribute(buffer_addr); | 1412 | + current_fa = get_field_attribute(&h3270,buffer_addr); |
1403 | last_cmd = True; | 1413 | last_cmd = True; |
1404 | last_zpt = False; | 1414 | last_zpt = False; |
1405 | break; | 1415 | break; |
@@ -1430,7 +1440,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1430,7 +1440,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1430 | } | 1440 | } |
1431 | INC_BA(buffer_addr); | 1441 | INC_BA(buffer_addr); |
1432 | } while (buffer_addr != baddr); | 1442 | } while (buffer_addr != baddr); |
1433 | - current_fa = get_field_attribute(buffer_addr); | 1443 | + current_fa = get_field_attribute(&h3270,buffer_addr); |
1434 | last_cmd = True; | 1444 | last_cmd = True; |
1435 | last_zpt = False; | 1445 | last_zpt = False; |
1436 | break; | 1446 | break; |
@@ -1450,7 +1460,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1450,7 +1460,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1450 | ctlr_add_gr(buffer_addr, default_gr); | 1460 | ctlr_add_gr(buffer_addr, default_gr); |
1451 | ctlr_add_ic(buffer_addr, default_ic); | 1461 | ctlr_add_ic(buffer_addr, default_ic); |
1452 | INC_BA(buffer_addr); | 1462 | INC_BA(buffer_addr); |
1453 | - current_fa = get_field_attribute(buffer_addr); | 1463 | + current_fa = get_field_attribute(&h3270,buffer_addr); |
1454 | last_cmd = False; | 1464 | last_cmd = False; |
1455 | last_zpt = False; | 1465 | last_zpt = False; |
1456 | break; | 1466 | break; |
@@ -1697,7 +1707,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1697,7 +1707,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1697 | if (d != DBCS_NONE && why == DBCS_FIELD) { | 1707 | if (d != DBCS_NONE && why == DBCS_FIELD) { |
1698 | ABORT_WRITE("SI in DBCS field"); | 1708 | ABORT_WRITE("SI in DBCS field"); |
1699 | } | 1709 | } |
1700 | - fa_addr = find_field_attribute(buffer_addr); | 1710 | + fa_addr = find_field_attribute(&h3270,buffer_addr); |
1701 | baddr = buffer_addr; | 1711 | baddr = buffer_addr; |
1702 | DEC_BA(baddr); | 1712 | DEC_BA(baddr); |
1703 | while (!aborted && | 1713 | while (!aborted && |
@@ -1849,7 +1859,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1849,7 +1859,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1849 | break; | 1859 | break; |
1850 | } | 1860 | } |
1851 | } | 1861 | } |
1852 | - set_formatted(); | 1862 | + set_formatted(&h3270); |
1853 | END_TEXT0; | 1863 | END_TEXT0; |
1854 | trace_ds("\n"); | 1864 | trace_ds("\n"); |
1855 | if (wcc_keyboard_restore) { | 1865 | if (wcc_keyboard_restore) { |
@@ -2278,8 +2288,8 @@ ps_process(void) | @@ -2278,8 +2288,8 @@ ps_process(void) | ||
2278 | #if defined(X3270_FT) /*[*/ | 2288 | #if defined(X3270_FT) /*[*/ |
2279 | /* Process file transfers. */ | 2289 | /* Process file transfers. */ |
2280 | if (ft_state != FT_NONE && /* transfer in progress */ | 2290 | if (ft_state != FT_NONE && /* transfer in progress */ |
2281 | - formatted && /* screen is formatted */ | ||
2282 | - !screen_alt && /* 24x80 screen */ | 2291 | + h3270.formatted && /* screen is formatted */ |
2292 | + !h3270.screen_alt && /* 24x80 screen */ | ||
2283 | !kybdlock && /* keyboard not locked */ | 2293 | !kybdlock && /* keyboard not locked */ |
2284 | /* magic field */ | 2294 | /* magic field */ |
2285 | ea_buf[1919].fa && FA_IS_SKIP(ea_buf[1919].fa)) { | 2295 | ea_buf[1919].fa && FA_IS_SKIP(ea_buf[1919].fa)) { |
@@ -2308,7 +2318,7 @@ ctlr_any_data(void) | @@ -2308,7 +2318,7 @@ ctlr_any_data(void) | ||
2308 | * and buffer addresses and extended attributes. | 2318 | * and buffer addresses and extended attributes. |
2309 | */ | 2319 | */ |
2310 | void | 2320 | void |
2311 | -ctlr_clear(Boolean can_snap) | 2321 | +ctlr_clear(H3270 *session, Boolean can_snap) |
2312 | { | 2322 | { |
2313 | /* Snap any data that is about to be lost into the trace file. */ | 2323 | /* Snap any data that is about to be lost into the trace file. */ |
2314 | if (ctlr_any_data()) { | 2324 | if (ctlr_any_data()) { |
@@ -2316,18 +2326,18 @@ ctlr_clear(Boolean can_snap) | @@ -2316,18 +2326,18 @@ ctlr_clear(Boolean can_snap) | ||
2316 | if (can_snap && !trace_skipping && toggled(SCREEN_TRACE)) | 2326 | if (can_snap && !trace_skipping && toggled(SCREEN_TRACE)) |
2317 | trace_screen(); | 2327 | trace_screen(); |
2318 | #endif /*]*/ | 2328 | #endif /*]*/ |
2319 | - scroll_save(maxROWS, ever_3270 ? False : True); | 2329 | + scroll_save(session->maxROWS, ever_3270 ? False : True); |
2320 | } | 2330 | } |
2321 | #if defined(X3270_TRACE) /*[*/ | 2331 | #if defined(X3270_TRACE) /*[*/ |
2322 | trace_skipping = False; | 2332 | trace_skipping = False; |
2323 | #endif /*]*/ | 2333 | #endif /*]*/ |
2324 | 2334 | ||
2325 | /* Clear the screen. */ | 2335 | /* Clear the screen. */ |
2326 | - (void) memset((char *)ea_buf, 0, h3270.rows*h3270.cols*sizeof(struct ea)); | 2336 | + (void) memset((char *)ea_buf, 0, session->rows*session->cols*sizeof(struct ea)); |
2327 | cursor_move(0); | 2337 | cursor_move(0); |
2328 | buffer_addr = 0; | 2338 | buffer_addr = 0; |
2329 | // unselect(0, ROWS*COLS); | 2339 | // unselect(0, ROWS*COLS); |
2330 | - formatted = False; | 2340 | + session->formatted = False; |
2331 | default_fg = 0; | 2341 | default_fg = 0; |
2332 | default_bg = 0; | 2342 | default_bg = 0; |
2333 | default_gr = 0; | 2343 | default_gr = 0; |
@@ -2335,7 +2345,7 @@ ctlr_clear(Boolean can_snap) | @@ -2335,7 +2345,7 @@ ctlr_clear(Boolean can_snap) | ||
2335 | sscp_start = 0; | 2345 | sscp_start = 0; |
2336 | 2346 | ||
2337 | // ALL_CHANGED; | 2347 | // ALL_CHANGED; |
2338 | - screen_erase(&h3270); | 2348 | + screen_erase(session); |
2339 | 2349 | ||
2340 | } | 2350 | } |
2341 | 2351 | ||
@@ -2354,7 +2364,7 @@ ctlr_blanks(void) | @@ -2354,7 +2364,7 @@ ctlr_blanks(void) | ||
2354 | cursor_move(0); | 2364 | cursor_move(0); |
2355 | buffer_addr = 0; | 2365 | buffer_addr = 0; |
2356 | // unselect(0, ROWS*COLS); | 2366 | // unselect(0, ROWS*COLS); |
2357 | - formatted = False; | 2367 | + h3270.formatted = False; |
2358 | ALL_CHANGED; | 2368 | ALL_CHANGED; |
2359 | } | 2369 | } |
2360 | 2370 | ||
@@ -2376,7 +2386,7 @@ ctlr_add(int baddr, unsigned char c, unsigned char cs) | @@ -2376,7 +2386,7 @@ ctlr_add(int baddr, unsigned char c, unsigned char cs) | ||
2376 | if (toggled(SCREEN_TRACE)) | 2386 | if (toggled(SCREEN_TRACE)) |
2377 | trace_screen(); | 2387 | trace_screen(); |
2378 | #endif /*]*/ | 2388 | #endif /*]*/ |
2379 | - scroll_save(maxROWS, False); | 2389 | + scroll_save(session->maxROWS, False); |
2380 | trace_primed = False; | 2390 | trace_primed = False; |
2381 | } | 2391 | } |
2382 | /* | 2392 | /* |
@@ -2622,22 +2632,23 @@ void changed(H3270 *session, int bstart, int bend) | @@ -2622,22 +2632,23 @@ void changed(H3270 *session, int bstart, int bend) | ||
2622 | 2632 | ||
2623 | } | 2633 | } |
2624 | 2634 | ||
2625 | -#if defined(X3270_ANSI) /*[*/ | ||
2626 | /* | 2635 | /* |
2627 | * Swap the regular and alternate screen buffers | 2636 | * Swap the regular and alternate screen buffers |
2628 | */ | 2637 | */ |
2629 | -void | ||
2630 | -ctlr_altbuffer(Boolean alt) | 2638 | +void ctlr_altbuffer(H3270 *session, int alt) |
2631 | { | 2639 | { |
2632 | struct ea *etmp; | 2640 | struct ea *etmp; |
2633 | 2641 | ||
2634 | - if (alt != is_altbuffer) { | 2642 | + CHECK_SESSION_HANDLE(session); |
2643 | + | ||
2644 | + if (alt != session->is_altbuffer) | ||
2645 | + { | ||
2635 | 2646 | ||
2636 | etmp = ea_buf; | 2647 | etmp = ea_buf; |
2637 | ea_buf = aea_buf; | 2648 | ea_buf = aea_buf; |
2638 | aea_buf = etmp; | 2649 | aea_buf = etmp; |
2639 | 2650 | ||
2640 | - is_altbuffer = alt; | 2651 | + session->is_altbuffer = alt; |
2641 | ALL_CHANGED; | 2652 | ALL_CHANGED; |
2642 | // unselect(0, ROWS*COLS); | 2653 | // unselect(0, ROWS*COLS); |
2643 | 2654 | ||
@@ -2648,7 +2659,6 @@ ctlr_altbuffer(Boolean alt) | @@ -2648,7 +2659,6 @@ ctlr_altbuffer(Boolean alt) | ||
2648 | blink_start(); | 2659 | blink_start(); |
2649 | } | 2660 | } |
2650 | } | 2661 | } |
2651 | -#endif /*]*/ | ||
2652 | 2662 | ||
2653 | 2663 | ||
2654 | /* | 2664 | /* |
@@ -2659,7 +2669,7 @@ mdt_set(int baddr) | @@ -2659,7 +2669,7 @@ mdt_set(int baddr) | ||
2659 | { | 2669 | { |
2660 | int faddr; | 2670 | int faddr; |
2661 | 2671 | ||
2662 | - faddr = find_field_attribute(baddr); | 2672 | + faddr = find_field_attribute(&h3270,baddr); |
2663 | if (faddr >= 0 && !(ea_buf[faddr].fa & FA_MODIFY)) { | 2673 | if (faddr >= 0 && !(ea_buf[faddr].fa & FA_MODIFY)) { |
2664 | ea_buf[faddr].fa |= FA_MODIFY; | 2674 | ea_buf[faddr].fa |= FA_MODIFY; |
2665 | if (appres.modified_sel) | 2675 | if (appres.modified_sel) |
@@ -2672,7 +2682,7 @@ mdt_clear(int baddr) | @@ -2672,7 +2682,7 @@ mdt_clear(int baddr) | ||
2672 | { | 2682 | { |
2673 | int faddr; | 2683 | int faddr; |
2674 | 2684 | ||
2675 | - faddr = find_field_attribute(baddr); | 2685 | + faddr = find_field_attribute(&h3270,baddr); |
2676 | if (faddr >= 0 && (ea_buf[faddr].fa & FA_MODIFY)) { | 2686 | if (faddr >= 0 && (ea_buf[faddr].fa & FA_MODIFY)) { |
2677 | ea_buf[faddr].fa &= ~FA_MODIFY; | 2687 | ea_buf[faddr].fa &= ~FA_MODIFY; |
2678 | if (appres.modified_sel) | 2688 | if (appres.modified_sel) |
latest/src/lib/ctlr.h
@@ -20,5 +20,5 @@ | @@ -20,5 +20,5 @@ | ||
20 | LIB3270_INTERNAL int buffer_addr; /**< buffer address */ | 20 | LIB3270_INTERNAL int buffer_addr; /**< buffer address */ |
21 | LIB3270_INTERNAL int cursor_addr; /**< cursor address */ | 21 | LIB3270_INTERNAL int cursor_addr; /**< cursor address */ |
22 | LIB3270_INTERNAL struct ea *ea_buf; /**< 3270 device buffer */ | 22 | LIB3270_INTERNAL struct ea *ea_buf; /**< 3270 device buffer */ |
23 | -LIB3270_INTERNAL Boolean formatted; /**< contains at least one field? */ | ||
24 | -LIB3270_INTERNAL Boolean is_altbuffer; /**< in alternate-buffer mode? */ | 23 | +//LIB3270_INTERNAL Boolean formatted; /**< contains at least one field? */ |
24 | +//LIB3270_INTERNAL Boolean is_altbuffer; /**< in alternate-buffer mode? */ |
latest/src/lib/ctlrc.h
@@ -31,11 +31,11 @@ LIB3270_INTERNAL void ctlr_add_cs(int baddr, unsigned char cs); | @@ -31,11 +31,11 @@ LIB3270_INTERNAL void ctlr_add_cs(int baddr, unsigned char cs); | ||
31 | LIB3270_INTERNAL void ctlr_add_fa(int baddr, unsigned char fa, unsigned char cs); | 31 | LIB3270_INTERNAL void ctlr_add_fa(int baddr, unsigned char fa, unsigned char cs); |
32 | LIB3270_INTERNAL void ctlr_add_fg(int baddr, unsigned char color); | 32 | LIB3270_INTERNAL void ctlr_add_fg(int baddr, unsigned char color); |
33 | LIB3270_INTERNAL void ctlr_add_gr(int baddr, unsigned char gr); | 33 | LIB3270_INTERNAL void ctlr_add_gr(int baddr, unsigned char gr); |
34 | -LIB3270_INTERNAL void ctlr_altbuffer(Boolean alt); | 34 | +LIB3270_INTERNAL void ctlr_altbuffer(H3270 *session, int alt); |
35 | LIB3270_INTERNAL Boolean ctlr_any_data(void); | 35 | LIB3270_INTERNAL Boolean ctlr_any_data(void); |
36 | LIB3270_INTERNAL void ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea); | 36 | LIB3270_INTERNAL void ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea); |
37 | // LIB3270_INTERNAL void ctlr_changed(int bstart, int bend); | 37 | // LIB3270_INTERNAL void ctlr_changed(int bstart, int bend); |
38 | -LIB3270_INTERNAL void ctlr_clear(Boolean can_snap); | 38 | +LIB3270_INTERNAL void ctlr_clear(H3270 *session, Boolean can_snap); |
39 | LIB3270_INTERNAL void ctlr_erase_all_unprotected(void); | 39 | LIB3270_INTERNAL void ctlr_erase_all_unprotected(void); |
40 | LIB3270_INTERNAL void ctlr_init(unsigned cmask); | 40 | LIB3270_INTERNAL void ctlr_init(unsigned cmask); |
41 | LIB3270_INTERNAL void ctlr_read_buffer(unsigned char aid_byte); | 41 | LIB3270_INTERNAL void ctlr_read_buffer(unsigned char aid_byte); |
@@ -59,6 +59,7 @@ LIB3270_INTERNAL void ps_process(void); | @@ -59,6 +59,7 @@ LIB3270_INTERNAL void ps_process(void); | ||
59 | 59 | ||
60 | LIB3270_INTERNAL void update_model_info(H3270 *session, int model, int cols, int rows); | 60 | LIB3270_INTERNAL void update_model_info(H3270 *session, int model, int cols, int rows); |
61 | LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr); | 61 | LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr); |
62 | +LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); | ||
62 | 63 | ||
63 | LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); | 64 | LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); |
64 | LIB3270_INTERNAL void toggle_nop(struct toggle *t, enum toggle_type tt); | 65 | LIB3270_INTERNAL void toggle_nop(struct toggle *t, enum toggle_type tt); |
latest/src/lib/globals.h
@@ -203,10 +203,10 @@ LIB3270_INTERNAL char *hostname; | @@ -203,10 +203,10 @@ LIB3270_INTERNAL char *hostname; | ||
203 | LIB3270_INTERNAL Boolean local_process; | 203 | LIB3270_INTERNAL Boolean local_process; |
204 | #endif /*]*/ | 204 | #endif /*]*/ |
205 | 205 | ||
206 | -LIB3270_INTERNAL int maxCOLS; | ||
207 | -LIB3270_INTERNAL int maxROWS; | ||
208 | -LIB3270_INTERNAL char *model_name; | ||
209 | -LIB3270_INTERNAL int model_num; | 206 | +// LIB3270_INTERNAL int maxCOLS; |
207 | +// LIB3270_INTERNAL int maxROWS; | ||
208 | +// LIB3270_INTERNAL char *model_name; | ||
209 | +// LIB3270_INTERNAL int model_num; | ||
210 | LIB3270_INTERNAL Boolean no_login_host; | 210 | LIB3270_INTERNAL Boolean no_login_host; |
211 | LIB3270_INTERNAL Boolean non_tn3270e_host; | 211 | LIB3270_INTERNAL Boolean non_tn3270e_host; |
212 | LIB3270_INTERNAL int ov_cols, ov_rows; | 212 | LIB3270_INTERNAL int ov_cols, ov_rows; |
latest/src/lib/kybd.c
@@ -766,8 +766,8 @@ key_Character(int code, Boolean with_ge, Boolean pasting, Boolean *skipped) | @@ -766,8 +766,8 @@ key_Character(int code, Boolean with_ge, Boolean pasting, Boolean *skipped) | ||
766 | return False; | 766 | return False; |
767 | } | 767 | } |
768 | baddr = h3270.cursor_addr; | 768 | baddr = h3270.cursor_addr; |
769 | - faddr = find_field_attribute(baddr); | ||
770 | - fa = get_field_attribute(baddr); | 769 | + faddr = find_field_attribute(&h3270,baddr); |
770 | + fa = get_field_attribute(&h3270,baddr); | ||
771 | if (ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) { | 771 | if (ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) { |
772 | operator_error(KL_OERR_PROTECTED); | 772 | operator_error(KL_OERR_PROTECTED); |
773 | return False; | 773 | return False; |
@@ -919,7 +919,7 @@ key_Character(int code, Boolean with_ge, Boolean pasting, Boolean *skipped) | @@ -919,7 +919,7 @@ key_Character(int code, Boolean with_ge, Boolean pasting, Boolean *skipped) | ||
919 | INC_BA(baddr); | 919 | INC_BA(baddr); |
920 | 920 | ||
921 | /* Replace leading nulls with blanks, if desired. */ | 921 | /* Replace leading nulls with blanks, if desired. */ |
922 | - if (formatted && toggled(BLANK_FILL)) { | 922 | + if (h3270.formatted && toggled(BLANK_FILL)) { |
923 | register int baddr_fill = baddr; | 923 | register int baddr_fill = baddr; |
924 | 924 | ||
925 | DEC_BA(baddr_fill); | 925 | DEC_BA(baddr_fill); |
@@ -1602,7 +1602,7 @@ LIB3270_ACTION( firstfield ) | @@ -1602,7 +1602,7 @@ LIB3270_ACTION( firstfield ) | ||
1602 | return 0; | 1602 | return 0; |
1603 | } | 1603 | } |
1604 | #endif /*]*/ | 1604 | #endif /*]*/ |
1605 | - if (!formatted) { | 1605 | + if (!h3270.formatted) { |
1606 | cursor_move(0); | 1606 | cursor_move(0); |
1607 | return 0; | 1607 | return 0; |
1608 | } | 1608 | } |
@@ -1692,7 +1692,7 @@ do_delete(void) | @@ -1692,7 +1692,7 @@ do_delete(void) | ||
1692 | baddr = h3270.cursor_addr; | 1692 | baddr = h3270.cursor_addr; |
1693 | 1693 | ||
1694 | /* Can't delete a field attribute. */ | 1694 | /* Can't delete a field attribute. */ |
1695 | - fa = get_field_attribute(baddr); | 1695 | + fa = get_field_attribute(&h3270,baddr); |
1696 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { | 1696 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { |
1697 | operator_error(KL_OERR_PROTECTED); | 1697 | operator_error(KL_OERR_PROTECTED); |
1698 | return False; | 1698 | return False; |
@@ -1718,7 +1718,7 @@ do_delete(void) | @@ -1718,7 +1718,7 @@ do_delete(void) | ||
1718 | ndel = 1; | 1718 | ndel = 1; |
1719 | 1719 | ||
1720 | /* find next fa */ | 1720 | /* find next fa */ |
1721 | - if (formatted) { | 1721 | + if (h3270.formatted) { |
1722 | end_baddr = baddr; | 1722 | end_baddr = baddr; |
1723 | do { | 1723 | do { |
1724 | INC_BA(end_baddr); | 1724 | INC_BA(end_baddr); |
@@ -1826,7 +1826,7 @@ do_erase(void) | @@ -1826,7 +1826,7 @@ do_erase(void) | ||
1826 | enum dbcs_state d; | 1826 | enum dbcs_state d; |
1827 | 1827 | ||
1828 | baddr = h3270.cursor_addr; | 1828 | baddr = h3270.cursor_addr; |
1829 | - faddr = find_field_attribute(baddr); | 1829 | + faddr = find_field_attribute(&h3270,baddr); |
1830 | if (faddr == baddr || FA_IS_PROTECTED(ea_buf[baddr].fa)) { | 1830 | if (faddr == baddr || FA_IS_PROTECTED(ea_buf[baddr].fa)) { |
1831 | operator_error(KL_OERR_PROTECTED); | 1831 | operator_error(KL_OERR_PROTECTED); |
1832 | return; | 1832 | return; |
@@ -1994,11 +1994,11 @@ LIB3270_ACTION( previousword ) | @@ -1994,11 +1994,11 @@ LIB3270_ACTION( previousword ) | ||
1994 | if (IN_ANSI) | 1994 | if (IN_ANSI) |
1995 | return 0; | 1995 | return 0; |
1996 | #endif /*]*/ | 1996 | #endif /*]*/ |
1997 | - if (!formatted) | 1997 | + if (!h3270.formatted) |
1998 | return 0; | 1998 | return 0; |
1999 | 1999 | ||
2000 | baddr = h3270.cursor_addr; | 2000 | baddr = h3270.cursor_addr; |
2001 | - prot = FA_IS_PROTECTED(get_field_attribute(baddr)); | 2001 | + prot = FA_IS_PROTECTED(get_field_attribute(&h3270,baddr)); |
2002 | 2002 | ||
2003 | /* Skip to before this word, if in one now. */ | 2003 | /* Skip to before this word, if in one now. */ |
2004 | if (!prot) { | 2004 | if (!prot) { |
@@ -2017,7 +2017,7 @@ LIB3270_ACTION( previousword ) | @@ -2017,7 +2017,7 @@ LIB3270_ACTION( previousword ) | ||
2017 | c = ea_buf[baddr].cc; | 2017 | c = ea_buf[baddr].cc; |
2018 | if (ea_buf[baddr].fa) { | 2018 | if (ea_buf[baddr].fa) { |
2019 | DEC_BA(baddr); | 2019 | DEC_BA(baddr); |
2020 | - prot = FA_IS_PROTECTED(get_field_attribute(baddr)); | 2020 | + prot = FA_IS_PROTECTED(get_field_attribute(&h3270,baddr)); |
2021 | continue; | 2021 | continue; |
2022 | } | 2022 | } |
2023 | if (!prot && c != EBC_space && c != EBC_null) | 2023 | if (!prot && c != EBC_space && c != EBC_null) |
@@ -2087,7 +2087,7 @@ nu_word(int baddr) | @@ -2087,7 +2087,7 @@ nu_word(int baddr) | ||
2087 | unsigned char c; | 2087 | unsigned char c; |
2088 | Boolean prot; | 2088 | Boolean prot; |
2089 | 2089 | ||
2090 | - prot = FA_IS_PROTECTED(get_field_attribute(baddr)); | 2090 | + prot = FA_IS_PROTECTED(get_field_attribute(&h3270,baddr)); |
2091 | 2091 | ||
2092 | do { | 2092 | do { |
2093 | c = ea_buf[baddr].cc; | 2093 | c = ea_buf[baddr].cc; |
@@ -2145,12 +2145,12 @@ LIB3270_ACTION( nextword ) | @@ -2145,12 +2145,12 @@ LIB3270_ACTION( nextword ) | ||
2145 | if (IN_ANSI) | 2145 | if (IN_ANSI) |
2146 | return 0; | 2146 | return 0; |
2147 | #endif /*]*/ | 2147 | #endif /*]*/ |
2148 | - if (!formatted) | 2148 | + if (!h3270.formatted) |
2149 | return 0; | 2149 | return 0; |
2150 | 2150 | ||
2151 | /* If not in an unprotected field, go to the next unprotected word. */ | 2151 | /* If not in an unprotected field, go to the next unprotected word. */ |
2152 | if (ea_buf[h3270.cursor_addr].fa || | 2152 | if (ea_buf[h3270.cursor_addr].fa || |
2153 | - FA_IS_PROTECTED(get_field_attribute(h3270.cursor_addr))) { | 2153 | + FA_IS_PROTECTED(get_field_attribute(&h3270,h3270.cursor_addr))) { |
2154 | baddr = nu_word(h3270.cursor_addr); | 2154 | baddr = nu_word(h3270.cursor_addr); |
2155 | if (baddr != -1) | 2155 | if (baddr != -1) |
2156 | cursor_move(baddr); | 2156 | cursor_move(baddr); |
@@ -2311,7 +2311,7 @@ LIB3270_CURSOR_ACTION( newline ) | @@ -2311,7 +2311,7 @@ LIB3270_CURSOR_ACTION( newline ) | ||
2311 | #endif /*]*/ | 2311 | #endif /*]*/ |
2312 | baddr = (h3270.cursor_addr + h3270.cols) % (h3270.cols * h3270.rows); /* down */ | 2312 | baddr = (h3270.cursor_addr + h3270.cols) % (h3270.cols * h3270.rows); /* down */ |
2313 | baddr = (baddr / h3270.cols) * h3270.cols; /* 1st col */ | 2313 | baddr = (baddr / h3270.cols) * h3270.cols; /* 1st col */ |
2314 | - faddr = find_field_attribute(baddr); | 2314 | + faddr = find_field_attribute(&h3270,baddr); |
2315 | fa = ea_buf[faddr].fa; | 2315 | fa = ea_buf[faddr].fa; |
2316 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) | 2316 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) |
2317 | cursor_move(baddr); | 2317 | cursor_move(baddr); |
@@ -2426,7 +2426,7 @@ LIB3270_ACTION( clear ) | @@ -2426,7 +2426,7 @@ LIB3270_ACTION( clear ) | ||
2426 | } | 2426 | } |
2427 | #endif /*]*/ | 2427 | #endif /*]*/ |
2428 | buffer_addr = 0; | 2428 | buffer_addr = 0; |
2429 | - ctlr_clear(True); | 2429 | + ctlr_clear(&h3270,True); |
2430 | cursor_move(0); | 2430 | cursor_move(0); |
2431 | if (CONNECTED) | 2431 | if (CONNECTED) |
2432 | key_AID(AID_CLEAR); | 2432 | key_AID(AID_CLEAR); |
@@ -2566,14 +2566,14 @@ LIB3270_ACTION( eraseeol ) | @@ -2566,14 +2566,14 @@ LIB3270_ACTION( eraseeol ) | ||
2566 | #endif /*]*/ | 2566 | #endif /*]*/ |
2567 | 2567 | ||
2568 | baddr = h3270.cursor_addr; | 2568 | baddr = h3270.cursor_addr; |
2569 | - fa = get_field_attribute(baddr); | 2569 | + fa = get_field_attribute(&h3270,baddr); |
2570 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) | 2570 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) |
2571 | { | 2571 | { |
2572 | operator_error(KL_OERR_PROTECTED); | 2572 | operator_error(KL_OERR_PROTECTED); |
2573 | return -1; | 2573 | return -1; |
2574 | } | 2574 | } |
2575 | 2575 | ||
2576 | - if (formatted) | 2576 | + if (h3270.formatted) |
2577 | { | 2577 | { |
2578 | /* erase to next field attribute or current line */ | 2578 | /* erase to next field attribute or current line */ |
2579 | do | 2579 | do |
@@ -2631,12 +2631,12 @@ LIB3270_ACTION( eraseeof ) | @@ -2631,12 +2631,12 @@ LIB3270_ACTION( eraseeof ) | ||
2631 | return 0; | 2631 | return 0; |
2632 | #endif /*]*/ | 2632 | #endif /*]*/ |
2633 | baddr = h3270.cursor_addr; | 2633 | baddr = h3270.cursor_addr; |
2634 | - fa = get_field_attribute(baddr); | 2634 | + fa = get_field_attribute(&h3270,baddr); |
2635 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { | 2635 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { |
2636 | operator_error(KL_OERR_PROTECTED); | 2636 | operator_error(KL_OERR_PROTECTED); |
2637 | return -1; | 2637 | return -1; |
2638 | } | 2638 | } |
2639 | - if (formatted) { /* erase to next field attribute */ | 2639 | + if (h3270.formatted) { /* erase to next field attribute */ |
2640 | do { | 2640 | do { |
2641 | ctlr_add(baddr, EBC_null, 0); | 2641 | ctlr_add(baddr, EBC_null, 0); |
2642 | INC_BA(baddr); | 2642 | INC_BA(baddr); |
@@ -2679,7 +2679,7 @@ LIB3270_ACTION( eraseinput ) | @@ -2679,7 +2679,7 @@ LIB3270_ACTION( eraseinput ) | ||
2679 | if (IN_ANSI) | 2679 | if (IN_ANSI) |
2680 | return 0; | 2680 | return 0; |
2681 | #endif /*]*/ | 2681 | #endif /*]*/ |
2682 | - if (formatted) { | 2682 | + if (h3270.formatted) { |
2683 | /* find first field attribute */ | 2683 | /* find first field attribute */ |
2684 | baddr = 0; | 2684 | baddr = 0; |
2685 | do { | 2685 | do { |
@@ -2712,7 +2712,7 @@ LIB3270_ACTION( eraseinput ) | @@ -2712,7 +2712,7 @@ LIB3270_ACTION( eraseinput ) | ||
2712 | if (!f) | 2712 | if (!f) |
2713 | cursor_move(0); | 2713 | cursor_move(0); |
2714 | } else { | 2714 | } else { |
2715 | - ctlr_clear(True); | 2715 | + ctlr_clear(&h3270,True); |
2716 | cursor_move(0); | 2716 | cursor_move(0); |
2717 | } | 2717 | } |
2718 | screen_disp(&h3270); | 2718 | screen_disp(&h3270); |
@@ -2745,11 +2745,11 @@ LIB3270_ACTION( deleteword ) | @@ -2745,11 +2745,11 @@ LIB3270_ACTION( deleteword ) | ||
2745 | return 0; | 2745 | return 0; |
2746 | } | 2746 | } |
2747 | #endif /*]*/ | 2747 | #endif /*]*/ |
2748 | - if (!formatted) | 2748 | + if (!h3270.formatted) |
2749 | return 0; | 2749 | return 0; |
2750 | 2750 | ||
2751 | baddr = h3270.cursor_addr; | 2751 | baddr = h3270.cursor_addr; |
2752 | - fa = get_field_attribute(baddr); | 2752 | + fa = get_field_attribute(&h3270,baddr); |
2753 | 2753 | ||
2754 | /* Make sure we're on a modifiable field. */ | 2754 | /* Make sure we're on a modifiable field. */ |
2755 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { | 2755 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { |
@@ -2812,11 +2812,11 @@ LIB3270_ACTION( deletefield ) | @@ -2812,11 +2812,11 @@ LIB3270_ACTION( deletefield ) | ||
2812 | return 0; | 2812 | return 0; |
2813 | } | 2813 | } |
2814 | #endif /*]*/ | 2814 | #endif /*]*/ |
2815 | - if (!formatted) | 2815 | + if (!h3270.formatted) |
2816 | return 0; | 2816 | return 0; |
2817 | 2817 | ||
2818 | baddr = h3270.cursor_addr; | 2818 | baddr = h3270.cursor_addr; |
2819 | - fa = get_field_attribute(baddr); | 2819 | + fa = get_field_attribute(&h3270,baddr); |
2820 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { | 2820 | if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { |
2821 | operator_error(KL_OERR_PROTECTED); | 2821 | operator_error(KL_OERR_PROTECTED); |
2822 | return -1; | 2822 | return -1; |
@@ -2916,10 +2916,10 @@ LIB3270_ACTION( fieldend ) | @@ -2916,10 +2916,10 @@ LIB3270_ACTION( fieldend ) | ||
2916 | if (IN_ANSI) | 2916 | if (IN_ANSI) |
2917 | return 0; | 2917 | return 0; |
2918 | #endif /*]*/ | 2918 | #endif /*]*/ |
2919 | - if (!formatted) | 2919 | + if (!h3270.formatted) |
2920 | return 0; | 2920 | return 0; |
2921 | baddr = h3270.cursor_addr; | 2921 | baddr = h3270.cursor_addr; |
2922 | - faddr = find_field_attribute(baddr); | 2922 | + faddr = find_field_attribute(&h3270,baddr); |
2923 | fa = ea_buf[faddr].fa; | 2923 | fa = ea_buf[faddr].fa; |
2924 | if (faddr == baddr || FA_IS_PROTECTED(fa)) | 2924 | if (faddr == baddr || FA_IS_PROTECTED(fa)) |
2925 | return 0; | 2925 | return 0; |
@@ -3299,7 +3299,7 @@ remargin(int lmargin) | @@ -3299,7 +3299,7 @@ remargin(int lmargin) | ||
3299 | b0 = baddr; | 3299 | b0 = baddr; |
3300 | ever = True; | 3300 | ever = True; |
3301 | } | 3301 | } |
3302 | - faddr = find_field_attribute(baddr); | 3302 | + faddr = find_field_attribute(&h3270,baddr); |
3303 | fa = ea_buf[faddr].fa; | 3303 | fa = ea_buf[faddr].fa; |
3304 | if (faddr == baddr || FA_IS_PROTECTED(fa)) { | 3304 | if (faddr == baddr || FA_IS_PROTECTED(fa)) { |
3305 | baddr = next_unprotected(baddr); | 3305 | baddr = next_unprotected(baddr); |
@@ -3855,10 +3855,10 @@ kybd_prime(void) | @@ -3855,10 +3855,10 @@ kybd_prime(void) | ||
3855 | * No point in trying if the screen isn't formatted, the keyboard | 3855 | * No point in trying if the screen isn't formatted, the keyboard |
3856 | * is locked, or we aren't in 3270 mode. | 3856 | * is locked, or we aren't in 3270 mode. |
3857 | */ | 3857 | */ |
3858 | - if (!formatted || kybdlock || !IN_3270) | 3858 | + if (!h3270.formatted || kybdlock || !IN_3270) |
3859 | return 0; | 3859 | return 0; |
3860 | 3860 | ||
3861 | - fa = get_field_attribute(h3270.cursor_addr); | 3861 | + fa = get_field_attribute(&h3270,h3270.cursor_addr); |
3862 | if (ea_buf[h3270.cursor_addr].fa || FA_IS_PROTECTED(fa)) { | 3862 | if (ea_buf[h3270.cursor_addr].fa || FA_IS_PROTECTED(fa)) { |
3863 | /* | 3863 | /* |
3864 | * The cursor is not in an unprotected field. Find the | 3864 | * The cursor is not in an unprotected field. Find the |
latest/src/lib/paste.c
@@ -111,7 +111,7 @@ | @@ -111,7 +111,7 @@ | ||
111 | ever = True; | 111 | ever = True; |
112 | } | 112 | } |
113 | 113 | ||
114 | - faddr = find_field_attribute(baddr); | 114 | + faddr = find_field_attribute(&h3270,baddr); |
115 | fa = ea_buf[faddr].fa; | 115 | fa = ea_buf[faddr].fa; |
116 | if (faddr == baddr || FA_IS_PROTECTED(fa)) | 116 | if (faddr == baddr || FA_IS_PROTECTED(fa)) |
117 | { | 117 | { |
@@ -132,7 +132,7 @@ | @@ -132,7 +132,7 @@ | ||
132 | 132 | ||
133 | if(toggled(SMART_PASTE)) | 133 | if(toggled(SMART_PASTE)) |
134 | { | 134 | { |
135 | - int faddr = find_field_attribute(h3270.cursor_addr); | 135 | + int faddr = find_field_attribute(&h3270,h3270.cursor_addr); |
136 | if(FA_IS_PROTECTED(ea_buf[faddr].fa)) | 136 | if(FA_IS_PROTECTED(ea_buf[faddr].fa)) |
137 | h3270.cursor_addr++; | 137 | h3270.cursor_addr++; |
138 | else | 138 | else |
@@ -190,7 +190,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | @@ -190,7 +190,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | ||
190 | { | 190 | { |
191 | baddr = (h->cursor_addr + h->cols) % (h->cols * h->rows); /* down */ | 191 | baddr = (h->cursor_addr + h->cols) % (h->cols * h->rows); /* down */ |
192 | baddr = (baddr / h->cols) * h->cols; /* 1st col */ | 192 | baddr = (baddr / h->cols) * h->cols; /* 1st col */ |
193 | - faddr = find_field_attribute(baddr); | 193 | + faddr = find_field_attribute(h,baddr); |
194 | fa = ea_buf[faddr].fa; | 194 | fa = ea_buf[faddr].fa; |
195 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) | 195 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) |
196 | cursor_move(baddr); | 196 | cursor_move(baddr); |
latest/src/lib/print.c
@@ -150,7 +150,7 @@ fprint_screen(FILE *f, Boolean even_if_empty, Boolean use_html) | @@ -150,7 +150,7 @@ fprint_screen(FILE *f, Boolean even_if_empty, Boolean use_html) | ||
150 | int ns = 0; | 150 | int ns = 0; |
151 | int nr = 0; | 151 | int nr = 0; |
152 | Boolean any = False; | 152 | Boolean any = False; |
153 | - int fa_addr = find_field_attribute(0); | 153 | + int fa_addr = find_field_attribute(&h3270,0); |
154 | unsigned char fa = ea_buf[fa_addr].fa; | 154 | unsigned char fa = ea_buf[fa_addr].fa; |
155 | int fa_color, current_color; | 155 | int fa_color, current_color; |
156 | Bool fa_high, current_high; | 156 | Bool fa_high, current_high; |
latest/src/lib/screen.c
@@ -99,11 +99,19 @@ void set_display_charset(char *dcs) | @@ -99,11 +99,19 @@ void set_display_charset(char *dcs) | ||
99 | callbacks->charset(dcs); | 99 | callbacks->charset(dcs); |
100 | } | 100 | } |
101 | 101 | ||
102 | +/* | ||
102 | static void addch(int row, int col, int c, int attr) | 103 | static void addch(int row, int col, int c, int attr) |
103 | { | 104 | { |
104 | if(callbacks && callbacks->addch) | 105 | if(callbacks && callbacks->addch) |
105 | callbacks->addch(row, col, c, attr); | 106 | callbacks->addch(row, col, c, attr); |
106 | } | 107 | } |
108 | +*/ | ||
109 | + | ||
110 | +static void addch(H3270 *session, int baddr, unsigned short c, int attr) | ||
111 | +{ | ||
112 | + if(callbacks && callbacks->addch) | ||
113 | + callbacks->addch(baddr/session->cols, baddr%session->cols, c, attr); | ||
114 | +} | ||
107 | 115 | ||
108 | /** | 116 | /** |
109 | * Initialize the screen. | 117 | * Initialize the screen. |
@@ -141,8 +149,6 @@ int screen_init(H3270 *session) | @@ -141,8 +149,6 @@ int screen_init(H3270 *session) | ||
141 | // if (ab_mode == TS_AUTO) | 149 | // if (ab_mode == TS_AUTO) |
142 | // ab_mode = appres.m3279? TS_ON: TS_OFF; | 150 | // ab_mode = appres.m3279? TS_ON: TS_OFF; |
143 | 151 | ||
144 | - /* Pull in the user's color mappings. */ | ||
145 | - | ||
146 | /* Set up the controller. */ | 152 | /* Set up the controller. */ |
147 | ctlr_init(-1); | 153 | ctlr_init(-1); |
148 | ctlr_reinit(session,-1); | 154 | ctlr_reinit(session,-1); |
@@ -298,7 +304,7 @@ void update_model_info(H3270 *session, int model, int cols, int rows) | @@ -298,7 +304,7 @@ void update_model_info(H3270 *session, int model, int cols, int rows) | ||
298 | /* Get screen contents */ | 304 | /* Get screen contents */ |
299 | int screen_read(char *dest, int baddr, int count) | 305 | int screen_read(char *dest, int baddr, int count) |
300 | { | 306 | { |
301 | - unsigned char fa = get_field_attribute(baddr); | 307 | + unsigned char fa = get_field_attribute(&h3270,baddr); |
302 | int max = (h3270.maxROWS * h3270.maxCOLS); | 308 | int max = (h3270.maxROWS * h3270.maxCOLS); |
303 | 309 | ||
304 | *dest = 0; | 310 | *dest = 0; |
@@ -333,20 +339,15 @@ int screen_read(char *dest, int baddr, int count) | @@ -333,20 +339,15 @@ int screen_read(char *dest, int baddr, int count) | ||
333 | static void screen_update(H3270 *session, int bstart, int bend) | 339 | static void screen_update(H3270 *session, int bstart, int bend) |
334 | { | 340 | { |
335 | 341 | ||
336 | - int baddr, row, col; | 342 | + int baddr; |
337 | unsigned short a; | 343 | unsigned short a; |
338 | int attr = COLOR_GREEN; | 344 | int attr = COLOR_GREEN; |
339 | unsigned char fa; | 345 | unsigned char fa; |
340 | int fa_addr; | 346 | int fa_addr; |
341 | 347 | ||
342 | - fa = get_field_attribute(bstart); | 348 | + fa = get_field_attribute(session,bstart); |
343 | a = color_from_fa(fa); | 349 | a = color_from_fa(fa); |
344 | - fa_addr = find_field_attribute(bstart); // may be -1, that's okay | ||
345 | - | ||
346 | - row = bstart/session->cols; | ||
347 | - col = bstart%session->cols; | ||
348 | - | ||
349 | - Trace("Update@%d-%d (%d,%d): [%c]",bstart,bend,row,col,ebc2asc[ea_buf[bstart].cc]); | 350 | + fa_addr = find_field_attribute(session,bstart); // may be -1, that's okay |
350 | 351 | ||
351 | for(baddr = bstart; baddr <= bend; baddr++) | 352 | for(baddr = bstart; baddr <= bend; baddr++) |
352 | { | 353 | { |
@@ -356,12 +357,12 @@ static void screen_update(H3270 *session, int bstart, int bend) | @@ -356,12 +357,12 @@ static void screen_update(H3270 *session, int bstart, int bend) | ||
356 | fa_addr = baddr; | 357 | fa_addr = baddr; |
357 | fa = ea_buf[baddr].fa; | 358 | fa = ea_buf[baddr].fa; |
358 | a = calc_attrs(baddr, baddr, fa); | 359 | a = calc_attrs(baddr, baddr, fa); |
359 | - addch(row,col,' ',(attr = COLOR_GREEN)|CHAR_ATTR_MARKER); | 360 | + addch(session,baddr,' ',(attr = COLOR_GREEN)|CHAR_ATTR_MARKER); |
360 | } | 361 | } |
361 | else if (FA_IS_ZERO(fa)) | 362 | else if (FA_IS_ZERO(fa)) |
362 | { | 363 | { |
363 | // Blank. | 364 | // Blank. |
364 | - addch(row,col,' ',attr=a); | 365 | + addch(session,baddr,' ',attr=a); |
365 | } | 366 | } |
366 | else | 367 | else |
367 | { | 368 | { |
@@ -384,27 +385,21 @@ static void screen_update(H3270 *session, int bstart, int bend) | @@ -384,27 +385,21 @@ static void screen_update(H3270 *session, int bstart, int bend) | ||
384 | 385 | ||
385 | if (ea_buf[baddr].cs == CS_LINEDRAW) | 386 | if (ea_buf[baddr].cs == CS_LINEDRAW) |
386 | { | 387 | { |
387 | - addch(row,col,ea_buf[baddr].cc,attr); | 388 | + addch(session,baddr,ea_buf[baddr].cc,attr); |
388 | } | 389 | } |
389 | else if (ea_buf[baddr].cs == CS_APL || (ea_buf[baddr].cs & CS_GE)) | 390 | else if (ea_buf[baddr].cs == CS_APL || (ea_buf[baddr].cs & CS_GE)) |
390 | { | 391 | { |
391 | - addch(row,col,ea_buf[baddr].cc,attr|CHAR_ATTR_CG); | 392 | + addch(session,baddr,ea_buf[baddr].cc,attr|CHAR_ATTR_CG); |
392 | } | 393 | } |
393 | else | 394 | else |
394 | { | 395 | { |
395 | if (toggled(MONOCASE)) | 396 | if (toggled(MONOCASE)) |
396 | - addch(row,col,asc2uc[ebc2asc[ea_buf[baddr].cc]],attr); | 397 | + addch(session,baddr,asc2uc[ebc2asc[ea_buf[baddr].cc]],attr); |
397 | else | 398 | else |
398 | - addch(row,col,ebc2asc[ea_buf[baddr].cc],attr); | 399 | + addch(session,baddr,ebc2asc[ea_buf[baddr].cc],attr); |
399 | } | 400 | } |
400 | } | 401 | } |
401 | 402 | ||
402 | - if(++col >= session->cols) | ||
403 | - { | ||
404 | - row++; | ||
405 | - col=0; | ||
406 | - } | ||
407 | - | ||
408 | } | 403 | } |
409 | } | 404 | } |
410 | 405 | ||
@@ -598,8 +593,10 @@ static void status_connect(H3270 *session, int connected, void *dunno) | @@ -598,8 +593,10 @@ static void status_connect(H3270 *session, int connected, void *dunno) | ||
598 | { | 593 | { |
599 | STATUS_CODE id = STATUS_CODE_USER; | 594 | STATUS_CODE id = STATUS_CODE_USER; |
600 | 595 | ||
601 | - if (connected) { | 596 | + ctlr_erase(session,1); |
602 | 597 | ||
598 | + if (connected) | ||
599 | + { | ||
603 | set_status(session,OIA_FLAG_BOXSOLID,IN_3270 && !IN_SSCP); | 600 | set_status(session,OIA_FLAG_BOXSOLID,IN_3270 && !IN_SSCP); |
604 | 601 | ||
605 | if (kybdlock & KL_AWAITING_FIRST) | 602 | if (kybdlock & KL_AWAITING_FIRST) |
@@ -611,7 +608,9 @@ static void status_connect(H3270 *session, int connected, void *dunno) | @@ -611,7 +608,9 @@ static void status_connect(H3270 *session, int connected, void *dunno) | ||
611 | set_status(session,OIA_FLAG_SECURE,session->secure_connection); | 608 | set_status(session,OIA_FLAG_SECURE,session->secure_connection); |
612 | #endif /*]*/ | 609 | #endif /*]*/ |
613 | 610 | ||
614 | - } else { | 611 | + } |
612 | + else | ||
613 | + { | ||
615 | set_status(session,OIA_FLAG_BOXSOLID,False); | 614 | set_status(session,OIA_FLAG_BOXSOLID,False); |
616 | set_status(session,OIA_FLAG_SECURE,False); | 615 | set_status(session,OIA_FLAG_SECURE,False); |
617 | 616 |
latest/src/lib/sf.c
@@ -65,7 +65,7 @@ | @@ -65,7 +65,7 @@ | ||
65 | #include <lib3270/api.h> | 65 | #include <lib3270/api.h> |
66 | 66 | ||
67 | /* Externals: ctlr.c */ | 67 | /* Externals: ctlr.c */ |
68 | -extern Boolean screen_alt; | 68 | +// extern Boolean screen_alt; |
69 | extern unsigned char reply_mode; | 69 | extern unsigned char reply_mode; |
70 | extern int crm_nattr; | 70 | extern int crm_nattr; |
71 | extern unsigned char crm_attr[]; | 71 | extern unsigned char crm_attr[]; |
@@ -380,11 +380,11 @@ sf_erase_reset(unsigned char buf[], int buflen) | @@ -380,11 +380,11 @@ sf_erase_reset(unsigned char buf[], int buflen) | ||
380 | switch (buf[3]) { | 380 | switch (buf[3]) { |
381 | case SF_ER_DEFAULT: | 381 | case SF_ER_DEFAULT: |
382 | trace_ds(" Default\n"); | 382 | trace_ds(" Default\n"); |
383 | - ctlr_erase(False); | 383 | + ctlr_erase(NULL,False); |
384 | break; | 384 | break; |
385 | case SF_ER_ALT: | 385 | case SF_ER_ALT: |
386 | trace_ds(" Alternate\n"); | 386 | trace_ds(" Alternate\n"); |
387 | - ctlr_erase(True); | 387 | + ctlr_erase(NULL,True); |
388 | break; | 388 | break; |
389 | default: | 389 | default: |
390 | trace_ds(" unknown type 0x%02x\n", buf[3]); | 390 | trace_ds(" unknown type 0x%02x\n", buf[3]); |
@@ -509,13 +509,13 @@ sf_create_partition(unsigned char buf[], int buflen) | @@ -509,13 +509,13 @@ sf_create_partition(unsigned char buf[], int buflen) | ||
509 | GET16(h, &buf[6]); | 509 | GET16(h, &buf[6]); |
510 | trace_ds(",h=%d", h); | 510 | trace_ds(",h=%d", h); |
511 | } else | 511 | } else |
512 | - h = maxROWS; | 512 | + h = h3270.maxROWS; |
513 | 513 | ||
514 | if (buflen > 9) { | 514 | if (buflen > 9) { |
515 | GET16(w, &buf[8]); | 515 | GET16(w, &buf[8]); |
516 | trace_ds(",w=%d", w); | 516 | trace_ds(",w=%d", w); |
517 | } else | 517 | } else |
518 | - w = maxCOLS; | 518 | + w = h3270.maxCOLS; |
519 | 519 | ||
520 | if (buflen > 11) { | 520 | if (buflen > 11) { |
521 | GET16(rv, &buf[10]); | 521 | GET16(rv, &buf[10]); |
@@ -533,13 +533,13 @@ sf_create_partition(unsigned char buf[], int buflen) | @@ -533,13 +533,13 @@ sf_create_partition(unsigned char buf[], int buflen) | ||
533 | GET16(hv, &buf[14]); | 533 | GET16(hv, &buf[14]); |
534 | trace_ds(",hv=%d", hv); | 534 | trace_ds(",hv=%d", hv); |
535 | } else | 535 | } else |
536 | - hv = (h > maxROWS)? maxROWS: h; | 536 | + hv = (h > h3270.maxROWS)? h3270.maxROWS: h; |
537 | 537 | ||
538 | if (buflen > 17) { | 538 | if (buflen > 17) { |
539 | GET16(wv, &buf[16]); | 539 | GET16(wv, &buf[16]); |
540 | trace_ds(",wv=%d", wv); | 540 | trace_ds(",wv=%d", wv); |
541 | } else | 541 | } else |
542 | - wv = (w > maxCOLS)? maxCOLS: w; | 542 | + wv = (w > h3270.maxCOLS)? h3270.maxCOLS: w; |
543 | 543 | ||
544 | if (buflen > 19) { | 544 | if (buflen > 19) { |
545 | GET16(rw, &buf[18]); | 545 | GET16(rw, &buf[18]); |
@@ -605,7 +605,7 @@ sf_outbound_ds(unsigned char buf[], int buflen) | @@ -605,7 +605,7 @@ sf_outbound_ds(unsigned char buf[], int buflen) | ||
605 | break; | 605 | break; |
606 | case SNA_CMD_EW: | 606 | case SNA_CMD_EW: |
607 | trace_ds(" EraseWrite"); | 607 | trace_ds(" EraseWrite"); |
608 | - ctlr_erase(screen_alt); | 608 | + ctlr_erase(&h3270,h3270.screen_alt); |
609 | if (buflen > 5) { | 609 | if (buflen > 5) { |
610 | if ((rv = ctlr_write(&buf[4], buflen-4, True)) < 0) | 610 | if ((rv = ctlr_write(&buf[4], buflen-4, True)) < 0) |
611 | return rv; | 611 | return rv; |
@@ -614,7 +614,7 @@ sf_outbound_ds(unsigned char buf[], int buflen) | @@ -614,7 +614,7 @@ sf_outbound_ds(unsigned char buf[], int buflen) | ||
614 | break; | 614 | break; |
615 | case SNA_CMD_EWA: | 615 | case SNA_CMD_EWA: |
616 | trace_ds(" EraseWriteAlternate"); | 616 | trace_ds(" EraseWriteAlternate"); |
617 | - ctlr_erase(screen_alt); | 617 | + ctlr_erase(&h3270,h3270.screen_alt); |
618 | if (buflen > 5) { | 618 | if (buflen > 5) { |
619 | if ((rv = ctlr_write(&buf[4], buflen-4, True)) < 0) | 619 | if ((rv = ctlr_write(&buf[4], buflen-4, True)) < 0) |
620 | return rv; | 620 | return rv; |
latest/src/lib/trace_ds.c
@@ -447,7 +447,7 @@ create_tracefile_header(const char *mode) | @@ -447,7 +447,7 @@ create_tracefile_header(const char *mode) | ||
447 | * write to ensure that the display is in the right | 447 | * write to ensure that the display is in the right |
448 | * mode. | 448 | * mode. |
449 | */ | 449 | */ |
450 | - if (formatted) { | 450 | + if (h3270.formatted) { |
451 | wtrace(" Screen contents:\n"); | 451 | wtrace(" Screen contents:\n"); |
452 | obptr = obuf; | 452 | obptr = obuf; |
453 | #if defined(X3270_TN3270E) /*[*/ | 453 | #if defined(X3270_TN3270E) /*[*/ |