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 | 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 | 860 | if(!cbk) |
856 | 861 | return EINVAL; |
... | ... | @@ -937,7 +942,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * |
937 | 942 | if(h->set_timer) |
938 | 943 | h->set_timer(h,1); |
939 | 944 | |
940 | - lib3270_main_iterate(0); | |
945 | + lib3270_main_iterate(h,0); | |
941 | 946 | if(callbacks->callthread) |
942 | 947 | { |
943 | 948 | h->bgthread = 1; |
... | ... | @@ -950,7 +955,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * |
950 | 955 | { |
951 | 956 | rc = callback(h,parm); |
952 | 957 | } |
953 | - lib3270_main_iterate(0); | |
958 | + lib3270_main_iterate(h,0); | |
954 | 959 | |
955 | 960 | if(h->set_timer) |
956 | 961 | h->set_timer(h,0); |
... | ... | @@ -958,7 +963,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * |
958 | 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 | 968 | if(callbacks->RunPendingEvents) |
964 | 969 | callbacks->RunPendingEvents(wait); |
... | ... | @@ -976,7 +981,7 @@ LIB3270_EXPORT int lib3270_wait(seconds) |
976 | 981 | |
977 | 982 | while(time(0) < end) |
978 | 983 | { |
979 | - lib3270_main_iterate(1); | |
984 | + lib3270_main_iterate(&h3270,1); | |
980 | 985 | } |
981 | 986 | |
982 | 987 | return 0; | ... | ... |
appres.h
charset.c
... | ... | @@ -90,10 +90,9 @@ unsigned char xk_selector = 0; |
90 | 90 | unsigned char auto_keymap = 0; |
91 | 91 | |
92 | 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 | 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 | 96 | static void remap_one(unsigned char ebc, KeySym iso, remap_scope scope,Boolean one_way); |
98 | 97 | |
99 | 98 | #if defined(DEBUG_CHARSET) /*[*/ |
... | ... | @@ -195,7 +194,7 @@ wide_resource_init(char *csname) |
195 | 194 | /* |
196 | 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 | 199 | char *cs; |
201 | 200 | const char *ftcs; |
... | ... | @@ -370,7 +369,7 @@ set_charset_name(char *csname) |
370 | 369 | */ |
371 | 370 | |
372 | 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 | 374 | enum cs_result rc; |
376 | 375 | int ne = 0; |
... | ... | @@ -586,8 +585,7 @@ remap_one(unsigned char ebc, KeySym iso, remap_scope scope, Boolean one_way) |
586 | 585 | * characters that replace certain standard Latin-1 graphics. The keysym |
587 | 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 | 590 | char *s; |
593 | 591 | char *ebcs, *isos; | ... | ... |
charsetc.h
... | ... | @@ -35,7 +35,7 @@ LIB3270_INTERNAL char *default_display_charset; |
35 | 35 | |
36 | 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 | 39 | // LIB3270_INTERNAL char *get_charset_name(void); |
40 | 40 | |
41 | 41 | LIB3270_INTERNAL void set_display_charset(H3270 *session, const char *dcs); | ... | ... |
glue.c
... | ... | @@ -171,15 +171,15 @@ static void initialize(void) |
171 | 171 | // appres.hostsfile = CN; |
172 | 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 | 184 | // appres.termname = CN; |
185 | 185 | appres.macros = CN; |
... | ... | @@ -305,7 +305,7 @@ static const struct lib3270_option options[] = |
305 | 305 | #if defined(HAVE_LIBSSL) /*[*/ |
306 | 306 | { OptCertFile, OPT_STRING, False, ResCertFile, offset(cert_file), NULL }, |
307 | 307 | #endif /*]*/ |
308 | - { OptCharset, OPT_STRING, False, ResCharset, offset(charset), NULL }, | |
308 | +// { OptCharset, OPT_STRING, False, ResCharset, offset(charset), NULL }, | |
309 | 309 | { OptClear, OPT_SKIP2, False, NULL, NULL, NULL }, |
310 | 310 | // { OptDefScreen,OPT_STRING, False, ResDefScreen, offset(defscreen), NULL }, |
311 | 311 | //#if defined(X3270_TRACE) |
... | ... | @@ -383,7 +383,7 @@ static struct { |
383 | 383 | #if defined(HAVE_LIBSSL) /*[*/ |
384 | 384 | { ResCertFile, offset(cert_file), XRM_STRING }, |
385 | 385 | #endif /*]*/ |
386 | - { ResCharset, offset(charset), XRM_STRING }, | |
386 | +// { ResCharset, offset(charset), XRM_STRING }, | |
387 | 387 | // { ResColor8, offset(color8), XRM_BOOLEAN }, |
388 | 388 | { ResConfDir, offset(conf_dir), XRM_STRING }, |
389 | 389 | // { ResDefScreen, offset(defscreen), XRM_STRING }, | ... | ... |
host.c
... | ... | @@ -615,7 +615,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) |
615 | 615 | |
616 | 616 | CHECK_SESSION_HANDLE(h); |
617 | 617 | |
618 | - lib3270_main_iterate(0); | |
618 | + lib3270_main_iterate(h,0); | |
619 | 619 | |
620 | 620 | if(h->auto_reconnect_inprogress) |
621 | 621 | return EAGAIN; |
... | ... | @@ -638,7 +638,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) |
638 | 638 | { |
639 | 639 | while(!IN_ANSI && !IN_3270) |
640 | 640 | { |
641 | - lib3270_main_iterate(1); | |
641 | + lib3270_main_iterate(h,1); | |
642 | 642 | |
643 | 643 | if(!PCONNECTED) |
644 | 644 | { | ... | ... |
init.c
... | ... | @@ -32,7 +32,7 @@ |
32 | 32 | |
33 | 33 | |
34 | 34 | #include "globals.h" |
35 | -#include "appres.h" | |
35 | +// #include "appres.h" | |
36 | 36 | #include "charsetc.h" |
37 | 37 | #include "kybdc.h" |
38 | 38 | #include "ansic.h" |
... | ... | @@ -142,6 +142,20 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
142 | 142 | hSession->unlock_delay = 1; |
143 | 143 | hSession->icrnl = 1; |
144 | 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 | 160 | // Initialize toggles |
147 | 161 | initialize_toggles(hSession); |
... | ... | @@ -223,7 +237,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
223 | 237 | Trace("Termtype: %s",hSession->termtype); |
224 | 238 | |
225 | 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 | 258 | |
245 | 259 | configured = 1; |
246 | 260 | |
261 | + | |
247 | 262 | lib3270_session_init(hSession, model); |
248 | 263 | |
249 | 264 | if(screen_init(hSession)) |
250 | 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 | 271 | (void) charset_init(hSession,CN); |
257 | 272 | } |
258 | 273 | ... | ... |
sources.mak
... | ... | @@ -27,9 +27,9 @@ |
27 | 27 | # Terminal only sources |
28 | 28 | TERMINAL_SOURCES = bounds.c XtGlue.c ctlr.c util.c toggles.c screen.c selection.c kybd.c telnet.c \ |
29 | 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 | 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 | 34 | rpq.c see.c trace_ds.c paste.c macros.c fallbacks.c |
35 | 35 | ... | ... |