Commit 262679c7751ab9f884796c47a9f4014eebc7c0af
1 parent
0476ebd3
Exists in
master
and in
5 other branches
Android - WIP
Showing
18 changed files
with
202 additions
and
85 deletions
Show diff stats
pw3270.cbp
@@ -45,6 +45,8 @@ | @@ -45,6 +45,8 @@ | ||
45 | <Unit filename="colors.conf" /> | 45 | <Unit filename="colors.conf" /> |
46 | <Unit filename="configure.ac" /> | 46 | <Unit filename="configure.ac" /> |
47 | <Unit filename="pw3270.spec.in" /> | 47 | <Unit filename="pw3270.spec.in" /> |
48 | + <Unit filename="src/android/jni/main.cpp" /> | ||
49 | + <Unit filename="src/android/jni/misc.cpp" /> | ||
48 | <Unit filename="src/include/lib3270.h" /> | 50 | <Unit filename="src/include/lib3270.h" /> |
49 | <Unit filename="src/include/lib3270/action_table.h" /> | 51 | <Unit filename="src/include/lib3270/action_table.h" /> |
50 | <Unit filename="src/include/lib3270/actions.h" /> | 52 | <Unit filename="src/include/lib3270/actions.h" /> |
src/android/jni/Android.mk
@@ -33,7 +33,7 @@ LOCAL_CFLAGS=-I../include | @@ -33,7 +33,7 @@ LOCAL_CFLAGS=-I../include | ||
33 | LOCAL_DEFAULT_CPP_EXTENSION := cpp | 33 | LOCAL_DEFAULT_CPP_EXTENSION := cpp |
34 | LOCAL_MODULE := lib3270 | 34 | LOCAL_MODULE := lib3270 |
35 | LOCAL_SRC_FILES := $(foreach SRC, $(TERMINAL_SOURCES), ../../lib3270/$(SRC)) \ | 35 | LOCAL_SRC_FILES := $(foreach SRC, $(TERMINAL_SOURCES), ../../lib3270/$(SRC)) \ |
36 | - misc.cpp init.cpp | 36 | + main.cpp misc.cpp |
37 | 37 | ||
38 | include $(BUILD_SHARED_LIBRARY) | 38 | include $(BUILD_SHARED_LIBRARY) |
39 | 39 |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, 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. 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., 59 Temple | ||
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como globals.h e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * | ||
27 | + */ | ||
28 | + | ||
29 | + #include "lib3270jni.h" | ||
30 | + #include <lib3270.h> |
src/android/jni/init.cpp
@@ -1,40 +0,0 @@ | @@ -1,40 +0,0 @@ | ||
1 | -/* | ||
2 | - * "Software pw3270, 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. 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., 59 Temple | ||
19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | - * | ||
21 | - * Este programa está nomeado como init.cpp e possui - linhas de código. | ||
22 | - * | ||
23 | - * Contatos: | ||
24 | - * | ||
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | - * | ||
27 | - */ | ||
28 | - | ||
29 | - #include "lib3270jni.h" | ||
30 | - #include <lib3270.h> | ||
31 | - | ||
32 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
33 | - | ||
34 | -JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_init(JNIEnv *env, jobject obj) | ||
35 | -{ | ||
36 | - H3270 *session = lib3270_session_new(""); | ||
37 | - | ||
38 | - | ||
39 | -} | ||
40 | - |
@@ -0,0 +1,73 @@ | @@ -0,0 +1,73 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, 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. 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., 59 Temple | ||
19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como main.cpp e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * | ||
27 | + */ | ||
28 | + | ||
29 | + #include "globals.h" | ||
30 | + #include <lib3270/session.h> | ||
31 | + | ||
32 | +/*--[ Defines ]--------------------------------------------------------------------------------------*/ | ||
33 | + | ||
34 | + typedef struct _info | ||
35 | + { | ||
36 | + JNIEnv * env; | ||
37 | + jobject obj; | ||
38 | + | ||
39 | + } INFO; | ||
40 | + | ||
41 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
42 | + | ||
43 | +JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_init(JNIEnv *env, jclass obj) | ||
44 | +{ | ||
45 | + H3270 * session = lib3270_session_new(""); | ||
46 | + | ||
47 | + return 0; | ||
48 | +} | ||
49 | + | ||
50 | +JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_processEvents(JNIEnv *env, jobject obj) | ||
51 | +{ | ||
52 | + /* | ||
53 | + INFO data = { env, obj }; | ||
54 | + H3270 * session = lib3270_get_default_session_handle(); | ||
55 | + | ||
56 | + session->widget = &data; | ||
57 | + lib3270_main_iterate(session,1); | ||
58 | + session->widget = 0; | ||
59 | + */ | ||
60 | + return 0; | ||
61 | +} | ||
62 | + | ||
63 | +JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isConnected(JNIEnv *, jobject) | ||
64 | +{ | ||
65 | +// return (lib3270_connected(lib3270_get_default_session_handle())) ? JNI_TRUE : JNI_FALSE;; | ||
66 | + return JNI_FALSE; | ||
67 | +} | ||
68 | + | ||
69 | +JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isTerminalReady(JNIEnv *, jobject) | ||
70 | +{ | ||
71 | + return JNI_FALSE; | ||
72 | +} | ||
73 | + |
src/android/jni/misc.cpp
@@ -26,8 +26,7 @@ | @@ -26,8 +26,7 @@ | ||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | - #include "lib3270jni.h" | ||
30 | - #include <lib3270.h> | 29 | + #include "globals.h" |
31 | 30 | ||
32 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 31 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
33 | 32 | ||
@@ -40,3 +39,8 @@ JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getRevision(JNIEnv *env, | @@ -40,3 +39,8 @@ JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getRevision(JNIEnv *env, | ||
40 | { | 39 | { |
41 | return env->NewStringUTF(lib3270_get_revision()); | 40 | return env->NewStringUTF(lib3270_get_revision()); |
42 | } | 41 | } |
42 | + | ||
43 | +JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getEncoding(JNIEnv *env, jobject obj) | ||
44 | +{ | ||
45 | + return env->NewStringUTF(lib3270_get_charset(lib3270_get_default_session_handle())); | ||
46 | +} |
src/android/lib3270NDK.cbp
@@ -34,7 +34,8 @@ | @@ -34,7 +34,8 @@ | ||
34 | </Compiler> | 34 | </Compiler> |
35 | <Unit filename="Makefile" /> | 35 | <Unit filename="Makefile" /> |
36 | <Unit filename="jni/Android.mk" /> | 36 | <Unit filename="jni/Android.mk" /> |
37 | - <Unit filename="jni/init.cpp" /> | 37 | + <Unit filename="jni/globals.h" /> |
38 | + <Unit filename="jni/main.cpp" /> | ||
38 | <Unit filename="jni/misc.cpp" /> | 39 | <Unit filename="jni/misc.cpp" /> |
39 | <Unit filename="src/br/com/bb/pw3270/lib3270.java" /> | 40 | <Unit filename="src/br/com/bb/pw3270/lib3270.java" /> |
40 | <Extensions> | 41 | <Extensions> |
src/android/src/br/com/bb/pw3270/lib3270.java
1 | package br.com.bb.pw3270; | 1 | package br.com.bb.pw3270; |
2 | 2 | ||
3 | -public class lib3270 { | 3 | +import java.lang.Thread; |
4 | + | ||
5 | +public class lib3270 extends Thread | ||
6 | +{ | ||
4 | 7 | ||
5 | static | 8 | static |
6 | { | 9 | { |
@@ -16,11 +19,28 @@ public class lib3270 { | @@ -16,11 +19,28 @@ public class lib3270 { | ||
16 | // TODO Auto-generated method stub | 19 | // TODO Auto-generated method stub |
17 | 20 | ||
18 | } | 21 | } |
22 | + | ||
23 | + /** | ||
24 | + * Connect to host, keep event loop running until disconnected. | ||
25 | + */ | ||
26 | + public void run() | ||
27 | + { | ||
28 | + while(isConnected()) | ||
29 | + processEvents(); | ||
30 | + } | ||
31 | + | ||
32 | + static private native int init(); | ||
33 | + private native int processEvents(); | ||
19 | 34 | ||
20 | // Misc calls | 35 | // Misc calls |
21 | - static private native int init(); | ||
22 | - public native String getVersion(); | ||
23 | - public native String getRevision(); | 36 | + public native String getEncoding(); |
37 | + | ||
38 | + public native String getVersion(); | ||
39 | + public native String getRevision(); | ||
40 | + | ||
41 | + // Connection status | ||
42 | + public native boolean isConnected(); | ||
43 | + public native boolean isTerminalReady(); | ||
24 | 44 | ||
25 | 45 | ||
26 | 46 |
src/include/lib3270.h
@@ -647,10 +647,11 @@ | @@ -647,10 +647,11 @@ | ||
647 | * | 647 | * |
648 | * Run lib3270 internal iterations, check for network inputs, process signals. | 648 | * Run lib3270 internal iterations, check for network inputs, process signals. |
649 | * | 649 | * |
650 | + * @param h Related session. | ||
650 | * @param wait Wait for signal if not available. | 651 | * @param wait Wait for signal if not available. |
651 | * | 652 | * |
652 | */ | 653 | */ |
653 | - LIB3270_EXPORT void lib3270_main_iterate(int wait); | 654 | + LIB3270_EXPORT void lib3270_main_iterate(H3270 *h, int wait); |
654 | 655 | ||
655 | /** | 656 | /** |
656 | * Wait for "N" seconds keeping main loop active. | 657 | * Wait for "N" seconds keeping main loop active. |
@@ -776,6 +777,14 @@ | @@ -776,6 +777,14 @@ | ||
776 | 777 | ||
777 | 778 | ||
778 | /** | 779 | /** |
780 | + * Get default session handle. | ||
781 | + * | ||
782 | + * @return Internal's lib3270 session handle. | ||
783 | + * | ||
784 | + */ | ||
785 | + LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void); | ||
786 | + | ||
787 | + /** | ||
779 | * Get resource string. | 788 | * Get resource string. |
780 | * | 789 | * |
781 | * @param first_element First element of resource path | 790 | * @param first_element First element of resource path |
src/include/lib3270/session.h
@@ -119,7 +119,7 @@ | @@ -119,7 +119,7 @@ | ||
119 | char * qualified_host; | 119 | char * qualified_host; |
120 | char * proxy; /**< Proxy server (type:host[:port]) */ | 120 | char * proxy; /**< Proxy server (type:host[:port]) */ |
121 | char * termname; | 121 | char * termname; |
122 | - | 122 | + char * charset; |
123 | 123 | ||
124 | LIB3270_MESSAGE oia_status; | 124 | LIB3270_MESSAGE oia_status; |
125 | 125 | ||
@@ -131,7 +131,7 @@ | @@ -131,7 +131,7 @@ | ||
131 | void * ft; /**< Active file transfer data */ | 131 | void * ft; /**< Active file transfer data */ |
132 | 132 | ||
133 | // screen info | 133 | // screen info |
134 | - char * charset; | 134 | + const char * host_charset; |
135 | int ov_rows; | 135 | int ov_rows; |
136 | int ov_cols; | 136 | int ov_cols; |
137 | int maxROWS; | 137 | int maxROWS; |
src/lib3270/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; |
src/lib3270/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; |
src/lib3270/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; |
src/lib3270/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); |
src/lib3270/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 }, |
src/lib3270/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 | { |
src/lib3270/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 |
src/lib3270/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 |