Commit ab92de7881cd12954c88d348cf58a493ee0fe3a1

Authored by perry.werneck@gmail.com
1 parent d714f42e
Exists in master

Mais ajustes para multi-sessao, retirando warnings durante a compilação da lib e…

…m modo stand-alone, corrigindo compilação em linux
src/lib/Makefile.in
@@ -123,9 +123,9 @@ version.c: ./mkversion.sh @@ -123,9 +123,9 @@ version.c: ./mkversion.sh
123 @chmod +x ./mkversion.sh 123 @chmod +x ./mkversion.sh
124 @./mkversion.sh 124 @./mkversion.sh
125 125
126 -fallbacks.c: $(BINDIR)/mkfb.exe X3270.xad 126 +fallbacks.c: $(BINDIR)/mkfb@EXEEXT@ X3270.xad
127 @mkdir -p $(TMPDIR) 127 @mkdir -p $(TMPDIR)
128 - @$(BINDIR)/mkfb.exe -c X3270.xad falbacks.c 128 + @$(BINDIR)/mkfb@EXEEXT@ -c X3270.xad falbacks.c
129 129
130 $(OBJDIR)/fallbacks@OBJEXT@: fallbacks.c 130 $(OBJDIR)/fallbacks@OBJEXT@: fallbacks.c
131 @echo $@ ... 131 @echo $@ ...
src/lib/ansi.c
@@ -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 && !h3270.is_altbuffer) 717 + if (h3270.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;
src/lib/charset.c
@@ -211,13 +211,18 @@ charset_init(char *csname) @@ -211,13 +211,18 @@ charset_init(char *csname)
211 charset_defaults(); 211 charset_defaults();
212 set_cgcsgids(CN); 212 set_cgcsgids(CN);
213 set_charset_name(CN); 213 set_charset_name(CN);
214 -#if defined(_WIN32) || defined(LIB3270)/*[*/  
215 set_display_charset("iso8859-1"); 214 set_display_charset("iso8859-1");
216 -#elif defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32)) /*[*/ 215 +
  216 +/*
  217 +#if defined(_WIN32) || defined(LIB3270)
  218 + set_display_charset("iso8859-1");
  219 +#elif defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32))
217 (void) screen_new_display_charsets(default_display_charset,"us"); 220 (void) screen_new_display_charsets(default_display_charset,"us");
218 -#else /*][*/ 221 +#else
219 utf8_set_display_charsets(default_display_charset, "us"); 222 utf8_set_display_charsets(default_display_charset, "us");
220 -#endif /*]*/ 223 +#endif
  224 +*/
  225 +
221 return CS_OKAY; 226 return CS_OKAY;
222 } 227 }
223 228
src/lib/ctlr.h
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 */ 18 */
19 19
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? */ 23 //LIB3270_INTERNAL Boolean formatted; /**< contains at least one field? */
24 //LIB3270_INTERNAL Boolean is_altbuffer; /**< in alternate-buffer mode? */ 24 //LIB3270_INTERNAL Boolean is_altbuffer; /**< in alternate-buffer mode? */
src/lib/host.c
@@ -579,8 +579,8 @@ static int do_connect(H3270 *hSession, const char *n) @@ -579,8 +579,8 @@ static int do_connect(H3270 *hSession, const char *n)
579 Replace(hSession->current_host, CN); 579 Replace(hSession->current_host, CN);
580 580
581 if (localprocess_cmd != CN) { 581 if (localprocess_cmd != CN) {
582 - if (full_current_host[strlen(OptLocalProcess)] != '\0')  
583 - hSession->current_host = NewString(full_current_host + strlen(OptLocalProcess) + 1); 582 + if (hSession->full_current_host[strlen(OptLocalProcess)] != '\0')
  583 + hSession->current_host = NewString(hSession->full_current_host + strlen(OptLocalProcess) + 1);
584 else 584 else
585 hSession->current_host = NewString("default shell"); 585 hSession->current_host = NewString("default shell");
586 } else { 586 } else {
src/lib/kybd.c
@@ -1771,13 +1771,13 @@ LIB3270_ACTION( delete ) @@ -1771,13 +1771,13 @@ LIB3270_ACTION( delete )
1771 if (!do_delete()) 1771 if (!do_delete())
1772 return 0; 1772 return 0;
1773 if (reverse) { 1773 if (reverse) {
1774 - int baddr = cursor_addr; 1774 + int baddr = hSession->cursor_addr;
1775 1775
1776 DEC_BA(baddr); 1776 DEC_BA(baddr);
1777 if (!ea_buf[baddr].fa) 1777 if (!ea_buf[baddr].fa)
1778 cursor_move(baddr); 1778 cursor_move(baddr);
1779 } 1779 }
1780 - screen_disp(&h3270); 1780 + screen_disp(hSession);
1781 return 0; 1781 return 0;
1782 } 1782 }
1783 1783
@@ -1848,9 +1848,9 @@ do_erase(void) @@ -1848,9 +1848,9 @@ do_erase(void)
1848 * This ensures that if this is the end of a DBCS subfield, we will 1848 * This ensures that if this is the end of a DBCS subfield, we will
1849 * land on the SI, instead of on the character following. 1849 * land on the SI, instead of on the character following.
1850 */ 1850 */
1851 - d = ctlr_dbcs_state(cursor_addr); 1851 + d = ctlr_dbcs_state(h3270.cursor_addr);
1852 if (IS_RIGHT(d)) { 1852 if (IS_RIGHT(d)) {
1853 - baddr = cursor_addr; 1853 + baddr = h3270.cursor_addr;
1854 DEC_BA(baddr); 1854 DEC_BA(baddr);
1855 cursor_move(baddr); 1855 cursor_move(baddr);
1856 } 1856 }
@@ -2596,11 +2596,11 @@ LIB3270_ACTION( eraseeol ) @@ -2596,11 +2596,11 @@ LIB3270_ACTION( eraseeol )
2596 d = ctlr_lookleft_state(cursor_addr, &why); 2596 d = ctlr_lookleft_state(cursor_addr, &why);
2597 if (IS_DBCS(d) && why == DBCS_SUBFIELD) { 2597 if (IS_DBCS(d) && why == DBCS_SUBFIELD) {
2598 if (d == DBCS_RIGHT) { 2598 if (d == DBCS_RIGHT) {
2599 - baddr = cursor_addr; 2599 + baddr = h3270.cursor_addr;
2600 DEC_BA(baddr); 2600 DEC_BA(baddr);
2601 ea_buf[baddr].cc = EBC_si; 2601 ea_buf[baddr].cc = EBC_si;
2602 } else 2602 } else
2603 - ea_buf[cursor_addr].cc = EBC_si; 2603 + ea_buf[h3270.cursor_addr].cc = EBC_si;
2604 } 2604 }
2605 (void) ctlr_dbcs_postprocess(); 2605 (void) ctlr_dbcs_postprocess();
2606 screen_disp(&h3270); 2606 screen_disp(&h3270);
@@ -2628,18 +2628,18 @@ LIB3270_ACTION( eraseeof ) @@ -2628,18 +2628,18 @@ LIB3270_ACTION( eraseeof )
2628 if (IN_ANSI) 2628 if (IN_ANSI)
2629 return 0; 2629 return 0;
2630 #endif /*]*/ 2630 #endif /*]*/
2631 - baddr = h3270.cursor_addr;  
2632 - fa = get_field_attribute(&h3270,baddr); 2631 + baddr = hSession->cursor_addr;
  2632 + fa = get_field_attribute(hSession,baddr);
2633 if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { 2633 if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) {
2634 operator_error(KL_OERR_PROTECTED); 2634 operator_error(KL_OERR_PROTECTED);
2635 return -1; 2635 return -1;
2636 } 2636 }
2637 - if (h3270.formatted) { /* erase to next field attribute */ 2637 + if (hSession->formatted) { /* erase to next field attribute */
2638 do { 2638 do {
2639 ctlr_add(baddr, EBC_null, 0); 2639 ctlr_add(baddr, EBC_null, 0);
2640 INC_BA(baddr); 2640 INC_BA(baddr);
2641 } while (!ea_buf[baddr].fa); 2641 } while (!ea_buf[baddr].fa);
2642 - mdt_set(h3270.cursor_addr); 2642 + mdt_set(hSession->cursor_addr);
2643 } else { /* erase to end of screen */ 2643 } else { /* erase to end of screen */
2644 do { 2644 do {
2645 ctlr_add(baddr, EBC_null, 0); 2645 ctlr_add(baddr, EBC_null, 0);
@@ -2651,14 +2651,14 @@ LIB3270_ACTION( eraseeof ) @@ -2651,14 +2651,14 @@ LIB3270_ACTION( eraseeof )
2651 d = ctlr_lookleft_state(cursor_addr, &why); 2651 d = ctlr_lookleft_state(cursor_addr, &why);
2652 if (IS_DBCS(d) && why == DBCS_SUBFIELD) { 2652 if (IS_DBCS(d) && why == DBCS_SUBFIELD) {
2653 if (d == DBCS_RIGHT) { 2653 if (d == DBCS_RIGHT) {
2654 - baddr = cursor_addr; 2654 + baddr = hSession->cursor_addr;
2655 DEC_BA(baddr); 2655 DEC_BA(baddr);
2656 ea_buf[baddr].cc = EBC_si; 2656 ea_buf[baddr].cc = EBC_si;
2657 } else 2657 } else
2658 - ea_buf[cursor_addr].cc = EBC_si; 2658 + ea_buf[hSession->cursor_addr].cc = EBC_si;
2659 } 2659 }
2660 (void) ctlr_dbcs_postprocess(); 2660 (void) ctlr_dbcs_postprocess();
2661 - screen_disp(&h3270); 2661 + screen_disp(hSession);
2662 return 0; 2662 return 0;
2663 } 2663 }
2664 2664
@@ -2677,7 +2677,7 @@ LIB3270_ACTION( eraseinput ) @@ -2677,7 +2677,7 @@ LIB3270_ACTION( eraseinput )
2677 if (IN_ANSI) 2677 if (IN_ANSI)
2678 return 0; 2678 return 0;
2679 #endif /*]*/ 2679 #endif /*]*/
2680 - if (h3270.formatted) { 2680 + if (hSession->formatted) {
2681 /* find first field attribute */ 2681 /* find first field attribute */
2682 baddr = 0; 2682 baddr = 0;
2683 do { 2683 do {
@@ -2710,10 +2710,10 @@ LIB3270_ACTION( eraseinput ) @@ -2710,10 +2710,10 @@ LIB3270_ACTION( eraseinput )
2710 if (!f) 2710 if (!f)
2711 cursor_move(0); 2711 cursor_move(0);
2712 } else { 2712 } else {
2713 - ctlr_clear(&h3270,True); 2713 + ctlr_clear(hSession,True);
2714 cursor_move(0); 2714 cursor_move(0);
2715 } 2715 }
2716 - screen_disp(&h3270); 2716 + screen_disp(hSession);
2717 return 0; 2717 return 0;
2718 } 2718 }
2719 2719
@@ -2743,11 +2743,11 @@ LIB3270_ACTION( deleteword ) @@ -2743,11 +2743,11 @@ LIB3270_ACTION( deleteword )
2743 return 0; 2743 return 0;
2744 } 2744 }
2745 #endif /*]*/ 2745 #endif /*]*/
2746 - if (!h3270.formatted) 2746 + if (!hSession->formatted)
2747 return 0; 2747 return 0;
2748 2748
2749 - baddr = h3270.cursor_addr;  
2750 - fa = get_field_attribute(&h3270,baddr); 2749 + baddr = hSession->cursor_addr;
  2750 + fa = get_field_attribute(hSession,baddr);
2751 2751
2752 /* Make sure we're on a modifiable field. */ 2752 /* Make sure we're on a modifiable field. */
2753 if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { 2753 if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) {
@@ -2757,7 +2757,7 @@ LIB3270_ACTION( deleteword ) @@ -2757,7 +2757,7 @@ LIB3270_ACTION( deleteword )
2757 2757
2758 /* Backspace over any spaces to the left of the cursor. */ 2758 /* Backspace over any spaces to the left of the cursor. */
2759 for (;;) { 2759 for (;;) {
2760 - baddr = h3270.cursor_addr; 2760 + baddr = hSession->cursor_addr;
2761 DEC_BA(baddr); 2761 DEC_BA(baddr);
2762 if (ea_buf[baddr].fa) 2762 if (ea_buf[baddr].fa)
2763 return 0; 2763 return 0;
@@ -2770,7 +2770,7 @@ LIB3270_ACTION( deleteword ) @@ -2770,7 +2770,7 @@ LIB3270_ACTION( deleteword )
2770 2770
2771 /* Backspace until the character to the left of the cursor is blank. */ 2771 /* Backspace until the character to the left of the cursor is blank. */
2772 for (;;) { 2772 for (;;) {
2773 - baddr = h3270.cursor_addr; 2773 + baddr = hSession->cursor_addr;
2774 DEC_BA(baddr); 2774 DEC_BA(baddr);
2775 if (ea_buf[baddr].fa) 2775 if (ea_buf[baddr].fa)
2776 return 0; 2776 return 0;
@@ -2780,7 +2780,7 @@ LIB3270_ACTION( deleteword ) @@ -2780,7 +2780,7 @@ LIB3270_ACTION( deleteword )
2780 else 2780 else
2781 do_erase(); 2781 do_erase();
2782 } 2782 }
2783 - screen_disp(&h3270); 2783 + screen_disp(hSession);
2784 return 0; 2784 return 0;
2785 } 2785 }
2786 2786
@@ -2810,11 +2810,11 @@ LIB3270_ACTION( deletefield ) @@ -2810,11 +2810,11 @@ LIB3270_ACTION( deletefield )
2810 return 0; 2810 return 0;
2811 } 2811 }
2812 #endif /*]*/ 2812 #endif /*]*/
2813 - if (!h3270.formatted) 2813 + if (!hSession->formatted)
2814 return 0; 2814 return 0;
2815 2815
2816 - baddr = h3270.cursor_addr;  
2817 - fa = get_field_attribute(&h3270,baddr); 2816 + baddr = hSession->cursor_addr;
  2817 + fa = get_field_attribute(hSession,baddr);
2818 if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) { 2818 if (FA_IS_PROTECTED(fa) || ea_buf[baddr].fa) {
2819 operator_error(KL_OERR_PROTECTED); 2819 operator_error(KL_OERR_PROTECTED);
2820 return -1; 2820 return -1;
@@ -2822,13 +2822,13 @@ LIB3270_ACTION( deletefield ) @@ -2822,13 +2822,13 @@ LIB3270_ACTION( deletefield )
2822 while (!ea_buf[baddr].fa) 2822 while (!ea_buf[baddr].fa)
2823 DEC_BA(baddr); 2823 DEC_BA(baddr);
2824 INC_BA(baddr); 2824 INC_BA(baddr);
2825 - mdt_set(h3270.cursor_addr); 2825 + mdt_set(hSession->cursor_addr);
2826 cursor_move(baddr); 2826 cursor_move(baddr);
2827 while (!ea_buf[baddr].fa) { 2827 while (!ea_buf[baddr].fa) {
2828 ctlr_add(baddr, EBC_null, 0); 2828 ctlr_add(baddr, EBC_null, 0);
2829 INC_BA(baddr); 2829 INC_BA(baddr);
2830 } 2830 }
2831 - screen_disp(&h3270); 2831 + screen_disp(hSession);
2832 return 0; 2832 return 0;
2833 } 2833 }
2834 2834
@@ -2914,10 +2914,10 @@ LIB3270_ACTION( fieldend ) @@ -2914,10 +2914,10 @@ LIB3270_ACTION( fieldend )
2914 if (IN_ANSI) 2914 if (IN_ANSI)
2915 return 0; 2915 return 0;
2916 #endif /*]*/ 2916 #endif /*]*/
2917 - if (!h3270.formatted) 2917 + if (!hSession->formatted)
2918 return 0; 2918 return 0;
2919 - baddr = h3270.cursor_addr;  
2920 - faddr = find_field_attribute(&h3270,baddr); 2919 + baddr = hSession->cursor_addr;
  2920 + faddr = find_field_attribute(hSession,baddr);
2921 fa = ea_buf[faddr].fa; 2921 fa = ea_buf[faddr].fa;
2922 if (faddr == baddr || FA_IS_PROTECTED(fa)) 2922 if (faddr == baddr || FA_IS_PROTECTED(fa))
2923 return 0; 2923 return 0;
@@ -3375,12 +3375,12 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3375,12 +3375,12 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3375 if (pasting && IN_3270) { 3375 if (pasting && IN_3270) {
3376 3376
3377 /* Check for cursor wrap to top of screen. */ 3377 /* Check for cursor wrap to top of screen. */
3378 - if (h3270.cursor_addr < orig_addr) 3378 + if (session->cursor_addr < orig_addr)
3379 return len-1; /* wrapped */ 3379 return len-1; /* wrapped */
3380 3380
3381 /* Jump cursor over left margin. */ 3381 /* Jump cursor over left margin. */
3382 if (toggled(MARGINED_PASTE) && 3382 if (toggled(MARGINED_PASTE) &&
3383 - BA_TO_COL(h3270.cursor_addr) < orig_col) { 3383 + BA_TO_COL(session->cursor_addr) < orig_col) {
3384 if (!remargin(orig_col)) 3384 if (!remargin(orig_col))
3385 return len-1; 3385 return len-1;
3386 skipped = True; 3386 skipped = True;
@@ -3393,7 +3393,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3393,7 +3393,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3393 case BASE: 3393 case BASE:
3394 switch (c) { 3394 switch (c) {
3395 case '\b': 3395 case '\b':
3396 - lib3270_cursor_left(&h3270); 3396 + lib3270_cursor_left(session);
3397 skipped = False; 3397 skipped = False;
3398 break; 3398 break;
3399 case '\f': 3399 case '\f':
@@ -3401,7 +3401,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3401,7 +3401,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3401 key_ACharacter((unsigned char) ' ', 3401 key_ACharacter((unsigned char) ' ',
3402 KT_STD, ia, &skipped); 3402 KT_STD, ia, &skipped);
3403 } else { 3403 } else {
3404 - lib3270_clear(&h3270); 3404 + lib3270_clear(session);
3405 skipped = False; 3405 skipped = False;
3406 if (IN_3270) 3406 if (IN_3270)
3407 return len-1; 3407 return len-1;
@@ -3410,11 +3410,11 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3410,11 +3410,11 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3410 case '\n': 3410 case '\n':
3411 if (pasting) { 3411 if (pasting) {
3412 if (!skipped) 3412 if (!skipped)
3413 - lib3270_cursor_newline(&h3270); 3413 + lib3270_cursor_newline(session);
3414 // action_internal(Newline_action,ia, CN, CN); 3414 // action_internal(Newline_action,ia, CN, CN);
3415 skipped = False; 3415 skipped = False;
3416 } else { 3416 } else {
3417 - lib3270_enter(&h3270); 3417 + lib3270_enter(session);
3418 skipped = False; 3418 skipped = False;
3419 if (IN_3270) 3419 if (IN_3270)
3420 return len-1; 3420 return len-1;
@@ -3423,7 +3423,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3423,7 +3423,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3423 case '\r': /* ignored */ 3423 case '\r': /* ignored */
3424 break; 3424 break;
3425 case '\t': 3425 case '\t':
3426 - lib3270_tab(&h3270); 3426 + lib3270_tab(session);
3427 skipped = False; 3427 skipped = False;
3428 break; 3428 break;
3429 case '\\': /* backslashes are NOT special when 3429 case '\\': /* backslashes are NOT special when
@@ -3489,13 +3489,13 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3489,13 +3489,13 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3489 state = BASE; 3489 state = BASE;
3490 break; 3490 break;
3491 case 'b': 3491 case 'b':
3492 - lib3270_cursor_left(&h3270); 3492 + lib3270_cursor_left(session);
3493 // action_internal(Left_action, ia, CN, CN); 3493 // action_internal(Left_action, ia, CN, CN);
3494 skipped = False; 3494 skipped = False;
3495 state = BASE; 3495 state = BASE;
3496 break; 3496 break;
3497 case 'f': 3497 case 'f':
3498 - lib3270_clear(&h3270); 3498 + lib3270_clear(session);
3499 skipped = False; 3499 skipped = False;
3500 state = BASE; 3500 state = BASE;
3501 if (IN_3270) 3501 if (IN_3270)
@@ -3503,7 +3503,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3503,7 +3503,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3503 else 3503 else
3504 break; 3504 break;
3505 case 'n': 3505 case 'n':
3506 - lib3270_enter(&h3270); 3506 + lib3270_enter(session);
3507 skipped = False; 3507 skipped = False;
3508 state = BASE; 3508 state = BASE;
3509 if (IN_3270) 3509 if (IN_3270)
@@ -3515,25 +3515,24 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3515,25 +3515,24 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3515 break; 3515 break;
3516 3516
3517 case 'r': 3517 case 'r':
3518 - lib3270_cursor_newline(&h3270); 3518 + lib3270_cursor_newline(session);
3519 // action_internal(Newline_action, ia, CN, CN); 3519 // action_internal(Newline_action, ia, CN, CN);
3520 skipped = False; 3520 skipped = False;
3521 state = BASE; 3521 state = BASE;
3522 break; 3522 break;
3523 3523
3524 case 't': 3524 case 't':
3525 - lib3270_tab(&h3270); 3525 + lib3270_tab(session);
3526 skipped = False; 3526 skipped = False;
3527 state = BASE; 3527 state = BASE;
3528 break; 3528 break;
3529 case 'T': 3529 case 'T':
3530 - lib3270_tab(&h3270); 3530 + lib3270_tab(session);
3531 skipped = False; 3531 skipped = False;
3532 state = BASE; 3532 state = BASE;
3533 break; 3533 break;
3534 case 'v': 3534 case 'v':
3535 - popup_an_error("%s: Vertical tab not supported",  
3536 - action_name(String_action)); 3535 + popup_an_error("%s: Vertical tab not supported",action_name(String_action));
3537 // cancel_if_idle_command(); 3536 // cancel_if_idle_command();
3538 state = BASE; 3537 state = BASE;
3539 break; 3538 break;
@@ -3541,8 +3540,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3541,8 +3540,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3541 state = BACKX; 3540 state = BACKX;
3542 break; 3541 break;
3543 case '\\': 3542 case '\\':
3544 - key_ACharacter((unsigned char) c, KT_STD, ia,  
3545 - &skipped); 3543 + key_ACharacter((unsigned char) c, KT_STD, ia,&skipped);
3546 state = BASE; 3544 state = BASE;
3547 break; 3545 break;
3548 case '0': 3546 case '0':
@@ -3679,7 +3677,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3679,7 +3677,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3679 switch (state) { 3677 switch (state) {
3680 case BASE: 3678 case BASE:
3681 if (toggled(MARGINED_PASTE) && 3679 if (toggled(MARGINED_PASTE) &&
3682 - BA_TO_COL(h3270.cursor_addr) < orig_col) { 3680 + BA_TO_COL(session->cursor_addr) < orig_col) {
3683 (void) remargin(orig_col); 3681 (void) remargin(orig_col);
3684 } 3682 }
3685 break; 3683 break;
@@ -3688,7 +3686,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3688,7 +3686,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3688 key_ACharacter((unsigned char) literal, KT_STD, ia, &skipped); 3686 key_ACharacter((unsigned char) literal, KT_STD, ia, &skipped);
3689 state = BASE; 3687 state = BASE;
3690 if (toggled(MARGINED_PASTE) && 3688 if (toggled(MARGINED_PASTE) &&
3691 - BA_TO_COL(h3270.cursor_addr) < orig_col) { 3689 + BA_TO_COL(session->cursor_addr) < orig_col) {
3692 (void) remargin(orig_col); 3690 (void) remargin(orig_col);
3693 } 3691 }
3694 break; 3692 break;
@@ -3711,7 +3709,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3711,7 +3709,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3711 break; 3709 break;
3712 } 3710 }
3713 3711
3714 - screen_disp(&h3270); 3712 + screen_disp(session);
3715 return len; 3713 return len;
3716 } 3714 }
3717 3715
src/lib/mkfb.c
1 -/* 1 +/*
2 * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 2 * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3 * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a 3 * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4 * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. 4 * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
5 - * 5 + *
6 * Copyright (C) <2008> <Banco do Brasil S.A.> 6 * Copyright (C) <2008> <Banco do Brasil S.A.>
7 - * 7 + *
8 * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob 8 * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9 * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela 9 * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10 * Free Software Foundation. 10 * Free Software Foundation.
11 - * 11 + *
12 * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER 12 * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13 * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO 13 * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14 * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para 14 * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15 * obter mais detalhes. 15 * obter mais detalhes.
16 - * 16 + *
17 * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este 17 * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18 * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple 18 * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA, 02111-1307, USA 19 * Place, Suite 330, Boston, MA, 02111-1307, USA
20 - * 20 + *
21 * Este programa está nomeado como mkfb.c e possui 577 linhas de código. 21 * Este programa está nomeado como mkfb.c e possui 577 linhas de código.
22 - *  
23 - * Contatos:  
24 - * 22 + *
  23 + * Contatos:
  24 + *
25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) 25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) 26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27 * licinio@bb.com.br (Licínio Luis Branco) 27 * licinio@bb.com.br (Licínio Luis Branco)
@@ -538,7 +538,7 @@ main(int argc, char *argv[]) @@ -538,7 +538,7 @@ main(int argc, char *argv[])
538 fprintf(o, "\t(String)NULL\n};\n\n"); 538 fprintf(o, "\t(String)NULL\n};\n\n");
539 539
540 /* Emit some test code. */ 540 /* Emit some test code. */
541 - fprintf(o, "%s", "#if defined(DEBUG) /*[*/\n\ 541 + fprintf(o, "%s", "#if defined(DUMP) /*[*/\n\
542 #include <stdio.h>\n\ 542 #include <stdio.h>\n\
543 int\n\ 543 int\n\
544 main(int argc, char *argv[])\n\ 544 main(int argc, char *argv[])\n\
src/lib/util.c
@@ -36,9 +36,23 @@ @@ -36,9 +36,23 @@
36 */ 36 */
37 37
38 #include "globals.h" 38 #include "globals.h"
39 -#if !defined(_WIN32) /*[*/  
40 -#include <pwd.h>  
41 -#endif /*]*/ 39 +
  40 +#if defined(_WIN32)
  41 +
  42 + #include <windows.h>
  43 + #include "winversc.h"
  44 +
  45 + #include <winsock2.h>
  46 + #include <ws2tcpip.h>
  47 + #include <stdio.h>
  48 + #include <errno.h>
  49 +
  50 + #include "w3miscc.h"
  51 +
  52 +#else
  53 + #include <pwd.h>
  54 +#endif // _WIN32
  55 +
42 #include <stdarg.h> 56 #include <stdarg.h>
43 #include "resources.h" 57 #include "resources.h"
44 58
@@ -47,6 +61,99 @@ @@ -47,6 +61,99 @@
47 61
48 #define my_isspace(c) isspace((unsigned char)c) 62 #define my_isspace(c) isspace((unsigned char)c)
49 63
  64 +
  65 +#if defined(_WIN32)
  66 +
  67 +int is_nt = 1;
  68 +int has_ipv6 = 1;
  69 +
  70 +int get_version_info(void)
  71 +{
  72 + OSVERSIONINFO info;
  73 +
  74 + // Figure out what version of Windows this is.
  75 + memset(&info, '\0', sizeof(info));
  76 + info.dwOSVersionInfoSize = sizeof(info);
  77 + if(GetVersionEx(&info) == 0)
  78 + {
  79 + WriteLog("lib3270","%s","Can't get Windows version");
  80 + return -1;
  81 + }
  82 +
  83 + // Yes, people still run Win98.
  84 + if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
  85 + is_nt = 0;
  86 +
  87 + // Win2K and earlier is IPv4-only. WinXP and later can have IPv6.
  88 + if (!is_nt || info.dwMajorVersion < 5 || (info.dwMajorVersion == 5 && info.dwMinorVersion < 1))
  89 + {
  90 + has_ipv6 = 0;
  91 + }
  92 +
  93 + return 0;
  94 +}
  95 +
  96 +// Convert a network address to a string.
  97 +const char * inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
  98 +{
  99 + union {
  100 + struct sockaddr sa;
  101 + struct sockaddr_in sin;
  102 + struct sockaddr_in6 sin6;
  103 + } sa;
  104 + DWORD ssz;
  105 + DWORD sz = cnt;
  106 +
  107 + memset(&sa, '\0', sizeof(sa));
  108 +
  109 + switch (af) {
  110 + case AF_INET:
  111 + sa.sin = *(struct sockaddr_in *)src; // struct copy
  112 + ssz = sizeof(struct sockaddr_in);
  113 + break;
  114 + case AF_INET6:
  115 + sa.sin6 = *(struct sockaddr_in6 *)src; // struct copy
  116 + ssz = sizeof(struct sockaddr_in6);
  117 + break;
  118 + default:
  119 + if (cnt > 0)
  120 + dst[0] = '\0';
  121 + return NULL;
  122 + }
  123 +
  124 + sa.sa.sa_family = af;
  125 +
  126 + if (WSAAddressToString(&sa.sa, ssz, NULL, dst, &sz) != 0) {
  127 + if (cnt > 0)
  128 + dst[0] = '\0';
  129 + return NULL;
  130 + }
  131 +
  132 + return dst;
  133 +}
  134 +
  135 +// Decode a Win32 error number.
  136 +const char * win32_strerror(int e)
  137 +{
  138 + static char buffer[4096];
  139 +
  140 + if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
  141 + NULL,
  142 + e,
  143 + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
  144 + buffer,
  145 + sizeof(buffer),
  146 + NULL) == 0) {
  147 +
  148 + sprintf(buffer, "Windows error %d", e);
  149 + }
  150 +
  151 + return buffer;
  152 +}
  153 +
  154 +
  155 +#endif // _WIN32
  156 +
50 /* 157 /*
51 * Cheesy internal version of sprintf that allocates its own memory. 158 * Cheesy internal version of sprintf that allocates its own memory.
52 */ 159 */
src/lib/w3misc.c
1 -/* 1 +/*
2 * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 2 * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3 * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a 3 * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4 * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. 4 * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
5 - * 5 + *
6 * Copyright (C) <2008> <Banco do Brasil S.A.> 6 * Copyright (C) <2008> <Banco do Brasil S.A.>
7 - * 7 + *
8 * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob 8 * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9 * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela 9 * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10 * Free Software Foundation. 10 * Free Software Foundation.
11 - * 11 + *
12 * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER 12 * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13 * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO 13 * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14 * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para 14 * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15 * obter mais detalhes. 15 * obter mais detalhes.
16 - * 16 + *
17 * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este 17 * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18 * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple 18 * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA, 02111-1307, USA 19 * Place, Suite 330, Boston, MA, 02111-1307, USA
20 - * 20 + *
21 * Este programa está nomeado como w3misc.c e possui 110 linhas de código. 21 * Este programa está nomeado como w3misc.c e possui 110 linhas de código.
22 - *  
23 - * Contatos:  
24 - * 22 + *
  23 + * Contatos:
  24 + *
25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) 25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) 26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27 * licinio@bb.com.br (Licínio Luis Branco) 27 * licinio@bb.com.br (Licínio Luis Branco)
@@ -36,11 +36,12 @@ @@ -36,11 +36,12 @@
36 * Miscellaneous Win32 functions. 36 * Miscellaneous Win32 functions.
37 */ 37 */
38 38
  39 +/*
39 #include "globals.h" 40 #include "globals.h"
40 41
41 -#if !defined(_WIN32) /*[*/ 42 +#if !defined(_WIN32)
42 #error This module is only for Win32. 43 #error This module is only for Win32.
43 -#endif /*]*/ 44 +#endif
44 45
45 #include <winsock2.h> 46 #include <winsock2.h>
46 #include <ws2tcpip.h> 47 #include <ws2tcpip.h>
@@ -49,9 +50,8 @@ @@ -49,9 +50,8 @@
49 50
50 #include "w3miscc.h" 51 #include "w3miscc.h"
51 52
52 -/* Convert a network address to a string. */  
53 -const char *  
54 -inet_ntop(int af, const void *src, char *dst, socklen_t cnt) 53 +// Convert a network address to a string.
  54 +const char * inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
55 { 55 {
56 union { 56 union {
57 struct sockaddr sa; 57 struct sockaddr sa;
@@ -65,11 +65,11 @@ inet_ntop(int af, const void *src, char *dst, socklen_t cnt) @@ -65,11 +65,11 @@ inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
65 65
66 switch (af) { 66 switch (af) {
67 case AF_INET: 67 case AF_INET:
68 - sa.sin = *(struct sockaddr_in *)src; /* struct copy */ 68 + sa.sin = *(struct sockaddr_in *)src; // struct copy
69 ssz = sizeof(struct sockaddr_in); 69 ssz = sizeof(struct sockaddr_in);
70 break; 70 break;
71 case AF_INET6: 71 case AF_INET6:
72 - sa.sin6 = *(struct sockaddr_in6 *)src; /* struct copy */ 72 + sa.sin6 = *(struct sockaddr_in6 *)src; // struct copy
73 ssz = sizeof(struct sockaddr_in6); 73 ssz = sizeof(struct sockaddr_in6);
74 break; 74 break;
75 default: 75 default:
@@ -89,9 +89,8 @@ inet_ntop(int af, const void *src, char *dst, socklen_t cnt) @@ -89,9 +89,8 @@ inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
89 return dst; 89 return dst;
90 } 90 }
91 91
92 -/* Decode a Win32 error number. */  
93 -const char *  
94 -win32_strerror(int e) 92 +// Decode a Win32 error number.
  93 +const char * win32_strerror(int e)
95 { 94 {
96 static char buffer[4096]; 95 static char buffer[4096];
97 96
@@ -102,9 +101,11 @@ win32_strerror(int e) @@ -102,9 +101,11 @@ win32_strerror(int e)
102 buffer, 101 buffer,
103 sizeof(buffer), 102 sizeof(buffer),
104 NULL) == 0) { 103 NULL) == 0) {
105 - 104 +
106 sprintf(buffer, "Windows error %d", e); 105 sprintf(buffer, "Windows error %d", e);
107 } 106 }
108 107
109 return buffer; 108 return buffer;
110 } 109 }
  110 +
  111 +*/
src/lib/winvers.c
1 -/* 1 +/*
2 * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 2 * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3 * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a 3 * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4 * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. 4 * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
5 - * 5 + *
6 * Copyright (C) <2008> <Banco do Brasil S.A.> 6 * Copyright (C) <2008> <Banco do Brasil S.A.>
7 - * 7 + *
8 * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob 8 * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9 * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela 9 * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10 * Free Software Foundation. 10 * Free Software Foundation.
11 - * 11 + *
12 * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER 12 * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13 * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO 13 * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14 * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para 14 * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15 * obter mais detalhes. 15 * obter mais detalhes.
16 - * 16 + *
17 * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este 17 * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18 * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple 18 * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA, 02111-1307, USA 19 * Place, Suite 330, Boston, MA, 02111-1307, USA
20 - * 20 + *
21 * Este programa está nomeado como winvers.c e possui 73 linhas de código. 21 * Este programa está nomeado como winvers.c e possui 73 linhas de código.
22 - *  
23 - * Contatos:  
24 - * 22 + *
  23 + * Contatos:
  24 + *
25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) 25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) 26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27 * licinio@bb.com.br (Licínio Luis Branco) 27 * licinio@bb.com.br (Licínio Luis Branco)
@@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
37 * OS version query 37 * OS version query
38 */ 38 */
39 39
  40 +/*
40 #include <windows.h> 41 #include <windows.h>
41 #include <stdio.h> 42 #include <stdio.h>
42 43
@@ -51,7 +52,7 @@ get_version_info(void) @@ -51,7 +52,7 @@ get_version_info(void)
51 { 52 {
52 OSVERSIONINFO info; 53 OSVERSIONINFO info;
53 54
54 - /* Figure out what version of Windows this is. */ 55 + // Figure out what version of Windows this is.
55 memset(&info, '\0', sizeof(info)); 56 memset(&info, '\0', sizeof(info));
56 info.dwOSVersionInfoSize = sizeof(info); 57 info.dwOSVersionInfoSize = sizeof(info);
57 if (GetVersionEx(&info) == 0) { 58 if (GetVersionEx(&info) == 0) {
@@ -59,11 +60,11 @@ get_version_info(void) @@ -59,11 +60,11 @@ get_version_info(void)
59 return -1; 60 return -1;
60 } 61 }
61 62
62 - /* Yes, people still run Win98. */ 63 + // Yes, people still run Win98.
63 if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) 64 if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
64 is_nt = 0; 65 is_nt = 0;
65 66
66 - /* Win2K and earlier is IPv4-only. WinXP and later can have IPv6. */ 67 + // Win2K and earlier is IPv4-only. WinXP and later can have IPv6.
67 if (!is_nt || 68 if (!is_nt ||
68 info.dwMajorVersion < 5 || 69 info.dwMajorVersion < 5 ||
69 (info.dwMajorVersion == 5 && info.dwMinorVersion < 1)) { 70 (info.dwMajorVersion == 5 && info.dwMinorVersion < 1)) {
@@ -72,3 +73,5 @@ get_version_info(void) @@ -72,3 +73,5 @@ get_version_info(void)
72 73
73 return 0; 74 return 0;
74 } 75 }
  76 +
  77 +*/