Commit c252e4b4241732844596ea4e9f16bf3e90f72a8f
1 parent
4d1ed1d1
Exists in
master
and in
3 other branches
Refactoring toggle api calls.
Showing
22 changed files
with
141 additions
and
170 deletions
Show diff stats
lib3270.cbp
| @@ -210,6 +210,7 @@ | @@ -210,6 +210,7 @@ | ||
| 210 | <Unit filename="src/include/lib3270/properties.h" /> | 210 | <Unit filename="src/include/lib3270/properties.h" /> |
| 211 | <Unit filename="src/include/lib3270/selection.h" /> | 211 | <Unit filename="src/include/lib3270/selection.h" /> |
| 212 | <Unit filename="src/include/lib3270/session.h" /> | 212 | <Unit filename="src/include/lib3270/session.h" /> |
| 213 | + <Unit filename="src/include/lib3270/toggle.h" /> | ||
| 213 | <Unit filename="src/include/lib3270/trace.h" /> | 214 | <Unit filename="src/include/lib3270/trace.h" /> |
| 214 | <Unit filename="src/include/localdefs.h" /> | 215 | <Unit filename="src/include/localdefs.h" /> |
| 215 | <Unit filename="src/include/objects.h" /> | 216 | <Unit filename="src/include/objects.h" /> |
| @@ -230,7 +231,6 @@ | @@ -230,7 +231,6 @@ | ||
| 230 | <Unit filename="src/include/statusc.h" /> | 231 | <Unit filename="src/include/statusc.h" /> |
| 231 | <Unit filename="src/include/telnetc.h" /> | 232 | <Unit filename="src/include/telnetc.h" /> |
| 232 | <Unit filename="src/include/tn3270e.h" /> | 233 | <Unit filename="src/include/tn3270e.h" /> |
| 233 | - <Unit filename="src/include/toggle.h" /> | ||
| 234 | <Unit filename="src/include/togglesc.h" /> | 234 | <Unit filename="src/include/togglesc.h" /> |
| 235 | <Unit filename="src/include/trace_dsc.h" /> | 235 | <Unit filename="src/include/trace_dsc.h" /> |
| 236 | <Unit filename="src/include/utf8c.h" /> | 236 | <Unit filename="src/include/utf8c.h" /> |
src/core/ansi.c
src/core/connect.c
| @@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
| 33 | #include <errno.h> | 33 | #include <errno.h> |
| 34 | #include <lib3270/log.h> | 34 | #include <lib3270/log.h> |
| 35 | #include <lib3270/trace.h> | 35 | #include <lib3270/trace.h> |
| 36 | +#include <lib3270/toggle.h> | ||
| 36 | #include <trace_dsc.h> | 37 | #include <trace_dsc.h> |
| 37 | 38 | ||
| 38 | #if defined(HAVE_LIBSSL) | 39 | #if defined(HAVE_LIBSSL) |
src/core/ctlr.c
| @@ -42,6 +42,7 @@ | @@ -42,6 +42,7 @@ | ||
| 42 | #include <lib3270/trace.h> | 42 | #include <lib3270/trace.h> |
| 43 | #include <lib3270/log.h> | 43 | #include <lib3270/log.h> |
| 44 | #include <lib3270/actions.h> | 44 | #include <lib3270/actions.h> |
| 45 | +#include <lib3270/toggle.h> | ||
| 45 | 46 | ||
| 46 | #include <errno.h> | 47 | #include <errno.h> |
| 47 | #include <stdlib.h> | 48 | #include <stdlib.h> |
src/core/cursor.c
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | #include <lib3270/trace.h> | 36 | #include <lib3270/trace.h> |
| 37 | #include <lib3270/log.h> | 37 | #include <lib3270/log.h> |
| 38 | #include <lib3270/selection.h> | 38 | #include <lib3270/selection.h> |
| 39 | +#include <lib3270/toggle.h> | ||
| 39 | 40 | ||
| 40 | #include "kybdc.h" | 41 | #include "kybdc.h" |
| 41 | #include "ctlrc.h" | 42 | #include "ctlrc.h" |
src/core/host.c
| @@ -56,6 +56,7 @@ | @@ -56,6 +56,7 @@ | ||
| 56 | #include <lib3270/properties.h> | 56 | #include <lib3270/properties.h> |
| 57 | #include <lib3270/log.h> | 57 | #include <lib3270/log.h> |
| 58 | #include <lib3270/trace.h> | 58 | #include <lib3270/trace.h> |
| 59 | +#include <lib3270/toggle.h> | ||
| 59 | 60 | ||
| 60 | /** | 61 | /** |
| 61 | * @brief Called from timer to attempt an automatic reconnection. | 62 | * @brief Called from timer to attempt an automatic reconnection. |
src/core/iocalls.c
src/core/keyboard/kybd.c
| @@ -42,6 +42,7 @@ struct ta; | @@ -42,6 +42,7 @@ struct ta; | ||
| 42 | #include <lib3270/trace.h> | 42 | #include <lib3270/trace.h> |
| 43 | #include <lib3270/selection.h> | 43 | #include <lib3270/selection.h> |
| 44 | #include <lib3270/log.h> | 44 | #include <lib3270/log.h> |
| 45 | +#include <lib3270/toggle.h> | ||
| 45 | 46 | ||
| 46 | #ifndef ANDROID | 47 | #ifndef ANDROID |
| 47 | #include <stdlib.h> | 48 | #include <stdlib.h> |
src/core/paste.c
| @@ -79,6 +79,7 @@ | @@ -79,6 +79,7 @@ | ||
| 79 | #include <lib3270/popup.h> | 79 | #include <lib3270/popup.h> |
| 80 | #include <lib3270/selection.h> | 80 | #include <lib3270/selection.h> |
| 81 | #include <lib3270/log.h> | 81 | #include <lib3270/log.h> |
| 82 | +#include <lib3270/toggle.h> | ||
| 82 | 83 | ||
| 83 | /*---[ Struct ]-------------------------------------------------------------------------------------------------*/ | 84 | /*---[ Struct ]-------------------------------------------------------------------------------------------------*/ |
| 84 | 85 |
src/core/screen.c
| @@ -52,6 +52,7 @@ | @@ -52,6 +52,7 @@ | ||
| 52 | #include "togglesc.h" | 52 | #include "togglesc.h" |
| 53 | #include <lib3270/actions.h> | 53 | #include <lib3270/actions.h> |
| 54 | #include <lib3270/log.h> | 54 | #include <lib3270/log.h> |
| 55 | +#include <lib3270/toggle.h> | ||
| 55 | 56 | ||
| 56 | #if defined(_WIN32) | 57 | #if defined(_WIN32) |
| 57 | #include <windows.h> | 58 | #include <windows.h> |
src/core/telnet.c
| @@ -104,6 +104,7 @@ | @@ -104,6 +104,7 @@ | ||
| 104 | #include <lib3270/internals.h> | 104 | #include <lib3270/internals.h> |
| 105 | #include <lib3270/trace.h> | 105 | #include <lib3270/trace.h> |
| 106 | #include <lib3270/log.h> | 106 | #include <lib3270/log.h> |
| 107 | +#include <lib3270/toggle.h> | ||
| 107 | 108 | ||
| 108 | #if !defined(TELOPT_NAWS) /*[*/ | 109 | #if !defined(TELOPT_NAWS) /*[*/ |
| 109 | #define TELOPT_NAWS 31 | 110 | #define TELOPT_NAWS 31 |
src/core/toggles.c
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin |
| 19 | * St, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | * | 20 | * |
| 21 | - * Este programa está nomeado como toggles.c e possui 253 linhas de código. | 21 | + * Este programa está nomeado como toggles.c e possui - linhas de código. |
| 22 | * | 22 | * |
| 23 | * Contatos: | 23 | * Contatos: |
| 24 | * | 24 | * |
| @@ -31,9 +31,9 @@ | @@ -31,9 +31,9 @@ | ||
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | -/* | ||
| 35 | - * toggles.c | ||
| 36 | - * This module handles toggles. | 34 | +/** |
| 35 | + * @file toggles.c | ||
| 36 | + * @brief This module handles toggles. | ||
| 37 | */ | 37 | */ |
| 38 | 38 | ||
| 39 | #include <errno.h> | 39 | #include <errno.h> |
| @@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
| 48 | #endif // !WIN32 | 48 | #endif // !WIN32 |
| 49 | 49 | ||
| 50 | #include <config.h> | 50 | #include <config.h> |
| 51 | -#include "toggle.h" | 51 | +#include <lib3270/toggle.h> |
| 52 | #include <lib3270-internals.h> | 52 | #include <lib3270-internals.h> |
| 53 | 53 | ||
| 54 | #include "ansic.h" | 54 | #include "ansic.h" |
| @@ -250,10 +250,10 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE i | @@ -250,10 +250,10 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE i | ||
| 250 | static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE ix) | 250 | static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE ix) |
| 251 | { | 251 | { |
| 252 | trace("%s: ix=%d upcall=%p",__FUNCTION__,ix,t->upcall); | 252 | trace("%s: ix=%d upcall=%p",__FUNCTION__,ix,t->upcall); |
| 253 | - t->upcall(session, t, TT_INTERACTIVE); | 253 | + t->upcall(session, t, LIB3270_TOGGLE_TYPE_INTERACTIVE); |
| 254 | 254 | ||
| 255 | if(session->cbk.update_toggle) | 255 | if(session->cbk.update_toggle) |
| 256 | - session->cbk.update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_info[ix].name); | 256 | + session->cbk.update_toggle(session,ix,t->value,LIB3270_TOGGLE_TYPE_INTERACTIVE,toggle_info[ix].name); |
| 257 | 257 | ||
| 258 | } | 258 | } |
| 259 | 259 | ||
| @@ -362,7 +362,7 @@ void initialize_toggles(H3270 *session) | @@ -362,7 +362,7 @@ void initialize_toggles(H3270 *session) | ||
| 362 | { | 362 | { |
| 363 | session->toggle[f].value = toggle_info[f].def; | 363 | session->toggle[f].value = toggle_info[f].def; |
| 364 | if(session->toggle[f].value) | 364 | if(session->toggle[f].value) |
| 365 | - session->toggle[f].upcall(session,&session->toggle[f],TT_INITIAL); | 365 | + session->toggle[f].upcall(session,&session->toggle[f],LIB3270_TOGGLE_TYPE_INITIAL); |
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | } | 368 | } |
| @@ -373,7 +373,7 @@ void initialize_toggles(H3270 *session) | @@ -373,7 +373,7 @@ void initialize_toggles(H3270 *session) | ||
| 373 | void shutdown_toggles(H3270 *session) | 373 | void shutdown_toggles(H3270 *session) |
| 374 | { | 374 | { |
| 375 | #if defined(X3270_TRACE) | 375 | #if defined(X3270_TRACE) |
| 376 | - static const LIB3270_TOGGLE disable_on_shutdown[] = {DS_TRACE, EVENT_TRACE, SCREEN_TRACE}; | 376 | + static const LIB3270_TOGGLE disable_on_shutdown[] = {LIB3270_TOGGLE_DS_TRACE, LIB3270_TOGGLE_EVENT_TRACE, LIB3270_TOGGLE_SCREEN_TRACE}; |
| 377 | 377 | ||
| 378 | size_t f; | 378 | size_t f; |
| 379 | 379 | ||
| @@ -383,21 +383,21 @@ void shutdown_toggles(H3270 *session) | @@ -383,21 +383,21 @@ void shutdown_toggles(H3270 *session) | ||
| 383 | #endif | 383 | #endif |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | -LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE_ID ix) | 386 | +LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE ix) |
| 387 | { | 387 | { |
| 388 | if(ix < LIB3270_TOGGLE_COUNT) | 388 | if(ix < LIB3270_TOGGLE_COUNT) |
| 389 | return toggle_info[ix].label; | 389 | return toggle_info[ix].label; |
| 390 | return ""; | 390 | return ""; |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | -LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE_ID ix) | 393 | +LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE ix) |
| 394 | { | 394 | { |
| 395 | if(ix < LIB3270_TOGGLE_COUNT) | 395 | if(ix < LIB3270_TOGGLE_COUNT) |
| 396 | return toggle_info[ix].description; | 396 | return toggle_info[ix].description; |
| 397 | return ""; | 397 | return ""; |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | -LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE_ID ix) | 400 | +LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE ix) |
| 401 | { | 401 | { |
| 402 | if(ix < LIB3270_TOGGLE_COUNT) | 402 | if(ix < LIB3270_TOGGLE_COUNT) |
| 403 | return toggle_info[ix].name; | 403 | return toggle_info[ix].name; |
src/core/trace_ds.c
| @@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
| 62 | #include "telnetc.h" | 62 | #include "telnetc.h" |
| 63 | #include "trace_dsc.h" | 63 | #include "trace_dsc.h" |
| 64 | #include "utilc.h" | 64 | #include "utilc.h" |
| 65 | -#include "toggle.h" | 65 | +#include <lib3270/toggle.h> |
| 66 | 66 | ||
| 67 | /* Maximum size of a tracefile header. */ | 67 | /* Maximum size of a tracefile header. */ |
| 68 | #define MAX_HEADER_SIZE (10*1024) | 68 | #define MAX_HEADER_SIZE (10*1024) |
| @@ -88,7 +88,7 @@ static void trace_ds_s(H3270 *hSession, char *s, Boolean can_break) | @@ -88,7 +88,7 @@ static void trace_ds_s(H3270 *hSession, char *s, Boolean can_break) | ||
| 88 | int len = strlen(s); | 88 | int len = strlen(s); |
| 89 | Boolean nl = False; | 89 | Boolean nl = False; |
| 90 | 90 | ||
| 91 | - if (!lib3270_get_toggle(hSession,DS_TRACE) || !len) | 91 | + if (!lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE) || !len) |
| 92 | return; | 92 | return; |
| 93 | 93 | ||
| 94 | if (s && s[len-1] == '\n') | 94 | if (s && s[len-1] == '\n') |
| @@ -131,7 +131,7 @@ void trace_ds(H3270 *hSession, const char *fmt, ...) | @@ -131,7 +131,7 @@ void trace_ds(H3270 *hSession, const char *fmt, ...) | ||
| 131 | char * text; | 131 | char * text; |
| 132 | va_list args; | 132 | va_list args; |
| 133 | 133 | ||
| 134 | - if (!lib3270_get_toggle(hSession,DS_TRACE)) | 134 | + if (!lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE)) |
| 135 | return; | 135 | return; |
| 136 | 136 | ||
| 137 | va_start(args, fmt); | 137 | va_start(args, fmt); |
| @@ -148,7 +148,7 @@ void trace_ds_nb(H3270 *hSession, const char *fmt, ...) | @@ -148,7 +148,7 @@ void trace_ds_nb(H3270 *hSession, const char *fmt, ...) | ||
| 148 | char *text; | 148 | char *text; |
| 149 | va_list args; | 149 | va_list args; |
| 150 | 150 | ||
| 151 | - if (!lib3270_get_toggle(hSession,DS_TRACE)) | 151 | + if (!lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE)) |
| 152 | return; | 152 | return; |
| 153 | 153 | ||
| 154 | va_start(args, fmt); | 154 | va_start(args, fmt); |
| @@ -166,7 +166,7 @@ void trace_dsn(H3270 *session, const char *fmt, ...) | @@ -166,7 +166,7 @@ void trace_dsn(H3270 *session, const char *fmt, ...) | ||
| 166 | { | 166 | { |
| 167 | va_list args; | 167 | va_list args; |
| 168 | 168 | ||
| 169 | - if (!lib3270_get_toggle(session,DS_TRACE)) | 169 | + if (!lib3270_get_toggle(session,LIB3270_TOGGLE_DS_TRACE)) |
| 170 | return; | 170 | return; |
| 171 | 171 | ||
| 172 | /* print out message */ | 172 | /* print out message */ |
src/core/windows/connect.c
| @@ -41,6 +41,7 @@ | @@ -41,6 +41,7 @@ | ||
| 41 | #include <errno.h> | 41 | #include <errno.h> |
| 42 | #include <lib3270/trace.h> | 42 | #include <lib3270/trace.h> |
| 43 | #include <lib3270/log.h> | 43 | #include <lib3270/log.h> |
| 44 | +#include <lib3270/toggle.h> | ||
| 44 | 45 | ||
| 45 | #ifdef HAVE_ICONV | 46 | #ifdef HAVE_ICONV |
| 46 | #include <iconv.h> | 47 | #include <iconv.h> |
src/include/lib3270.h
| @@ -850,77 +850,6 @@ | @@ -850,77 +850,6 @@ | ||
| 850 | LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr); | 850 | LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr); |
| 851 | 851 | ||
| 852 | /** | 852 | /** |
| 853 | - * @brief get toggle state. | ||
| 854 | - * | ||
| 855 | - * @param h Session handle. | ||
| 856 | - * @param ix Toggle id. | ||
| 857 | - * | ||
| 858 | - * @return 0 if the toggle is disabled, non zero if enabled. | ||
| 859 | - * | ||
| 860 | - */ | ||
| 861 | - LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *h, LIB3270_TOGGLE ix); | ||
| 862 | - | ||
| 863 | - /** | ||
| 864 | - * @brief Set toggle state. | ||
| 865 | - * | ||
| 866 | - * @param h Session handle. | ||
| 867 | - * @param ix Toggle id. | ||
| 868 | - * @param value New toggle state (non zero for true). | ||
| 869 | - * | ||
| 870 | - * @returns 0 if the toggle is already at the state, 1 if the toggle was changed; < 0 on error (sets errno). | ||
| 871 | - */ | ||
| 872 | - LIB3270_EXPORT int lib3270_set_toggle(H3270 *h, LIB3270_TOGGLE ix, int value); | ||
| 873 | - | ||
| 874 | - /** | ||
| 875 | - * @brief Translate a string toggle name to the corresponding value. | ||
| 876 | - * | ||
| 877 | - * @param name Toggle name. | ||
| 878 | - * | ||
| 879 | - * @return Toggle ID or -1 if it's invalid. | ||
| 880 | - * | ||
| 881 | - */ | ||
| 882 | - LIB3270_EXPORT LIB3270_TOGGLE lib3270_get_toggle_id(const char *name); | ||
| 883 | - | ||
| 884 | - /** | ||
| 885 | - * @brief Get the toggle name as string. | ||
| 886 | - * | ||
| 887 | - * @param id Toggle id | ||
| 888 | - * | ||
| 889 | - * @return Constant string with the toggle name or "" if invalid. | ||
| 890 | - * | ||
| 891 | - */ | ||
| 892 | - LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE ix); | ||
| 893 | - | ||
| 894 | - /** | ||
| 895 | - * @brief Get a long description of the toggle. | ||
| 896 | - * | ||
| 897 | - * @return Constant string with the toggle description. | ||
| 898 | - * | ||
| 899 | - */ | ||
| 900 | - LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE ix); | ||
| 901 | - | ||
| 902 | - /** | ||
| 903 | - * @brief Get a short description of the toggle (for menus). | ||
| 904 | - * | ||
| 905 | - * @return Constant string with the toggle label. | ||
| 906 | - * | ||
| 907 | - */ | ||
| 908 | - LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE ix); | ||
| 909 | - | ||
| 910 | - /** | ||
| 911 | - * @brief Revert toggle status. | ||
| 912 | - * | ||
| 913 | - * @param h Session handle. | ||
| 914 | - * @param ix Toggle id. | ||
| 915 | - * | ||
| 916 | - * @return Toggle status. | ||
| 917 | - */ | ||
| 918 | - LIB3270_EXPORT int lib3270_toggle(H3270 *h, LIB3270_TOGGLE ix); | ||
| 919 | - | ||
| 920 | - LIB3270_EXPORT void lib3270_set_session_id(H3270 *hSession, char id); | ||
| 921 | - LIB3270_EXPORT char lib3270_get_session_id(H3270 *hSession); | ||
| 922 | - | ||
| 923 | - /** | ||
| 924 | * @brief IO flags. | 853 | * @brief IO flags. |
| 925 | * | 854 | * |
| 926 | */ | 855 | */ |
| @@ -0,0 +1,107 @@ | @@ -0,0 +1,107 @@ | ||
| 1 | +/* | ||
| 2 | + * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
| 5 | + * | ||
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
| 7 | + * | ||
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
| 10 | + * Free Software Foundation. | ||
| 11 | + * | ||
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
| 15 | + * obter mais detalhes. | ||
| 16 | + * | ||
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | + * | ||
| 21 | + * Este programa está nomeado como toggle.h e possui - linhas de código. | ||
| 22 | + * | ||
| 23 | + * Contatos: | ||
| 24 | + * | ||
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | ||
| 27 | + * | ||
| 28 | + */ | ||
| 29 | + | ||
| 30 | +#ifndef LIB3270_TOGGLE_H_INCLUDED | ||
| 31 | + | ||
| 32 | + #define LIB3270_TOGGLE_H_INCLUDED 1 | ||
| 33 | + | ||
| 34 | + #include <lib3270.h> | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * @brief get toggle state. | ||
| 38 | + * | ||
| 39 | + * @param h Session handle. | ||
| 40 | + * @param ix Toggle id. | ||
| 41 | + * | ||
| 42 | + * @return 0 if the toggle is disabled, non zero if enabled. | ||
| 43 | + * | ||
| 44 | + */ | ||
| 45 | + LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *h, LIB3270_TOGGLE ix); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * @brief Set toggle state. | ||
| 49 | + * | ||
| 50 | + * @param h Session handle. | ||
| 51 | + * @param ix Toggle id. | ||
| 52 | + * @param value New toggle state (non zero for true). | ||
| 53 | + * | ||
| 54 | + * @returns 0 if the toggle is already at the state, 1 if the toggle was changed; < 0 on error (sets errno). | ||
| 55 | + */ | ||
| 56 | + LIB3270_EXPORT int lib3270_set_toggle(H3270 *h, LIB3270_TOGGLE ix, int value); | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * @brief Translate a string toggle name to the corresponding value. | ||
| 60 | + * | ||
| 61 | + * @param name Toggle name. | ||
| 62 | + * | ||
| 63 | + * @return Toggle ID or -1 if it's invalid. | ||
| 64 | + * | ||
| 65 | + */ | ||
| 66 | + LIB3270_EXPORT LIB3270_TOGGLE lib3270_get_toggle_id(const char *name); | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * @brief Get the toggle name as string. | ||
| 70 | + * | ||
| 71 | + * @param id Toggle id | ||
| 72 | + * | ||
| 73 | + * @return Constant string with the toggle name or "" if invalid. | ||
| 74 | + * | ||
| 75 | + */ | ||
| 76 | + LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE ix); | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * @brief Get a long description of the toggle. | ||
| 80 | + * | ||
| 81 | + * @return Constant string with the toggle description. | ||
| 82 | + * | ||
| 83 | + */ | ||
| 84 | + LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE ix); | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * @brief Get a short description of the toggle (for menus). | ||
| 88 | + * | ||
| 89 | + * @return Constant string with the toggle label. | ||
| 90 | + * | ||
| 91 | + */ | ||
| 92 | + LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE ix); | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * @brief Revert toggle status. | ||
| 96 | + * | ||
| 97 | + * @param h Session handle. | ||
| 98 | + * @param ix Toggle id. | ||
| 99 | + * | ||
| 100 | + * @return Toggle status. | ||
| 101 | + */ | ||
| 102 | + LIB3270_EXPORT int lib3270_toggle(H3270 *h, LIB3270_TOGGLE ix); | ||
| 103 | + | ||
| 104 | + LIB3270_EXPORT void lib3270_set_session_id(H3270 *hSession, char id); | ||
| 105 | + LIB3270_EXPORT char lib3270_get_session_id(H3270 *hSession); | ||
| 106 | + | ||
| 107 | +#endif /* LIB3270_TOGGLE_H_INCLUDED */ |
src/include/toggle.h
| @@ -1,81 +0,0 @@ | @@ -1,81 +0,0 @@ | ||
| 1 | -/* | ||
| 2 | - * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
| 3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
| 4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
| 5 | - * | ||
| 6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
| 7 | - * | ||
| 8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
| 9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
| 10 | - * Free Software Foundation. | ||
| 11 | - * | ||
| 12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
| 13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
| 14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
| 15 | - * obter mais detalhes. | ||
| 16 | - * | ||
| 17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
| 18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
| 19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | - * | ||
| 21 | - * Este programa está nomeado como toggle.h e possui 77 linhas de código. | ||
| 22 | - * | ||
| 23 | - * Contatos: | ||
| 24 | - * | ||
| 25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
| 26 | - * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | ||
| 27 | - * licinio@bb.com.br (Licínio Luis Branco) | ||
| 28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | ||
| 29 | - * | ||
| 30 | - */ | ||
| 31 | - | ||
| 32 | -#ifndef TOGGLE3270_H_INCLUDED | ||
| 33 | - | ||
| 34 | - #define TOGGLE3270_H_INCLUDED 1 | ||
| 35 | - | ||
| 36 | - #include <lib3270.h> | ||
| 37 | - | ||
| 38 | - #define TT_INITIAL LIB3270_TOGGLE_TYPE_INITIAL | ||
| 39 | - #define TT_INTERACTIVE LIB3270_TOGGLE_TYPE_INTERACTIVE | ||
| 40 | - #define TT_ACTION LIB3270_TOGGLE_TYPE_ACTION | ||
| 41 | - #define TT_FINAL LIB3270_TOGGLE_TYPE_FINAL | ||
| 42 | - #define TT_UPDATE LIB3270_TOGGLE_TYPE_UPDATE | ||
| 43 | - | ||
| 44 | - #define MONOCASE LIB3270_TOGGLE_MONOCASE | ||
| 45 | - #define ALT_CURSOR LIB3270_TOGGLE_ALT_CURSOR | ||
| 46 | - #define CURSOR_BLINK LIB3270_TOGGLE_CURSOR_BLINK | ||
| 47 | - #define SHOW_TIMING LIB3270_TOGGLE_SHOW_TIMING | ||
| 48 | - #define CURSOR_POS LIB3270_TOGGLE_CURSOR_POS | ||
| 49 | - #define DS_TRACE LIB3270_TOGGLE_DS_TRACE | ||
| 50 | - #define SCROLL_BAR LIB3270_TOGGLE_SCROLL_BAR | ||
| 51 | - #define LINE_WRAP LIB3270_TOGGLE_LINE_WRAP | ||
| 52 | -// #define BLANK_FILL LIB3270_TOGGLE_BLANK_FILL | ||
| 53 | - #define SCREEN_TRACE LIB3270_TOGGLE_SCREEN_TRACE | ||
| 54 | - #define EVENT_TRACE LIB3270_TOGGLE_EVENT_TRACE | ||
| 55 | -// #define MARGINED_PASTE LIB3270_TOGGLE_MARGINED_PASTE | ||
| 56 | - #define RECTANGLE_SELECT LIB3270_TOGGLE_RECTANGLE_SELECT | ||
| 57 | - #define CROSSHAIR LIB3270_TOGGLE_CROSSHAIR | ||
| 58 | -// #define VISIBLE_CONTROL LIB3270_TOGGLE_VISIBLE_CONTROL | ||
| 59 | - #define AID_WAIT LIB3270_TOGGLE_AID_WAIT | ||
| 60 | - #define FULL_SCREEN LIB3270_TOGGLE_FULL_SCREEN | ||
| 61 | - #define RECONNECT LIB3270_TOGGLE_RECONNECT | ||
| 62 | -// #define INSERT LIB3270_TOGGLE_INSERT | ||
| 63 | - #define KEYPAD LIB3270_TOGGLE_KEYPAD | ||
| 64 | - #define SMART_PASTE LIB3270_TOGGLE_SMART_PASTE | ||
| 65 | -// #define N_TOGGLES LIB3270_TOGGLE_COUNT | ||
| 66 | - | ||
| 67 | - #define LIB3270_TOGGLE_ID LIB3270_TOGGLE | ||
| 68 | - | ||
| 69 | -// #define register_3270_toggle_monitor(ix,callback) lib3270_register_tchange(NULL,ix,callback) | ||
| 70 | - #define get_3270_toggle_by_name(x) lib3270_get_toggle_id(x) | ||
| 71 | - | ||
| 72 | - // Compatibility macros | ||
| 73 | - #define register_tchange(ix,callback) register_3270_toggle_monitor(ix,callback) | ||
| 74 | - #define do_toggle(ix) lib3270_toggle(NULL,ix) | ||
| 75 | - | ||
| 76 | - #define get_3270_toggle_name(ix) lib3270_get_toggle_name(ix) | ||
| 77 | - #define get_toggle_name(ix) lib3270_get_toggle_name(ix) | ||
| 78 | -// #define set_toggle(ix,value) lib3270_set_toggle(NULL,ix,value) | ||
| 79 | - #define get_toggle_by_name(name) lib3270_get_toggle_id(name) | ||
| 80 | - | ||
| 81 | -#endif /* TOGGLE3270_H_INCLUDED */ |
src/selection/actions.c
| @@ -34,6 +34,7 @@ | @@ -34,6 +34,7 @@ | ||
| 34 | #include <lib3270/selection.h> | 34 | #include <lib3270/selection.h> |
| 35 | #include <lib3270/log.h> | 35 | #include <lib3270/log.h> |
| 36 | #include <lib3270/trace.h> | 36 | #include <lib3270/trace.h> |
| 37 | + #include <lib3270/toggle.h> | ||
| 37 | #include "3270ds.h" | 38 | #include "3270ds.h" |
| 38 | 39 | ||
| 39 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 40 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
src/ssl/negotiate.c
| @@ -53,6 +53,7 @@ | @@ -53,6 +53,7 @@ | ||
| 53 | #include <lib3270/internals.h> | 53 | #include <lib3270/internals.h> |
| 54 | #include <lib3270/trace.h> | 54 | #include <lib3270/trace.h> |
| 55 | #include <lib3270/log.h> | 55 | #include <lib3270/log.h> |
| 56 | +#include <lib3270/toggle.h> | ||
| 56 | #include "hostc.h" // host_disconnect | 57 | #include "hostc.h" // host_disconnect |
| 57 | #include "trace_dsc.h" | 58 | #include "trace_dsc.h" |
| 58 | 59 |
src/ssl/windows/curl.c
src/ssl/windows/ldap.c
| @@ -41,6 +41,7 @@ | @@ -41,6 +41,7 @@ | ||
| 41 | #include "private.h" | 41 | #include "private.h" |
| 42 | #include <winldap.h> | 42 | #include <winldap.h> |
| 43 | #include <utilc.h> | 43 | #include <utilc.h> |
| 44 | +#include <lib3270/toggle.h> | ||
| 44 | 45 | ||
| 45 | # ifndef LDAP_VENDOR_NAME | 46 | # ifndef LDAP_VENDOR_NAME |
| 46 | # error Your Platform SDK is NOT sufficient for LDAP support! \ | 47 | # error Your Platform SDK is NOT sufficient for LDAP support! \ |
src/testprogram/testprogram.c