Commit 0597c00dd9891fd4282c190c76ee684b17019de0
1 parent
f007470a
Exists in
master
and in
3 other branches
Updating API, adding method to get screen format state.
Showing
3 changed files
with
29 additions
and
33 deletions
Show diff stats
src/core/ctlr.c
| @@ -429,6 +429,14 @@ static void ctlr_connect(H3270 *hSession, int GNUC_UNUSED(ignored), void GNUC_UN | @@ -429,6 +429,14 @@ static void ctlr_connect(H3270 *hSession, int GNUC_UNUSED(ignored), void GNUC_UN | ||
| 429 | hSession->crm_nattr = 0; | 429 | hSession->crm_nattr = 0; |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | +LIB3270_EXPORT int lib3270_get_is_formatted(H3270 *hSession) | ||
| 433 | +{ | ||
| 434 | + if(check_online_session(hSession)) | ||
| 435 | + return -1; | ||
| 436 | + | ||
| 437 | + return hSession->formatted ? 1 : 0; | ||
| 438 | +} | ||
| 439 | + | ||
| 432 | /** | 440 | /** |
| 433 | * @brief Get field address. | 441 | * @brief Get field address. |
| 434 | * | 442 | * |
| @@ -531,7 +539,7 @@ LIB3270_EXPORT LIB3270_FIELD_ATTRIBUTE lib3270_get_field_attribute(H3270 *hSessi | @@ -531,7 +539,7 @@ LIB3270_EXPORT LIB3270_FIELD_ATTRIBUTE lib3270_get_field_attribute(H3270 *hSessi | ||
| 531 | if(!hSession->formatted) | 539 | if(!hSession->formatted) |
| 532 | { | 540 | { |
| 533 | errno = ENOTCONN; | 541 | errno = ENOTCONN; |
| 534 | - return (LIB3270_FIELD_ATTRIBUTE) 0; | 542 | + return LIB3270_FIELD_ATTRIBUTE_INVALID; |
| 535 | } | 543 | } |
| 536 | 544 | ||
| 537 | if(baddr < 0) | 545 | if(baddr < 0) |
| @@ -547,7 +555,7 @@ LIB3270_EXPORT LIB3270_FIELD_ATTRIBUTE lib3270_get_field_attribute(H3270 *hSessi | @@ -547,7 +555,7 @@ LIB3270_EXPORT LIB3270_FIELD_ATTRIBUTE lib3270_get_field_attribute(H3270 *hSessi | ||
| 547 | } while (baddr != sbaddr); | 555 | } while (baddr != sbaddr); |
| 548 | 556 | ||
| 549 | errno = EINVAL; | 557 | errno = EINVAL; |
| 550 | - return (LIB3270_FIELD_ATTRIBUTE) 0; | 558 | + return LIB3270_FIELD_ATTRIBUTE_INVALID; |
| 551 | 559 | ||
| 552 | } | 560 | } |
| 553 | 561 | ||
| @@ -646,26 +654,9 @@ LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr) | @@ -646,26 +654,9 @@ LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr) | ||
| 646 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr) | 654 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr) |
| 647 | { | 655 | { |
| 648 | return lib3270_get_is_protected(h, baddr); | 656 | return lib3270_get_is_protected(h, baddr); |
| 649 | - | ||
| 650 | - /* | ||
| 651 | - unsigned char fa; | ||
| 652 | - | ||
| 653 | - FAIL_IF_NOT_ONLINE(h); | ||
| 654 | - | ||
| 655 | - if(baddr > (h->rows * h->cols)) | ||
| 656 | - { | ||
| 657 | - errno = EINVAL; | ||
| 658 | - return -1; | ||
| 659 | - } | ||
| 660 | - | ||
| 661 | - fa = get_field_attribute(h,baddr); | ||
| 662 | - | ||
| 663 | - return FA_IS_PROTECTED(fa); | ||
| 664 | - */ | ||
| 665 | } | 657 | } |
| 666 | 658 | ||
| 667 | 659 | ||
| 668 | - | ||
| 669 | /** | 660 | /** |
| 670 | * Perform an erase command, which may include changing the (virtual) screen size. | 661 | * Perform an erase command, which may include changing the (virtual) screen size. |
| 671 | * | 662 | * |
src/core/properties.c
| @@ -56,11 +56,6 @@ | @@ -56,11 +56,6 @@ | ||
| 56 | return hSession->starting != 0; | 56 | return hSession->starting != 0; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | - int lib3270_get_formatted(H3270 *hSession) | ||
| 60 | - { | ||
| 61 | - return hSession->formatted != 0; | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | const LIB3270_INT_PROPERTY * lib3270_get_boolean_properties_list(void) | 59 | const LIB3270_INT_PROPERTY * lib3270_get_boolean_properties_list(void) |
| 65 | { | 60 | { |
| 66 | 61 | ||
| @@ -173,7 +168,7 @@ | @@ -173,7 +168,7 @@ | ||
| 173 | { | 168 | { |
| 174 | "formatted", // Property name. | 169 | "formatted", // Property name. |
| 175 | N_( "Formatted screen" ), // Property description. | 170 | N_( "Formatted screen" ), // Property description. |
| 176 | - lib3270_get_formatted, // Get value. | 171 | + lib3270_get_is_formatted, // Get value. |
| 177 | NULL // Set value. | 172 | NULL // Set value. |
| 178 | }, | 173 | }, |
| 179 | 174 | ||
| @@ -212,7 +207,7 @@ | @@ -212,7 +207,7 @@ | ||
| 212 | }, | 207 | }, |
| 213 | 208 | ||
| 214 | { | 209 | { |
| 215 | - "width",// Property name. | 210 | + "width", // Property name. |
| 216 | N_( "Current screen width in columns" ), // Property description. | 211 | N_( "Current screen width in columns" ), // Property description. |
| 217 | lib3270_get_width, // Get value. | 212 | lib3270_get_width, // Get value. |
| 218 | NULL // Set value. | 213 | NULL // Set value. |
src/include/lib3270.h
| @@ -296,6 +296,7 @@ | @@ -296,6 +296,7 @@ | ||
| 296 | */ | 296 | */ |
| 297 | typedef enum lib3270_field_attribute | 297 | typedef enum lib3270_field_attribute |
| 298 | { | 298 | { |
| 299 | + LIB3270_FIELD_ATTRIBUTE_INVALID = 0x00, ///< @brief Attribute is invalid. | ||
| 299 | LIB3270_FIELD_ATTRIBUTE_PRINTABLE = 0xc0, ///< @brief these make the character "printable" | 300 | LIB3270_FIELD_ATTRIBUTE_PRINTABLE = 0xc0, ///< @brief these make the character "printable" |
| 300 | LIB3270_FIELD_ATTRIBUTE_PROTECT = 0x20, ///< @brief unprotected (0) / protected (1) | 301 | LIB3270_FIELD_ATTRIBUTE_PROTECT = 0x20, ///< @brief unprotected (0) / protected (1) |
| 301 | LIB3270_FIELD_ATTRIBUTE_NUMERIC = 0x10, ///< @brief alphanumeric (0) / numeric (1) | 302 | LIB3270_FIELD_ATTRIBUTE_NUMERIC = 0x10, ///< @brief alphanumeric (0) / numeric (1) |
| @@ -309,15 +310,14 @@ | @@ -309,15 +310,14 @@ | ||
| 309 | } LIB3270_FIELD_ATTRIBUTE; | 310 | } LIB3270_FIELD_ATTRIBUTE; |
| 310 | 311 | ||
| 311 | /** | 312 | /** |
| 312 | - * @brief Host options | 313 | + * @brief Host types. |
| 313 | * | 314 | * |
| 314 | */ | 315 | */ |
| 315 | typedef enum lib3270_host_type | 316 | typedef enum lib3270_host_type |
| 316 | { | 317 | { |
| 317 | - // Host types | ||
| 318 | - LIB3270_HOST_AS400 = 0x0001, ///< AS400 host - Prefix every PF with PA1 | ||
| 319 | - LIB3270_HOST_TSO = 0x0002, ///< Host is TSO? | ||
| 320 | - LIB3270_HOST_S390 = 0x0006, ///< Host is S390? (TSO included) | 318 | + LIB3270_HOST_AS400 = 0x0001, ///< @brief AS400 host - Prefix every PF with PA1 |
| 319 | + LIB3270_HOST_TSO = 0x0002, ///< @brief Host is TSO | ||
| 320 | + LIB3270_HOST_S390 = 0x0006, ///< @brief Host is S390 (TSO included) | ||
| 321 | 321 | ||
| 322 | } LIB3270_HOST_TYPE; | 322 | } LIB3270_HOST_TYPE; |
| 323 | 323 | ||
| @@ -332,7 +332,7 @@ | @@ -332,7 +332,7 @@ | ||
| 332 | } LIB3270_HOST_TYPE_ENTRY; | 332 | } LIB3270_HOST_TYPE_ENTRY; |
| 333 | 333 | ||
| 334 | /** | 334 | /** |
| 335 | - * SSL state | 335 | + * @brief SSL state |
| 336 | * | 336 | * |
| 337 | */ | 337 | */ |
| 338 | typedef enum lib3270_ssl_state | 338 | typedef enum lib3270_ssl_state |
| @@ -1147,6 +1147,16 @@ | @@ -1147,6 +1147,16 @@ | ||
| 1147 | LIB3270_EXPORT int LIB3270_DEPRECATED(lib3270_is_protected(H3270 *h, unsigned int baddr)); | 1147 | LIB3270_EXPORT int LIB3270_DEPRECATED(lib3270_is_protected(H3270 *h, unsigned int baddr)); |
| 1148 | 1148 | ||
| 1149 | /** | 1149 | /** |
| 1150 | + * @brief Check if the screen is formatted. | ||
| 1151 | + * | ||
| 1152 | + * @param hSession Session handle. | ||
| 1153 | + * | ||
| 1154 | + * @return -1 when failed 1 if the session is formatted and 0 if not. | ||
| 1155 | + * | ||
| 1156 | + */ | ||
| 1157 | + LIB3270_EXPORT int lib3270_get_is_formatted(H3270 *hSession); | ||
| 1158 | + | ||
| 1159 | + /** | ||
| 1150 | * @brief Get Check if the screen position is protected. | 1160 | * @brief Get Check if the screen position is protected. |
| 1151 | * | 1161 | * |
| 1152 | * @param h Session Handle. | 1162 | * @param h Session Handle. |
| @@ -1186,7 +1196,7 @@ | @@ -1186,7 +1196,7 @@ | ||
| 1186 | * @param hSession Session handle. | 1196 | * @param hSession Session handle. |
| 1187 | * @param addr Buffer address of the field (-1 to use the cursor address). | 1197 | * @param addr Buffer address of the field (-1 to use the cursor address). |
| 1188 | * | 1198 | * |
| 1189 | - * @return field attribute or 0 when failed (sets errno). | 1199 | + * @return field attribute or LIB3270_FIELD_ATTRIBUTE_INVALID when failed (sets errno). |
| 1190 | */ | 1200 | */ |
| 1191 | LIB3270_EXPORT LIB3270_FIELD_ATTRIBUTE lib3270_get_field_attribute(H3270 *hSession, int baddr); | 1201 | LIB3270_EXPORT LIB3270_FIELD_ATTRIBUTE lib3270_get_field_attribute(H3270 *hSession, int baddr); |
| 1192 | 1202 |