Commit 913e61021dcef7b2715717248c81ef1543eb5879
1 parent
25907e2e
Exists in
master
and in
5 other branches
Small fixes in the API
Showing
8 changed files
with
39 additions
and
7 deletions
Show diff stats
src/classlib/local.cc
@@ -425,7 +425,7 @@ | @@ -425,7 +425,7 @@ | ||
425 | 425 | ||
426 | int set_host(const char *uri) | 426 | int set_host(const char *uri) |
427 | { | 427 | { |
428 | - return _set_host(hSession,uri) != NULL ? 1 : 0; | 428 | + return (_set_host(hSession,uri) == NULL) ? 0 : 1; |
429 | } | 429 | } |
430 | 430 | ||
431 | int disconnect(void) | 431 | int disconnect(void) |
src/include/lib3270.h
@@ -244,18 +244,24 @@ | @@ -244,18 +244,24 @@ | ||
244 | */ | 244 | */ |
245 | typedef enum lib3270_option | 245 | typedef enum lib3270_option |
246 | { | 246 | { |
247 | - LIB3270_OPTION_DEFAULTS = 0x0000, | ||
248 | - LIB3270_OPTION_AS400 = 0x0001, /**< Prefix every PF with PA1 */ | 247 | + /* Host types */ |
248 | + LIB3270_OPTION_AS400 = 0x0001, /**< AS400 host - Prefix every PF with PA1 */ | ||
249 | LIB3270_OPTION_TSO = 0x0002, /**< Host is TSO? */ | 249 | LIB3270_OPTION_TSO = 0x0002, /**< Host is TSO? */ |
250 | - LIB3270_OPTION_SSL = 0x0004, | 250 | + LIB3270_OPTION_S390 = 0x0006, /**< Host is S390? (TSO included) */ |
251 | + | ||
252 | + /* Other options */ | ||
253 | + LIB3270_OPTION_SSL = 0x0010, /**< Secure connection ? */ | ||
254 | + | ||
251 | 255 | ||
252 | LIB3270_OPTION_WAIT = 0x8000 /**< Wait for session ready on connect ? */ | 256 | LIB3270_OPTION_WAIT = 0x8000 /**< Wait for session ready on connect ? */ |
253 | } LIB3270_OPTION; | 257 | } LIB3270_OPTION; |
254 | 258 | ||
259 | + #define LIB3270_OPTION_HOST_TYPE 0x0007 | ||
260 | + #define LIB3270_OPTION_DEFAULTS LIB3270_OPTION_S390 | ||
255 | 261 | ||
256 | // LIB3270_OPTION_COLOR8 = 0x0001, /**< If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors. */ | 262 | // LIB3270_OPTION_COLOR8 = 0x0001, /**< If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors. */ |
257 | 263 | ||
258 | - #define LIB3270_OPTION_DEFAULT 0 | 264 | +// #define LIB3270_OPTION_DEFAULT 0 |
259 | #define LIB3270_OPTION_COUNT 3 | 265 | #define LIB3270_OPTION_COUNT 3 |
260 | 266 | ||
261 | typedef struct _lib3270_option_entry | 267 | typedef struct _lib3270_option_entry |
@@ -1045,7 +1051,9 @@ | @@ -1045,7 +1051,9 @@ | ||
1045 | LIB3270_EXPORT int lib3270_clear_operator_error(H3270 *hSession); | 1051 | LIB3270_EXPORT int lib3270_clear_operator_error(H3270 *hSession); |
1046 | 1052 | ||
1047 | LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt); | 1053 | LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt); |
1054 | + | ||
1048 | LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype); | 1055 | LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype); |
1056 | + LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession); | ||
1049 | 1057 | ||
1050 | LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void); | 1058 | LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void); |
1051 | 1059 |
src/include/lib3270/session.h
@@ -101,7 +101,7 @@ | @@ -101,7 +101,7 @@ | ||
101 | int oerr_lock : 1; | 101 | int oerr_lock : 1; |
102 | int unlock_delay : 1; | 102 | int unlock_delay : 1; |
103 | int auto_reconnect_inprogress : 1; | 103 | int auto_reconnect_inprogress : 1; |
104 | - int colors : 5; | 104 | + unsigned int colors : 5; |
105 | int apl_mode : 1; | 105 | int apl_mode : 1; |
106 | int icrnl : 1; | 106 | int icrnl : 1; |
107 | int inlcr : 1; | 107 | int inlcr : 1; |
src/include/pw3270/v3270.h
@@ -227,8 +227,13 @@ | @@ -227,8 +227,13 @@ | ||
227 | LIB3270_EXPORT const gchar * v3270_get_ssl_status_message(GtkWidget *widget); | 227 | LIB3270_EXPORT const gchar * v3270_get_ssl_status_message(GtkWidget *widget); |
228 | LIB3270_EXPORT void v3270_popup_security_dialog(GtkWidget *widget); | 228 | LIB3270_EXPORT void v3270_popup_security_dialog(GtkWidget *widget); |
229 | 229 | ||
230 | + // File transfer | ||
230 | LIB3270_EXPORT gint v3270_transfer_file(GtkWidget *widget, LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl, int blksize, int primspace, int secspace, int dft); | 231 | LIB3270_EXPORT gint v3270_transfer_file(GtkWidget *widget, LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl, int blksize, int primspace, int secspace, int dft); |
231 | 232 | ||
233 | + // Auxiliary widgets | ||
234 | + LIB3270_EXPORT GtkWidget * v3270_host_select_new(GtkWidget *widget); | ||
235 | + | ||
236 | + | ||
232 | G_END_DECLS | 237 | G_END_DECLS |
233 | 238 | ||
234 | #endif // V3270_H_INCLUDED | 239 | #endif // V3270_H_INCLUDED |
src/lib3270/options.c
@@ -77,6 +77,16 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt) | @@ -77,6 +77,16 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt) | ||
77 | hSession->options = opt; | 77 | hSession->options = opt; |
78 | } | 78 | } |
79 | 79 | ||
80 | +LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession) | ||
81 | +{ | ||
82 | + CHECK_SESSION_HANDLE(hSession); | ||
83 | + | ||
84 | + trace("******************* %d",hSession->colors); | ||
85 | + | ||
86 | + return hSession->mono ? 2 : hSession->colors; | ||
87 | +} | ||
88 | + | ||
89 | + | ||
80 | LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype) | 90 | LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype) |
81 | { | 91 | { |
82 | CHECK_SESSION_HANDLE(hSession); | 92 | CHECK_SESSION_HANDLE(hSession); |
src/lib3270/session.c
@@ -303,6 +303,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char | @@ -303,6 +303,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char | ||
303 | hSession->saved_wraparound_mode = 1; | 303 | hSession->saved_wraparound_mode = 1; |
304 | hSession->once_cset = -1; | 304 | hSession->once_cset = -1; |
305 | hSession->state = LIB3270_ANSI_STATE_DATA; | 305 | hSession->state = LIB3270_ANSI_STATE_DATA; |
306 | + hSession->options = LIB3270_OPTION_DEFAULTS; | ||
307 | + hSession->colors = 16; | ||
308 | + hSession->m3279 = 1; | ||
306 | 309 | ||
307 | for(f=0;f<4;f++) | 310 | for(f=0;f<4;f++) |
308 | hSession->csd[f] = hSession->saved_csd[f] = LIB3270_ANSI_CSD_US; | 311 | hSession->csd[f] = hSession->saved_csd[f] = LIB3270_ANSI_CSD_US; |
src/pw3270/hostdialog.c
@@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
39 | LIB3270_OPTION option; | 39 | LIB3270_OPTION option; |
40 | } host_type[] = | 40 | } host_type[] = |
41 | { | 41 | { |
42 | - { "S390", N_( "IBM S/390" ), LIB3270_OPTION_TSO }, | 42 | + { "S390", N_( "IBM S/390" ), LIB3270_OPTION_S390 }, |
43 | { "AS400", N_( "IBM AS/400" ), LIB3270_OPTION_AS400 }, | 43 | { "AS400", N_( "IBM AS/400" ), LIB3270_OPTION_AS400 }, |
44 | { "TSO", N_( "Other (TSO)" ), LIB3270_OPTION_TSO }, | 44 | { "TSO", N_( "Other (TSO)" ), LIB3270_OPTION_TSO }, |
45 | { "VM/CMS", N_( "Other (VM/CMS)" ), 0 } | 45 | { "VM/CMS", N_( "Other (VM/CMS)" ), 0 } |
src/pw3270/v3270/widget.c
@@ -1552,6 +1552,12 @@ int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype) | @@ -1552,6 +1552,12 @@ int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype) | ||
1552 | return lib3270_set_color_type(GTK_V3270(widget)->host,colortype); | 1552 | return lib3270_set_color_type(GTK_V3270(widget)->host,colortype); |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | +unsigned short v3270_get_session_color_type(GtkWidget *widget) | ||
1556 | +{ | ||
1557 | + g_return_val_if_fail(GTK_IS_V3270(widget),-1); | ||
1558 | + return lib3270_get_color_type(GTK_V3270(widget)->host); | ||
1559 | +} | ||
1560 | + | ||
1555 | gboolean v3270_is_connected(GtkWidget *widget) | 1561 | gboolean v3270_is_connected(GtkWidget *widget) |
1556 | { | 1562 | { |
1557 | g_return_val_if_fail(GTK_IS_V3270(widget),FALSE); | 1563 | g_return_val_if_fail(GTK_IS_V3270(widget),FALSE); |