Commit 5f85cba18b1eeed254ec2bc6502877b2ac0375bf
1 parent
8b9c149d
Exists in
master
and in
3 other branches
Updating method declarations.
Showing
11 changed files
with
41 additions
and
46 deletions
Show diff stats
src/core/ctlr.c
... | ... | @@ -318,7 +318,7 @@ static void ctlr_connect(H3270 *hSession, int GNUC_UNUSED(ignored), void GNUC_UN |
318 | 318 | hSession->crm_nattr = 0; |
319 | 319 | } |
320 | 320 | |
321 | -LIB3270_EXPORT int lib3270_get_is_formatted(H3270 *hSession) | |
321 | +LIB3270_EXPORT int lib3270_get_is_formatted(const H3270 *hSession) | |
322 | 322 | { |
323 | 323 | if(check_online_session(hSession)) |
324 | 324 | return -1; |
... | ... | @@ -389,7 +389,7 @@ LIB3270_EXPORT int lib3270_get_field_len(H3270 *hSession, int baddr) |
389 | 389 | return -(errno = ENODATA); |
390 | 390 | } |
391 | 391 | |
392 | -LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr) | |
392 | +LIB3270_EXPORT int lib3270_field_addr(const H3270 *hSession, int baddr) | |
393 | 393 | { |
394 | 394 | int sbaddr; |
395 | 395 | |
... | ... | @@ -525,11 +525,11 @@ LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0) |
525 | 525 | return 0; |
526 | 526 | } |
527 | 527 | |
528 | -LIB3270_EXPORT int lib3270_get_is_protected_at(H3270 *h, unsigned int row, unsigned int col) { | |
529 | - return lib3270_get_is_protected(h, ((row-1) * h->view.cols) + (col-1)); | |
528 | +LIB3270_EXPORT int lib3270_get_is_protected_at(const H3270 *h, unsigned int row, unsigned int col) { | |
529 | + return lib3270_get_is_protected(h, lib3270_translate_to_address(h,row,col)); | |
530 | 530 | } |
531 | 531 | |
532 | -LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr) | |
532 | +LIB3270_EXPORT int lib3270_get_is_protected(const H3270 *hSession, int baddr) | |
533 | 533 | { |
534 | 534 | FAIL_IF_NOT_ONLINE(hSession); |
535 | 535 | ... | ... |
src/core/keyboard/properties.c
... | ... | @@ -31,7 +31,7 @@ |
31 | 31 | #include <lib3270/keyboard.h> |
32 | 32 | #include <lib3270/properties.h> |
33 | 33 | |
34 | -LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession) | |
34 | +LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(const H3270 *hSession) | |
35 | 35 | { |
36 | 36 | if(check_online_session(hSession)) |
37 | 37 | return LIB3270_KL_NOT_CONNECTED; |
... | ... | @@ -45,7 +45,7 @@ LIB3270_EXPORT int lib3270_set_lock_on_operator_error(H3270 *hSession, int enabl |
45 | 45 | return 0; |
46 | 46 | } |
47 | 47 | |
48 | -int lib3270_get_lock_on_operator_error(H3270 *hSession) | |
48 | +int lib3270_get_lock_on_operator_error(const H3270 *hSession) | |
49 | 49 | { |
50 | 50 | return (int) hSession->oerr_lock; |
51 | 51 | } |
... | ... | @@ -57,7 +57,7 @@ LIB3270_EXPORT int lib3270_set_unlock_delay(H3270 *hSession, unsigned int delay) |
57 | 57 | return 0; |
58 | 58 | } |
59 | 59 | |
60 | -LIB3270_EXPORT unsigned int lib3270_get_unlock_delay(H3270 *hSession) | |
60 | +LIB3270_EXPORT unsigned int lib3270_get_unlock_delay(const H3270 *hSession) | |
61 | 61 | { |
62 | 62 | return (unsigned int) hSession->unlock_delay_ms; |
63 | 63 | } | ... | ... |
src/core/model.c
src/core/properties/boolean.c
src/core/properties/signed.c
... | ... | @@ -34,17 +34,17 @@ |
34 | 34 | #include <lib3270/properties.h> |
35 | 35 | #include <lib3270/keyboard.h> |
36 | 36 | |
37 | - static int lib3270_get_connection_state_as_int(H3270 *hSession) | |
37 | + static int lib3270_get_connection_state_as_int(const H3270 *hSession) | |
38 | 38 | { |
39 | 39 | return (int) lib3270_get_connection_state(hSession); |
40 | 40 | } |
41 | 41 | |
42 | - static int lib3270_get_program_message_as_int(H3270 *hSession) | |
42 | + static int lib3270_get_program_message_as_int(const H3270 *hSession) | |
43 | 43 | { |
44 | 44 | return (int) lib3270_get_program_message(hSession); |
45 | 45 | } |
46 | 46 | |
47 | - static int lib3270_get_ssl_state_as_int(H3270 * hSession) | |
47 | + static int lib3270_get_ssl_state_as_int(const H3270 * hSession) | |
48 | 48 | { |
49 | 49 | return (int) lib3270_get_ssl_state(hSession); |
50 | 50 | } | ... | ... |
src/core/properties/unsigned.c
... | ... | @@ -34,7 +34,7 @@ |
34 | 34 | #include <lib3270/properties.h> |
35 | 35 | #include <lib3270/keyboard.h> |
36 | 36 | |
37 | - unsigned int lib3270_get_kybdlock_as_int(H3270 *hSession) | |
37 | + unsigned int lib3270_get_kybdlock_as_int(const H3270 *hSession) | |
38 | 38 | { |
39 | 39 | return (unsigned int) lib3270_get_keyboard_lock_state(hSession); |
40 | 40 | } | ... | ... |
src/core/screen.c
... | ... | @@ -245,31 +245,24 @@ static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa) |
245 | 245 | return a; |
246 | 246 | } |
247 | 247 | |
248 | -LIB3270_EXPORT unsigned int lib3270_get_length(H3270 *h) | |
248 | +LIB3270_EXPORT unsigned int lib3270_get_length(const H3270 *h) | |
249 | 249 | { |
250 | - CHECK_SESSION_HANDLE(h); | |
251 | 250 | return h->view.rows * h->view.cols; |
252 | 251 | } |
253 | 252 | |
254 | -LIB3270_EXPORT void lib3270_get_screen_size(H3270 *h, unsigned int *r, unsigned int *c) | |
253 | +LIB3270_EXPORT void lib3270_get_screen_size(const H3270 *h, unsigned int *r, unsigned int *c) | |
255 | 254 | { |
256 | - CHECK_SESSION_HANDLE(h); | |
257 | 255 | *r = h->view.rows; |
258 | 256 | *c = h->view.cols; |
259 | - | |
260 | -// trace("%s: %d - %d",__FUNCTION__, h->rows, h->cols); | |
261 | - | |
262 | 257 | } |
263 | 258 | |
264 | -LIB3270_EXPORT unsigned int lib3270_get_width(H3270 *h) | |
259 | +LIB3270_EXPORT unsigned int lib3270_get_width(const H3270 *h) | |
265 | 260 | { |
266 | - CHECK_SESSION_HANDLE(h); | |
267 | 261 | return h->view.cols; |
268 | 262 | } |
269 | 263 | |
270 | -LIB3270_EXPORT unsigned int lib3270_get_height(H3270 *h) | |
264 | +LIB3270_EXPORT unsigned int lib3270_get_height(const H3270 *h) | |
271 | 265 | { |
272 | - CHECK_SESSION_HANDLE(h); | |
273 | 266 | return h->view.rows; |
274 | 267 | } |
275 | 268 | |
... | ... | @@ -405,7 +398,7 @@ void screen_update(H3270 *session, int bstart, int bend) |
405 | 398 | |
406 | 399 | } |
407 | 400 | |
408 | -LIB3270_EXPORT unsigned int lib3270_get_cursor_address(H3270 *hSession) | |
401 | +LIB3270_EXPORT unsigned int lib3270_get_cursor_address(const H3270 *hSession) | |
409 | 402 | { |
410 | 403 | if(check_online_session(hSession)) |
411 | 404 | return 0; |
... | ... | @@ -587,9 +580,8 @@ void status_reset(H3270 *session) |
587 | 580 | * |
588 | 581 | * @see LIB3270_MESSAGE |
589 | 582 | */ |
590 | -LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_program_message(H3270 *session) | |
583 | +LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_program_message(const H3270 *session) | |
591 | 584 | { |
592 | - CHECK_SESSION_HANDLE(session); | |
593 | 585 | return session->oia.status; |
594 | 586 | } |
595 | 587 | ... | ... |
src/include/lib3270.h
... | ... | @@ -425,7 +425,7 @@ |
425 | 425 | * @param c Pointer to screen columns. |
426 | 426 | * |
427 | 427 | */ |
428 | - LIB3270_EXPORT void lib3270_get_screen_size(H3270 *h, unsigned int *r, unsigned int *c); | |
428 | + LIB3270_EXPORT void lib3270_get_screen_size(const H3270 *h, unsigned int *r, unsigned int *c); | |
429 | 429 | |
430 | 430 | /** |
431 | 431 | * Get current screen width in columns. |
... | ... | @@ -435,7 +435,7 @@ |
435 | 435 | * @return screen width. |
436 | 436 | * |
437 | 437 | */ |
438 | - LIB3270_EXPORT unsigned int lib3270_get_width(H3270 *h); | |
438 | + LIB3270_EXPORT unsigned int lib3270_get_width(const H3270 *h); | |
439 | 439 | |
440 | 440 | /** |
441 | 441 | * Get current screen width in rows. |
... | ... | @@ -445,9 +445,9 @@ |
445 | 445 | * @return screen rows. |
446 | 446 | * |
447 | 447 | */ |
448 | - LIB3270_EXPORT unsigned int lib3270_get_height(H3270 *h); | |
448 | + LIB3270_EXPORT unsigned int lib3270_get_height(const H3270 *h); | |
449 | 449 | |
450 | - LIB3270_EXPORT unsigned int lib3270_get_length(H3270 *h); | |
450 | + LIB3270_EXPORT unsigned int lib3270_get_length(const H3270 *h); | |
451 | 451 | |
452 | 452 | /** |
453 | 453 | * @brief Creates an empty TN3270 session. |
... | ... | @@ -800,7 +800,7 @@ |
800 | 800 | * @return Cursor address or 0 if invalid (sets errno). |
801 | 801 | * |
802 | 802 | */ |
803 | - LIB3270_EXPORT unsigned int lib3270_get_cursor_address(H3270 *hSession); | |
803 | + LIB3270_EXPORT unsigned int lib3270_get_cursor_address(const H3270 *hSession); | |
804 | 804 | |
805 | 805 | /** |
806 | 806 | * @brief Move cursor |
... | ... | @@ -966,7 +966,7 @@ |
966 | 966 | * @return Latest program message. |
967 | 967 | * |
968 | 968 | */ |
969 | - LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_program_message(H3270 *h); | |
969 | + LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_program_message(const H3270 *h); | |
970 | 970 | |
971 | 971 | /** |
972 | 972 | * Get connected LU name. |
... | ... | @@ -1089,7 +1089,7 @@ |
1089 | 1089 | |
1090 | 1090 | LIB3270_EXPORT char * lib3270_cut_selected(H3270 *hSession); |
1091 | 1091 | |
1092 | - LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession); | |
1092 | + LIB3270_EXPORT int lib3270_has_selection(const H3270 *hSession); | |
1093 | 1093 | |
1094 | 1094 | /** |
1095 | 1095 | * @brief Get all text inside the terminal. |
... | ... | @@ -1174,7 +1174,7 @@ |
1174 | 1174 | * @return -1 when failed 1 if the addr is protected and 0 if not. |
1175 | 1175 | * |
1176 | 1176 | */ |
1177 | - LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr0); | |
1177 | + LIB3270_EXPORT int lib3270_get_is_protected(const H3270 *hSession, int baddr0); | |
1178 | 1178 | |
1179 | 1179 | LIB3270_EXPORT int LIB3270_DEPRECATED(lib3270_is_protected(H3270 *h, unsigned int baddr)); |
1180 | 1180 | |
... | ... | @@ -1185,8 +1185,11 @@ |
1185 | 1185 | * |
1186 | 1186 | * @return -1 when failed 1 if the session is formatted and 0 if not. |
1187 | 1187 | * |
1188 | + * @retval -1 Failed (check errno for error code). | |
1189 | + * @retval 0 Screen is not formatted. | |
1190 | + * @retval 1 Screen is formatted. | |
1188 | 1191 | */ |
1189 | - LIB3270_EXPORT int lib3270_get_is_formatted(H3270 *hSession); | |
1192 | + LIB3270_EXPORT int lib3270_get_is_formatted(const H3270 *hSession); | |
1190 | 1193 | |
1191 | 1194 | /** |
1192 | 1195 | * @brief Get Check if the screen position is protected. |
... | ... | @@ -1196,7 +1199,7 @@ |
1196 | 1199 | * @param col Desired col. |
1197 | 1200 | * |
1198 | 1201 | */ |
1199 | - LIB3270_EXPORT int lib3270_get_is_protected_at(H3270 *h, unsigned int row, unsigned int col); | |
1202 | + LIB3270_EXPORT int lib3270_get_is_protected_at(const H3270 *h, unsigned int row, unsigned int col); | |
1200 | 1203 | |
1201 | 1204 | /** |
1202 | 1205 | * @brief Get address of the first blank. |
... | ... | @@ -1225,7 +1228,7 @@ |
1225 | 1228 | * @exception -ENODATA No field at the address. |
1226 | 1229 | * |
1227 | 1230 | */ |
1228 | - LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr); | |
1231 | + LIB3270_EXPORT int lib3270_field_addr(const H3270 *hSession, int baddr); | |
1229 | 1232 | |
1230 | 1233 | /** |
1231 | 1234 | * @brief Get field attribute for a given buffer address. |
... | ... | @@ -1304,7 +1307,7 @@ |
1304 | 1307 | LIB3270_EXPORT int lib3270_set_model(H3270 *hSession, const char *name); |
1305 | 1308 | |
1306 | 1309 | LIB3270_EXPORT const char * lib3270_get_model(const H3270 *session); |
1307 | - LIB3270_EXPORT int lib3270_get_model_number(H3270 *hSession); | |
1310 | + LIB3270_EXPORT int lib3270_get_model_number(const H3270 *hSession); | |
1308 | 1311 | |
1309 | 1312 | LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name); |
1310 | 1313 | |
... | ... | @@ -1328,7 +1331,7 @@ |
1328 | 1331 | * |
1329 | 1332 | */ |
1330 | 1333 | LIB3270_EXPORT int lib3270_set_unlock_delay(H3270 *session, unsigned int delay); |
1331 | - LIB3270_EXPORT unsigned int lib3270_get_unlock_delay(H3270 *session); | |
1334 | + LIB3270_EXPORT unsigned int lib3270_get_unlock_delay(const H3270 *session); | |
1332 | 1335 | |
1333 | 1336 | /** |
1334 | 1337 | * @brief Alloc/Realloc memory buffer. | ... | ... |
src/include/lib3270/keyboard.h
... | ... | @@ -69,7 +69,7 @@ |
69 | 69 | */ |
70 | 70 | LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H3270 *hSession, int seconds); |
71 | 71 | |
72 | - LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession); | |
72 | + LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(const H3270 *hSession); | |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @brief Set te operator error lock. |
... | ... | @@ -83,7 +83,7 @@ |
83 | 83 | * |
84 | 84 | */ |
85 | 85 | LIB3270_EXPORT int lib3270_set_lock_on_operator_error(H3270 *hSession, int enable); |
86 | - LIB3270_EXPORT int lib3270_get_lock_on_operator_error(H3270 *hSession); | |
86 | + LIB3270_EXPORT int lib3270_get_lock_on_operator_error(const H3270 *hSession); | |
87 | 87 | |
88 | 88 | #ifdef __cplusplus |
89 | 89 | } | ... | ... |
src/include/lib3270/properties.h
... | ... | @@ -46,7 +46,7 @@ |
46 | 46 | { |
47 | 47 | const char * name; ///< @brief Property name. |
48 | 48 | const char * description; ///< @brief Property description. |
49 | - int (*get)(H3270 *hSession); ///< @brief Get value. | |
49 | + int (*get)(const H3270 *hSession); ///< @brief Get value. | |
50 | 50 | int (*set)(H3270 *hSession, int value); ///< @brief Set value. |
51 | 51 | |
52 | 52 | } LIB3270_INT_PROPERTY; |
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | { |
56 | 56 | const char * name; ///< @brief Property name. |
57 | 57 | const char * description; ///< @brief Property description. |
58 | - unsigned int (*get)(H3270 *hSession); ///< @brief Get value. | |
58 | + unsigned int (*get)(const H3270 *hSession); ///< @brief Get value. | |
59 | 59 | int (*set)(H3270 *hSession, unsigned int value); ///< @brief Set value. |
60 | 60 | |
61 | 61 | } LIB3270_UINT_PROPERTY; | ... | ... |
src/selection/selection.c
... | ... | @@ -390,7 +390,7 @@ LIB3270_EXPORT char * lib3270_get_field_string_at(H3270 *session, int baddr) |
390 | 390 | return lib3270_get_string_at_address(session,first,lib3270_field_length(session,first)+1,0); |
391 | 391 | } |
392 | 392 | |
393 | -LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession) | |
393 | +LIB3270_EXPORT int lib3270_has_selection(const H3270 *hSession) | |
394 | 394 | { |
395 | 395 | if(check_online_session(hSession)) |
396 | 396 | return 0; | ... | ... |