From 545d9579f808496719f1a1de9eeae626e6187b57 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 24 Dec 2018 11:56:27 -0200 Subject: [PATCH] + Adding cursor and color properties. --- src/include/lib3270.h | 4 ++-- src/lib3270/options.c | 10 +++++----- src/lib3270/properties.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------- 3 files changed, 87 insertions(+), 59 deletions(-) diff --git a/src/include/lib3270.h b/src/include/lib3270.h index e971626..4657a8a 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -1211,8 +1211,8 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt); - LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype); - LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession); + LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, int colortype); + LIB3270_EXPORT int lib3270_get_color_type(H3270 *hSession); LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name); LIB3270_EXPORT LIB3270_OPTION lib3270_parse_host_type(const char *name); diff --git a/src/lib3270/options.c b/src/lib3270/options.c index 678db5a..daf749c 100644 --- a/src/lib3270/options.c +++ b/src/lib3270/options.c @@ -94,18 +94,18 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt) } -LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession) +LIB3270_EXPORT int lib3270_get_color_type(H3270 *hSession) { CHECK_SESSION_HANDLE(hSession); - return hSession->mono ? 2 : hSession->colors; + return (int) (hSession->mono ? 2 : hSession->colors); } -LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype) +LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, int colortype) { CHECK_SESSION_HANDLE(hSession); if(hSession->cstate != LIB3270_NOT_CONNECTED) - return EBUSY; + return errno = EBUSY; switch(colortype) { @@ -129,7 +129,7 @@ LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colort break; default: - return EINVAL; + return errno = EINVAL; } diff --git a/src/lib3270/properties.c b/src/lib3270/properties.c index fad4a8b..6187929 100644 --- a/src/lib3270/properties.c +++ b/src/lib3270/properties.c @@ -40,95 +40,123 @@ static const LIB3270_INT_PROPERTY properties[] = { { - "ready", ///< Property name. - N_( "" ), ///< Property description. - lib3270_is_ready, ///< Get value. - NULL ///< Set value. + "ready", // Property name. + N_( "" ), // Property description. + lib3270_is_ready, // Get value. + NULL // Set value. }, { - "connected", ///< Property name. - N_( "" ), ///< Property description. - lib3270_is_connected, ///< Get value. - lib3270_set_connected ///< Set value. + "connected", // Property name. + N_( "" ), // Property description. + lib3270_is_connected, // Get value. + lib3270_set_connected // Set value. }, { - "secure", ///< Property name. - N_( "" ), ///< Property description. - lib3270_is_secure, ///< Get value. - NULL ///< Set value. + "secure", // Property name. + N_( "" ), // Property description. + lib3270_is_secure, // Get value. + NULL // Set value. }, { - "tso", ///< Property name. - N_( "Non zero if the host is TSO." ), ///< Property description. - lib3270_is_tso, ///< Get value. - NULL ///< Set value. + "tso", // Property name. + N_( "Non zero if the host is TSO." ), // Property description. + lib3270_is_tso, // Get value. + NULL // Set value. }, { - "pconnected", ///< Property name. - N_( "" ), ///< Property description. - lib3270_pconnected, ///< Get value. - NULL ///< Set value. + "pconnected", // Property name. + N_( "" ), // Property description. + lib3270_pconnected, // Get value. + NULL // Set value. }, { - "half_connected", ///< Property name. - N_( "" ), ///< Property description. - lib3270_half_connected, ///< Get value. - NULL ///< Set value. + "half_connected", // Property name. + N_( "" ), // Property description. + lib3270_half_connected, // Get value. + NULL // Set value. }, { - "neither", ///< Property name. - N_( "" ), ///< Property description. - lib3270_in_neither, ///< Get value. - NULL ///< Set value. + "neither", // Property name. + N_( "" ), // Property description. + lib3270_in_neither, // Get value. + NULL // Set value. }, { - "ansi", ///< Property name. - N_( "" ), ///< Property description. - lib3270_in_ansi, ///< Get value. - NULL ///< Set value. + "ansi", // Property name. + N_( "" ), // Property description. + lib3270_in_ansi, // Get value. + NULL // Set value. }, { - "3270", ///< Property name. - N_( "" ), ///< Property description. - lib3270_in_3270, ///< Get value. - NULL ///< Set value. + "3270", // Property name. + N_( "" ), // Property description. + lib3270_in_3270, // Get value. + NULL // Set value. }, { - "sscp", ///< Property name. - N_( "" ), ///< Property description. - lib3270_in_sscp, ///< Get value. - NULL ///< Set value. + "sscp", // Property name. + N_( "" ), // Property description. + lib3270_in_sscp, // Get value. + NULL // Set value. }, { - "tn3270e", ///< Property name. - N_( "" ), ///< Property description. - lib3270_in_tn3270e, ///< Get value. - NULL ///< Set value. + "tn3270e", // Property name. + N_( "" ), // Property description. + lib3270_in_tn3270e, // Get value. + NULL // Set value. }, { - "e", ///< Property name. - N_( "" ), ///< Property description. - lib3270_in_e, ///< Get value. - NULL ///< Set value. + "e", // Property name. + N_( "" ), // Property description. + lib3270_in_e, // Get value. + NULL // Set value. + }, + + { + "cursor_address", // Property name. + N_( "Cursor address" ), // Property description. + lib3270_get_cursor_address, // Get value. + lib3270_set_cursor_address // Set value. + }, + + { + "has_selection", // Property name. + N_( "Has selected aread" ), // Property description. + lib3270_has_selection, // Get value. + NULL // Set value. + }, + + { + "model_number", // Property name. + N_( "The model number" ), // Property description. + lib3270_get_model_number, // Get value. + NULL // Set value. + }, + + { + "color_type", // Property name. + N_( "The color type" ), // Property description. + lib3270_get_color_type, // Get value. + lib3270_set_color_type // Set value. }, /* { - "", ///< Property name. - N_( "" ), ///< Property description. - NULL, ///< Get value. - NULL ///< Set value. + "", // Property name. + N_( "" ), // Property description. + NULL, // Get value. + NULL // Set value. }, */ -- libgit2 0.21.2