Commit 30dbf344c9763f4965a411f46a658db356e07494

Authored by Perry Werneck
1 parent 4ef00412

Cleaning up, fixing warnings.

src/include/3270ds.h
@@ -138,19 +138,19 @@ @@ -138,19 +138,19 @@
138 #define BA_TO_COL(ba) ((ba) % hSession->cols) 138 #define BA_TO_COL(ba) ((ba) % hSession->cols)
139 #define ROWCOL_TO_BA(r,c) (((r) * hSession->cols) + c) 139 #define ROWCOL_TO_BA(r,c) (((r) * hSession->cols) + c)
140 #define INC_BA(ba) { (ba) = ((ba) + 1) % (hSession->cols * hSession->rows); } 140 #define INC_BA(ba) { (ba) = ((ba) + 1) % (hSession->cols * hSession->rows); }
141 -#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : ((hSession->cols*hSession->rows) - 1); } 141 +#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : (((int) (hSession->cols*hSession->rows)) - 1); }
142 142
143 /** Field attributes. */ 143 /** Field attributes. */
144 -#define FA_PRINTABLE 0xc0 /**< these make the character "printable" */  
145 -#define FA_PROTECT 0x20 /**< unprotected (0) / protected (1) */  
146 -#define FA_NUMERIC 0x10 /**< alphanumeric (0) /numeric (1) */  
147 -#define FA_INTENSITY 0x0c /**< display/selector pen detectable: */  
148 -#define FA_INT_NORM_NSEL 0x00 /**< 00 normal, non-detect */  
149 -#define FA_INT_NORM_SEL 0x04 /**< 01 normal, detectable */  
150 -#define FA_INT_HIGH_SEL 0x08 /**< 10 intensified, detectable */  
151 -#define FA_INT_ZERO_NSEL 0x0c /**< 11 nondisplay, non-detect */  
152 -#define FA_RESERVED 0x02 /**< must be 0 */  
153 -#define FA_MODIFY 0x01 /**< modified (1) */ 144 +#define FA_PRINTABLE 0xc0 ///< @brief these make the character "printable" */
  145 +#define FA_PROTECT 0x20 ///< @brief unprotected (0) / protected (1) */
  146 +#define FA_NUMERIC 0x10 ///< @brief alphanumeric (0) /numeric (1) */
  147 +#define FA_INTENSITY 0x0c ///< @brief display/selector pen detectable: */
  148 +#define FA_INT_NORM_NSEL 0x00 ///< @brief 00 normal, non-detect */
  149 +#define FA_INT_NORM_SEL 0x04 ///< @brief 01 normal, detectable */
  150 +#define FA_INT_HIGH_SEL 0x08 ///< @brief 10 intensified, detectable */
  151 +#define FA_INT_ZERO_NSEL 0x0c ///< @brief 11 nondisplay, non-detect */
  152 +#define FA_RESERVED 0x02 ///< @brief must be 0 */
  153 +#define FA_MODIFY 0x01 ///< @brief modified (1) */
154 154
155 /* Bits in the field attribute that are stored. */ 155 /* Bits in the field attribute that are stored. */
156 #define FA_MASK (FA_PROTECT | FA_NUMERIC | FA_INTENSITY | FA_MODIFY) 156 #define FA_MASK (FA_PROTECT | FA_NUMERIC | FA_INTENSITY | FA_MODIFY)
src/include/api.h
@@ -29,6 +29,7 @@ @@ -29,6 +29,7 @@
29 * 29 *
30 */ 30 */
31 31
  32 +#error Deprecated
32 33
33 #ifndef LIB3270_API_INCLUDED 34 #ifndef LIB3270_API_INCLUDED
34 35
@@ -99,36 +100,12 @@ @@ -99,36 +100,12 @@
99 100
100 #include <lib3270/log.h> 101 #include <lib3270/log.h>
101 102
102 - #define OIA_FLAG_BOXSOLID LIB3270_FLAG_BOXSOLID  
103 - #define OIA_FLAG_UNDERA LIB3270_FLAG_UNDERA  
104 - #define OIA_FLAG_TYPEAHEAD LIB3270_FLAG_TYPEAHEAD  
105 - #define OIA_FLAG_USER LIB3270_FLAG_COUNT  
106 - #define OIA_FLAG LIB3270_FLAG  
107 -  
108 -// struct lib3270_state_callback;  
109 -  
110 #include <lib3270/session.h> 103 #include <lib3270/session.h>
111 104
112 105
113 /** Type of dialog boxes */ 106 /** Type of dialog boxes */
114 #include <lib3270/popup.h> 107 #include <lib3270/popup.h>
115 108
116 - #define PW3270_DIALOG_INFO LIB3270_NOTIFY_INFO  
117 - #define PW3270_DIALOG_CRITICAL LIB3270_NOTIFY_CRITICAL  
118 - #define PW3270_DIALOG LIB3270_NOTIFY  
119 -  
120 - #define GR_BLINK 0x01  
121 - #define GR_REVERSE 0x02  
122 - #define GR_UNDERLINE 0x04  
123 - #define GR_INTENSIFY 0x08  
124 -  
125 - #define CS_MASK 0x03 /**< mask for specific character sets */  
126 - #define CS_BASE 0x00 /**< base character set (X'00') */  
127 - #define CS_APL 0x01 /**< APL character set (X'01' or GE) */  
128 - #define CS_LINEDRAW 0x02 /**< DEC line-drawing character set (ANSI) */  
129 - #define CS_DBCS 0x03 /**< DBCS character set (X'F8') */  
130 - #define CS_GE 0x04 /**< cs flag for Graphic Escape */  
131 -  
132 /* File transfer */ 109 /* File transfer */
133 110
134 #define FT_RECORD_FORMAT_FIXED LIB3270_FT_RECORD_FORMAT_FIXED 111 #define FT_RECORD_FORMAT_FIXED LIB3270_FT_RECORD_FORMAT_FIXED
@@ -141,12 +118,6 @@ @@ -141,12 +118,6 @@
141 #define FT_ALLOCATION_UNITS_AVBLOCK LIB3270_FT_ALLOCATION_UNITS_AVBLOCK 118 #define FT_ALLOCATION_UNITS_AVBLOCK LIB3270_FT_ALLOCATION_UNITS_AVBLOCK
142 #define FT_ALLOCATION_UNITS_MASK LIB3270_FT_ALLOCATION_UNITS_MASK 119 #define FT_ALLOCATION_UNITS_MASK LIB3270_FT_ALLOCATION_UNITS_MASK
143 120
144 - #define FT_NONE LIB3270_FT_STATE_NONE  
145 - #define FT_AWAIT_ACK LIB3270_FT_STATE_AWAIT_ACK  
146 - #define FT_RUNNING LIB3270_FT_STATE_RUNNING  
147 - #define FT_ABORT_WAIT LIB3270_FT_STATE_ABORT_WAIT  
148 - #define FT_ABORT_SENT LIB3270_FT_STATE_ABORT_SENT  
149 -  
150 LOCAL_EXTERN int CancelFileTransfer(int force); 121 LOCAL_EXTERN int CancelFileTransfer(int force);
151 122
152 #define PCONNECTED lib3270_pconnected(hSession) 123 #define PCONNECTED lib3270_pconnected(hSession)
@@ -160,21 +131,13 @@ @@ -160,21 +131,13 @@
160 #define IN_TN3270E lib3270_in_tn3270e(hSession) 131 #define IN_TN3270E lib3270_in_tn3270e(hSession)
161 #define IN_E lib3270_in_e(hSession) 132 #define IN_E lib3270_in_e(hSession)
162 133
163 - #define COLOR_ATTR_NONE 0x0000  
164 - #define COLOR_ATTR_FIELD LIB3270_ATTR_FIELD  
165 - #define COLOR_ATTR_BLINK LIB3270_ATTR_BLINK  
166 - #define COLOR_ATTR_INTENSIFY LIB3270_ATTR_INTENSIFY  
167 -  
168 - #define CHAR_ATTR_UNCONVERTED LIB3270_ATTR_CG  
169 -  
170 -  
171 /* Set/Get screen contents */ 134 /* Set/Get screen contents */
172 #define find_field_attribute(s,a) lib3270_field_addr(s,a) 135 #define find_field_attribute(s,a) lib3270_field_addr(s,a)
173 #define find_field_length(s,a) find_field_length(s,a) 136 #define find_field_length(s,a) find_field_length(s,a)
174 137
175 - LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr);  
176 - LOCAL_EXTERN void Input_String(const unsigned char *str);  
177 - LOCAL_EXTERN void screen_size(int *rows, int *cols); 138 + // LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr);
  139 + // LOCAL_EXTERN void Input_String(const unsigned char *str);
  140 + // LOCAL_EXTERN void screen_size(int *rows, int *cols);
178 141
179 #define lib3270_paste_string(str) lib3270_set_string(NULL,str) 142 #define lib3270_paste_string(str) lib3270_set_string(NULL,str)
180 143
src/include/hostc.h
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 * @brief Global declarations for host.c. 35 * @brief Global declarations for host.c.
36 */ 36 */
37 37
38 - #include "api.h" 38 +// #include "api.h"
39 39
40 40
41 /** 41 /**
src/include/lib3270.h
@@ -693,7 +693,7 @@ @@ -693,7 +693,7 @@
693 * @return Negative if error or number of processed characters. 693 * @return Negative if error or number of processed characters.
694 * 694 *
695 */ 695 */
696 - LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, const unsigned char *str); 696 + LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, unsigned int row, unsigned int col, const unsigned char *str);
697 697
698 /** 698 /**
699 * @brief Set string at defined adress. 699 * @brief Set string at defined adress.
src/include/popupsc.h
@@ -31,11 +31,13 @@ @@ -31,11 +31,13 @@
31 31
32 /* Popup calls */ 32 /* Popup calls */
33 33
  34 + #include <lib3270.h>
  35 +
34 #define popup_an_errno(hSession, errn, fmt, ...) lib3270_popup_an_errno(hSession, errn, fmt, __VA_ARGS__) 36 #define popup_an_errno(hSession, errn, fmt, ...) lib3270_popup_an_errno(hSession, errn, fmt, __VA_ARGS__)
35 37
36 - LOCAL_EXTERN void popup_an_error(H3270 *session, const char *fmt, ...) LIB3270_GNUC_FORMAT(2,3);  
37 - LOCAL_EXTERN void popup_system_error(H3270 *session, const char *title, const char *message, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5);  
38 - LOCAL_EXTERN void popup_a_sockerr(H3270 *session, char *fmt, ...) LIB3270_GNUC_FORMAT(2,3); 38 + LIB3270_INTERNAL void popup_an_error(H3270 *session, const char *fmt, ...) LIB3270_GNUC_FORMAT(2,3);
  39 + LIB3270_INTERNAL void popup_system_error(H3270 *session, const char *title, const char *message, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5);
  40 + LIB3270_INTERNAL void popup_a_sockerr(H3270 *session, char *fmt, ...) LIB3270_GNUC_FORMAT(2,3);
39 41
40 - LOCAL_EXTERN void Error(H3270 *session, const char *fmt, ...);  
41 - LOCAL_EXTERN void Warning(H3270 *session, const char *fmt, ...); 42 + LIB3270_INTERNAL void Error(H3270 *session, const char *fmt, ...);
  43 + LIB3270_INTERNAL void Warning(H3270 *session, const char *fmt, ...);
src/include/statusc.h
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 13
14 /* c3270 verson of statusc.h */ 14 /* c3270 verson of statusc.h */
15 15
16 -#include "api.h" 16 +// #include "api.h"
17 17
18 LIB3270_INTERNAL void status_compose(int on, unsigned char c, enum keytype keytype); 18 LIB3270_INTERNAL void status_compose(int on, unsigned char c, enum keytype keytype);
19 LIB3270_INTERNAL void status_ctlr_done(H3270 *session); 19 LIB3270_INTERNAL void status_ctlr_done(H3270 *session);
@@ -31,8 +31,8 @@ LIB3270_INTERNAL void status_twait(H3270 *session); @@ -31,8 +31,8 @@ LIB3270_INTERNAL void status_twait(H3270 *session);
31 31
32 LIB3270_INTERNAL void status_changed(H3270 *session, LIB3270_MESSAGE id); 32 LIB3270_INTERNAL void status_changed(H3270 *session, LIB3270_MESSAGE id);
33 33
34 -LIB3270_INTERNAL void set_status(H3270 *session, OIA_FLAG id, Boolean on); 34 +LIB3270_INTERNAL void set_status(H3270 *session, LIB3270_FLAG id, Boolean on);
35 35
36 36
37 -#define status_typeahead(h,on) set_status(h,OIA_FLAG_TYPEAHEAD,on) 37 +#define status_typeahead(h,on) set_status(h,LIB3270_FLAG_TYPEAHEAD,on)
38 38
src/lib3270/charset.c
@@ -37,6 +37,8 @@ @@ -37,6 +37,8 @@
37 #include "private.h" 37 #include "private.h"
38 #include <lib3270/X11keysym.h> 38 #include <lib3270/X11keysym.h>
39 #include <lib3270/charset.h> 39 #include <lib3270/charset.h>
  40 +#include <lib3270/log.h>
  41 +#include <lib3270/trace.h>
40 42
41 /* 43 /*
42 * EBCDIC-to-Unicode translation tables. 44 * EBCDIC-to-Unicode translation tables.
@@ -46,18 +48,6 @@ @@ -46,18 +48,6 @@
46 #define UT_SIZE 190 48 #define UT_SIZE 190
47 #define UT_OFFSET 0x41 49 #define UT_OFFSET 0x41
48 50
49 -/*  
50 -typedef struct  
51 -{  
52 - const char * name;  
53 - const char * host_codepage;  
54 - const char * cgcsgid;  
55 - const char * display_charset;  
56 - unsigned short code[UT_SIZE];  
57 -} charset_table;  
58 -*/  
59 -  
60 -  
61 /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ 51 /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/
62 52
63 const unsigned short ebc2asc0[256] = 53 const unsigned short ebc2asc0[256] =
src/lib3270/connect.c
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 #include "private.h" 31 #include "private.h"
32 #include "telnetc.h" 32 #include "telnetc.h"
33 #include <errno.h> 33 #include <errno.h>
  34 +#include <lib3270/log.h>
34 #include <lib3270/trace.h> 35 #include <lib3270/trace.h>
35 36
36 #if defined(HAVE_LIBSSL) 37 #if defined(HAVE_LIBSSL)
src/lib3270/ctlr.c
@@ -37,11 +37,15 @@ @@ -37,11 +37,15 @@
37 #pragma GCC diagnostic ignored "-Wsign-compare" 37 #pragma GCC diagnostic ignored "-Wsign-compare"
38 38
39 #include "private.h" 39 #include "private.h"
  40 +
  41 +#include <lib3270.h>
  42 +#include <lib3270/trace.h>
  43 +#include <lib3270/log.h>
  44 +#include <lib3270/actions.h>
  45 +
40 #include <errno.h> 46 #include <errno.h>
41 #include <stdlib.h> 47 #include <stdlib.h>
42 #include "3270ds.h" 48 #include "3270ds.h"
43 -//#include "appres.h"  
44 -// #include "ctlr.h"  
45 #include "screen.h" 49 #include "screen.h"
46 #include "resources.h" 50 #include "resources.h"
47 51
@@ -53,11 +57,9 @@ @@ -53,11 +57,9 @@
53 #include "kybdc.h" 57 #include "kybdc.h"
54 #include "popupsc.h" 58 #include "popupsc.h"
55 #include "screenc.h" 59 #include "screenc.h"
56 -// #include "scrollc.h"  
57 #include "seec.h" 60 #include "seec.h"
58 #include "sf.h" 61 #include "sf.h"
59 #include "statusc.h" 62 #include "statusc.h"
60 -// #include "tablesc.h"  
61 #include "telnetc.h" 63 #include "telnetc.h"
62 #include "trace_dsc.h" 64 #include "trace_dsc.h"
63 #include "utilc.h" 65 #include "utilc.h"
@@ -464,7 +466,7 @@ LIB3270_EXPORT int lib3270_get_field_len(H3270 *hSession, int baddr) @@ -464,7 +466,7 @@ LIB3270_EXPORT int lib3270_get_field_len(H3270 *hSession, int baddr)
464 if(baddr < 0) 466 if(baddr < 0)
465 baddr = hSession->cursor_addr; 467 baddr = hSession->cursor_addr;
466 468
467 - addr = find_field_attribute(hSession,baddr); 469 + addr = lib3270_field_addr(hSession,baddr);
468 470
469 if(addr < 0) 471 if(addr < 0)
470 return -1; 472 return -1;
@@ -550,7 +552,7 @@ int lib3270_field_length(H3270 *hSession, int baddr) @@ -550,7 +552,7 @@ int lib3270_field_length(H3270 *hSession, int baddr)
550 int addr; 552 int addr;
551 int width = 0; 553 int width = 0;
552 554
553 - addr = find_field_attribute(hSession,baddr); 555 + addr = lib3270_field_addr(hSession,baddr);
554 556
555 if(addr < 0) 557 if(addr < 0)
556 return -1; 558 return -1;
@@ -575,7 +577,7 @@ int lib3270_field_length(H3270 *hSession, int baddr) @@ -575,7 +577,7 @@ int lib3270_field_length(H3270 *hSession, int baddr)
575 */ 577 */
576 unsigned char get_field_attribute(H3270 *hSession, int baddr) 578 unsigned char get_field_attribute(H3270 *hSession, int baddr)
577 { 579 {
578 - return hSession->ea_buf[find_field_attribute(hSession,baddr)].fa; 580 + return hSession->ea_buf[lib3270_field_addr(hSession,baddr)].fa;
579 } 581 }
580 582
581 /** 583 /**
@@ -622,7 +624,7 @@ LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr) @@ -622,7 +624,7 @@ LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr)
622 if(baddr < 0) 624 if(baddr < 0)
623 baddr = hSession->cursor_addr; 625 baddr = hSession->cursor_addr;
624 626
625 - int faddr = find_field_attribute(hSession,baddr); 627 + int faddr = lib3270_field_addr(hSession,baddr);
626 628
627 return FA_IS_PROTECTED(hSession->ea_buf[faddr].fa) ? 1 : 0; 629 return FA_IS_PROTECTED(hSession->ea_buf[faddr].fa) ? 1 : 0;
628 } 630 }
@@ -1827,7 +1829,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er @@ -1827,7 +1829,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er
1827 if (d != DBCS_NONE && why == DBCS_FIELD) { 1829 if (d != DBCS_NONE && why == DBCS_FIELD) {
1828 ABORT_WRITE("SI in DBCS field"); 1830 ABORT_WRITE("SI in DBCS field");
1829 } 1831 }
1830 - fa_addr = find_field_attribute(hSession,hSession->buffer_addr); 1832 + fa_addr = lib3270_field_addr(hSession,hSession->buffer_addr);
1831 baddr = hSession->buffer_addr; 1833 baddr = hSession->buffer_addr;
1832 DEC_BA(baddr); 1834 DEC_BA(baddr);
1833 while (!aborted && 1835 while (!aborted &&
@@ -2145,7 +2147,7 @@ ctlr_lookleft_state(int baddr, enum dbcs_why *why) @@ -2145,7 +2147,7 @@ ctlr_lookleft_state(int baddr, enum dbcs_why *why)
2145 return DBCS_NONE; 2147 return DBCS_NONE;
2146 2148
2147 /* Find the field attribute, if any. */ 2149 /* Find the field attribute, if any. */
2148 - faddr = find_field_attribute(baddr); 2150 + faddr = lib3270_field_addr(baddr);
2149 2151
2150 /* 2152 /*
2151 * First in precedence is a DBCS field. 2153 * First in precedence is a DBCS field.
@@ -2258,7 +2260,7 @@ int ctlr_dbcs_postprocess(H3270 *hSession) @@ -2258,7 +2260,7 @@ int ctlr_dbcs_postprocess(H3270 *hSession)
2258 * dummy at -1. Also compute the starting and ending points for the 2260 * dummy at -1. Also compute the starting and ending points for the
2259 * scan: the first location after that field attribute. 2261 * scan: the first location after that field attribute.
2260 */ 2262 */
2261 - faddr0 = find_field_attribute(0); 2263 + faddr0 = lib3270_field_addr(0);
2262 baddr = faddr0; 2264 baddr = faddr0;
2263 INC_BA(baddr); 2265 INC_BA(baddr);
2264 if (faddr0 < 0) 2266 if (faddr0 < 0)
@@ -2738,7 +2740,7 @@ void mdt_set(H3270 *hSession, int baddr) @@ -2738,7 +2740,7 @@ void mdt_set(H3270 *hSession, int baddr)
2738 { 2740 {
2739 int faddr; 2741 int faddr;
2740 2742
2741 - faddr = find_field_attribute(hSession,baddr); 2743 + faddr = lib3270_field_addr(hSession,baddr);
2742 if (faddr >= 0 && !(hSession->ea_buf[faddr].fa & FA_MODIFY)) 2744 if (faddr >= 0 && !(hSession->ea_buf[faddr].fa & FA_MODIFY))
2743 { 2745 {
2744 hSession->ea_buf[faddr].fa |= FA_MODIFY; 2746 hSession->ea_buf[faddr].fa |= FA_MODIFY;
@@ -2749,7 +2751,7 @@ void mdt_set(H3270 *hSession, int baddr) @@ -2749,7 +2751,7 @@ void mdt_set(H3270 *hSession, int baddr)
2749 2751
2750 void mdt_clear(H3270 *hSession, int baddr) 2752 void mdt_clear(H3270 *hSession, int baddr)
2751 { 2753 {
2752 - int faddr = find_field_attribute(hSession,baddr); 2754 + int faddr = lib3270_field_addr(hSession,baddr);
2753 2755
2754 if (faddr >= 0 && (hSession->ea_buf[faddr].fa & FA_MODIFY)) 2756 if (faddr >= 0 && (hSession->ea_buf[faddr].fa & FA_MODIFY))
2755 { 2757 {
src/lib3270/cursor.c
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
34 34
35 #include "private.h" 35 #include "private.h"
36 #include <lib3270/trace.h> 36 #include <lib3270/trace.h>
  37 +#include <lib3270/log.h>
37 #include <lib3270/selection.h> 38 #include <lib3270/selection.h>
38 39
39 #include "kybdc.h" 40 #include "kybdc.h"
src/lib3270/ft.c
@@ -39,6 +39,7 @@ @@ -39,6 +39,7 @@
39 #include <config.h> 39 #include <config.h>
40 #include <lib3270.h> 40 #include <lib3270.h>
41 #include <lib3270/filetransfer.h> 41 #include <lib3270/filetransfer.h>
  42 +#include <lib3270/log.h>
42 #include "private.h" 43 #include "private.h"
43 #include <lib3270/trace.h> 44 #include <lib3270/trace.h>
44 45
@@ -404,8 +405,8 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -404,8 +405,8 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
404 if(!ft) 405 if(!ft)
405 return EINVAL; 406 return EINVAL;
406 407
407 - recfm = (ft->flags & FT_RECORD_FORMAT_MASK) >> 8;  
408 - units = (ft->flags & FT_ALLOCATION_UNITS_MASK) >> 12; 408 + recfm = (ft->flags & LIB3270_FT_RECORD_FORMAT_MASK) >> 8;
  409 + units = (ft->flags & LIB3270_FT_ALLOCATION_UNITS_MASK) >> 12;
409 ft->ascii_flag = (ft->flags & LIB3270_FT_OPTION_ASCII) ? 1 : 0; 410 ft->ascii_flag = (ft->flags & LIB3270_FT_OPTION_ASCII) ? 1 : 0;
410 ft->cr_flag = (ft->flags & LIB3270_FT_OPTION_CRLF) ? 1 : 0; 411 ft->cr_flag = (ft->flags & LIB3270_FT_OPTION_CRLF) ? 1 : 0;
411 ft->remap_flag = (ft->flags & LIB3270_FT_OPTION_REMAP) ? 1 : 0; 412 ft->remap_flag = (ft->flags & LIB3270_FT_OPTION_REMAP) ? 1 : 0;
@@ -568,7 +569,7 @@ static double finish(H3270FT *ft) @@ -568,7 +569,7 @@ static double finish(H3270FT *ft)
568 } 569 }
569 570
570 // Clean up the state. 571 // Clean up the state.
571 - set_ft_state(ft,FT_NONE); 572 + set_ft_state(ft,LIB3270_FT_STATE_NONE);
572 573
573 ft_update_length(ft); 574 ft_update_length(ft);
574 575
@@ -643,8 +644,8 @@ void ft_running(H3270FT *ft, Boolean is_cut) @@ -643,8 +644,8 @@ void ft_running(H3270FT *ft, Boolean is_cut)
643 644
644 gettimeofday(&ft->starting_time, (struct timezone *)NULL); 645 gettimeofday(&ft->starting_time, (struct timezone *)NULL);
645 646
646 - if (ft->state == FT_AWAIT_ACK)  
647 - set_ft_state(ft,FT_RUNNING); 647 + if (ft->state == LIB3270_FT_STATE_AWAIT_ACK)
  648 + set_ft_state(ft,LIB3270_FT_STATE_RUNNING);
648 649
649 ft->cbk.running(ft->host,is_cut,ft->user_data); 650 ft->cbk.running(ft->host,is_cut,ft->user_data);
650 651
@@ -670,9 +671,9 @@ LIB3270_EXPORT struct lib3270_ft_callbacks * lib3270_get_ft_callbacks(H3270 *ses @@ -670,9 +671,9 @@ LIB3270_EXPORT struct lib3270_ft_callbacks * lib3270_get_ft_callbacks(H3270 *ses
670 // Process a protocol-generated abort. 671 // Process a protocol-generated abort.
671 void ft_aborting(H3270FT *h, const char *reason) 672 void ft_aborting(H3270FT *h, const char *reason)
672 { 673 {
673 - if (h->state == FT_RUNNING || h->state == FT_ABORT_WAIT) 674 + if (h->state == LIB3270_FT_STATE_RUNNING || h->state == LIB3270_FT_STATE_ABORT_WAIT)
674 { 675 {
675 - set_ft_state(h,FT_ABORT_SENT); 676 + set_ft_state(h,LIB3270_FT_STATE_ABORT_SENT);
676 h->cbk.message(h->host,N_("Aborting..."),h->user_data); 677 h->cbk.message(h->host,N_("Aborting..."),h->user_data);
677 h->cbk.aborting(h->host,reason,h->user_data); 678 h->cbk.aborting(h->host,reason,h->user_data);
678 } 679 }
src/lib3270/ft_cut.c
@@ -39,17 +39,18 @@ @@ -39,17 +39,18 @@
39 39
40 #include "private.h" 40 #include "private.h"
41 41
  42 +#include <lib3270.h>
  43 +#include <lib3270/actions.h>
  44 +
42 #if defined(X3270_FT) /*[*/ 45 #if defined(X3270_FT) /*[*/
43 46
44 #include "3270ds.h" 47 #include "3270ds.h"
45 -//#include "actionsc.h"  
46 #include "ctlrc.h" 48 #include "ctlrc.h"
47 #include "ft_cutc.h" 49 #include "ft_cutc.h"
48 #include "ft_cut_ds.h" 50 #include "ft_cut_ds.h"
49 #include "ftc.h" 51 #include "ftc.h"
50 #include "kybdc.h" 52 #include "kybdc.h"
51 #include "popupsc.h" 53 #include "popupsc.h"
52 -// #include "tablesc.h"  
53 #include "telnetc.h" 54 #include "telnetc.h"
54 #include "trace_dsc.h" 55 #include "trace_dsc.h"
55 #include "utilc.h" 56 #include "utilc.h"
@@ -343,7 +344,7 @@ static void cut_control_code(H3270 *hSession) @@ -343,7 +344,7 @@ static void cut_control_code(H3270 *hSession)
343 hSession->cut_xfer_in_progress = 0; 344 hSession->cut_xfer_in_progress = 0;
344 cut_ack(hSession); 345 cut_ack(hSession);
345 346
346 - if (lib3270_get_ft_state(hSession) == FT_ABORT_SENT && ft->saved_errmsg != CN) 347 + if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_SENT && ft->saved_errmsg != CN)
347 { 348 {
348 buf = ft->saved_errmsg; 349 buf = ft->saved_errmsg;
349 ft->saved_errmsg = CN; 350 ft->saved_errmsg = CN;
@@ -394,7 +395,7 @@ static void cut_data_request(H3270 *hSession) @@ -394,7 +395,7 @@ static void cut_data_request(H3270 *hSession)
394 unsigned char attr; 395 unsigned char attr;
395 396
396 trace_ds(hSession,"< FT DATA_REQUEST %u\n", from6(hSession, seq)); 397 trace_ds(hSession,"< FT DATA_REQUEST %u\n", from6(hSession, seq));
397 - if (lib3270_get_ft_state(hSession) == FT_ABORT_WAIT) 398 + if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_WAIT)
398 { 399 {
399 cut_abort(hSession,SC_ABORT_FILE,"%s", N_("Transfer cancelled by user") ); 400 cut_abort(hSession,SC_ABORT_FILE,"%s", N_("Transfer cancelled by user") );
400 return; 401 return;
src/lib3270/ft_dft.c
@@ -44,23 +44,18 @@ @@ -44,23 +44,18 @@
44 44
45 #if defined(X3270_FT) /*[*/ 45 #if defined(X3270_FT) /*[*/
46 46
47 -//#include "appres.h"  
48 #include "3270ds.h" 47 #include "3270ds.h"
49 #include "ft_dft_ds.h" 48 #include "ft_dft_ds.h"
50 -  
51 -//#include "actionsc.h"  
52 #include "kybdc.h" 49 #include "kybdc.h"
53 #include "ft_dftc.h" 50 #include "ft_dftc.h"
54 #include "ftc.h" 51 #include "ftc.h"
55 -//#include "tablesc.h"  
56 #include "telnetc.h" 52 #include "telnetc.h"
57 #include "trace_dsc.h" 53 #include "trace_dsc.h"
58 #include "utilc.h" 54 #include "utilc.h"
  55 +#include <lib3270/log.h>
59 56
60 #include <errno.h> 57 #include <errno.h>
61 58
62 -// extern unsigned char aid;  
63 -  
64 /* Macros. */ 59 /* Macros. */
65 #define OPEN_MSG "FT:MSG" /* Open request for message */ 60 #define OPEN_MSG "FT:MSG" /* Open request for message */
66 #define END_TRANSFER "TRANS03" /* Message for xfer complete */ 61 #define END_TRANSFER "TRANS03" /* Message for xfer complete */
@@ -100,7 +95,7 @@ void ft_dft_data(H3270 *hSession, unsigned char *data, int GNUC_UNUSED(length)) @@ -100,7 +95,7 @@ void ft_dft_data(H3270 *hSession, unsigned char *data, int GNUC_UNUSED(length))
100 unsigned short data_length, data_type; 95 unsigned short data_length, data_type;
101 unsigned char *cp; 96 unsigned char *cp;
102 97
103 - if (lib3270_get_ft_state(hSession) == FT_NONE) 98 + if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_NONE)
104 { 99 {
105 trace_ds(hSession," (no transfer in progress)\n"); 100 trace_ds(hSession," (no transfer in progress)\n");
106 return; 101 return;
@@ -228,7 +223,7 @@ static void dft_data_insert(H3270 *hSession, struct data_buffer *data_bufr) @@ -228,7 +223,7 @@ static void dft_data_insert(H3270 *hSession, struct data_buffer *data_bufr)
228 int my_length; 223 int my_length;
229 unsigned char * cp; 224 unsigned char * cp;
230 225
231 - if(!ft->message_flag && lib3270_get_ft_state(hSession) == FT_ABORT_WAIT) 226 + if(!ft->message_flag && lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_WAIT)
232 { 227 {
233 dft_abort(hSession,TR_DATA_INSERT, "%s", _("Transfer cancelled by user") ); 228 dft_abort(hSession,TR_DATA_INSERT, "%s", _("Transfer cancelled by user") );
234 return; 229 return;
@@ -273,7 +268,7 @@ static void dft_data_insert(H3270 *hSession, struct data_buffer *data_bufr) @@ -273,7 +268,7 @@ static void dft_data_insert(H3270 *hSession, struct data_buffer *data_bufr)
273 ft_complete(hSession->ft,(const char *) msgp); 268 ft_complete(hSession->ft,(const char *) msgp);
274 lib3270_free(msgp); 269 lib3270_free(msgp);
275 } 270 }
276 - else if (lib3270_get_ft_state(hSession) == FT_ABORT_SENT && ((H3270FT *) hSession->ft)->abort_string != CN) 271 + else if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_SENT && ((H3270FT *) hSession->ft)->abort_string != CN)
277 { 272 {
278 trace_ds(hSession,"ABORT_TRANSFER [%s]\n",msgp); 273 trace_ds(hSession,"ABORT_TRANSFER [%s]\n",msgp);
279 lib3270_free(msgp); 274 lib3270_free(msgp);
@@ -371,7 +366,7 @@ static void dft_get_request(H3270 *hSession) @@ -371,7 +366,7 @@ static void dft_get_request(H3270 *hSession)
371 366
372 trace_ds(hSession," Get\n"); 367 trace_ds(hSession," Get\n");
373 368
374 - if (!ft->message_flag && lib3270_get_ft_state(hSession) == FT_ABORT_WAIT) 369 + if (!ft->message_flag && lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_WAIT)
375 { 370 {
376 dft_abort(hSession,TR_GET_REQ, _( "Transfer cancelled by user" ) ); 371 dft_abort(hSession,TR_GET_REQ, _( "Transfer cancelled by user" ) );
377 return; 372 return;
src/lib3270/host.c
@@ -54,6 +54,8 @@ @@ -54,6 +54,8 @@
54 #include <errno.h> 54 #include <errno.h>
55 #include <lib3270/internals.h> 55 #include <lib3270/internals.h>
56 #include <lib3270/properties.h> 56 #include <lib3270/properties.h>
  57 +#include <lib3270/log.h>
  58 +#include <lib3270/trace.h>
57 59
58 /** 60 /**
59 * @brief Called from timer to attempt an automatic reconnection. 61 * @brief Called from timer to attempt an automatic reconnection.
@@ -152,7 +154,7 @@ void lib3270_set_disconnected(H3270 *hSession) @@ -152,7 +154,7 @@ void lib3270_set_disconnected(H3270 *hSession)
152 hSession->starting = 0; 154 hSession->starting = 0;
153 hSession->ssl.state = LIB3270_SSL_UNDEFINED; 155 hSession->ssl.state = LIB3270_SSL_UNDEFINED;
154 156
155 - set_status(hSession,OIA_FLAG_UNDERA,False); 157 + set_status(hSession,LIB3270_FLAG_UNDERA,False);
156 158
157 lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False); 159 lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False);
158 160
src/lib3270/html.c
@@ -236,7 +236,7 @@ @@ -236,7 +236,7 @@
236 236
237 LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option) 237 LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option)
238 { 238 {
239 - int row, baddr; 239 + unsigned int row, baddr;
240 struct html_info info; 240 struct html_info info;
241 241
242 memset(&info,0,sizeof(info)); 242 memset(&info,0,sizeof(info));
@@ -256,7 +256,7 @@ @@ -256,7 +256,7 @@
256 baddr = 0; 256 baddr = 0;
257 for(row=0;row < session->rows;row++) 257 for(row=0;row < session->rows;row++)
258 { 258 {
259 - int col; 259 + unsigned int col;
260 260
261 for(col = 0; col < session->cols;col++) 261 for(col = 0; col < session->cols;col++)
262 { 262 {
src/lib3270/iocalls.c
@@ -48,6 +48,9 @@ @@ -48,6 +48,9 @@
48 #include <fcntl.h> 48 #include <fcntl.h>
49 #endif 49 #endif
50 50
  51 +#include <lib3270/log.h>
  52 +#include <lib3270/trace.h>
  53 +
51 #define MILLION 1000000L 54 #define MILLION 1000000L
52 // 55 //
53 //#if defined(_WIN32) 56 //#if defined(_WIN32)
src/lib3270/kybd.c
@@ -43,6 +43,7 @@ struct ta; @@ -43,6 +43,7 @@ struct ta;
43 #include "private.h" 43 #include "private.h"
44 #include <lib3270/trace.h> 44 #include <lib3270/trace.h>
45 #include <lib3270/selection.h> 45 #include <lib3270/selection.h>
  46 +#include <lib3270/log.h>
46 47
47 #ifndef ANDROID 48 #ifndef ANDROID
48 #include <stdlib.h> 49 #include <stdlib.h>
@@ -80,7 +81,7 @@ struct ta; @@ -80,7 +81,7 @@ struct ta;
80 81
81 #include <lib3270/actions.h> 82 #include <lib3270/actions.h>
82 83
83 -#include "api.h" 84 +// #include "api.h"
84 85
85 86
86 //#ifdef DEBUG 87 //#ifdef DEBUG
@@ -739,7 +740,7 @@ static Boolean key_Character(H3270 *hSession, int code, Boolean with_ge, Boolean @@ -739,7 +740,7 @@ static Boolean key_Character(H3270 *hSession, int code, Boolean with_ge, Boolean
739 return False; 740 return False;
740 } 741 }
741 baddr = hSession->cursor_addr; 742 baddr = hSession->cursor_addr;
742 - faddr = find_field_attribute(hSession,baddr); 743 + faddr = lib3270_field_addr(hSession,baddr);
743 fa = get_field_attribute(hSession,baddr); 744 fa = get_field_attribute(hSession,baddr);
744 745
745 if (hSession->ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) 746 if (hSession->ea_buf[baddr].fa || FA_IS_PROTECTED(fa))
@@ -1394,7 +1395,7 @@ static void do_erase(H3270 *hSession) @@ -1394,7 +1395,7 @@ static void do_erase(H3270 *hSession)
1394 enum dbcs_state d; 1395 enum dbcs_state d;
1395 1396
1396 baddr = hSession->cursor_addr; 1397 baddr = hSession->cursor_addr;
1397 - faddr = find_field_attribute(hSession,baddr); 1398 + faddr = lib3270_field_addr(hSession,baddr);
1398 if (faddr == baddr || FA_IS_PROTECTED(hSession->ea_buf[baddr].fa)) 1399 if (faddr == baddr || FA_IS_PROTECTED(hSession->ea_buf[baddr].fa))
1399 { 1400 {
1400 operator_error(hSession,KL_OERR_PROTECTED); 1401 operator_error(hSession,KL_OERR_PROTECTED);
@@ -1685,7 +1686,7 @@ LIB3270_EXPORT int lib3270_newline(H3270 *hSession) @@ -1685,7 +1686,7 @@ LIB3270_EXPORT int lib3270_newline(H3270 *hSession)
1685 #endif /*]*/ 1686 #endif /*]*/
1686 baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); /* down */ 1687 baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); /* down */
1687 baddr = (baddr / hSession->cols) * hSession->cols; /* 1st col */ 1688 baddr = (baddr / hSession->cols) * hSession->cols; /* 1st col */
1688 - faddr = find_field_attribute(hSession,baddr); 1689 + faddr = lib3270_field_addr(hSession,baddr);
1689 fa = hSession->ea_buf[faddr].fa; 1690 fa = hSession->ea_buf[faddr].fa;
1690 if (faddr != baddr && !FA_IS_PROTECTED(fa)) 1691 if (faddr != baddr && !FA_IS_PROTECTED(fa))
1691 cursor_move(hSession,baddr); 1692 cursor_move(hSession,baddr);
@@ -2163,7 +2164,7 @@ int lib3270_get_field_end(H3270 *hSession, int baddr) @@ -2163,7 +2164,7 @@ int lib3270_get_field_end(H3270 *hSession, int baddr)
2163 if (!hSession->formatted) 2164 if (!hSession->formatted)
2164 return errno = EINVAL; 2165 return errno = EINVAL;
2165 2166
2166 - faddr = find_field_attribute(hSession,baddr); 2167 + faddr = lib3270_field_addr(hSession,baddr);
2167 fa = hSession->ea_buf[faddr].fa; 2168 fa = hSession->ea_buf[faddr].fa;
2168 if (faddr == baddr || FA_IS_PROTECTED(fa)) 2169 if (faddr == baddr || FA_IS_PROTECTED(fa))
2169 return errno = EPERM; 2170 return errno = EPERM;
@@ -2243,7 +2244,7 @@ static Boolean remargin(H3270 *hSession, int lmargin) @@ -2243,7 +2244,7 @@ static Boolean remargin(H3270 *hSession, int lmargin)
2243 b0 = baddr; 2244 b0 = baddr;
2244 ever = True; 2245 ever = True;
2245 } 2246 }
2246 - faddr = find_field_attribute(hSession,baddr); 2247 + faddr = lib3270_field_addr(hSession,baddr);
2247 fa = hSession->ea_buf[faddr].fa; 2248 fa = hSession->ea_buf[faddr].fa;
2248 2249
2249 if (faddr == baddr || FA_IS_PROTECTED(fa)) 2250 if (faddr == baddr || FA_IS_PROTECTED(fa))
src/lib3270/linux/connect.c
@@ -54,6 +54,8 @@ @@ -54,6 +54,8 @@
54 #include "screen.h" 54 #include "screen.h"
55 55
56 #include <lib3270/internals.h> 56 #include <lib3270/internals.h>
  57 +#include <lib3270/log.h>
  58 +#include <lib3270/trace.h>
57 59
58 /*---[ Implement ]-------------------------------------------------------------------------------*/ 60 /*---[ Implement ]-------------------------------------------------------------------------------*/
59 61
src/lib3270/linux/event_dispatcher.c
@@ -35,9 +35,8 @@ @@ -35,9 +35,8 @@
35 #include "../private.h" 35 #include "../private.h"
36 #include <sys/time.h> 36 #include <sys/time.h>
37 #include <sys/types.h> 37 #include <sys/types.h>
38 -// #include "../xioc.h"  
39 -// #include "telnetc.h"  
40 -// #include "utilc.h" 38 +#include <lib3270/log.h>
  39 +#include <lib3270/trace.h>
41 40
42 #define MILLION 1000000L 41 #define MILLION 1000000L
43 #define TN (timeout_t *)NULL 42 #define TN (timeout_t *)NULL
src/lib3270/log.c
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 #include <config.h> 41 #include <config.h>
42 #include <lib3270.h> 42 #include <lib3270.h>
43 #include <lib3270/log.h> 43 #include <lib3270/log.h>
44 -#include "api.h" 44 +// #include "api.h"
45 45
46 /*---[ Prototipes ]-----------------------------------------------------------------------------------------*/ 46 /*---[ Prototipes ]-----------------------------------------------------------------------------------------*/
47 47
src/lib3270/paste.c
@@ -77,10 +77,11 @@ @@ -77,10 +77,11 @@
77 #if defined(X3270_DBCS) /*[*/ 77 #if defined(X3270_DBCS) /*[*/
78 #include "widec.h" 78 #include "widec.h"
79 #endif /*]*/ 79 #endif /*]*/
80 -#include "api.h" 80 +// #include "api.h"
81 81
82 #include <lib3270/popup.h> 82 #include <lib3270/popup.h>
83 #include <lib3270/selection.h> 83 #include <lib3270/selection.h>
  84 +#include <lib3270/log.h>
84 85
85 /*---[ Struct ]-------------------------------------------------------------------------------------------------*/ 86 /*---[ Struct ]-------------------------------------------------------------------------------------------------*/
86 87
@@ -117,7 +118,7 @@ @@ -117,7 +118,7 @@
117 ever = True; 118 ever = True;
118 } 119 }
119 120
120 - faddr = find_field_attribute(hSession,baddr); 121 + faddr = lib3270_field_addr(hSession,baddr);
121 fa = hSession->ea_buf[faddr].fa; 122 fa = hSession->ea_buf[faddr].fa;
122 if (faddr == baddr || FA_IS_PROTECTED(fa)) 123 if (faddr == baddr || FA_IS_PROTECTED(fa))
123 { 124 {
@@ -138,7 +139,7 @@ @@ -138,7 +139,7 @@
138 139
139 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SMART_PASTE)) 140 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SMART_PASTE))
140 { 141 {
141 - int faddr = find_field_attribute(hSession,hSession->cursor_addr); 142 + int faddr = lib3270_field_addr(hSession,hSession->cursor_addr);
142 if(FA_IS_PROTECTED(hSession->ea_buf[faddr].fa)) 143 if(FA_IS_PROTECTED(hSession->ea_buf[faddr].fa))
143 hSession->cursor_addr++; 144 hSession->cursor_addr++;
144 else 145 else
@@ -190,7 +191,7 @@ static int set_string(H3270 *hSession, const unsigned char *str) @@ -190,7 +191,7 @@ static int set_string(H3270 *hSession, const unsigned char *str)
190 191
191 baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); /* down */ 192 baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); /* down */
192 baddr = (baddr / hSession->cols) * hSession->cols; /* 1st col */ 193 baddr = (baddr / hSession->cols) * hSession->cols; /* 1st col */
193 - faddr = find_field_attribute(hSession,baddr); 194 + faddr = lib3270_field_addr(hSession,baddr);
194 fa = hSession->ea_buf[faddr].fa; 195 fa = hSession->ea_buf[faddr].fa;
195 if (faddr != baddr && !FA_IS_PROTECTED(fa)) 196 if (faddr != baddr && !FA_IS_PROTECTED(fa))
196 cursor_move(hSession,baddr); 197 cursor_move(hSession,baddr);
@@ -232,7 +233,7 @@ static int set_string(H3270 *hSession, const unsigned char *str) @@ -232,7 +233,7 @@ static int set_string(H3270 *hSession, const unsigned char *str)
232 * @return -1 if error (sets errno) or number of processed characters. 233 * @return -1 if error (sets errno) or number of processed characters.
233 * 234 *
234 */ 235 */
235 -LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, const unsigned char *str) 236 +LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, unsigned int row, unsigned int col, const unsigned char *str)
236 { 237 {
237 int rc = 0; 238 int rc = 0;
238 239
@@ -248,7 +249,7 @@ LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, cons @@ -248,7 +249,7 @@ LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, cons
248 row--; 249 row--;
249 col--; 250 col--;
250 251
251 - if(row >= 0 && col >= 0 && row <= hSession->rows && col <= hSession->cols) 252 + if(row <= hSession->rows && col <= hSession->cols)
252 { 253 {
253 hSession->cbk.suspend(hSession); 254 hSession->cbk.suspend(hSession);
254 255
src/lib3270/private.h
@@ -36,7 +36,8 @@ @@ -36,7 +36,8 @@
36 #include <config.h> /* autoconf settings */ 36 #include <config.h> /* autoconf settings */
37 #include <lib3270.h> /* lib3270 API calls and defs */ 37 #include <lib3270.h> /* lib3270 API calls and defs */
38 #include <lib3270/charset.h> 38 #include <lib3270/charset.h>
39 -#include "api.h" 39 +#include <lib3270/session.h>
  40 +// #include "api.h"
40 41
41 #if defined(HAVE_LIBSSL) 42 #if defined(HAVE_LIBSSL)
42 #include <openssl/ssl.h> 43 #include <openssl/ssl.h>
@@ -158,12 +159,33 @@ struct toggle_name { @@ -158,12 +159,33 @@ struct toggle_name {
158 int index; 159 int index;
159 }; 160 };
160 161
  162 +/// @brief State macros
  163 +#define PCONNECTED lib3270_pconnected(hSession)
  164 +#define HALF_CONNECTED lib3270_half_connected(hSession)
  165 +#define CONNECTED lib3270_connected(hSession)
161 166
162 -/* input key type */ 167 +#define IN_NEITHER lib3270_in_neither(hSession)
  168 +#define IN_ANSI lib3270_in_ansi(hSession)
  169 +#define IN_3270 lib3270_in_3270(hSession)
  170 +#define IN_SSCP lib3270_in_sscp(hSession)
  171 +#define IN_TN3270E lib3270_in_tn3270e(hSession)
  172 +#define IN_E lib3270_in_e(hSession)
163 173
164 -/* Naming convention for private actions. */ 174 +/// @brief Naming convention for private actions.
165 #define PA_PFX "PA-" 175 #define PA_PFX "PA-"
166 176
  177 +#define GR_BLINK 0x01
  178 +#define GR_REVERSE 0x02
  179 +#define GR_UNDERLINE 0x04
  180 +#define GR_INTENSIFY 0x08
  181 +
  182 +#define CS_MASK 0x03 ///< @brief mask for specific character sets */
  183 +#define CS_BASE 0x00 ///< @brief base character set (X'00') */
  184 +#define CS_APL 0x01 ///< @brief APL character set (X'01' or GE) */
  185 +#define CS_LINEDRAW 0x02 ///< @brief DEC line-drawing character set (ANSI) */
  186 +#define CS_DBCS 0x03 ///< @brief DBCS character set (X'F8') */
  187 +#define CS_GE 0x04 ///< @brief cs flag for Graphic Escape */
  188 +
167 /// @brief Shorthand macros 189 /// @brief Shorthand macros
168 #define CN ((char *) NULL) 190 #define CN ((char *) NULL)
169 #define PN ((XtPointer) NULL) 191 #define PN ((XtPointer) NULL)
@@ -313,7 +335,7 @@ struct lib3270_state_callback @@ -313,7 +335,7 @@ struct lib3270_state_callback
313 */ 335 */
314 struct _h3270 336 struct _h3270
315 { 337 {
316 - struct lib3270_session_callbacks cbk; // Callback table - Always the first one. 338 + struct lib3270_session_callbacks cbk; ///< @brief Callback table - Always the first one.
317 339
318 // Session info 340 // Session info
319 char id; ///< @brief Session Identifier. 341 char id; ///< @brief Session Identifier.
@@ -746,5 +768,7 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); @@ -746,5 +768,7 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on);
746 /// @brief Clear element at adress. 768 /// @brief Clear element at adress.
747 LIB3270_INTERNAL void clear_chr(H3270 *hSession, int baddr); 769 LIB3270_INTERNAL void clear_chr(H3270 *hSession, int baddr);
748 770
  771 + LIB3270_INTERNAL unsigned char get_field_attribute(H3270 *session, int baddr);
  772 +
749 #endif 773 #endif
750 774
src/lib3270/resolver.c
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 59
60 #include <stdio.h> 60 #include <stdio.h>
61 #include <string.h> 61 #include <string.h>
62 -#include "api.h" 62 +// #include "api.h"
63 63
64 #include "resolverc.h" 64 #include "resolverc.h"
65 #include "statusc.h" 65 #include "statusc.h"
src/lib3270/resources.c
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 36
37 #include "private.h" 37 #include "private.h"
38 #include "utilc.h" 38 #include "utilc.h"
  39 +#include <lib3270/log.h>
39 40
40 extern String fallbacks[]; 41 extern String fallbacks[];
41 42
src/lib3270/rpq.c
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 #include <stdlib.h> 53 #include <stdlib.h>
54 #endif // !ANDROID 54 #endif // !ANDROID
55 55
56 -#include "api.h" 56 +// #include "api.h"
57 57
58 #include <assert.h> 58 #include <assert.h>
59 #include <stdarg.h> 59 #include <stdarg.h>
@@ -66,6 +66,8 @@ @@ -66,6 +66,8 @@
66 #include "utilc.h" 66 #include "utilc.h"
67 #include "sf.h" 67 #include "sf.h"
68 68
  69 +#include <lib3270/log.h>
  70 +
69 /* Statics */ 71 /* Statics */
70 static Boolean select_rpq_terms(H3270 *hSession); 72 static Boolean select_rpq_terms(H3270 *hSession);
71 static int get_rpq_timezone(H3270 *hSession); 73 static int get_rpq_timezone(H3270 *hSession);
src/lib3270/screen.c
@@ -50,8 +50,8 @@ @@ -50,8 +50,8 @@
50 #include "errno.h" 50 #include "errno.h"
51 #include "statusc.h" 51 #include "statusc.h"
52 #include "togglesc.h" 52 #include "togglesc.h"
53 -#include "api.h"  
54 #include <lib3270/actions.h> 53 #include <lib3270/actions.h>
  54 +#include <lib3270/log.h>
55 55
56 #if defined(_WIN32) 56 #if defined(_WIN32)
57 #include <windows.h> 57 #include <windows.h>
@@ -165,10 +165,10 @@ int screen_init(H3270 *session) @@ -165,10 +165,10 @@ int screen_init(H3270 *session)
165 static unsigned short color_from_fa(H3270 *hSession, unsigned char fa) 165 static unsigned short color_from_fa(H3270 *hSession, unsigned char fa)
166 { 166 {
167 if (hSession->m3279) 167 if (hSession->m3279)
168 - return get_color_pair(DEFCOLOR_MAP(fa),0) | COLOR_ATTR_FIELD; 168 + return get_color_pair(DEFCOLOR_MAP(fa),0) | LIB3270_ATTR_FIELD;
169 169
170 // Green on black 170 // Green on black
171 - return get_color_pair(0,0) | COLOR_ATTR_FIELD | ((FA_IS_HIGH(fa)) ? COLOR_ATTR_INTENSIFY : 0); 171 + return get_color_pair(0,0) | LIB3270_ATTR_FIELD | ((FA_IS_HIGH(fa)) ? LIB3270_ATTR_INTENSIFY : 0);
172 } 172 }
173 173
174 /* 174 /*
@@ -322,7 +322,7 @@ void screen_update(H3270 *session, int bstart, int bend) @@ -322,7 +322,7 @@ void screen_update(H3270 *session, int bstart, int bend)
322 322
323 fa = get_field_attribute(session,bstart); 323 fa = get_field_attribute(session,bstart);
324 a = color_from_fa(session,fa); 324 a = color_from_fa(session,fa);
325 - fa_addr = find_field_attribute(session,bstart); // may be -1, that's okay 325 + fa_addr = lib3270_field_addr(session,bstart); // may be -1, that's okay
326 326
327 for(baddr = bstart; baddr < bend; baddr++) 327 for(baddr = bstart; baddr < bend; baddr++)
328 { 328 {
@@ -556,7 +556,7 @@ void set_status(H3270 *session, LIB3270_FLAG id, Boolean on) @@ -556,7 +556,7 @@ void set_status(H3270 *session, LIB3270_FLAG id, Boolean on)
556 void status_ctlr_done(H3270 *session) 556 void status_ctlr_done(H3270 *session)
557 { 557 {
558 CHECK_SESSION_HANDLE(session); 558 CHECK_SESSION_HANDLE(session);
559 - set_status(session,OIA_FLAG_UNDERA,True); 559 + set_status(session,LIB3270_FLAG_UNDERA,True);
560 session->cbk.ctlr_done(session); 560 session->cbk.ctlr_done(session);
561 } 561 }
562 562
@@ -697,7 +697,7 @@ void status_changed(H3270 *session, LIB3270_MESSAGE id) @@ -697,7 +697,7 @@ void status_changed(H3270 *session, LIB3270_MESSAGE id)
697 void status_twait(H3270 *session) 697 void status_twait(H3270 *session)
698 { 698 {
699 CHECK_SESSION_HANDLE(session); 699 CHECK_SESSION_HANDLE(session);
700 - set_status(session,OIA_FLAG_UNDERA,False); 700 + set_status(session,LIB3270_FLAG_UNDERA,False);
701 status_changed(session,LIB3270_MESSAGE_TWAIT); 701 status_changed(session,LIB3270_MESSAGE_TWAIT);
702 } 702 }
703 703
@@ -735,7 +735,7 @@ static void status_connect(H3270 *hSession, int connected, void GNUC_UNUSED(*dun @@ -735,7 +735,7 @@ static void status_connect(H3270 *hSession, int connected, void GNUC_UNUSED(*dun
735 735
736 if (connected) 736 if (connected)
737 { 737 {
738 - set_status(hSession,OIA_FLAG_BOXSOLID,IN_3270 && !IN_SSCP); 738 + set_status(hSession,LIB3270_FLAG_BOXSOLID,IN_3270 && !IN_SSCP);
739 739
740 if (hSession->kybdlock & KL_AWAITING_FIRST) 740 if (hSession->kybdlock & KL_AWAITING_FIRST)
741 id = LIB3270_MESSAGE_AWAITING_FIRST; 741 id = LIB3270_MESSAGE_AWAITING_FIRST;
@@ -745,7 +745,7 @@ static void status_connect(H3270 *hSession, int connected, void GNUC_UNUSED(*dun @@ -745,7 +745,7 @@ static void status_connect(H3270 *hSession, int connected, void GNUC_UNUSED(*dun
745 } 745 }
746 else 746 else
747 { 747 {
748 - set_status(hSession,OIA_FLAG_BOXSOLID,False); 748 + set_status(hSession,LIB3270_FLAG_BOXSOLID,False);
749 id = LIB3270_MESSAGE_DISCONNECTED; 749 id = LIB3270_MESSAGE_DISCONNECTED;
750 } 750 }
751 751
@@ -760,15 +760,15 @@ static void status_3270_mode(H3270 *hSession, int GNUC_UNUSED(ignored), void GNU @@ -760,15 +760,15 @@ static void status_3270_mode(H3270 *hSession, int GNUC_UNUSED(ignored), void GNU
760 CHECK_SESSION_HANDLE(hSession); 760 CHECK_SESSION_HANDLE(hSession);
761 761
762 if(oia_boxsolid) 762 if(oia_boxsolid)
763 - set_status(hSession,OIA_FLAG_UNDERA,True);  
764 - set_status(hSession,OIA_FLAG_BOXSOLID,oia_boxsolid); 763 + set_status(hSession,LIB3270_FLAG_UNDERA,True);
  764 + set_status(hSession,LIB3270_FLAG_BOXSOLID,oia_boxsolid);
765 765
766 } 766 }
767 767
768 /* 768 /*
769 static void status_printer(H3270 *session, int on, void *dunno) 769 static void status_printer(H3270 *session, int on, void *dunno)
770 { 770 {
771 - set_status(session,OIA_FLAG_PRINTER,on); 771 + set_status(session,LIB3270_FLAG_PRINTER,on);
772 } 772 }
773 */ 773 */
774 774
src/lib3270/selection/actions.c
@@ -32,6 +32,8 @@ @@ -32,6 +32,8 @@
32 #include <lib3270/actions.h> 32 #include <lib3270/actions.h>
33 #include <lib3270/session.h> 33 #include <lib3270/session.h>
34 #include <lib3270/selection.h> 34 #include <lib3270/selection.h>
  35 + #include <lib3270/log.h>
  36 + #include <lib3270/trace.h>
35 #include "3270ds.h" 37 #include "3270ds.h"
36 38
37 /*--[ Implement ]------------------------------------------------------------------------------------*/ 39 /*--[ Implement ]------------------------------------------------------------------------------------*/
@@ -48,7 +50,7 @@ LIB3270_EXPORT int lib3270_unselect(H3270 *hSession) @@ -48,7 +50,7 @@ LIB3270_EXPORT int lib3270_unselect(H3270 *hSession)
48 { 50 {
49 hSession->selected = 0; 51 hSession->selected = 0;
50 52
51 - for(a = 0; a < hSession->rows*hSession->cols; a++) 53 + for(a = 0; a < ((int) (hSession->rows*hSession->cols)); a++)
52 { 54 {
53 if(hSession->text[a].attr & LIB3270_ATTR_SELECTED) 55 if(hSession->text[a].attr & LIB3270_ATTR_SELECTED)
54 { 56 {
@@ -211,10 +213,10 @@ LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) @@ -211,10 +213,10 @@ LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to)
211 if(col < 0) 213 if(col < 0)
212 cols = - (pos[f] % hSession->cols); 214 cols = - (pos[f] % hSession->cols);
213 215
214 - if(row >= (hSession->rows)) 216 + if(row >= ((int) hSession->rows))
215 rows = hSession->rows - ((pos[f] / hSession->cols)+1); 217 rows = hSession->rows - ((pos[f] / hSession->cols)+1);
216 218
217 - if(col >= hSession->cols) 219 + if(col >= ((int) hSession->cols))
218 cols = hSession->cols - ((pos[f] % hSession->cols)+1); 220 cols = hSession->cols - ((pos[f] % hSession->cols)+1);
219 } 221 }
220 222
src/lib3270/selection/selection.c
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 #include <lib3270/actions.h> 32 #include <lib3270/actions.h>
33 #include <lib3270/session.h> 33 #include <lib3270/session.h>
34 #include <lib3270/selection.h> 34 #include <lib3270/selection.h>
  35 + #include <lib3270/log.h>
35 #include "3270ds.h" 36 #include "3270ds.h"
36 #include "kybdc.h" 37 #include "kybdc.h"
37 38
@@ -221,9 +222,9 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba @@ -221,9 +222,9 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba
221 if( (col == 0) || !(hSession->text[baddr-1].attr & LIB3270_ATTR_SELECTED) ) 222 if( (col == 0) || !(hSession->text[baddr-1].attr & LIB3270_ATTR_SELECTED) )
222 rc |= SELECTION_LEFT; 223 rc |= SELECTION_LEFT;
223 224
224 - /// FIXME: It should text if baddr is the last element before the +1. 225 + /// FIXME: It should test if baddr is the last element before the +1.
225 226
226 - if( (col == hSession->cols) || !(hSession->text[baddr+1].attr & LIB3270_ATTR_SELECTED) ) 227 + if( (col == ((int) hSession->cols)) || !(hSession->text[baddr+1].attr & LIB3270_ATTR_SELECTED) )
227 rc |= SELECTION_RIGHT; 228 rc |= SELECTION_RIGHT;
228 } 229 }
229 230
@@ -236,7 +237,7 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba @@ -236,7 +237,7 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba
236 if( (row == 0) || !(hSession->text[baddr-hSession->cols].attr & LIB3270_ATTR_SELECTED) ) 237 if( (row == 0) || !(hSession->text[baddr-hSession->cols].attr & LIB3270_ATTR_SELECTED) )
237 rc |= SELECTION_TOP; 238 rc |= SELECTION_TOP;
238 239
239 - if( (row == hSession->rows) || !(hSession->text[baddr+hSession->cols].attr & LIB3270_ATTR_SELECTED) ) 240 + if( (row == ((int) hSession->rows)) || !(hSession->text[baddr+hSession->cols].attr & LIB3270_ATTR_SELECTED) )
240 rc |= SELECTION_BOTTOM; 241 rc |= SELECTION_BOTTOM;
241 } 242 }
242 243
src/lib3270/session.c
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 #include "3270ds.h" 45 #include "3270ds.h"
46 #include "popupsc.h" 46 #include "popupsc.h"
47 #include <lib3270/trace.h> 47 #include <lib3270/trace.h>
  48 +#include <lib3270/log.h>
48 49
49 50
50 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ 51 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/
src/lib3270/sf.c
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 #include "trace_dsc.h" 63 #include "trace_dsc.h"
64 #include "utilc.h" 64 #include "utilc.h"
65 65
66 -#include "api.h" 66 +// #include "api.h"
67 67
68 // Externals 68 // Externals
69 // extern unsigned char reply_mode; 69 // extern unsigned char reply_mode;
src/lib3270/ssl/linux/getcrl.c
@@ -58,6 +58,7 @@ @@ -58,6 +58,7 @@
58 #include <errno.h> 58 #include <errno.h>
59 #include <lib3270.h> 59 #include <lib3270.h>
60 #include <lib3270/trace.h> 60 #include <lib3270/trace.h>
  61 +#include <lib3270/log.h>
61 62
62 /*--[ Implement ]------------------------------------------------------------------------------------*/ 63 /*--[ Implement ]------------------------------------------------------------------------------------*/
63 64
src/lib3270/ssl/negotiate.c
@@ -51,6 +51,7 @@ @@ -51,6 +51,7 @@
51 #include <lib3270.h> 51 #include <lib3270.h>
52 #include <lib3270/internals.h> 52 #include <lib3270/internals.h>
53 #include <lib3270/trace.h> 53 #include <lib3270/trace.h>
  54 +#include <lib3270/log.h>
54 #include "hostc.h" // host_disconnect 55 #include "hostc.h" // host_disconnect
55 #include "trace_dsc.h" 56 #include "trace_dsc.h"
56 57
src/lib3270/ssl/state.c
@@ -35,6 +35,8 @@ @@ -35,6 +35,8 @@
35 #include <lib3270/popup.h> 35 #include <lib3270/popup.h>
36 #include <lib3270/trace.h> 36 #include <lib3270/trace.h>
37 #include <trace_dsc.h> 37 #include <trace_dsc.h>
  38 +#include <lib3270/log.h>
  39 +#include <lib3270/trace.h>
38 40
39 #ifdef HAVE_LIBSSL 41 #ifdef HAVE_LIBSSL
40 #include <openssl/ssl.h> 42 #include <openssl/ssl.h>
src/lib3270/telnet.c
@@ -103,6 +103,7 @@ @@ -103,6 +103,7 @@
103 103
104 #include <lib3270/internals.h> 104 #include <lib3270/internals.h>
105 #include <lib3270/trace.h> 105 #include <lib3270/trace.h>
  106 +#include <lib3270/log.h>
106 107
107 #if !defined(TELOPT_NAWS) /*[*/ 108 #if !defined(TELOPT_NAWS) /*[*/
108 #define TELOPT_NAWS 31 109 #define TELOPT_NAWS 31
src/lib3270/toggles.c
@@ -59,6 +59,7 @@ @@ -59,6 +59,7 @@
59 #include "togglesc.h" 59 #include "togglesc.h"
60 //#include "api.h" 60 //#include "api.h"
61 #include "utilc.h" 61 #include "utilc.h"
  62 +#include <lib3270/log.h>
62 63
63 static const struct _toggle_info 64 static const struct _toggle_info
64 { 65 {
src/lib3270/utf8.c
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 */ 37 */
38 38
39 #include "private.h" 39 #include "private.h"
40 -#include "api.h" 40 +// #include "api.h"
41 41
42 #include "popupsc.h" 42 #include "popupsc.h"
43 #include "utf8c.h" 43 #include "utf8c.h"
src/lib3270/util.c
@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
38 #include "utilc.h" 38 #include "utilc.h"
39 #include "popupsc.h" 39 #include "popupsc.h"
40 #include <lib3270/selection.h> 40 #include <lib3270/selection.h>
  41 +#include <lib3270/log.h>
41 42
42 #define my_isspace(c) isspace((unsigned char)c) 43 #define my_isspace(c) isspace((unsigned char)c)
43 44