Commit b7c0601b78df8d09e562961fa2d3f3b1afc4a34f
1 parent
cae99156
Exists in
master
and in
3 other branches
Android - WIP
Showing
8 changed files
with
52 additions
and
34 deletions
Show diff stats
XtGlue.c
| @@ -850,7 +850,12 @@ void RemoveInput(unsigned long id) | @@ -850,7 +850,12 @@ void RemoveInput(unsigned long id) | ||
| 850 | callbacks->RemoveInput(id); | 850 | callbacks->RemoveInput(id); |
| 851 | } | 851 | } |
| 852 | 852 | ||
| 853 | -int LIB3270_EXPORT lib3270_register_handlers(const struct lib3270_callbacks *cbk) | 853 | +LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) |
| 854 | +{ | ||
| 855 | + return &h3270; | ||
| 856 | +} | ||
| 857 | + | ||
| 858 | +LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk) | ||
| 854 | { | 859 | { |
| 855 | if(!cbk) | 860 | if(!cbk) |
| 856 | return EINVAL; | 861 | return EINVAL; |
| @@ -937,7 +942,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | @@ -937,7 +942,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | ||
| 937 | if(h->set_timer) | 942 | if(h->set_timer) |
| 938 | h->set_timer(h,1); | 943 | h->set_timer(h,1); |
| 939 | 944 | ||
| 940 | - lib3270_main_iterate(0); | 945 | + lib3270_main_iterate(h,0); |
| 941 | if(callbacks->callthread) | 946 | if(callbacks->callthread) |
| 942 | { | 947 | { |
| 943 | h->bgthread = 1; | 948 | h->bgthread = 1; |
| @@ -950,7 +955,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | @@ -950,7 +955,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | ||
| 950 | { | 955 | { |
| 951 | rc = callback(h,parm); | 956 | rc = callback(h,parm); |
| 952 | } | 957 | } |
| 953 | - lib3270_main_iterate(0); | 958 | + lib3270_main_iterate(h,0); |
| 954 | 959 | ||
| 955 | if(h->set_timer) | 960 | if(h->set_timer) |
| 956 | h->set_timer(h,0); | 961 | h->set_timer(h,0); |
| @@ -958,7 +963,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | @@ -958,7 +963,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * | ||
| 958 | return rc; | 963 | return rc; |
| 959 | } | 964 | } |
| 960 | 965 | ||
| 961 | -LIB3270_EXPORT void lib3270_main_iterate(int wait) | 966 | +LIB3270_EXPORT void lib3270_main_iterate(H3270 *session, int wait) |
| 962 | { | 967 | { |
| 963 | if(callbacks->RunPendingEvents) | 968 | if(callbacks->RunPendingEvents) |
| 964 | callbacks->RunPendingEvents(wait); | 969 | callbacks->RunPendingEvents(wait); |
| @@ -976,7 +981,7 @@ LIB3270_EXPORT int lib3270_wait(seconds) | @@ -976,7 +981,7 @@ LIB3270_EXPORT int lib3270_wait(seconds) | ||
| 976 | 981 | ||
| 977 | while(time(0) < end) | 982 | while(time(0) < end) |
| 978 | { | 983 | { |
| 979 | - lib3270_main_iterate(1); | 984 | + lib3270_main_iterate(&h3270,1); |
| 980 | } | 985 | } |
| 981 | 986 | ||
| 982 | return 0; | 987 | return 0; |
appres.h
| @@ -149,7 +149,7 @@ typedef struct { | @@ -149,7 +149,7 @@ typedef struct { | ||
| 149 | char *model; | 149 | char *model; |
| 150 | // char *hostsfile; | 150 | // char *hostsfile; |
| 151 | // char *port; | 151 | // char *port; |
| 152 | - char *charset; | 152 | +// char *charset; |
| 153 | // char *termname; | 153 | // char *termname; |
| 154 | // char *login_macro; | 154 | // char *login_macro; |
| 155 | char *macros; | 155 | char *macros; |
charset.c
| @@ -90,10 +90,9 @@ unsigned char xk_selector = 0; | @@ -90,10 +90,9 @@ unsigned char xk_selector = 0; | ||
| 90 | unsigned char auto_keymap = 0; | 90 | unsigned char auto_keymap = 0; |
| 91 | 91 | ||
| 92 | /* Statics. */ | 92 | /* Statics. */ |
| 93 | -static enum cs_result resource_charset(char *csname, char *cs, char *ftcs); | 93 | +static enum cs_result resource_charset(const char *csname, char *cs, char *ftcs); |
| 94 | typedef enum { CS_ONLY, FT_ONLY, BOTH } remap_scope; | 94 | typedef enum { CS_ONLY, FT_ONLY, BOTH } remap_scope; |
| 95 | -static enum cs_result remap_chars(char *csname, char *spec, remap_scope scope, | ||
| 96 | - int *ne); | 95 | +static enum cs_result remap_chars(const char *csname, char *spec, remap_scope scope, int *ne); |
| 97 | static void remap_one(unsigned char ebc, KeySym iso, remap_scope scope,Boolean one_way); | 96 | static void remap_one(unsigned char ebc, KeySym iso, remap_scope scope,Boolean one_way); |
| 98 | 97 | ||
| 99 | #if defined(DEBUG_CHARSET) /*[*/ | 98 | #if defined(DEBUG_CHARSET) /*[*/ |
| @@ -195,7 +194,7 @@ wide_resource_init(char *csname) | @@ -195,7 +194,7 @@ wide_resource_init(char *csname) | ||
| 195 | /* | 194 | /* |
| 196 | * Change character sets. | 195 | * Change character sets. |
| 197 | */ | 196 | */ |
| 198 | -enum cs_result charset_init(H3270 *session, char *csname) | 197 | +enum cs_result charset_init(H3270 *session, const char *csname) |
| 199 | { | 198 | { |
| 200 | char *cs; | 199 | char *cs; |
| 201 | const char *ftcs; | 200 | const char *ftcs; |
| @@ -370,7 +369,7 @@ set_charset_name(char *csname) | @@ -370,7 +369,7 @@ set_charset_name(char *csname) | ||
| 370 | */ | 369 | */ |
| 371 | 370 | ||
| 372 | /* Define a charset from resources. */ | 371 | /* Define a charset from resources. */ |
| 373 | -static enum cs_result resource_charset(char *csname, char *cs, char *ftcs) | 372 | +static enum cs_result resource_charset(const char *csname, char *cs, char *ftcs) |
| 374 | { | 373 | { |
| 375 | enum cs_result rc; | 374 | enum cs_result rc; |
| 376 | int ne = 0; | 375 | int ne = 0; |
| @@ -586,8 +585,7 @@ remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) | @@ -586,8 +585,7 @@ remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) | ||
| 586 | * characters that replace certain standard Latin-1 graphics. The keysym | 585 | * characters that replace certain standard Latin-1 graphics. The keysym |
| 587 | * will be entered into the extended keysym translation table. | 586 | * will be entered into the extended keysym translation table. |
| 588 | */ | 587 | */ |
| 589 | -static enum cs_result | ||
| 590 | -remap_chars(char *csname, char *spec, remap_scope scope, int *ne) | 588 | +static enum cs_result remap_chars(const char *csname, char *spec, remap_scope scope, int *ne) |
| 591 | { | 589 | { |
| 592 | char *s; | 590 | char *s; |
| 593 | char *ebcs, *isos; | 591 | char *ebcs, *isos; |
charsetc.h
| @@ -35,7 +35,7 @@ LIB3270_INTERNAL char *default_display_charset; | @@ -35,7 +35,7 @@ LIB3270_INTERNAL char *default_display_charset; | ||
| 35 | 35 | ||
| 36 | enum cs_result { CS_OKAY, CS_NOTFOUND, CS_BAD, CS_PREREQ, CS_ILLEGAL }; | 36 | enum cs_result { CS_OKAY, CS_NOTFOUND, CS_BAD, CS_PREREQ, CS_ILLEGAL }; |
| 37 | 37 | ||
| 38 | -LIB3270_INTERNAL enum cs_result charset_init(H3270 *session, char *csname); | 38 | +LIB3270_INTERNAL enum cs_result charset_init(H3270 *session, const char *csname); |
| 39 | // LIB3270_INTERNAL char *get_charset_name(void); | 39 | // LIB3270_INTERNAL char *get_charset_name(void); |
| 40 | 40 | ||
| 41 | LIB3270_INTERNAL void set_display_charset(H3270 *session, const char *dcs); | 41 | LIB3270_INTERNAL void set_display_charset(H3270 *session, const char *dcs); |
glue.c
| @@ -171,15 +171,15 @@ static void initialize(void) | @@ -171,15 +171,15 @@ static void initialize(void) | ||
| 171 | // appres.hostsfile = CN; | 171 | // appres.hostsfile = CN; |
| 172 | // appres.port = "telnet"; | 172 | // appres.port = "telnet"; |
| 173 | 173 | ||
| 174 | -#if !defined(_WIN32) /*[*/ | ||
| 175 | - appres.charset = "bracket"; | ||
| 176 | -#else /*][*/ | ||
| 177 | - | ||
| 178 | - if (is_nt) | ||
| 179 | - appres.charset = "bracket"; | ||
| 180 | - else | ||
| 181 | - appres.charset = "bracket437"; | ||
| 182 | -#endif /*]*/ | 174 | +// #if !defined(_WIN32) /*[*/ |
| 175 | +// appres.charset = "bracket"; | ||
| 176 | +// #else /*][*/ | ||
| 177 | +// | ||
| 178 | +// if (is_nt) | ||
| 179 | +// appres.charset = "bracket"; | ||
| 180 | +// else | ||
| 181 | +// appres.charset = "bracket437"; | ||
| 182 | +//#endif /*]*/ | ||
| 183 | 183 | ||
| 184 | // appres.termname = CN; | 184 | // appres.termname = CN; |
| 185 | appres.macros = CN; | 185 | appres.macros = CN; |
| @@ -305,7 +305,7 @@ static const struct lib3270_option options[] = | @@ -305,7 +305,7 @@ static const struct lib3270_option options[] = | ||
| 305 | #if defined(HAVE_LIBSSL) /*[*/ | 305 | #if defined(HAVE_LIBSSL) /*[*/ |
| 306 | { OptCertFile, OPT_STRING, False, ResCertFile, offset(cert_file), NULL }, | 306 | { OptCertFile, OPT_STRING, False, ResCertFile, offset(cert_file), NULL }, |
| 307 | #endif /*]*/ | 307 | #endif /*]*/ |
| 308 | - { OptCharset, OPT_STRING, False, ResCharset, offset(charset), NULL }, | 308 | +// { OptCharset, OPT_STRING, False, ResCharset, offset(charset), NULL }, |
| 309 | { OptClear, OPT_SKIP2, False, NULL, NULL, NULL }, | 309 | { OptClear, OPT_SKIP2, False, NULL, NULL, NULL }, |
| 310 | // { OptDefScreen,OPT_STRING, False, ResDefScreen, offset(defscreen), NULL }, | 310 | // { OptDefScreen,OPT_STRING, False, ResDefScreen, offset(defscreen), NULL }, |
| 311 | //#if defined(X3270_TRACE) | 311 | //#if defined(X3270_TRACE) |
| @@ -383,7 +383,7 @@ static struct { | @@ -383,7 +383,7 @@ static struct { | ||
| 383 | #if defined(HAVE_LIBSSL) /*[*/ | 383 | #if defined(HAVE_LIBSSL) /*[*/ |
| 384 | { ResCertFile, offset(cert_file), XRM_STRING }, | 384 | { ResCertFile, offset(cert_file), XRM_STRING }, |
| 385 | #endif /*]*/ | 385 | #endif /*]*/ |
| 386 | - { ResCharset, offset(charset), XRM_STRING }, | 386 | +// { ResCharset, offset(charset), XRM_STRING }, |
| 387 | // { ResColor8, offset(color8), XRM_BOOLEAN }, | 387 | // { ResColor8, offset(color8), XRM_BOOLEAN }, |
| 388 | { ResConfDir, offset(conf_dir), XRM_STRING }, | 388 | { ResConfDir, offset(conf_dir), XRM_STRING }, |
| 389 | // { ResDefScreen, offset(defscreen), XRM_STRING }, | 389 | // { ResDefScreen, offset(defscreen), XRM_STRING }, |
host.c
| @@ -615,7 +615,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | @@ -615,7 +615,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | ||
| 615 | 615 | ||
| 616 | CHECK_SESSION_HANDLE(h); | 616 | CHECK_SESSION_HANDLE(h); |
| 617 | 617 | ||
| 618 | - lib3270_main_iterate(0); | 618 | + lib3270_main_iterate(h,0); |
| 619 | 619 | ||
| 620 | if(h->auto_reconnect_inprogress) | 620 | if(h->auto_reconnect_inprogress) |
| 621 | return EAGAIN; | 621 | return EAGAIN; |
| @@ -638,7 +638,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | @@ -638,7 +638,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | ||
| 638 | { | 638 | { |
| 639 | while(!IN_ANSI && !IN_3270) | 639 | while(!IN_ANSI && !IN_3270) |
| 640 | { | 640 | { |
| 641 | - lib3270_main_iterate(1); | 641 | + lib3270_main_iterate(h,1); |
| 642 | 642 | ||
| 643 | if(!PCONNECTED) | 643 | if(!PCONNECTED) |
| 644 | { | 644 | { |
init.c
| @@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | #include "globals.h" | 34 | #include "globals.h" |
| 35 | -#include "appres.h" | 35 | +// #include "appres.h" |
| 36 | #include "charsetc.h" | 36 | #include "charsetc.h" |
| 37 | #include "kybdc.h" | 37 | #include "kybdc.h" |
| 38 | #include "ansic.h" | 38 | #include "ansic.h" |
| @@ -142,6 +142,20 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -142,6 +142,20 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
| 142 | hSession->unlock_delay = 1; | 142 | hSession->unlock_delay = 1; |
| 143 | hSession->icrnl = 1; | 143 | hSession->icrnl = 1; |
| 144 | hSession->onlcr = 1; | 144 | hSession->onlcr = 1; |
| 145 | + hSession->host_charset = "bracket"; | ||
| 146 | + | ||
| 147 | +/* | ||
| 148 | +#if !defined(_WIN32) | ||
| 149 | + hSession->host_charset = "bracket"; | ||
| 150 | +#else | ||
| 151 | + | ||
| 152 | + if (is_nt) | ||
| 153 | + hSession->host_charset = "bracket"; | ||
| 154 | + else | ||
| 155 | + hSession->host_charset = "bracket437"; | ||
| 156 | +#endif | ||
| 157 | +*/ | ||
| 158 | + | ||
| 145 | 159 | ||
| 146 | // Initialize toggles | 160 | // Initialize toggles |
| 147 | initialize_toggles(hSession); | 161 | initialize_toggles(hSession); |
| @@ -223,7 +237,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -223,7 +237,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
| 223 | Trace("Termtype: %s",hSession->termtype); | 237 | Trace("Termtype: %s",hSession->termtype); |
| 224 | 238 | ||
| 225 | if (hSession->apl_mode) | 239 | if (hSession->apl_mode) |
| 226 | - appres.charset = "apl"; | 240 | + hSession->host_charset = "apl"; |
| 227 | 241 | ||
| 228 | } | 242 | } |
| 229 | 243 | ||
| @@ -244,15 +258,16 @@ H3270 * lib3270_session_new(const char *model) | @@ -244,15 +258,16 @@ H3270 * lib3270_session_new(const char *model) | ||
| 244 | 258 | ||
| 245 | configured = 1; | 259 | configured = 1; |
| 246 | 260 | ||
| 261 | + | ||
| 247 | lib3270_session_init(hSession, model); | 262 | lib3270_session_init(hSession, model); |
| 248 | 263 | ||
| 249 | if(screen_init(hSession)) | 264 | if(screen_init(hSession)) |
| 250 | return NULL; | 265 | return NULL; |
| 251 | 266 | ||
| 252 | - Trace("Charset: %s",appres.charset); | ||
| 253 | - if (charset_init(hSession,appres.charset) != CS_OKAY) | 267 | + Trace("Charset: %s",hSession->host_charset); |
| 268 | + if (charset_init(hSession,hSession->host_charset) != CS_OKAY) | ||
| 254 | { | 269 | { |
| 255 | - Warning(hSession, _( "Cannot find charset \"%s\", using defaults" ), appres.charset); | 270 | + Warning(hSession, _( "Cannot find charset \"%s\", using defaults" ), hSession->host_charset); |
| 256 | (void) charset_init(hSession,CN); | 271 | (void) charset_init(hSession,CN); |
| 257 | } | 272 | } |
| 258 | 273 |
sources.mak
| @@ -27,9 +27,9 @@ | @@ -27,9 +27,9 @@ | ||
| 27 | # Terminal only sources | 27 | # Terminal only sources |
| 28 | TERMINAL_SOURCES = bounds.c XtGlue.c ctlr.c util.c toggles.c screen.c selection.c kybd.c telnet.c \ | 28 | TERMINAL_SOURCES = bounds.c XtGlue.c ctlr.c util.c toggles.c screen.c selection.c kybd.c telnet.c \ |
| 29 | host.c sf.c ansi.c log.c resolver.c xio.c tables.c proxy.c utf8.c charset.c \ | 29 | host.c sf.c ansi.c log.c resolver.c xio.c tables.c proxy.c utf8.c charset.c \ |
| 30 | - version.c | 30 | + version.c init.c |
| 31 | 31 | ||
| 32 | # Full library sources | 32 | # Full library sources |
| 33 | -SOURCES = $(TERMINAL_SOURCES) init.c actions.c ft.c ft_cut.c ft_dft.c glue.c resources.c \ | 33 | +SOURCES = $(TERMINAL_SOURCES) actions.c ft.c ft_cut.c ft_dft.c glue.c resources.c \ |
| 34 | rpq.c see.c trace_ds.c paste.c macros.c fallbacks.c | 34 | rpq.c see.c trace_ds.c paste.c macros.c fallbacks.c |
| 35 | 35 |