diff --git a/src/include/3270ds.h b/src/include/3270ds.h index b80aa4a..c4d9bd1 100644 --- a/src/include/3270ds.h +++ b/src/include/3270ds.h @@ -138,19 +138,19 @@ #define BA_TO_COL(ba) ((ba) % hSession->cols) #define ROWCOL_TO_BA(r,c) (((r) * hSession->cols) + c) #define INC_BA(ba) { (ba) = ((ba) + 1) % (hSession->cols * hSession->rows); } -#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : ((hSession->cols*hSession->rows) - 1); } +#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : (((int) (hSession->cols*hSession->rows)) - 1); } /** Field attributes. */ -#define FA_PRINTABLE 0xc0 /**< these make the character "printable" */ -#define FA_PROTECT 0x20 /**< unprotected (0) / protected (1) */ -#define FA_NUMERIC 0x10 /**< alphanumeric (0) /numeric (1) */ -#define FA_INTENSITY 0x0c /**< display/selector pen detectable: */ -#define FA_INT_NORM_NSEL 0x00 /**< 00 normal, non-detect */ -#define FA_INT_NORM_SEL 0x04 /**< 01 normal, detectable */ -#define FA_INT_HIGH_SEL 0x08 /**< 10 intensified, detectable */ -#define FA_INT_ZERO_NSEL 0x0c /**< 11 nondisplay, non-detect */ -#define FA_RESERVED 0x02 /**< must be 0 */ -#define FA_MODIFY 0x01 /**< modified (1) */ +#define FA_PRINTABLE 0xc0 ///< @brief these make the character "printable" */ +#define FA_PROTECT 0x20 ///< @brief unprotected (0) / protected (1) */ +#define FA_NUMERIC 0x10 ///< @brief alphanumeric (0) /numeric (1) */ +#define FA_INTENSITY 0x0c ///< @brief display/selector pen detectable: */ +#define FA_INT_NORM_NSEL 0x00 ///< @brief 00 normal, non-detect */ +#define FA_INT_NORM_SEL 0x04 ///< @brief 01 normal, detectable */ +#define FA_INT_HIGH_SEL 0x08 ///< @brief 10 intensified, detectable */ +#define FA_INT_ZERO_NSEL 0x0c ///< @brief 11 nondisplay, non-detect */ +#define FA_RESERVED 0x02 ///< @brief must be 0 */ +#define FA_MODIFY 0x01 ///< @brief modified (1) */ /* Bits in the field attribute that are stored. */ #define FA_MASK (FA_PROTECT | FA_NUMERIC | FA_INTENSITY | FA_MODIFY) diff --git a/src/include/api.h b/src/include/api.h index c990ccf..7411ea0 100644 --- a/src/include/api.h +++ b/src/include/api.h @@ -29,6 +29,7 @@ * */ +#error Deprecated #ifndef LIB3270_API_INCLUDED @@ -99,36 +100,12 @@ #include - #define OIA_FLAG_BOXSOLID LIB3270_FLAG_BOXSOLID - #define OIA_FLAG_UNDERA LIB3270_FLAG_UNDERA - #define OIA_FLAG_TYPEAHEAD LIB3270_FLAG_TYPEAHEAD - #define OIA_FLAG_USER LIB3270_FLAG_COUNT - #define OIA_FLAG LIB3270_FLAG - -// struct lib3270_state_callback; - #include /** Type of dialog boxes */ #include - #define PW3270_DIALOG_INFO LIB3270_NOTIFY_INFO - #define PW3270_DIALOG_CRITICAL LIB3270_NOTIFY_CRITICAL - #define PW3270_DIALOG LIB3270_NOTIFY - - #define GR_BLINK 0x01 - #define GR_REVERSE 0x02 - #define GR_UNDERLINE 0x04 - #define GR_INTENSIFY 0x08 - - #define CS_MASK 0x03 /**< mask for specific character sets */ - #define CS_BASE 0x00 /**< base character set (X'00') */ - #define CS_APL 0x01 /**< APL character set (X'01' or GE) */ - #define CS_LINEDRAW 0x02 /**< DEC line-drawing character set (ANSI) */ - #define CS_DBCS 0x03 /**< DBCS character set (X'F8') */ - #define CS_GE 0x04 /**< cs flag for Graphic Escape */ - /* File transfer */ #define FT_RECORD_FORMAT_FIXED LIB3270_FT_RECORD_FORMAT_FIXED @@ -141,12 +118,6 @@ #define FT_ALLOCATION_UNITS_AVBLOCK LIB3270_FT_ALLOCATION_UNITS_AVBLOCK #define FT_ALLOCATION_UNITS_MASK LIB3270_FT_ALLOCATION_UNITS_MASK - #define FT_NONE LIB3270_FT_STATE_NONE - #define FT_AWAIT_ACK LIB3270_FT_STATE_AWAIT_ACK - #define FT_RUNNING LIB3270_FT_STATE_RUNNING - #define FT_ABORT_WAIT LIB3270_FT_STATE_ABORT_WAIT - #define FT_ABORT_SENT LIB3270_FT_STATE_ABORT_SENT - LOCAL_EXTERN int CancelFileTransfer(int force); #define PCONNECTED lib3270_pconnected(hSession) @@ -160,21 +131,13 @@ #define IN_TN3270E lib3270_in_tn3270e(hSession) #define IN_E lib3270_in_e(hSession) - #define COLOR_ATTR_NONE 0x0000 - #define COLOR_ATTR_FIELD LIB3270_ATTR_FIELD - #define COLOR_ATTR_BLINK LIB3270_ATTR_BLINK - #define COLOR_ATTR_INTENSIFY LIB3270_ATTR_INTENSIFY - - #define CHAR_ATTR_UNCONVERTED LIB3270_ATTR_CG - - /* Set/Get screen contents */ #define find_field_attribute(s,a) lib3270_field_addr(s,a) #define find_field_length(s,a) find_field_length(s,a) - LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr); - LOCAL_EXTERN void Input_String(const unsigned char *str); - LOCAL_EXTERN void screen_size(int *rows, int *cols); + // LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr); + // LOCAL_EXTERN void Input_String(const unsigned char *str); + // LOCAL_EXTERN void screen_size(int *rows, int *cols); #define lib3270_paste_string(str) lib3270_set_string(NULL,str) diff --git a/src/include/hostc.h b/src/include/hostc.h index 6576048..875757a 100644 --- a/src/include/hostc.h +++ b/src/include/hostc.h @@ -35,7 +35,7 @@ * @brief Global declarations for host.c. */ - #include "api.h" +// #include "api.h" /** diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 78ba705..8593b86 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -693,7 +693,7 @@ * @return Negative if error or number of processed characters. * */ - LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, const unsigned char *str); + LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, unsigned int row, unsigned int col, const unsigned char *str); /** * @brief Set string at defined adress. diff --git a/src/include/popupsc.h b/src/include/popupsc.h index 6efa3ea..ac7b078 100644 --- a/src/include/popupsc.h +++ b/src/include/popupsc.h @@ -31,11 +31,13 @@ /* Popup calls */ + #include + #define popup_an_errno(hSession, errn, fmt, ...) lib3270_popup_an_errno(hSession, errn, fmt, __VA_ARGS__) - LOCAL_EXTERN void popup_an_error(H3270 *session, const char *fmt, ...) LIB3270_GNUC_FORMAT(2,3); - LOCAL_EXTERN void popup_system_error(H3270 *session, const char *title, const char *message, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5); - LOCAL_EXTERN void popup_a_sockerr(H3270 *session, char *fmt, ...) LIB3270_GNUC_FORMAT(2,3); + LIB3270_INTERNAL void popup_an_error(H3270 *session, const char *fmt, ...) LIB3270_GNUC_FORMAT(2,3); + LIB3270_INTERNAL void popup_system_error(H3270 *session, const char *title, const char *message, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5); + LIB3270_INTERNAL void popup_a_sockerr(H3270 *session, char *fmt, ...) LIB3270_GNUC_FORMAT(2,3); - LOCAL_EXTERN void Error(H3270 *session, const char *fmt, ...); - LOCAL_EXTERN void Warning(H3270 *session, const char *fmt, ...); + LIB3270_INTERNAL void Error(H3270 *session, const char *fmt, ...); + LIB3270_INTERNAL void Warning(H3270 *session, const char *fmt, ...); diff --git a/src/include/statusc.h b/src/include/statusc.h index 227ac1a..55973c5 100644 --- a/src/include/statusc.h +++ b/src/include/statusc.h @@ -13,7 +13,7 @@ /* c3270 verson of statusc.h */ -#include "api.h" +// #include "api.h" LIB3270_INTERNAL void status_compose(int on, unsigned char c, enum keytype keytype); LIB3270_INTERNAL void status_ctlr_done(H3270 *session); @@ -31,8 +31,8 @@ LIB3270_INTERNAL void status_twait(H3270 *session); LIB3270_INTERNAL void status_changed(H3270 *session, LIB3270_MESSAGE id); -LIB3270_INTERNAL void set_status(H3270 *session, OIA_FLAG id, Boolean on); +LIB3270_INTERNAL void set_status(H3270 *session, LIB3270_FLAG id, Boolean on); -#define status_typeahead(h,on) set_status(h,OIA_FLAG_TYPEAHEAD,on) +#define status_typeahead(h,on) set_status(h,LIB3270_FLAG_TYPEAHEAD,on) diff --git a/src/lib3270/charset.c b/src/lib3270/charset.c index 1cd54d5..f5007f3 100644 --- a/src/lib3270/charset.c +++ b/src/lib3270/charset.c @@ -37,6 +37,8 @@ #include "private.h" #include #include +#include +#include /* * EBCDIC-to-Unicode translation tables. @@ -46,18 +48,6 @@ #define UT_SIZE 190 #define UT_OFFSET 0x41 -/* -typedef struct -{ - const char * name; - const char * host_codepage; - const char * cgcsgid; - const char * display_charset; - unsigned short code[UT_SIZE]; -} charset_table; -*/ - - /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ const unsigned short ebc2asc0[256] = diff --git a/src/lib3270/connect.c b/src/lib3270/connect.c index 0c8a76f..8e65f67 100644 --- a/src/lib3270/connect.c +++ b/src/lib3270/connect.c @@ -31,6 +31,7 @@ #include "private.h" #include "telnetc.h" #include +#include #include #if defined(HAVE_LIBSSL) diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c index a958726..34a3979 100644 --- a/src/lib3270/ctlr.c +++ b/src/lib3270/ctlr.c @@ -37,11 +37,15 @@ #pragma GCC diagnostic ignored "-Wsign-compare" #include "private.h" + +#include +#include +#include +#include + #include #include #include "3270ds.h" -//#include "appres.h" -// #include "ctlr.h" #include "screen.h" #include "resources.h" @@ -53,11 +57,9 @@ #include "kybdc.h" #include "popupsc.h" #include "screenc.h" -// #include "scrollc.h" #include "seec.h" #include "sf.h" #include "statusc.h" -// #include "tablesc.h" #include "telnetc.h" #include "trace_dsc.h" #include "utilc.h" @@ -464,7 +466,7 @@ LIB3270_EXPORT int lib3270_get_field_len(H3270 *hSession, int baddr) if(baddr < 0) baddr = hSession->cursor_addr; - addr = find_field_attribute(hSession,baddr); + addr = lib3270_field_addr(hSession,baddr); if(addr < 0) return -1; @@ -550,7 +552,7 @@ int lib3270_field_length(H3270 *hSession, int baddr) int addr; int width = 0; - addr = find_field_attribute(hSession,baddr); + addr = lib3270_field_addr(hSession,baddr); if(addr < 0) return -1; @@ -575,7 +577,7 @@ int lib3270_field_length(H3270 *hSession, int baddr) */ unsigned char get_field_attribute(H3270 *hSession, int baddr) { - return hSession->ea_buf[find_field_attribute(hSession,baddr)].fa; + return hSession->ea_buf[lib3270_field_addr(hSession,baddr)].fa; } /** @@ -622,7 +624,7 @@ LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr) if(baddr < 0) baddr = hSession->cursor_addr; - int faddr = find_field_attribute(hSession,baddr); + int faddr = lib3270_field_addr(hSession,baddr); return FA_IS_PROTECTED(hSession->ea_buf[faddr].fa) ? 1 : 0; } @@ -1827,7 +1829,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er if (d != DBCS_NONE && why == DBCS_FIELD) { ABORT_WRITE("SI in DBCS field"); } - fa_addr = find_field_attribute(hSession,hSession->buffer_addr); + fa_addr = lib3270_field_addr(hSession,hSession->buffer_addr); baddr = hSession->buffer_addr; DEC_BA(baddr); while (!aborted && @@ -2145,7 +2147,7 @@ ctlr_lookleft_state(int baddr, enum dbcs_why *why) return DBCS_NONE; /* Find the field attribute, if any. */ - faddr = find_field_attribute(baddr); + faddr = lib3270_field_addr(baddr); /* * First in precedence is a DBCS field. @@ -2258,7 +2260,7 @@ int ctlr_dbcs_postprocess(H3270 *hSession) * dummy at -1. Also compute the starting and ending points for the * scan: the first location after that field attribute. */ - faddr0 = find_field_attribute(0); + faddr0 = lib3270_field_addr(0); baddr = faddr0; INC_BA(baddr); if (faddr0 < 0) @@ -2738,7 +2740,7 @@ void mdt_set(H3270 *hSession, int baddr) { int faddr; - faddr = find_field_attribute(hSession,baddr); + faddr = lib3270_field_addr(hSession,baddr); if (faddr >= 0 && !(hSession->ea_buf[faddr].fa & FA_MODIFY)) { hSession->ea_buf[faddr].fa |= FA_MODIFY; @@ -2749,7 +2751,7 @@ void mdt_set(H3270 *hSession, int baddr) void mdt_clear(H3270 *hSession, int baddr) { - int faddr = find_field_attribute(hSession,baddr); + int faddr = lib3270_field_addr(hSession,baddr); if (faddr >= 0 && (hSession->ea_buf[faddr].fa & FA_MODIFY)) { diff --git a/src/lib3270/cursor.c b/src/lib3270/cursor.c index c45d79f..fbd81ca 100644 --- a/src/lib3270/cursor.c +++ b/src/lib3270/cursor.c @@ -34,6 +34,7 @@ #include "private.h" #include +#include #include #include "kybdc.h" diff --git a/src/lib3270/ft.c b/src/lib3270/ft.c index bebc4c9..e6ec36e 100644 --- a/src/lib3270/ft.c +++ b/src/lib3270/ft.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "private.h" #include @@ -404,8 +405,8 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); if(!ft) return EINVAL; - recfm = (ft->flags & FT_RECORD_FORMAT_MASK) >> 8; - units = (ft->flags & FT_ALLOCATION_UNITS_MASK) >> 12; + recfm = (ft->flags & LIB3270_FT_RECORD_FORMAT_MASK) >> 8; + units = (ft->flags & LIB3270_FT_ALLOCATION_UNITS_MASK) >> 12; ft->ascii_flag = (ft->flags & LIB3270_FT_OPTION_ASCII) ? 1 : 0; ft->cr_flag = (ft->flags & LIB3270_FT_OPTION_CRLF) ? 1 : 0; ft->remap_flag = (ft->flags & LIB3270_FT_OPTION_REMAP) ? 1 : 0; @@ -568,7 +569,7 @@ static double finish(H3270FT *ft) } // Clean up the state. - set_ft_state(ft,FT_NONE); + set_ft_state(ft,LIB3270_FT_STATE_NONE); ft_update_length(ft); @@ -643,8 +644,8 @@ void ft_running(H3270FT *ft, Boolean is_cut) gettimeofday(&ft->starting_time, (struct timezone *)NULL); - if (ft->state == FT_AWAIT_ACK) - set_ft_state(ft,FT_RUNNING); + if (ft->state == LIB3270_FT_STATE_AWAIT_ACK) + set_ft_state(ft,LIB3270_FT_STATE_RUNNING); ft->cbk.running(ft->host,is_cut,ft->user_data); @@ -670,9 +671,9 @@ LIB3270_EXPORT struct lib3270_ft_callbacks * lib3270_get_ft_callbacks(H3270 *ses // Process a protocol-generated abort. void ft_aborting(H3270FT *h, const char *reason) { - if (h->state == FT_RUNNING || h->state == FT_ABORT_WAIT) + if (h->state == LIB3270_FT_STATE_RUNNING || h->state == LIB3270_FT_STATE_ABORT_WAIT) { - set_ft_state(h,FT_ABORT_SENT); + set_ft_state(h,LIB3270_FT_STATE_ABORT_SENT); h->cbk.message(h->host,N_("Aborting..."),h->user_data); h->cbk.aborting(h->host,reason,h->user_data); } diff --git a/src/lib3270/ft_cut.c b/src/lib3270/ft_cut.c index a2d967c..f83b700 100644 --- a/src/lib3270/ft_cut.c +++ b/src/lib3270/ft_cut.c @@ -39,17 +39,18 @@ #include "private.h" +#include +#include + #if defined(X3270_FT) /*[*/ #include "3270ds.h" -//#include "actionsc.h" #include "ctlrc.h" #include "ft_cutc.h" #include "ft_cut_ds.h" #include "ftc.h" #include "kybdc.h" #include "popupsc.h" -// #include "tablesc.h" #include "telnetc.h" #include "trace_dsc.h" #include "utilc.h" @@ -343,7 +344,7 @@ static void cut_control_code(H3270 *hSession) hSession->cut_xfer_in_progress = 0; cut_ack(hSession); - if (lib3270_get_ft_state(hSession) == FT_ABORT_SENT && ft->saved_errmsg != CN) + if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_SENT && ft->saved_errmsg != CN) { buf = ft->saved_errmsg; ft->saved_errmsg = CN; @@ -394,7 +395,7 @@ static void cut_data_request(H3270 *hSession) unsigned char attr; trace_ds(hSession,"< FT DATA_REQUEST %u\n", from6(hSession, seq)); - if (lib3270_get_ft_state(hSession) == FT_ABORT_WAIT) + if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_WAIT) { cut_abort(hSession,SC_ABORT_FILE,"%s", N_("Transfer cancelled by user") ); return; diff --git a/src/lib3270/ft_dft.c b/src/lib3270/ft_dft.c index 6918dd0..a409685 100644 --- a/src/lib3270/ft_dft.c +++ b/src/lib3270/ft_dft.c @@ -44,23 +44,18 @@ #if defined(X3270_FT) /*[*/ -//#include "appres.h" #include "3270ds.h" #include "ft_dft_ds.h" - -//#include "actionsc.h" #include "kybdc.h" #include "ft_dftc.h" #include "ftc.h" -//#include "tablesc.h" #include "telnetc.h" #include "trace_dsc.h" #include "utilc.h" +#include #include -// extern unsigned char aid; - /* Macros. */ #define OPEN_MSG "FT:MSG" /* Open request for message */ #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)) unsigned short data_length, data_type; unsigned char *cp; - if (lib3270_get_ft_state(hSession) == FT_NONE) + if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_NONE) { trace_ds(hSession," (no transfer in progress)\n"); return; @@ -228,7 +223,7 @@ static void dft_data_insert(H3270 *hSession, struct data_buffer *data_bufr) int my_length; unsigned char * cp; - if(!ft->message_flag && lib3270_get_ft_state(hSession) == FT_ABORT_WAIT) + if(!ft->message_flag && lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_WAIT) { dft_abort(hSession,TR_DATA_INSERT, "%s", _("Transfer cancelled by user") ); return; @@ -273,7 +268,7 @@ static void dft_data_insert(H3270 *hSession, struct data_buffer *data_bufr) ft_complete(hSession->ft,(const char *) msgp); lib3270_free(msgp); } - else if (lib3270_get_ft_state(hSession) == FT_ABORT_SENT && ((H3270FT *) hSession->ft)->abort_string != CN) + else if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_SENT && ((H3270FT *) hSession->ft)->abort_string != CN) { trace_ds(hSession,"ABORT_TRANSFER [%s]\n",msgp); lib3270_free(msgp); @@ -371,7 +366,7 @@ static void dft_get_request(H3270 *hSession) trace_ds(hSession," Get\n"); - if (!ft->message_flag && lib3270_get_ft_state(hSession) == FT_ABORT_WAIT) + if (!ft->message_flag && lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_WAIT) { dft_abort(hSession,TR_GET_REQ, _( "Transfer cancelled by user" ) ); return; diff --git a/src/lib3270/host.c b/src/lib3270/host.c index c55f206..0643a0e 100644 --- a/src/lib3270/host.c +++ b/src/lib3270/host.c @@ -54,6 +54,8 @@ #include #include #include +#include +#include /** * @brief Called from timer to attempt an automatic reconnection. @@ -152,7 +154,7 @@ void lib3270_set_disconnected(H3270 *hSession) hSession->starting = 0; hSession->ssl.state = LIB3270_SSL_UNDEFINED; - set_status(hSession,OIA_FLAG_UNDERA,False); + set_status(hSession,LIB3270_FLAG_UNDERA,False); lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False); diff --git a/src/lib3270/html.c b/src/lib3270/html.c index ef9fe2b..82fec2f 100644 --- a/src/lib3270/html.c +++ b/src/lib3270/html.c @@ -236,7 +236,7 @@ LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option) { - int row, baddr; + unsigned int row, baddr; struct html_info info; memset(&info,0,sizeof(info)); @@ -256,7 +256,7 @@ baddr = 0; for(row=0;row < session->rows;row++) { - int col; + unsigned int col; for(col = 0; col < session->cols;col++) { diff --git a/src/lib3270/iocalls.c b/src/lib3270/iocalls.c index 520bd4d..d49cb90 100644 --- a/src/lib3270/iocalls.c +++ b/src/lib3270/iocalls.c @@ -48,6 +48,9 @@ #include #endif +#include +#include + #define MILLION 1000000L // //#if defined(_WIN32) diff --git a/src/lib3270/kybd.c b/src/lib3270/kybd.c index 346081e..52961f4 100644 --- a/src/lib3270/kybd.c +++ b/src/lib3270/kybd.c @@ -43,6 +43,7 @@ struct ta; #include "private.h" #include #include +#include #ifndef ANDROID #include @@ -80,7 +81,7 @@ struct ta; #include -#include "api.h" +// #include "api.h" //#ifdef DEBUG @@ -739,7 +740,7 @@ static Boolean key_Character(H3270 *hSession, int code, Boolean with_ge, Boolean return False; } baddr = hSession->cursor_addr; - faddr = find_field_attribute(hSession,baddr); + faddr = lib3270_field_addr(hSession,baddr); fa = get_field_attribute(hSession,baddr); if (hSession->ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) @@ -1394,7 +1395,7 @@ static void do_erase(H3270 *hSession) enum dbcs_state d; baddr = hSession->cursor_addr; - faddr = find_field_attribute(hSession,baddr); + faddr = lib3270_field_addr(hSession,baddr); if (faddr == baddr || FA_IS_PROTECTED(hSession->ea_buf[baddr].fa)) { operator_error(hSession,KL_OERR_PROTECTED); @@ -1685,7 +1686,7 @@ LIB3270_EXPORT int lib3270_newline(H3270 *hSession) #endif /*]*/ baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); /* down */ baddr = (baddr / hSession->cols) * hSession->cols; /* 1st col */ - faddr = find_field_attribute(hSession,baddr); + faddr = lib3270_field_addr(hSession,baddr); fa = hSession->ea_buf[faddr].fa; if (faddr != baddr && !FA_IS_PROTECTED(fa)) cursor_move(hSession,baddr); @@ -2163,7 +2164,7 @@ int lib3270_get_field_end(H3270 *hSession, int baddr) if (!hSession->formatted) return errno = EINVAL; - faddr = find_field_attribute(hSession,baddr); + faddr = lib3270_field_addr(hSession,baddr); fa = hSession->ea_buf[faddr].fa; if (faddr == baddr || FA_IS_PROTECTED(fa)) return errno = EPERM; @@ -2243,7 +2244,7 @@ static Boolean remargin(H3270 *hSession, int lmargin) b0 = baddr; ever = True; } - faddr = find_field_attribute(hSession,baddr); + faddr = lib3270_field_addr(hSession,baddr); fa = hSession->ea_buf[faddr].fa; if (faddr == baddr || FA_IS_PROTECTED(fa)) diff --git a/src/lib3270/linux/connect.c b/src/lib3270/linux/connect.c index 5a1879f..df019fa 100644 --- a/src/lib3270/linux/connect.c +++ b/src/lib3270/linux/connect.c @@ -54,6 +54,8 @@ #include "screen.h" #include +#include +#include /*---[ Implement ]-------------------------------------------------------------------------------*/ diff --git a/src/lib3270/linux/event_dispatcher.c b/src/lib3270/linux/event_dispatcher.c index 95c6c68..769c18b 100644 --- a/src/lib3270/linux/event_dispatcher.c +++ b/src/lib3270/linux/event_dispatcher.c @@ -35,9 +35,8 @@ #include "../private.h" #include #include -// #include "../xioc.h" -// #include "telnetc.h" -// #include "utilc.h" +#include +#include #define MILLION 1000000L #define TN (timeout_t *)NULL diff --git a/src/lib3270/log.c b/src/lib3270/log.c index 1705b24..e1d7129 100644 --- a/src/lib3270/log.c +++ b/src/lib3270/log.c @@ -41,7 +41,7 @@ #include #include #include -#include "api.h" +// #include "api.h" /*---[ Prototipes ]-----------------------------------------------------------------------------------------*/ diff --git a/src/lib3270/paste.c b/src/lib3270/paste.c index 1fa2362..8776af7 100644 --- a/src/lib3270/paste.c +++ b/src/lib3270/paste.c @@ -77,10 +77,11 @@ #if defined(X3270_DBCS) /*[*/ #include "widec.h" #endif /*]*/ -#include "api.h" +// #include "api.h" #include #include +#include /*---[ Struct ]-------------------------------------------------------------------------------------------------*/ @@ -117,7 +118,7 @@ ever = True; } - faddr = find_field_attribute(hSession,baddr); + faddr = lib3270_field_addr(hSession,baddr); fa = hSession->ea_buf[faddr].fa; if (faddr == baddr || FA_IS_PROTECTED(fa)) { @@ -138,7 +139,7 @@ if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SMART_PASTE)) { - int faddr = find_field_attribute(hSession,hSession->cursor_addr); + int faddr = lib3270_field_addr(hSession,hSession->cursor_addr); if(FA_IS_PROTECTED(hSession->ea_buf[faddr].fa)) hSession->cursor_addr++; else @@ -190,7 +191,7 @@ static int set_string(H3270 *hSession, const unsigned char *str) baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); /* down */ baddr = (baddr / hSession->cols) * hSession->cols; /* 1st col */ - faddr = find_field_attribute(hSession,baddr); + faddr = lib3270_field_addr(hSession,baddr); fa = hSession->ea_buf[faddr].fa; if (faddr != baddr && !FA_IS_PROTECTED(fa)) cursor_move(hSession,baddr); @@ -232,7 +233,7 @@ static int set_string(H3270 *hSession, const unsigned char *str) * @return -1 if error (sets errno) or number of processed characters. * */ -LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, const unsigned char *str) +LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, unsigned int row, unsigned int col, const unsigned char *str) { int rc = 0; @@ -248,7 +249,7 @@ LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, cons row--; col--; - if(row >= 0 && col >= 0 && row <= hSession->rows && col <= hSession->cols) + if(row <= hSession->rows && col <= hSession->cols) { hSession->cbk.suspend(hSession); diff --git a/src/lib3270/private.h b/src/lib3270/private.h index 9e286fe..aac0a63 100644 --- a/src/lib3270/private.h +++ b/src/lib3270/private.h @@ -36,7 +36,8 @@ #include /* autoconf settings */ #include /* lib3270 API calls and defs */ #include -#include "api.h" +#include +// #include "api.h" #if defined(HAVE_LIBSSL) #include @@ -158,12 +159,33 @@ struct toggle_name { int index; }; +/// @brief State macros +#define PCONNECTED lib3270_pconnected(hSession) +#define HALF_CONNECTED lib3270_half_connected(hSession) +#define CONNECTED lib3270_connected(hSession) -/* input key type */ +#define IN_NEITHER lib3270_in_neither(hSession) +#define IN_ANSI lib3270_in_ansi(hSession) +#define IN_3270 lib3270_in_3270(hSession) +#define IN_SSCP lib3270_in_sscp(hSession) +#define IN_TN3270E lib3270_in_tn3270e(hSession) +#define IN_E lib3270_in_e(hSession) -/* Naming convention for private actions. */ +/// @brief Naming convention for private actions. #define PA_PFX "PA-" +#define GR_BLINK 0x01 +#define GR_REVERSE 0x02 +#define GR_UNDERLINE 0x04 +#define GR_INTENSIFY 0x08 + +#define CS_MASK 0x03 ///< @brief mask for specific character sets */ +#define CS_BASE 0x00 ///< @brief base character set (X'00') */ +#define CS_APL 0x01 ///< @brief APL character set (X'01' or GE) */ +#define CS_LINEDRAW 0x02 ///< @brief DEC line-drawing character set (ANSI) */ +#define CS_DBCS 0x03 ///< @brief DBCS character set (X'F8') */ +#define CS_GE 0x04 ///< @brief cs flag for Graphic Escape */ + /// @brief Shorthand macros #define CN ((char *) NULL) #define PN ((XtPointer) NULL) @@ -313,7 +335,7 @@ struct lib3270_state_callback */ struct _h3270 { - struct lib3270_session_callbacks cbk; // Callback table - Always the first one. + struct lib3270_session_callbacks cbk; ///< @brief Callback table - Always the first one. // Session info char id; ///< @brief Session Identifier. @@ -746,5 +768,7 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); /// @brief Clear element at adress. LIB3270_INTERNAL void clear_chr(H3270 *hSession, int baddr); + LIB3270_INTERNAL unsigned char get_field_attribute(H3270 *session, int baddr); + #endif diff --git a/src/lib3270/resolver.c b/src/lib3270/resolver.c index 62f4989..466c6fd 100644 --- a/src/lib3270/resolver.c +++ b/src/lib3270/resolver.c @@ -59,7 +59,7 @@ #include #include -#include "api.h" +// #include "api.h" #include "resolverc.h" #include "statusc.h" diff --git a/src/lib3270/resources.c b/src/lib3270/resources.c index 2dbae92..f685395 100644 --- a/src/lib3270/resources.c +++ b/src/lib3270/resources.c @@ -36,6 +36,7 @@ #include "private.h" #include "utilc.h" +#include extern String fallbacks[]; diff --git a/src/lib3270/rpq.c b/src/lib3270/rpq.c index 9a0318a..9c46b78 100644 --- a/src/lib3270/rpq.c +++ b/src/lib3270/rpq.c @@ -53,7 +53,7 @@ #include #endif // !ANDROID -#include "api.h" +// #include "api.h" #include #include @@ -66,6 +66,8 @@ #include "utilc.h" #include "sf.h" +#include + /* Statics */ static Boolean select_rpq_terms(H3270 *hSession); static int get_rpq_timezone(H3270 *hSession); diff --git a/src/lib3270/screen.c b/src/lib3270/screen.c index 107b08e..1796ddd 100644 --- a/src/lib3270/screen.c +++ b/src/lib3270/screen.c @@ -50,8 +50,8 @@ #include "errno.h" #include "statusc.h" #include "togglesc.h" -#include "api.h" #include +#include #if defined(_WIN32) #include @@ -165,10 +165,10 @@ int screen_init(H3270 *session) static unsigned short color_from_fa(H3270 *hSession, unsigned char fa) { if (hSession->m3279) - return get_color_pair(DEFCOLOR_MAP(fa),0) | COLOR_ATTR_FIELD; + return get_color_pair(DEFCOLOR_MAP(fa),0) | LIB3270_ATTR_FIELD; // Green on black - return get_color_pair(0,0) | COLOR_ATTR_FIELD | ((FA_IS_HIGH(fa)) ? COLOR_ATTR_INTENSIFY : 0); + return get_color_pair(0,0) | LIB3270_ATTR_FIELD | ((FA_IS_HIGH(fa)) ? LIB3270_ATTR_INTENSIFY : 0); } /* @@ -322,7 +322,7 @@ void screen_update(H3270 *session, int bstart, int bend) fa = get_field_attribute(session,bstart); a = color_from_fa(session,fa); - fa_addr = find_field_attribute(session,bstart); // may be -1, that's okay + fa_addr = lib3270_field_addr(session,bstart); // may be -1, that's okay for(baddr = bstart; baddr < bend; baddr++) { @@ -556,7 +556,7 @@ void set_status(H3270 *session, LIB3270_FLAG id, Boolean on) void status_ctlr_done(H3270 *session) { CHECK_SESSION_HANDLE(session); - set_status(session,OIA_FLAG_UNDERA,True); + set_status(session,LIB3270_FLAG_UNDERA,True); session->cbk.ctlr_done(session); } @@ -697,7 +697,7 @@ void status_changed(H3270 *session, LIB3270_MESSAGE id) void status_twait(H3270 *session) { CHECK_SESSION_HANDLE(session); - set_status(session,OIA_FLAG_UNDERA,False); + set_status(session,LIB3270_FLAG_UNDERA,False); status_changed(session,LIB3270_MESSAGE_TWAIT); } @@ -735,7 +735,7 @@ static void status_connect(H3270 *hSession, int connected, void GNUC_UNUSED(*dun if (connected) { - set_status(hSession,OIA_FLAG_BOXSOLID,IN_3270 && !IN_SSCP); + set_status(hSession,LIB3270_FLAG_BOXSOLID,IN_3270 && !IN_SSCP); if (hSession->kybdlock & KL_AWAITING_FIRST) id = LIB3270_MESSAGE_AWAITING_FIRST; @@ -745,7 +745,7 @@ static void status_connect(H3270 *hSession, int connected, void GNUC_UNUSED(*dun } else { - set_status(hSession,OIA_FLAG_BOXSOLID,False); + set_status(hSession,LIB3270_FLAG_BOXSOLID,False); id = LIB3270_MESSAGE_DISCONNECTED; } @@ -760,15 +760,15 @@ static void status_3270_mode(H3270 *hSession, int GNUC_UNUSED(ignored), void GNU CHECK_SESSION_HANDLE(hSession); if(oia_boxsolid) - set_status(hSession,OIA_FLAG_UNDERA,True); - set_status(hSession,OIA_FLAG_BOXSOLID,oia_boxsolid); + set_status(hSession,LIB3270_FLAG_UNDERA,True); + set_status(hSession,LIB3270_FLAG_BOXSOLID,oia_boxsolid); } /* static void status_printer(H3270 *session, int on, void *dunno) { - set_status(session,OIA_FLAG_PRINTER,on); + set_status(session,LIB3270_FLAG_PRINTER,on); } */ diff --git a/src/lib3270/selection/actions.c b/src/lib3270/selection/actions.c index 453d819..9f8bfa2 100644 --- a/src/lib3270/selection/actions.c +++ b/src/lib3270/selection/actions.c @@ -32,6 +32,8 @@ #include #include #include + #include + #include #include "3270ds.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -48,7 +50,7 @@ LIB3270_EXPORT int lib3270_unselect(H3270 *hSession) { hSession->selected = 0; - for(a = 0; a < hSession->rows*hSession->cols; a++) + for(a = 0; a < ((int) (hSession->rows*hSession->cols)); a++) { if(hSession->text[a].attr & LIB3270_ATTR_SELECTED) { @@ -211,10 +213,10 @@ LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) if(col < 0) cols = - (pos[f] % hSession->cols); - if(row >= (hSession->rows)) + if(row >= ((int) hSession->rows)) rows = hSession->rows - ((pos[f] / hSession->cols)+1); - if(col >= hSession->cols) + if(col >= ((int) hSession->cols)) cols = hSession->cols - ((pos[f] % hSession->cols)+1); } diff --git a/src/lib3270/selection/selection.c b/src/lib3270/selection/selection.c index 617f0ea..7a1b013 100644 --- a/src/lib3270/selection/selection.c +++ b/src/lib3270/selection/selection.c @@ -32,6 +32,7 @@ #include #include #include + #include #include "3270ds.h" #include "kybdc.h" @@ -221,9 +222,9 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba if( (col == 0) || !(hSession->text[baddr-1].attr & LIB3270_ATTR_SELECTED) ) rc |= SELECTION_LEFT; - /// FIXME: It should text if baddr is the last element before the +1. + /// FIXME: It should test if baddr is the last element before the +1. - if( (col == hSession->cols) || !(hSession->text[baddr+1].attr & LIB3270_ATTR_SELECTED) ) + if( (col == ((int) hSession->cols)) || !(hSession->text[baddr+1].attr & LIB3270_ATTR_SELECTED) ) rc |= SELECTION_RIGHT; } @@ -236,7 +237,7 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba if( (row == 0) || !(hSession->text[baddr-hSession->cols].attr & LIB3270_ATTR_SELECTED) ) rc |= SELECTION_TOP; - if( (row == hSession->rows) || !(hSession->text[baddr+hSession->cols].attr & LIB3270_ATTR_SELECTED) ) + if( (row == ((int) hSession->rows)) || !(hSession->text[baddr+hSession->cols].attr & LIB3270_ATTR_SELECTED) ) rc |= SELECTION_BOTTOM; } diff --git a/src/lib3270/session.c b/src/lib3270/session.c index 2cd270b..dc29481 100644 --- a/src/lib3270/session.c +++ b/src/lib3270/session.c @@ -45,6 +45,7 @@ #include "3270ds.h" #include "popupsc.h" #include +#include /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ diff --git a/src/lib3270/sf.c b/src/lib3270/sf.c index e23ea97..f05bb86 100644 --- a/src/lib3270/sf.c +++ b/src/lib3270/sf.c @@ -63,7 +63,7 @@ #include "trace_dsc.h" #include "utilc.h" -#include "api.h" +// #include "api.h" // Externals // extern unsigned char reply_mode; diff --git a/src/lib3270/ssl/linux/getcrl.c b/src/lib3270/ssl/linux/getcrl.c index e096fab..7de0fc9 100644 --- a/src/lib3270/ssl/linux/getcrl.c +++ b/src/lib3270/ssl/linux/getcrl.c @@ -58,6 +58,7 @@ #include #include #include +#include /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/lib3270/ssl/negotiate.c b/src/lib3270/ssl/negotiate.c index c8e6c0b..158530e 100644 --- a/src/lib3270/ssl/negotiate.c +++ b/src/lib3270/ssl/negotiate.c @@ -51,6 +51,7 @@ #include #include #include +#include #include "hostc.h" // host_disconnect #include "trace_dsc.h" diff --git a/src/lib3270/ssl/state.c b/src/lib3270/ssl/state.c index 9aee5d4..32934d7 100644 --- a/src/lib3270/ssl/state.c +++ b/src/lib3270/ssl/state.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #ifdef HAVE_LIBSSL #include diff --git a/src/lib3270/telnet.c b/src/lib3270/telnet.c index 5f8ba26..3e86171 100644 --- a/src/lib3270/telnet.c +++ b/src/lib3270/telnet.c @@ -103,6 +103,7 @@ #include #include +#include #if !defined(TELOPT_NAWS) /*[*/ #define TELOPT_NAWS 31 diff --git a/src/lib3270/toggles.c b/src/lib3270/toggles.c index 087ef58..653297f 100644 --- a/src/lib3270/toggles.c +++ b/src/lib3270/toggles.c @@ -59,6 +59,7 @@ #include "togglesc.h" //#include "api.h" #include "utilc.h" +#include static const struct _toggle_info { diff --git a/src/lib3270/utf8.c b/src/lib3270/utf8.c index b24c993..524fb9e 100644 --- a/src/lib3270/utf8.c +++ b/src/lib3270/utf8.c @@ -37,7 +37,7 @@ */ #include "private.h" -#include "api.h" +// #include "api.h" #include "popupsc.h" #include "utf8c.h" diff --git a/src/lib3270/util.c b/src/lib3270/util.c index c18caf9..e254724 100644 --- a/src/lib3270/util.c +++ b/src/lib3270/util.c @@ -38,6 +38,7 @@ #include "utilc.h" #include "popupsc.h" #include +#include #define my_isspace(c) isspace((unsigned char)c) -- libgit2 0.21.2