Commit 3dbcb212ef7504b32ef2ba70d4844c58f00f2e76

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

Implementando mais métodos de teclado pela estrutura de sessão

Showing 1 changed file with 95 additions and 81 deletions   Show diff stats
src/lib3270/kybd.c
@@ -303,7 +303,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char @@ -303,7 +303,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char
303 } 303 }
304 hSession->ta_tail = ta; 304 hSession->ta_tail = ta;
305 305
306 - trace_event(" action queued (kybdlock 0x%x)\n", h3270.kybdlock); 306 + trace_event(" action queued (kybdlock 0x%x)\n", hSession->kybdlock);
307 } 307 }
308 308
309 /* 309 /*
@@ -473,18 +473,18 @@ void kybd_in3270(H3270 *session, int in3270 unused, void *dunno) @@ -473,18 +473,18 @@ void kybd_in3270(H3270 *session, int in3270 unused, void *dunno)
473 /* 473 /*
474 * Lock the keyboard because of an operator error. 474 * Lock the keyboard because of an operator error.
475 */ 475 */
476 -static void operator_error(int error_type) 476 +static void operator_error(H3270 *hSession, int error_type)
477 { 477 {
478 - if(h3270.oerr_lock) 478 + if(hSession->oerr_lock)
479 { 479 {
480 - status_oerr(NULL,error_type);  
481 - mcursor_locked(&h3270);  
482 - kybdlock_set(&h3270,(unsigned int)error_type);  
483 - flush_ta(&h3270); 480 + status_oerr(hSession,error_type);
  481 + mcursor_locked(hSession);
  482 + kybdlock_set(hSession,(unsigned int)error_type);
  483 + flush_ta(hSession);
484 } 484 }
485 else 485 else
486 { 486 {
487 - lib3270_ring_bell(NULL); 487 + lib3270_ring_bell(hSession);
488 } 488 }
489 } 489 }
490 490
@@ -493,7 +493,7 @@ static void operator_error(int error_type) @@ -493,7 +493,7 @@ static void operator_error(int error_type)
493 * Handle an AID (Attention IDentifier) key. This is the common stuff that 493 * Handle an AID (Attention IDentifier) key. This is the common stuff that
494 * gets executed for all AID keys (PFs, PAs, Clear and etc). 494 * gets executed for all AID keys (PFs, PAs, Clear and etc).
495 */ 495 */
496 -static void key_AID(H3270 *session, unsigned char aid_code) 496 +static void key_AID(H3270 *hSession, unsigned char aid_code)
497 { 497 {
498 #if defined(X3270_ANSI) /*[*/ 498 #if defined(X3270_ANSI) /*[*/
499 if (IN_ANSI) { 499 if (IN_ANSI) {
@@ -523,33 +523,37 @@ static void key_AID(H3270 *session, unsigned char aid_code) @@ -523,33 +523,37 @@ static void key_AID(H3270 *session, unsigned char aid_code)
523 plugin_aid(aid_code); 523 plugin_aid(aid_code);
524 #endif /*]*/ 524 #endif /*]*/
525 525
526 - trace("IN_SSCP: %d cursor_addr: %d",IN_SSCP,h3270.cursor_addr); 526 + trace("IN_SSCP: %d cursor_addr: %d",IN_SSCP,hSession->cursor_addr);
527 527
528 - if (IN_SSCP) {  
529 - if (h3270.kybdlock & KL_OIA_MINUS) 528 + if (IN_SSCP)
  529 + {
  530 + if (hSession->kybdlock & KL_OIA_MINUS)
530 return; 531 return;
531 - if (aid_code != AID_ENTER && aid_code != AID_CLEAR) {  
532 - status_changed(&h3270,LIB3270_STATUS_MINUS);  
533 - kybdlock_set(&h3270,KL_OIA_MINUS); 532 + if (aid_code != AID_ENTER && aid_code != AID_CLEAR)
  533 + {
  534 + status_changed(hSession,LIB3270_STATUS_MINUS);
  535 + kybdlock_set(hSession,KL_OIA_MINUS);
534 return; 536 return;
535 } 537 }
536 } 538 }
  539 +
537 if (IN_SSCP && aid_code == AID_ENTER) 540 if (IN_SSCP && aid_code == AID_ENTER)
538 { 541 {
539 /* Act as if the host had written our input. */ 542 /* Act as if the host had written our input. */
540 - h3270.buffer_addr = h3270.cursor_addr; 543 + hSession->buffer_addr = hSession->cursor_addr;
541 } 544 }
  545 +
542 if (!IN_SSCP || aid_code != AID_CLEAR) 546 if (!IN_SSCP || aid_code != AID_CLEAR)
543 { 547 {
544 - status_twait(&h3270);  
545 - mcursor_waiting(&h3270);  
546 - lib3270_set_toggle(&h3270,LIB3270_TOGGLE_INSERT,0);  
547 - kybdlock_set(&h3270,KL_OIA_TWAIT | KL_OIA_LOCKED);  
548 - }  
549 - h3270.aid = aid_code;  
550 - ctlr_read_modified(h3270.aid, False);  
551 - ticking_start(&h3270,False);  
552 - status_ctlr_done(&h3270); 548 + status_twait(hSession);
  549 + mcursor_waiting(hSession);
  550 + lib3270_set_toggle(hSession,LIB3270_TOGGLE_INSERT,0);
  551 + kybdlock_set(hSession,KL_OIA_TWAIT | KL_OIA_LOCKED);
  552 + }
  553 + hSession->aid = aid_code;
  554 + ctlr_read_modified(hSession->aid, False);
  555 + ticking_start(hSession,False);
  556 + status_ctlr_done(hSession);
553 } 557 }
554 558
555 LIB3270_FKEY_ACTION( pfkey ) 559 LIB3270_FKEY_ACTION( pfkey )
@@ -656,7 +660,7 @@ static Boolean ins_prep(int faddr, int baddr, int count) @@ -656,7 +660,7 @@ static Boolean ins_prep(int faddr, int baddr, int count)
656 printf("need %d at %d, tb_start at %d\n", count, baddr, tb_start); 660 printf("need %d at %d, tb_start at %d\n", count, baddr, tb_start);
657 #endif /*]*/ 661 #endif /*]*/
658 if (need - ntb > 0) { 662 if (need - ntb > 0) {
659 - operator_error(KL_OERR_OVERFLOW); 663 + operator_error(&h3270,KL_OERR_OVERFLOW);
660 return False; 664 return False;
661 } 665 }
662 666
@@ -761,19 +765,19 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -761,19 +765,19 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
761 faddr = find_field_attribute(&h3270,baddr); 765 faddr = find_field_attribute(&h3270,baddr);
762 fa = get_field_attribute(&h3270,baddr); 766 fa = get_field_attribute(&h3270,baddr);
763 if (h3270.ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) { 767 if (h3270.ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) {
764 - operator_error(KL_OERR_PROTECTED); 768 + operator_error(&h3270,KL_OERR_PROTECTED);
765 return False; 769 return False;
766 } 770 }
767 if (h3270.numeric_lock && FA_IS_NUMERIC(fa) && 771 if (h3270.numeric_lock && FA_IS_NUMERIC(fa) &&
768 !((code >= EBC_0 && code <= EBC_9) || 772 !((code >= EBC_0 && code <= EBC_9) ||
769 code == EBC_minus || code == EBC_period)) { 773 code == EBC_minus || code == EBC_period)) {
770 - operator_error(KL_OERR_NUMERIC); 774 + operator_error(&h3270,KL_OERR_NUMERIC);
771 return False; 775 return False;
772 } 776 }
773 777
774 /* Can't put an SBCS in a DBCS field. */ 778 /* Can't put an SBCS in a DBCS field. */
775 if (h3270.ea_buf[faddr].cs == CS_DBCS) { 779 if (h3270.ea_buf[faddr].cs == CS_DBCS) {
776 - operator_error(KL_OERR_DBCS); 780 + operator_error(&h3270,KL_OERR_DBCS);
777 return False; 781 return False;
778 } 782 }
779 783
@@ -781,7 +785,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -781,7 +785,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
781 if (h3270.ea_buf[baddr].cc == EBC_si) { 785 if (h3270.ea_buf[baddr].cc == EBC_si) {
782 INC_BA(baddr); 786 INC_BA(baddr);
783 if (baddr == faddr) { 787 if (baddr == faddr) {
784 - operator_error(KL_OERR_OVERFLOW); 788 + operator_error(&h3270,KL_OERR_OVERFLOW);
785 return False; 789 return False;
786 } 790 }
787 } 791 }
@@ -1199,18 +1203,17 @@ LIB3270_ACTION( firstfield ) @@ -1199,18 +1203,17 @@ LIB3270_ACTION( firstfield )
1199 /* 1203 /*
1200 * Cursor left 1 position. 1204 * Cursor left 1 position.
1201 */ 1205 */
1202 -static void  
1203 -do_left(void) 1206 +static void do_left(H3270 *hSession)
1204 { 1207 {
1205 register int baddr; 1208 register int baddr;
1206 enum dbcs_state d; 1209 enum dbcs_state d;
1207 1210
1208 - baddr = h3270.cursor_addr; 1211 + baddr = hSession->cursor_addr;
1209 DEC_BA(baddr); 1212 DEC_BA(baddr);
1210 d = ctlr_dbcs_state(baddr); 1213 d = ctlr_dbcs_state(baddr);
1211 if (IS_LEFT(d)) 1214 if (IS_LEFT(d))
1212 DEC_BA(baddr); 1215 DEC_BA(baddr);
1213 - cursor_move(&h3270,baddr); 1216 + cursor_move(hSession,baddr);
1214 } 1217 }
1215 1218
1216 LIB3270_CURSOR_ACTION( left ) 1219 LIB3270_CURSOR_ACTION( left )
@@ -1220,7 +1223,7 @@ LIB3270_CURSOR_ACTION( left ) @@ -1220,7 +1223,7 @@ LIB3270_CURSOR_ACTION( left )
1220 if(KYBDLOCK_IS_OERR(hSession)) 1223 if(KYBDLOCK_IS_OERR(hSession))
1221 { 1224 {
1222 lib3270_kybdlock_clear(hSession,KL_OERR_MASK); 1225 lib3270_kybdlock_clear(hSession,KL_OERR_MASK);
1223 - status_reset(&h3270); 1226 + status_reset(hSession);
1224 } 1227 }
1225 else 1228 else
1226 { 1229 {
@@ -1238,7 +1241,7 @@ LIB3270_CURSOR_ACTION( left ) @@ -1238,7 +1241,7 @@ LIB3270_CURSOR_ACTION( left )
1238 1241
1239 if (!hSession->flipped) 1242 if (!hSession->flipped)
1240 { 1243 {
1241 - do_left(); 1244 + do_left(hSession);
1242 } 1245 }
1243 else 1246 else
1244 { 1247 {
@@ -1271,7 +1274,7 @@ do_delete(void) @@ -1271,7 +1274,7 @@ do_delete(void)
1271 /* Can't delete a field attribute. */ 1274 /* Can't delete a field attribute. */
1272 fa = get_field_attribute(&h3270,baddr); 1275 fa = get_field_attribute(&h3270,baddr);
1273 if (FA_IS_PROTECTED(fa) || h3270.ea_buf[baddr].fa) { 1276 if (FA_IS_PROTECTED(fa) || h3270.ea_buf[baddr].fa) {
1274 - operator_error(KL_OERR_PROTECTED); 1277 + operator_error(&h3270,KL_OERR_PROTECTED);
1275 return False; 1278 return False;
1276 } 1279 }
1277 if (h3270.ea_buf[baddr].cc == EBC_so || h3270.ea_buf[baddr].cc == EBC_si) { 1280 if (h3270.ea_buf[baddr].cc == EBC_so || h3270.ea_buf[baddr].cc == EBC_si) {
@@ -1284,7 +1287,7 @@ do_delete(void) @@ -1284,7 +1287,7 @@ do_delete(void)
1284 if (h3270.ea_buf[xaddr].cc == SOSI(h3270.ea_buf[baddr].cc)) { 1287 if (h3270.ea_buf[xaddr].cc == SOSI(h3270.ea_buf[baddr].cc)) {
1285 ndel = 2; 1288 ndel = 2;
1286 } else { 1289 } else {
1287 - operator_error(KL_OERR_PROTECTED); 1290 + operator_error(&h3270,KL_OERR_PROTECTED);
1288 return False; 1291 return False;
1289 } 1292 }
1290 } else if (IS_DBCS(h3270.ea_buf[baddr].db)) { 1293 } else if (IS_DBCS(h3270.ea_buf[baddr].db)) {
@@ -1380,7 +1383,7 @@ LIB3270_ACTION( backspace ) @@ -1380,7 +1383,7 @@ LIB3270_ACTION( backspace )
1380 if (hSession->reverse) 1383 if (hSession->reverse)
1381 (void) do_delete(); 1384 (void) do_delete();
1382 else if (!hSession->flipped) 1385 else if (!hSession->flipped)
1383 - do_left(); 1386 + do_left(hSession);
1384 else { 1387 else {
1385 register int baddr; 1388 register int baddr;
1386 1389
@@ -1396,29 +1399,32 @@ LIB3270_ACTION( backspace ) @@ -1396,29 +1399,32 @@ LIB3270_ACTION( backspace )
1396 /* 1399 /*
1397 * Destructive backspace, like Unix "erase". 1400 * Destructive backspace, like Unix "erase".
1398 */ 1401 */
1399 -static void  
1400 -do_erase(void) 1402 +static void do_erase(H3270 *hSession)
1401 { 1403 {
1402 int baddr, faddr; 1404 int baddr, faddr;
1403 enum dbcs_state d; 1405 enum dbcs_state d;
1404 1406
1405 - baddr = h3270.cursor_addr;  
1406 - faddr = find_field_attribute(&h3270,baddr);  
1407 - if (faddr == baddr || FA_IS_PROTECTED(h3270.ea_buf[baddr].fa)) {  
1408 - operator_error(KL_OERR_PROTECTED); 1407 + baddr = hSession->cursor_addr;
  1408 + faddr = find_field_attribute(hSession,baddr);
  1409 + if (faddr == baddr || FA_IS_PROTECTED(hSession->ea_buf[baddr].fa))
  1410 + {
  1411 + operator_error(hSession,KL_OERR_PROTECTED);
1409 return; 1412 return;
1410 } 1413 }
  1414 +
1411 if (baddr && faddr == baddr - 1) 1415 if (baddr && faddr == baddr - 1)
1412 return; 1416 return;
1413 - do_left(); 1417 +
  1418 + do_left(hSession);
1414 1419
1415 /* 1420 /*
1416 * If we are now on an SI, move left again. 1421 * If we are now on an SI, move left again.
1417 */ 1422 */
1418 - if (h3270.ea_buf[h3270.cursor_addr].cc == EBC_si) {  
1419 - baddr = h3270.cursor_addr; 1423 + if (hSession->ea_buf[hSession->cursor_addr].cc == EBC_si)
  1424 + {
  1425 + baddr = hSession->cursor_addr;
1420 DEC_BA(baddr); 1426 DEC_BA(baddr);
1421 - cursor_move(&h3270,baddr); 1427 + cursor_move(hSession,baddr);
1422 } 1428 }
1423 1429
1424 /* 1430 /*
@@ -1427,11 +1433,12 @@ do_erase(void) @@ -1427,11 +1433,12 @@ do_erase(void)
1427 * This ensures that if this is the end of a DBCS subfield, we will 1433 * This ensures that if this is the end of a DBCS subfield, we will
1428 * land on the SI, instead of on the character following. 1434 * land on the SI, instead of on the character following.
1429 */ 1435 */
1430 - d = ctlr_dbcs_state(h3270.cursor_addr);  
1431 - if (IS_RIGHT(d)) {  
1432 - baddr = h3270.cursor_addr; 1436 + d = ctlr_dbcs_state(hSession->cursor_addr);
  1437 + if (IS_RIGHT(d))
  1438 + {
  1439 + baddr = hSession->cursor_addr;
1433 DEC_BA(baddr); 1440 DEC_BA(baddr);
1434 - cursor_move(&h3270,baddr); 1441 + cursor_move(hSession,baddr);
1435 } 1442 }
1436 1443
1437 /* 1444 /*
@@ -1444,29 +1451,32 @@ do_erase(void) @@ -1444,29 +1451,32 @@ do_erase(void)
1444 * If we've just erased the last character of a DBCS subfield, erase 1451 * If we've just erased the last character of a DBCS subfield, erase
1445 * the SO/SI pair as well. 1452 * the SO/SI pair as well.
1446 */ 1453 */
1447 - baddr = h3270.cursor_addr; 1454 + baddr = hSession->cursor_addr;
1448 DEC_BA(baddr); 1455 DEC_BA(baddr);
1449 - if (h3270.ea_buf[baddr].cc == EBC_so && h3270.ea_buf[h3270.cursor_addr].cc == EBC_si) {  
1450 - cursor_move(&h3270,baddr); 1456 + if (hSession->ea_buf[baddr].cc == EBC_so && hSession->ea_buf[hSession->cursor_addr].cc == EBC_si)
  1457 + {
  1458 + cursor_move(hSession,baddr);
1451 (void) do_delete(); 1459 (void) do_delete();
1452 } 1460 }
1453 - h3270.display(&h3270); 1461 + hSession->display(hSession);
1454 } 1462 }
1455 1463
1456 LIB3270_ACTION( erase ) 1464 LIB3270_ACTION( erase )
1457 { 1465 {
1458 // reset_idle_timer(); 1466 // reset_idle_timer();
1459 - if (hSession->kybdlock) { 1467 + if (hSession->kybdlock)
  1468 + {
1460 ENQUEUE_ACTION(lib3270_erase); 1469 ENQUEUE_ACTION(lib3270_erase);
1461 return 0; 1470 return 0;
1462 } 1471 }
1463 #if defined(X3270_ANSI) /*[*/ 1472 #if defined(X3270_ANSI) /*[*/
1464 - if (IN_ANSI) { 1473 + if (IN_ANSI)
  1474 + {
1465 net_send_erase(); 1475 net_send_erase();
1466 return 0; 1476 return 0;
1467 } 1477 }
1468 #endif /*]*/ 1478 #endif /*]*/
1469 - do_erase(); 1479 + do_erase(hSession);
1470 return 0; 1480 return 0;
1471 } 1481 }
1472 1482
@@ -1508,7 +1518,7 @@ LIB3270_CURSOR_ACTION( right ) @@ -1508,7 +1518,7 @@ LIB3270_CURSOR_ACTION( right )
1508 } 1518 }
1509 else 1519 else
1510 { 1520 {
1511 - do_left(); 1521 + do_left(hSession);
1512 } 1522 }
1513 return 0; 1523 return 0;
1514 } 1524 }
@@ -1943,7 +1953,7 @@ LIB3270_ACTION( eraseeol ) @@ -1943,7 +1953,7 @@ LIB3270_ACTION( eraseeol )
1943 fa = get_field_attribute(&h3270,baddr); 1953 fa = get_field_attribute(&h3270,baddr);
1944 if (FA_IS_PROTECTED(fa) || h3270.ea_buf[baddr].fa) 1954 if (FA_IS_PROTECTED(fa) || h3270.ea_buf[baddr].fa)
1945 { 1955 {
1946 - operator_error(KL_OERR_PROTECTED); 1956 + operator_error(&h3270,KL_OERR_PROTECTED);
1947 return -1; 1957 return -1;
1948 } 1958 }
1949 1959
@@ -2007,7 +2017,7 @@ LIB3270_ACTION( eraseeof ) @@ -2007,7 +2017,7 @@ LIB3270_ACTION( eraseeof )
2007 baddr = hSession->cursor_addr; 2017 baddr = hSession->cursor_addr;
2008 fa = get_field_attribute(hSession,baddr); 2018 fa = get_field_attribute(hSession,baddr);
2009 if (FA_IS_PROTECTED(fa) || h3270.ea_buf[baddr].fa) { 2019 if (FA_IS_PROTECTED(fa) || h3270.ea_buf[baddr].fa) {
2010 - operator_error(KL_OERR_PROTECTED); 2020 + operator_error(&h3270,KL_OERR_PROTECTED);
2011 return -1; 2021 return -1;
2012 } 2022 }
2013 if (hSession->formatted) { /* erase to next field attribute */ 2023 if (hSession->formatted) { /* erase to next field attribute */
@@ -2127,7 +2137,7 @@ LIB3270_ACTION( deleteword ) @@ -2127,7 +2137,7 @@ LIB3270_ACTION( deleteword )
2127 2137
2128 /* Make sure we're on a modifiable field. */ 2138 /* Make sure we're on a modifiable field. */
2129 if (FA_IS_PROTECTED(fa) || hSession->ea_buf[baddr].fa) { 2139 if (FA_IS_PROTECTED(fa) || hSession->ea_buf[baddr].fa) {
2130 - operator_error(KL_OERR_PROTECTED); 2140 + operator_error(&h3270,KL_OERR_PROTECTED);
2131 return -1; 2141 return -1;
2132 } 2142 }
2133 2143
@@ -2139,13 +2149,14 @@ LIB3270_ACTION( deleteword ) @@ -2139,13 +2149,14 @@ LIB3270_ACTION( deleteword )
2139 return 0; 2149 return 0;
2140 if (hSession->ea_buf[baddr].cc == EBC_null || 2150 if (hSession->ea_buf[baddr].cc == EBC_null ||
2141 hSession->ea_buf[baddr].cc == EBC_space) 2151 hSession->ea_buf[baddr].cc == EBC_space)
2142 - do_erase(); 2152 + do_erase(hSession);
2143 else 2153 else
2144 break; 2154 break;
2145 } 2155 }
2146 2156
2147 /* Backspace until the character to the left of the cursor is blank. */ 2157 /* Backspace until the character to the left of the cursor is blank. */
2148 - for (;;) { 2158 + for (;;)
  2159 + {
2149 baddr = hSession->cursor_addr; 2160 baddr = hSession->cursor_addr;
2150 DEC_BA(baddr); 2161 DEC_BA(baddr);
2151 if (hSession->ea_buf[baddr].fa) 2162 if (hSession->ea_buf[baddr].fa)
@@ -2154,7 +2165,7 @@ LIB3270_ACTION( deleteword ) @@ -2154,7 +2165,7 @@ LIB3270_ACTION( deleteword )
2154 hSession->ea_buf[baddr].cc == EBC_space) 2165 hSession->ea_buf[baddr].cc == EBC_space)
2155 break; 2166 break;
2156 else 2167 else
2157 - do_erase(); 2168 + do_erase(hSession);
2158 } 2169 }
2159 hSession->display(hSession); 2170 hSession->display(hSession);
2160 return 0; 2171 return 0;
@@ -2192,7 +2203,7 @@ LIB3270_ACTION( deletefield ) @@ -2192,7 +2203,7 @@ LIB3270_ACTION( deletefield )
2192 baddr = hSession->cursor_addr; 2203 baddr = hSession->cursor_addr;
2193 fa = get_field_attribute(hSession,baddr); 2204 fa = get_field_attribute(hSession,baddr);
2194 if (FA_IS_PROTECTED(fa) || hSession->ea_buf[baddr].fa) { 2205 if (FA_IS_PROTECTED(fa) || hSession->ea_buf[baddr].fa) {
2195 - operator_error(KL_OERR_PROTECTED); 2206 + operator_error(hSession,KL_OERR_PROTECTED);
2196 return -1; 2207 return -1;
2197 } 2208 }
2198 while (!hSession->ea_buf[baddr].fa) 2209 while (!hSession->ea_buf[baddr].fa)
@@ -2362,31 +2373,34 @@ kybd_scroll_lock(Boolean lock) @@ -2362,31 +2373,34 @@ kybd_scroll_lock(Boolean lock)
2362 * Move the cursor back within the legal paste area. 2373 * Move the cursor back within the legal paste area.
2363 * Returns a Boolean indicating success. 2374 * Returns a Boolean indicating success.
2364 */ 2375 */
2365 -static Boolean  
2366 -remargin(int lmargin) 2376 +static Boolean remargin(H3270 *hSession, int lmargin)
2367 { 2377 {
2368 Boolean ever = False; 2378 Boolean ever = False;
2369 int baddr, b0 = 0; 2379 int baddr, b0 = 0;
2370 int faddr; 2380 int faddr;
2371 unsigned char fa; 2381 unsigned char fa;
2372 2382
2373 - baddr = h3270.cursor_addr;  
2374 - while (BA_TO_COL(baddr) < lmargin) { 2383 + baddr = hSession->cursor_addr;
  2384 + while (BA_TO_COL(baddr) < lmargin)
  2385 + {
2375 baddr = ROWCOL_TO_BA(BA_TO_ROW(baddr), lmargin); 2386 baddr = ROWCOL_TO_BA(BA_TO_ROW(baddr), lmargin);
2376 - if (!ever) { 2387 + if (!ever)
  2388 + {
2377 b0 = baddr; 2389 b0 = baddr;
2378 ever = True; 2390 ever = True;
2379 } 2391 }
2380 - faddr = find_field_attribute(&h3270,baddr);  
2381 - fa = h3270.ea_buf[faddr].fa;  
2382 - if (faddr == baddr || FA_IS_PROTECTED(fa)) {  
2383 - baddr = next_unprotected(&h3270,baddr); 2392 + faddr = find_field_attribute(hSession,baddr);
  2393 + fa = hSession->ea_buf[faddr].fa;
  2394 +
  2395 + if (faddr == baddr || FA_IS_PROTECTED(fa))
  2396 + {
  2397 + baddr = next_unprotected(hSession,baddr);
2384 if (baddr <= b0) 2398 if (baddr <= b0)
2385 return False; 2399 return False;
2386 } 2400 }
2387 } 2401 }
2388 2402
2389 - cursor_move(&h3270,baddr); 2403 + cursor_move(hSession,baddr);
2390 return True; 2404 return True;
2391 } 2405 }
2392 2406
@@ -2462,7 +2476,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -2462,7 +2476,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2462 /* Jump cursor over left margin. */ 2476 /* Jump cursor over left margin. */
2463 if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) && 2477 if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) &&
2464 BA_TO_COL(session->cursor_addr) < orig_col) { 2478 BA_TO_COL(session->cursor_addr) < orig_col) {
2465 - if (!remargin(orig_col)) 2479 + if (!remargin(&h3270,orig_col))
2466 return len-1; 2480 return len-1;
2467 skipped = True; 2481 skipped = True;
2468 } 2482 }
@@ -2743,7 +2757,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -2743,7 +2757,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2743 case BASE: 2757 case BASE:
2744 if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) && 2758 if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) &&
2745 BA_TO_COL(session->cursor_addr) < orig_col) { 2759 BA_TO_COL(session->cursor_addr) < orig_col) {
2746 - (void) remargin(orig_col); 2760 + (void) remargin(&h3270,orig_col);
2747 } 2761 }
2748 break; 2762 break;
2749 case OCTAL: 2763 case OCTAL:
@@ -2752,7 +2766,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -2752,7 +2766,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
2752 state = BASE; 2766 state = BASE;
2753 if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) && 2767 if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) &&
2754 BA_TO_COL(session->cursor_addr) < orig_col) { 2768 BA_TO_COL(session->cursor_addr) < orig_col) {
2755 - (void) remargin(orig_col); 2769 + (void) remargin(&h3270,orig_col);
2756 } 2770 }
2757 break; 2771 break;
2758 case BACKPF: 2772 case BACKPF: