Commit 276af5ac2135e531b11af2f7271331605b9b7626
1 parent
ffeef60c
Exists in
master
and in
3 other branches
Movendo mais campos de teclado para a estrutura de controle de sessao
Showing
5 changed files
with
95 additions
and
132 deletions
Show diff stats
ctlr.c
@@ -279,7 +279,7 @@ static void ctlr_connect(H3270 *session, int ignored unused, void *dunno) | @@ -279,7 +279,7 @@ static void ctlr_connect(H3270 *session, int ignored unused, void *dunno) | ||
279 | session->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; | 279 | session->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; |
280 | if (!IN_3270 || (IN_SSCP && (session->kybdlock & KL_OIA_TWAIT))) | 280 | if (!IN_3270 || (IN_SSCP && (session->kybdlock & KL_OIA_TWAIT))) |
281 | { | 281 | { |
282 | - kybdlock_clr(session,KL_OIA_TWAIT, "ctlr_connect"); | 282 | + lib3270_kybdlock_clear(session,KL_OIA_TWAIT); |
283 | status_reset(session); | 283 | status_reset(session); |
284 | } | 284 | } |
285 | 285 | ||
@@ -1830,7 +1830,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1830,7 +1830,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1830 | h3270.aid = AID_NO; | 1830 | h3270.aid = AID_NO; |
1831 | do_reset(&h3270,False); | 1831 | do_reset(&h3270,False); |
1832 | } else if (h3270.kybdlock & KL_OIA_TWAIT) { | 1832 | } else if (h3270.kybdlock & KL_OIA_TWAIT) { |
1833 | - kybdlock_clr(&h3270,KL_OIA_TWAIT, "ctlr_write"); | 1833 | + lib3270_kybdlock_clear(&h3270,KL_OIA_TWAIT); |
1834 | status_changed(&h3270,LIB3270_STATUS_SYSWAIT); | 1834 | status_changed(&h3270,LIB3270_STATUS_SYSWAIT); |
1835 | } | 1835 | } |
1836 | if (wcc_sound_alarm) | 1836 | if (wcc_sound_alarm) |
@@ -2245,7 +2245,7 @@ ctlr_dbcs_postprocess(void) | @@ -2245,7 +2245,7 @@ ctlr_dbcs_postprocess(void) | ||
2245 | void | 2245 | void |
2246 | ps_process(void) | 2246 | ps_process(void) |
2247 | { | 2247 | { |
2248 | - while (run_ta()) | 2248 | + while (run_ta(&h3270)) |
2249 | ; | 2249 | ; |
2250 | // sms_continue(); | 2250 | // sms_continue(); |
2251 | 2251 |
@@ -381,7 +381,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | @@ -381,7 +381,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | ||
381 | snconcat(buffer,4095,"%s","\n"); | 381 | snconcat(buffer,4095,"%s","\n"); |
382 | 382 | ||
383 | // Erase the line and enter the command. | 383 | // Erase the line and enter the command. |
384 | - flen = kybd_prime(); | 384 | + flen = kybd_prime(ft->host); |
385 | if (!flen || flen < strlen(buffer) - 1) | 385 | if (!flen || flen < strlen(buffer) - 1) |
386 | { | 386 | { |
387 | lib3270_write_log(ft->host, "Unable to send command \"%s\" (flen=%d szBuffer=%d)",buffer,flen,strlen(buffer)); | 387 | lib3270_write_log(ft->host, "Unable to send command \"%s\" (flen=%d szBuffer=%d)",buffer,flen,strlen(buffer)); |
kybd.c
@@ -101,13 +101,15 @@ static const char *ia_name[] = | @@ -101,13 +101,15 @@ static const char *ia_name[] = | ||
101 | }; | 101 | }; |
102 | #endif // X3270_TRACE | 102 | #endif // X3270_TRACE |
103 | 103 | ||
104 | -static unsigned char pf_xlate[] = { | 104 | +static unsigned char pf_xlate[] = |
105 | +{ | ||
105 | AID_PF1, AID_PF2, AID_PF3, AID_PF4, AID_PF5, AID_PF6, | 106 | AID_PF1, AID_PF2, AID_PF3, AID_PF4, AID_PF5, AID_PF6, |
106 | AID_PF7, AID_PF8, AID_PF9, AID_PF10, AID_PF11, AID_PF12, | 107 | AID_PF7, AID_PF8, AID_PF9, AID_PF10, AID_PF11, AID_PF12, |
107 | AID_PF13, AID_PF14, AID_PF15, AID_PF16, AID_PF17, AID_PF18, | 108 | AID_PF13, AID_PF14, AID_PF15, AID_PF16, AID_PF17, AID_PF18, |
108 | AID_PF19, AID_PF20, AID_PF21, AID_PF22, AID_PF23, AID_PF24 | 109 | AID_PF19, AID_PF20, AID_PF21, AID_PF22, AID_PF23, AID_PF24 |
109 | }; | 110 | }; |
110 | -static unsigned char pa_xlate[] = { | 111 | +static unsigned char pa_xlate[] = |
112 | +{ | ||
111 | AID_PA1, AID_PA2, AID_PA3 | 113 | AID_PA1, AID_PA2, AID_PA3 |
112 | }; | 114 | }; |
113 | #define PF_SZ (sizeof(pf_xlate)/sizeof(pf_xlate[0])) | 115 | #define PF_SZ (sizeof(pf_xlate)/sizeof(pf_xlate[0])) |
@@ -116,9 +118,9 @@ static unsigned char pa_xlate[] = { | @@ -116,9 +118,9 @@ static unsigned char pa_xlate[] = { | ||
116 | // static time_t unlock_delay_time; | 118 | // static time_t unlock_delay_time; |
117 | #define UNLOCK_MS 350 /* 0.35s after last unlock */ | 119 | #define UNLOCK_MS 350 /* 0.35s after last unlock */ |
118 | static Boolean key_Character(int code, Boolean with_ge, Boolean pasting,Boolean *skipped); | 120 | static Boolean key_Character(int code, Boolean with_ge, Boolean pasting,Boolean *skipped); |
119 | -static Boolean flush_ta(void); | 121 | +static int flush_ta(H3270 *hSession); |
120 | static void key_AID(H3270 *session, unsigned char aid_code); | 122 | static void key_AID(H3270 *session, unsigned char aid_code); |
121 | -static void kybdlock_set(unsigned int bits, const char *cause); | 123 | +static void kybdlock_set(H3270 *session, unsigned int bits); |
122 | // static KeySym MyStringToKeysym(char *s, enum keytype *keytypep); | 124 | // static KeySym MyStringToKeysym(char *s, enum keytype *keytypep); |
123 | 125 | ||
124 | /* | 126 | /* |
@@ -128,7 +130,8 @@ Boolean key_WCharacter(unsigned char code[], Boolean *skipped); | @@ -128,7 +130,8 @@ Boolean key_WCharacter(unsigned char code[], Boolean *skipped); | ||
128 | */ | 130 | */ |
129 | 131 | ||
130 | static int nxk = 0; | 132 | static int nxk = 0; |
131 | -static struct xks { | 133 | +static struct xks |
134 | +{ | ||
132 | KeySym key; | 135 | KeySym key; |
133 | KeySym assoc; | 136 | KeySym assoc; |
134 | } *xk; | 137 | } *xk; |
@@ -141,7 +144,8 @@ static struct xks { | @@ -141,7 +144,8 @@ static struct xks { | ||
141 | 144 | ||
142 | /* Composite key mappings. */ | 145 | /* Composite key mappings. */ |
143 | 146 | ||
144 | -struct akeysym { | 147 | +struct akeysym |
148 | +{ | ||
145 | KeySym keysym; | 149 | KeySym keysym; |
146 | enum keytype keytype; | 150 | enum keytype keytype; |
147 | }; | 151 | }; |
@@ -196,7 +200,7 @@ static const char dxl[] = "0123456789abcdef"; | @@ -196,7 +200,7 @@ static const char dxl[] = "0123456789abcdef"; | ||
196 | static int enq_chk(H3270 *session) | 200 | static int enq_chk(H3270 *session) |
197 | { | 201 | { |
198 | /* If no connection, forget it. */ | 202 | /* If no connection, forget it. */ |
199 | - if (!CONNECTED) | 203 | + if (!lib3270_connected(session)) |
200 | { | 204 | { |
201 | trace_event(" dropped (not connected)\n"); | 205 | trace_event(" dropped (not connected)\n"); |
202 | return -1; | 206 | return -1; |
@@ -305,82 +309,85 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | @@ -305,82 +309,85 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | ||
305 | /* | 309 | /* |
306 | * Execute an action from the typeahead queue. | 310 | * Execute an action from the typeahead queue. |
307 | */ | 311 | */ |
308 | -Boolean run_ta(void) | 312 | +int run_ta(H3270 *hSession) |
309 | { | 313 | { |
310 | struct ta *ta; | 314 | struct ta *ta; |
311 | 315 | ||
312 | - if (h3270.kybdlock || (ta = h3270.ta_head) == (struct ta *)NULL) | ||
313 | - return False; | 316 | + if (hSession->kybdlock || (ta = hSession->ta_head) == (struct ta *)NULL) |
317 | + return 0; | ||
314 | 318 | ||
315 | - if ((h3270.ta_head = ta->next) == (struct ta *)NULL) | 319 | + if ((hSession->ta_head = ta->next) == (struct ta *)NULL) |
316 | { | 320 | { |
317 | - h3270.ta_tail = (struct ta *)NULL; | ||
318 | - status_typeahead(&h3270,False); | 321 | + hSession->ta_tail = (struct ta *)NULL; |
322 | + status_typeahead(hSession,False); | ||
319 | } | 323 | } |
320 | 324 | ||
321 | switch(ta->type) | 325 | switch(ta->type) |
322 | { | 326 | { |
323 | case TA_TYPE_DEFAULT: | 327 | case TA_TYPE_DEFAULT: |
324 | - ta->fn(&h3270,ta->parm[0],ta->parm[1]); | 328 | + ta->fn(hSession,ta->parm[0],ta->parm[1]); |
325 | lib3270_free(ta->parm[0]); | 329 | lib3270_free(ta->parm[0]); |
326 | lib3270_free(ta->parm[1]); | 330 | lib3270_free(ta->parm[1]); |
327 | break; | 331 | break; |
328 | 332 | ||
329 | case TA_TYPE_KEY_AID: | 333 | case TA_TYPE_KEY_AID: |
330 | - trace("Sending enqueued key %02x",ta->aid_code); | ||
331 | - key_AID(&h3270,ta->aid_code); | 334 | +// trace("Sending enqueued key %02x",ta->aid_code); |
335 | + key_AID(hSession,ta->aid_code); | ||
332 | break; | 336 | break; |
333 | 337 | ||
334 | default: | 338 | default: |
335 | - popup_an_error(&h3270, _( "Unexpected type %d in typeahead queue" ), ta->type); | 339 | + popup_an_error(hSession, _( "Unexpected type %d in typeahead queue" ), ta->type); |
336 | 340 | ||
337 | } | 341 | } |
338 | 342 | ||
339 | lib3270_free(ta); | 343 | lib3270_free(ta); |
340 | 344 | ||
341 | - return True; | 345 | + return 1; |
342 | } | 346 | } |
343 | 347 | ||
344 | /* | 348 | /* |
345 | * Flush the typeahead queue. | 349 | * Flush the typeahead queue. |
346 | * Returns whether or not anything was flushed. | 350 | * Returns whether or not anything was flushed. |
347 | */ | 351 | */ |
348 | -static Boolean flush_ta(void) | 352 | +static int flush_ta(H3270 *hSession) |
349 | { | 353 | { |
350 | struct ta *ta, *next; | 354 | struct ta *ta, *next; |
351 | - Boolean any = False; | 355 | + int any = 0; |
352 | 356 | ||
353 | - for (ta = h3270.ta_head; ta != (struct ta *) NULL; ta = next) | 357 | + for (ta = hSession->ta_head; ta != (struct ta *) NULL; ta = next) |
354 | { | 358 | { |
355 | lib3270_free(ta->parm[0]); | 359 | lib3270_free(ta->parm[0]); |
356 | lib3270_free(ta->parm[1]); | 360 | lib3270_free(ta->parm[1]); |
357 | next = ta->next; | 361 | next = ta->next; |
358 | lib3270_free(ta); | 362 | lib3270_free(ta); |
359 | - any = True; | 363 | + any++; |
360 | } | 364 | } |
361 | - h3270.ta_head = h3270.ta_tail = (struct ta *) NULL; | ||
362 | - status_typeahead(&h3270,False); | 365 | + hSession->ta_head = hSession->ta_tail = (struct ta *) NULL; |
366 | + status_typeahead(hSession,False); | ||
363 | return any; | 367 | return any; |
364 | } | 368 | } |
365 | 369 | ||
366 | /* Set bits in the keyboard lock. */ | 370 | /* Set bits in the keyboard lock. */ |
367 | -static void | ||
368 | -kybdlock_set(unsigned int bits, const char *cause unused) | 371 | +static void kybdlock_set(H3270 *hSession, unsigned int bits) |
369 | { | 372 | { |
370 | unsigned int n; | 373 | unsigned int n; |
371 | 374 | ||
372 | - n = h3270.kybdlock | bits; | ||
373 | - if (n != h3270.kybdlock) { | ||
374 | -#if defined(KYBDLOCK_TRACE) /*[*/ | 375 | + n = hSession->kybdlock | bits; |
376 | + if (n != hSession->kybdlock) | ||
377 | + { | ||
378 | +/* | ||
379 | +#if defined(KYBDLOCK_TRACE) | ||
375 | trace_event(" %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n", | 380 | trace_event(" %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n", |
376 | cause, bits, kybdlock, n); | 381 | cause, bits, kybdlock, n); |
377 | -#endif /*]*/ | ||
378 | - if ((h3270.kybdlock ^ bits) & KL_DEFERRED_UNLOCK) { | 382 | +#endif |
383 | +*/ | ||
384 | + if ((hSession->kybdlock ^ bits) & KL_DEFERRED_UNLOCK) | ||
385 | + { | ||
379 | /* Turned on deferred unlock. */ | 386 | /* Turned on deferred unlock. */ |
380 | - h3270.unlock_delay_time = time(NULL); | 387 | + hSession->unlock_delay_time = time(NULL); |
381 | } | 388 | } |
382 | - h3270.kybdlock = n; | ||
383 | - status_changed(&h3270,LIB3270_STATUS_KYBDLOCK); | 389 | + hSession->kybdlock = n; |
390 | + status_changed(hSession,LIB3270_STATUS_KYBDLOCK); | ||
384 | } | 391 | } |
385 | } | 392 | } |
386 | 393 | ||
@@ -418,13 +425,13 @@ void kybd_inhibit(H3270 *session, Boolean inhibit) | @@ -418,13 +425,13 @@ void kybd_inhibit(H3270 *session, Boolean inhibit) | ||
418 | { | 425 | { |
419 | if (inhibit) | 426 | if (inhibit) |
420 | { | 427 | { |
421 | - kybdlock_set(KL_ENTER_INHIBIT, "kybd_inhibit"); | 428 | + kybdlock_set(session,KL_ENTER_INHIBIT); |
422 | if (session->kybdlock == KL_ENTER_INHIBIT) | 429 | if (session->kybdlock == KL_ENTER_INHIBIT) |
423 | status_reset(session); | 430 | status_reset(session); |
424 | } | 431 | } |
425 | else | 432 | else |
426 | { | 433 | { |
427 | - kybdlock_clr(session,KL_ENTER_INHIBIT, "kybd_inhibit"); | 434 | + lib3270_kybdlock_clear(session,KL_ENTER_INHIBIT); |
428 | if (!session->kybdlock) | 435 | if (!session->kybdlock) |
429 | status_reset(session); | 436 | status_reset(session); |
430 | } | 437 | } |
@@ -438,14 +445,14 @@ void kybd_connect(H3270 *session, int connected, void *dunno) | @@ -438,14 +445,14 @@ void kybd_connect(H3270 *session, int connected, void *dunno) | ||
438 | if (session->kybdlock & KL_DEFERRED_UNLOCK) | 445 | if (session->kybdlock & KL_DEFERRED_UNLOCK) |
439 | RemoveTimeOut(session->unlock_id); | 446 | RemoveTimeOut(session->unlock_id); |
440 | 447 | ||
441 | - kybdlock_clr(session, -1, "kybd_connect"); | 448 | + lib3270_kybdlock_clear(session, -1); |
442 | 449 | ||
443 | if (connected) { | 450 | if (connected) { |
444 | /* Wait for any output or a WCC(restore) from the host */ | 451 | /* Wait for any output or a WCC(restore) from the host */ |
445 | - kybdlock_set(KL_AWAITING_FIRST, "kybd_connect"); | 452 | + kybdlock_set(session,KL_AWAITING_FIRST); |
446 | } else { | 453 | } else { |
447 | - kybdlock_set(KL_NOT_CONNECTED, "kybd_connect"); | ||
448 | - (void) flush_ta(); | 454 | + kybdlock_set(session,KL_NOT_CONNECTED); |
455 | + (void) flush_ta(session); | ||
449 | } | 456 | } |
450 | } | 457 | } |
451 | 458 | ||
@@ -456,7 +463,7 @@ void kybd_in3270(H3270 *session, int in3270 unused, void *dunno) | @@ -456,7 +463,7 @@ void kybd_in3270(H3270 *session, int in3270 unused, void *dunno) | ||
456 | { | 463 | { |
457 | if (session->kybdlock & KL_DEFERRED_UNLOCK) | 464 | if (session->kybdlock & KL_DEFERRED_UNLOCK) |
458 | RemoveTimeOut(session->unlock_id); | 465 | RemoveTimeOut(session->unlock_id); |
459 | - kybdlock_clr(session,~KL_AWAITING_FIRST, "kybd_in3270"); | 466 | + lib3270_kybdlock_clear(session,~KL_AWAITING_FIRST); |
460 | 467 | ||
461 | /* There might be a macro pending. */ | 468 | /* There might be a macro pending. */ |
462 | if (CONNECTED) | 469 | if (CONNECTED) |
@@ -464,44 +471,16 @@ void kybd_in3270(H3270 *session, int in3270 unused, void *dunno) | @@ -464,44 +471,16 @@ void kybd_in3270(H3270 *session, int in3270 unused, void *dunno) | ||
464 | } | 471 | } |
465 | 472 | ||
466 | /* | 473 | /* |
467 | - * Called to initialize the keyboard logic. | ||
468 | - */ /* | ||
469 | -void kybd_init(void) | ||
470 | -{ | ||
471 | - // Register kybd interest in connect and disconnect events. | ||
472 | - trace("%s",__FUNCTION__); | ||
473 | - lib3270_register_schange(NULL,LIB3270_STATE_CONNECT,kybd_connect,NULL); | ||
474 | - lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,kybd_in3270,NULL); | ||
475 | -} | ||
476 | -*/ | ||
477 | - | ||
478 | -/* | ||
479 | - * Toggle reverse mode. | ||
480 | - */ | ||
481 | - /* | ||
482 | -static void | ||
483 | -reverse_mode(Boolean on) | ||
484 | -{ | ||
485 | - reverse = on; | ||
486 | - status_reverse_mode(on); | ||
487 | -} | ||
488 | -*/ | ||
489 | - | ||
490 | -/* | ||
491 | * Lock the keyboard because of an operator error. | 474 | * Lock the keyboard because of an operator error. |
492 | */ | 475 | */ |
493 | -static void | ||
494 | -operator_error(int error_type) | 476 | +static void operator_error(int error_type) |
495 | { | 477 | { |
496 | -// if (sms_redirect()) | ||
497 | -// popup_an_error("Keyboard locked"); | ||
498 | - | ||
499 | if(h3270.oerr_lock) | 478 | if(h3270.oerr_lock) |
500 | { | 479 | { |
501 | status_oerr(NULL,error_type); | 480 | status_oerr(NULL,error_type); |
502 | mcursor_locked(&h3270); | 481 | mcursor_locked(&h3270); |
503 | - kybdlock_set((unsigned int)error_type, "operator_error"); | ||
504 | - flush_ta(); | 482 | + kybdlock_set(&h3270,(unsigned int)error_type); |
483 | + flush_ta(&h3270); | ||
505 | } | 484 | } |
506 | else | 485 | else |
507 | { | 486 | { |
@@ -551,7 +530,7 @@ static void key_AID(H3270 *session, unsigned char aid_code) | @@ -551,7 +530,7 @@ static void key_AID(H3270 *session, unsigned char aid_code) | ||
551 | return; | 530 | return; |
552 | if (aid_code != AID_ENTER && aid_code != AID_CLEAR) { | 531 | if (aid_code != AID_ENTER && aid_code != AID_CLEAR) { |
553 | status_changed(&h3270,LIB3270_STATUS_MINUS); | 532 | status_changed(&h3270,LIB3270_STATUS_MINUS); |
554 | - kybdlock_set(KL_OIA_MINUS, "key_AID"); | 533 | + kybdlock_set(&h3270,KL_OIA_MINUS); |
555 | return; | 534 | return; |
556 | } | 535 | } |
557 | } | 536 | } |
@@ -565,7 +544,7 @@ static void key_AID(H3270 *session, unsigned char aid_code) | @@ -565,7 +544,7 @@ static void key_AID(H3270 *session, unsigned char aid_code) | ||
565 | status_twait(&h3270); | 544 | status_twait(&h3270); |
566 | mcursor_waiting(&h3270); | 545 | mcursor_waiting(&h3270); |
567 | lib3270_set_toggle(&h3270,LIB3270_TOGGLE_INSERT,0); | 546 | lib3270_set_toggle(&h3270,LIB3270_TOGGLE_INSERT,0); |
568 | - kybdlock_set(KL_OIA_TWAIT | KL_OIA_LOCKED, "key_AID"); | 547 | + kybdlock_set(&h3270,KL_OIA_TWAIT | KL_OIA_LOCKED); |
569 | } | 548 | } |
570 | h3270.aid = aid_code; | 549 | h3270.aid = aid_code; |
571 | ctlr_read_modified(h3270.aid, False); | 550 | ctlr_read_modified(h3270.aid, False); |
@@ -615,7 +594,7 @@ LIB3270_ACTION(break) | @@ -615,7 +594,7 @@ LIB3270_ACTION(break) | ||
615 | 594 | ||
616 | return 0; | 595 | return 0; |
617 | } | 596 | } |
618 | - | 597 | + |
619 | /* | 598 | /* |
620 | * ATTN key, per RFC 2355. Sends IP, regardless. | 599 | * ATTN key, per RFC 2355. Sends IP, regardless. |
621 | */ | 600 | */ |
@@ -630,26 +609,6 @@ LIB3270_ACTION(attn) | @@ -630,26 +609,6 @@ LIB3270_ACTION(attn) | ||
630 | } | 609 | } |
631 | 610 | ||
632 | /* | 611 | /* |
633 | - * IAC IP, which works for 5250 System Request and interrupts the program | ||
634 | - * on an AS/400, even when the keyboard is locked. | ||
635 | - * | ||
636 | - * This is now the same as the Attn action. | ||
637 | - */ /* | ||
638 | -void | ||
639 | -Interrupt_action(Widget w unused, XEvent *event, String *params, | ||
640 | - Cardinal *num_params) | ||
641 | -{ | ||
642 | - if (!IN_3270) | ||
643 | - return; | ||
644 | - | ||
645 | -// reset_idle_timer(); | ||
646 | - | ||
647 | - net_interrupt(); | ||
648 | -} | ||
649 | - | ||
650 | -*/ | ||
651 | - | ||
652 | -/* | ||
653 | * Prepare for an insert of 'count' bytes. | 612 | * Prepare for an insert of 'count' bytes. |
654 | * Returns True if the insert is legal, False otherwise. | 613 | * Returns True if the insert is legal, False otherwise. |
655 | */ | 614 | */ |
@@ -1045,7 +1004,7 @@ LIB3270_ACTION( nextfield ) | @@ -1045,7 +1004,7 @@ LIB3270_ACTION( nextfield ) | ||
1045 | { | 1004 | { |
1046 | if(KYBDLOCK_IS_OERR(hSession)) | 1005 | if(KYBDLOCK_IS_OERR(hSession)) |
1047 | { | 1006 | { |
1048 | - kybdlock_clr(hSession,KL_OERR_MASK, "Tab"); | 1007 | + lib3270_kybdlock_clear(hSession,KL_OERR_MASK); |
1049 | status_reset(hSession); | 1008 | status_reset(hSession); |
1050 | } else | 1009 | } else |
1051 | { | 1010 | { |
@@ -1092,7 +1051,7 @@ LIB3270_ACTION( previousfield ) | @@ -1092,7 +1051,7 @@ LIB3270_ACTION( previousfield ) | ||
1092 | { | 1051 | { |
1093 | if (KYBDLOCK_IS_OERR(hSession)) | 1052 | if (KYBDLOCK_IS_OERR(hSession)) |
1094 | { | 1053 | { |
1095 | - kybdlock_clr(hSession,KL_OERR_MASK, "BackTab"); | 1054 | + lib3270_kybdlock_clear(hSession,KL_OERR_MASK); |
1096 | status_reset(hSession); | 1055 | status_reset(hSession); |
1097 | } | 1056 | } |
1098 | else | 1057 | else |
@@ -1133,8 +1092,8 @@ LIB3270_ACTION( previousfield ) | @@ -1133,8 +1092,8 @@ LIB3270_ACTION( previousfield ) | ||
1133 | 1092 | ||
1134 | static void defer_unlock(H3270 *session) | 1093 | static void defer_unlock(H3270 *session) |
1135 | { | 1094 | { |
1136 | - trace("%s",__FUNCTION__); | ||
1137 | - kybdlock_clr(session,KL_DEFERRED_UNLOCK, "defer_unlock"); | 1095 | +// trace("%s",__FUNCTION__); |
1096 | + lib3270_kybdlock_clear(session,KL_DEFERRED_UNLOCK); | ||
1138 | status_reset(session); | 1097 | status_reset(session); |
1139 | if(CONNECTED) | 1098 | if(CONNECTED) |
1140 | ps_process(); | 1099 | ps_process(); |
@@ -1157,7 +1116,7 @@ void do_reset(H3270 *session, Boolean explicit) | @@ -1157,7 +1116,7 @@ void do_reset(H3270 *session, Boolean explicit) | ||
1157 | ) { | 1116 | ) { |
1158 | Boolean half_reset = False; | 1117 | Boolean half_reset = False; |
1159 | 1118 | ||
1160 | - if (flush_ta()) | 1119 | + if (flush_ta(session)) |
1161 | half_reset = True; | 1120 | half_reset = True; |
1162 | 1121 | ||
1163 | if (half_reset) | 1122 | if (half_reset) |
@@ -1188,11 +1147,11 @@ void do_reset(H3270 *session, Boolean explicit) | @@ -1188,11 +1147,11 @@ void do_reset(H3270 *session, Boolean explicit) | ||
1188 | #endif /*]*/ | 1147 | #endif /*]*/ |
1189 | || (!session->unlock_delay) // && !sms_in_macro()) | 1148 | || (!session->unlock_delay) // && !sms_in_macro()) |
1190 | || (session->unlock_delay_time != 0 && (time(NULL) - session->unlock_delay_time) > 1)) { | 1149 | || (session->unlock_delay_time != 0 && (time(NULL) - session->unlock_delay_time) > 1)) { |
1191 | - kybdlock_clr(session,-1, "do_reset"); | 1150 | + lib3270_kybdlock_clear(session,-1); |
1192 | } else if (session->kybdlock & | 1151 | } else if (session->kybdlock & |
1193 | (KL_DEFERRED_UNLOCK | KL_OIA_TWAIT | KL_OIA_LOCKED | KL_AWAITING_FIRST)) { | 1152 | (KL_DEFERRED_UNLOCK | KL_OIA_TWAIT | KL_OIA_LOCKED | KL_AWAITING_FIRST)) { |
1194 | - kybdlock_clr(session,~KL_DEFERRED_UNLOCK, "do_reset"); | ||
1195 | - kybdlock_set(KL_DEFERRED_UNLOCK, "do_reset"); | 1153 | + lib3270_kybdlock_clear(session,~KL_DEFERRED_UNLOCK); |
1154 | + kybdlock_set(session,KL_DEFERRED_UNLOCK); | ||
1196 | session->unlock_id = AddTimeOut(UNLOCK_MS, session, defer_unlock); | 1155 | session->unlock_id = AddTimeOut(UNLOCK_MS, session, defer_unlock); |
1197 | } | 1156 | } |
1198 | 1157 | ||
@@ -1260,7 +1219,7 @@ LIB3270_CURSOR_ACTION( left ) | @@ -1260,7 +1219,7 @@ LIB3270_CURSOR_ACTION( left ) | ||
1260 | { | 1219 | { |
1261 | if(KYBDLOCK_IS_OERR(hSession)) | 1220 | if(KYBDLOCK_IS_OERR(hSession)) |
1262 | { | 1221 | { |
1263 | - kybdlock_clr(hSession,KL_OERR_MASK, "Left"); | 1222 | + lib3270_kybdlock_clear(hSession,KL_OERR_MASK); |
1264 | status_reset(&h3270); | 1223 | status_reset(&h3270); |
1265 | } | 1224 | } |
1266 | else | 1225 | else |
@@ -1523,7 +1482,7 @@ LIB3270_CURSOR_ACTION( right ) | @@ -1523,7 +1482,7 @@ LIB3270_CURSOR_ACTION( right ) | ||
1523 | { | 1482 | { |
1524 | if (KYBDLOCK_IS_OERR(hSession)) | 1483 | if (KYBDLOCK_IS_OERR(hSession)) |
1525 | { | 1484 | { |
1526 | - kybdlock_clr(hSession,KL_OERR_MASK, "Right"); | 1485 | + lib3270_kybdlock_clear(hSession,KL_OERR_MASK); |
1527 | status_reset(hSession); | 1486 | status_reset(hSession); |
1528 | } | 1487 | } |
1529 | else | 1488 | else |
@@ -1753,7 +1712,7 @@ LIB3270_CURSOR_ACTION( up ) | @@ -1753,7 +1712,7 @@ LIB3270_CURSOR_ACTION( up ) | ||
1753 | { | 1712 | { |
1754 | if (KYBDLOCK_IS_OERR(hSession)) | 1713 | if (KYBDLOCK_IS_OERR(hSession)) |
1755 | { | 1714 | { |
1756 | - kybdlock_clr(hSession,KL_OERR_MASK, "Up"); | 1715 | + lib3270_kybdlock_clear(hSession,KL_OERR_MASK); |
1757 | status_reset(hSession); | 1716 | status_reset(hSession); |
1758 | } | 1717 | } |
1759 | else | 1718 | else |
@@ -1791,7 +1750,7 @@ LIB3270_CURSOR_ACTION( down ) | @@ -1791,7 +1750,7 @@ LIB3270_CURSOR_ACTION( down ) | ||
1791 | { | 1750 | { |
1792 | if (KYBDLOCK_IS_OERR(hSession)) | 1751 | if (KYBDLOCK_IS_OERR(hSession)) |
1793 | { | 1752 | { |
1794 | - kybdlock_clr(hSession,KL_OERR_MASK, "Down"); | 1753 | + lib3270_kybdlock_clear(hSession,KL_OERR_MASK); |
1795 | status_reset(hSession); | 1754 | status_reset(hSession); |
1796 | } else | 1755 | } else |
1797 | { | 1756 | { |
@@ -2387,7 +2346,7 @@ static void do_pf(unsigned n) | @@ -2387,7 +2346,7 @@ static void do_pf(unsigned n) | ||
2387 | 2346 | ||
2388 | /* | 2347 | /* |
2389 | * Set or clear the keyboard scroll lock. | 2348 | * Set or clear the keyboard scroll lock. |
2390 | - */ | 2349 | + */ /* |
2391 | void | 2350 | void |
2392 | kybd_scroll_lock(Boolean lock) | 2351 | kybd_scroll_lock(Boolean lock) |
2393 | { | 2352 | { |
@@ -2397,7 +2356,7 @@ kybd_scroll_lock(Boolean lock) | @@ -2397,7 +2356,7 @@ kybd_scroll_lock(Boolean lock) | ||
2397 | kybdlock_set(KL_SCROLLED, "kybd_scroll_lock"); | 2356 | kybdlock_set(KL_SCROLLED, "kybd_scroll_lock"); |
2398 | else | 2357 | else |
2399 | kybdlock_clr(&h3270, KL_SCROLLED, "kybd_scroll_lock"); | 2358 | kybdlock_clr(&h3270, KL_SCROLLED, "kybd_scroll_lock"); |
2400 | -} | 2359 | +} */ |
2401 | 2360 | ||
2402 | /* | 2361 | /* |
2403 | * Move the cursor back within the legal paste area. | 2362 | * Move the cursor back within the legal paste area. |
@@ -2825,8 +2784,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | @@ -2825,8 +2784,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | ||
2825 | * Returns the length of the input field, or 0 if there is no field | 2784 | * Returns the length of the input field, or 0 if there is no field |
2826 | * to set up. | 2785 | * to set up. |
2827 | */ | 2786 | */ |
2828 | -int | ||
2829 | -kybd_prime(void) | 2787 | +int kybd_prime(H3270 *hSession) |
2830 | { | 2788 | { |
2831 | int baddr; | 2789 | int baddr; |
2832 | register unsigned char fa; | 2790 | register unsigned char fa; |
@@ -2836,37 +2794,42 @@ kybd_prime(void) | @@ -2836,37 +2794,42 @@ kybd_prime(void) | ||
2836 | * No point in trying if the screen isn't formatted, the keyboard | 2794 | * No point in trying if the screen isn't formatted, the keyboard |
2837 | * is locked, or we aren't in 3270 mode. | 2795 | * is locked, or we aren't in 3270 mode. |
2838 | */ | 2796 | */ |
2839 | - if (!h3270.formatted || h3270.kybdlock || !IN_3270) | 2797 | + if (!hSession->formatted || hSession->kybdlock || !IN_3270) |
2840 | return 0; | 2798 | return 0; |
2841 | 2799 | ||
2842 | - fa = get_field_attribute(&h3270,h3270.cursor_addr); | ||
2843 | - if (h3270.ea_buf[h3270.cursor_addr].fa || FA_IS_PROTECTED(fa)) { | 2800 | + fa = get_field_attribute(hSession,hSession->cursor_addr); |
2801 | + if (hSession->ea_buf[hSession->cursor_addr].fa || FA_IS_PROTECTED(fa)) | ||
2802 | + { | ||
2844 | /* | 2803 | /* |
2845 | * The cursor is not in an unprotected field. Find the | 2804 | * The cursor is not in an unprotected field. Find the |
2846 | * next one. | 2805 | * next one. |
2847 | */ | 2806 | */ |
2848 | - baddr = next_unprotected(&h3270,h3270.cursor_addr); | 2807 | + baddr = next_unprotected(hSession,hSession->cursor_addr); |
2849 | 2808 | ||
2850 | /* If there isn't any, give up. */ | 2809 | /* If there isn't any, give up. */ |
2851 | if (!baddr) | 2810 | if (!baddr) |
2852 | return 0; | 2811 | return 0; |
2853 | 2812 | ||
2854 | /* Move the cursor there. */ | 2813 | /* Move the cursor there. */ |
2855 | - } else { | 2814 | + } |
2815 | + else | ||
2816 | + { | ||
2856 | /* Already in an unprotected field. Find its start. */ | 2817 | /* Already in an unprotected field. Find its start. */ |
2857 | - baddr = h3270.cursor_addr; | ||
2858 | - while (!h3270.ea_buf[baddr].fa) { | 2818 | + baddr = hSession->cursor_addr; |
2819 | + while (!hSession->ea_buf[baddr].fa) | ||
2820 | + { | ||
2859 | DEC_BA(baddr); | 2821 | DEC_BA(baddr); |
2860 | } | 2822 | } |
2861 | INC_BA(baddr); | 2823 | INC_BA(baddr); |
2862 | } | 2824 | } |
2863 | 2825 | ||
2864 | /* Move the cursor to the beginning of the field. */ | 2826 | /* Move the cursor to the beginning of the field. */ |
2865 | - cursor_move(&h3270,baddr); | 2827 | + cursor_move(hSession,baddr); |
2866 | 2828 | ||
2867 | /* Erase it. */ | 2829 | /* Erase it. */ |
2868 | - while (!h3270.ea_buf[baddr].fa) { | ||
2869 | - ctlr_add(&h3270,baddr, 0, 0); | 2830 | + while (!hSession->ea_buf[baddr].fa) |
2831 | + { | ||
2832 | + ctlr_add(hSession,baddr, 0, 0); | ||
2870 | len++; | 2833 | len++; |
2871 | INC_BA(baddr); | 2834 | INC_BA(baddr); |
2872 | } | 2835 | } |
kybdc.h
@@ -60,18 +60,18 @@ | @@ -60,18 +60,18 @@ | ||
60 | LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc); | 60 | LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc); |
61 | LIB3270_INTERNAL void clear_xks(void); | 61 | LIB3270_INTERNAL void clear_xks(void); |
62 | LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit); | 62 | LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit); |
63 | - LIB3270_INTERNAL void hex_input(char *s); | 63 | +// LIB3270_INTERNAL void hex_input(char *s); |
64 | 64 | ||
65 | - #define kybdlock_clr(session, bits, cause) lib3270_kybdlock_clear(session, bits) | 65 | +// #define kybdlock_clr(session, bits, cause) lib3270_kybdlock_clear(session, bits) |
66 | LIB3270_INTERNAL void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits); | 66 | LIB3270_INTERNAL void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits); |
67 | 67 | ||
68 | 68 | ||
69 | LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit); | 69 | LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit); |
70 | - LIB3270_INTERNAL void kybd_init(void); | ||
71 | - LIB3270_INTERNAL int kybd_prime(void); | 70 | +// LIB3270_INTERNAL void kybd_init(void); |
71 | + LIB3270_INTERNAL int kybd_prime(H3270 *hSession); | ||
72 | LIB3270_INTERNAL void kybd_scroll_lock(Boolean lock); | 72 | LIB3270_INTERNAL void kybd_scroll_lock(Boolean lock); |
73 | - LIB3270_INTERNAL Boolean run_ta(void); | ||
74 | - LIB3270_INTERNAL int state_from_keymap(char keymap[32]); | 73 | + LIB3270_INTERNAL int run_ta(H3270 *hSession); |
74 | +// LIB3270_INTERNAL int state_from_keymap(char keymap[32]); | ||
75 | LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno); | 75 | LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno); |
76 | LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270 unused, void *dunno); | 76 | LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270 unused, void *dunno); |
77 | 77 |
telnet.c
@@ -1222,7 +1222,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1222,7 +1222,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
1222 | cooked_init(session); | 1222 | cooked_init(session); |
1223 | #endif /*]*/ | 1223 | #endif /*]*/ |
1224 | host_in3270(session,CONNECTED_ANSI); | 1224 | host_in3270(session,CONNECTED_ANSI); |
1225 | - kybdlock_clr(session,KL_AWAITING_FIRST, "telnet_fsm"); | 1225 | + lib3270_kybdlock_clear(session,KL_AWAITING_FIRST); |
1226 | status_reset(session); | 1226 | status_reset(session); |
1227 | ps_process(); | 1227 | ps_process(); |
1228 | } | 1228 | } |