Commit c88e21fa82465fcbacfb6409c37b1ca025fd78d9
1 parent
ff256cff
Exists in
master
and in
5 other branches
Movendo fila de teclado para a estrutura de sessão
Showing
10 changed files
with
306 additions
and
658 deletions
Show diff stats
android/jni/actions.cpp
| @@ -36,7 +36,10 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_sendEnter(JNIEnv *env, jobj | @@ -36,7 +36,10 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_sendEnter(JNIEnv *env, jobj | ||
| 36 | { | 36 | { |
| 37 | PW3270_JNI_BEGIN | 37 | PW3270_JNI_BEGIN |
| 38 | 38 | ||
| 39 | - lib3270_enter(PW3270_SESSION); | 39 | + if(lib3270_connected(PW3270_SESSION)) |
| 40 | + lib3270_enter(PW3270_SESSION); | ||
| 41 | + else | ||
| 42 | + pw3270_jni_post_message(1,LIB3270_MESSAGE_DISCONNECTED); | ||
| 40 | 43 | ||
| 41 | PW3270_JNI_END | 44 | PW3270_JNI_END |
| 42 | } | 45 | } |
| @@ -45,7 +48,10 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_sendPFkey(JNIEnv *env, jobj | @@ -45,7 +48,10 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_sendPFkey(JNIEnv *env, jobj | ||
| 45 | { | 48 | { |
| 46 | PW3270_JNI_BEGIN | 49 | PW3270_JNI_BEGIN |
| 47 | 50 | ||
| 48 | - lib3270_pfkey(PW3270_SESSION,key); | 51 | + if(lib3270_connected(PW3270_SESSION)) |
| 52 | + lib3270_pfkey(PW3270_SESSION,key); | ||
| 53 | + else | ||
| 54 | + pw3270_jni_post_message(1,LIB3270_MESSAGE_DISCONNECTED); | ||
| 49 | 55 | ||
| 50 | PW3270_JNI_END | 56 | PW3270_JNI_END |
| 51 | } | 57 | } |
android/jni/globals.h
| @@ -76,6 +76,7 @@ | @@ -76,6 +76,7 @@ | ||
| 76 | 76 | ||
| 77 | void pw3270_jni_lock(JNIEnv *env, jobject obj); | 77 | void pw3270_jni_lock(JNIEnv *env, jobject obj); |
| 78 | void pw3270_jni_unlock(); | 78 | void pw3270_jni_unlock(); |
| 79 | + void pw3270_jni_post_message(int msgid, int arg1 = 0, int arg2 = 0); | ||
| 79 | 80 | ||
| 80 | jmethodID lib3270_getmethodID(const char *name, const char *sig); | 81 | jmethodID lib3270_getmethodID(const char *name, const char *sig); |
| 81 | 82 |
android/jni/main.cpp
| @@ -63,7 +63,7 @@ jmethodID lib3270_getmethodID(const char *name, const char *sig) | @@ -63,7 +63,7 @@ jmethodID lib3270_getmethodID(const char *name, const char *sig) | ||
| 63 | return PW3270_JNI_ENV->GetMethodID(PW3270_JNI_ENV->GetObjectClass(PW3270_JNI_OBJ), name, sig ); | 63 | return PW3270_JNI_ENV->GetMethodID(PW3270_JNI_ENV->GetObjectClass(PW3270_JNI_OBJ), name, sig ); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | -static void post_message(int msgid, int arg1 = 0, int arg2 = 0) | 66 | +void pw3270_jni_post_message(int msgid, int arg1, int arg2) |
| 67 | { | 67 | { |
| 68 | trace("%s: pw3270_env=%p pw3270_obj=%p",__FUNCTION__,PW3270_JNI_ENV,PW3270_JNI_OBJ); | 68 | trace("%s: pw3270_env=%p pw3270_obj=%p",__FUNCTION__,PW3270_JNI_ENV,PW3270_JNI_OBJ); |
| 69 | 69 | ||
| @@ -73,12 +73,12 @@ static void post_message(int msgid, int arg1 = 0, int arg2 = 0) | @@ -73,12 +73,12 @@ static void post_message(int msgid, int arg1 = 0, int arg2 = 0) | ||
| 73 | 73 | ||
| 74 | static void changed(H3270 *session, int offset, int len) | 74 | static void changed(H3270 *session, int offset, int len) |
| 75 | { | 75 | { |
| 76 | - post_message(2,offset,len); | 76 | + pw3270_jni_post_message(2,offset,len); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | static void erase(H3270 *session) | 79 | static void erase(H3270 *session) |
| 80 | { | 80 | { |
| 81 | - post_message(4); | 81 | + pw3270_jni_post_message(4); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | static int popuphandler(H3270 *session, void *terminal, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) | 84 | static int popuphandler(H3270 *session, void *terminal, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) |
| @@ -124,13 +124,13 @@ static int popuphandler(H3270 *session, void *terminal, LIB3270_NOTIFY type, con | @@ -124,13 +124,13 @@ static int popuphandler(H3270 *session, void *terminal, LIB3270_NOTIFY type, con | ||
| 124 | 124 | ||
| 125 | static void ctlr_done(H3270 *session) | 125 | static void ctlr_done(H3270 *session) |
| 126 | { | 126 | { |
| 127 | - post_message(4); | 127 | + pw3270_jni_post_message(4); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | void update_status(H3270 *session, LIB3270_MESSAGE id) | 130 | void update_status(H3270 *session, LIB3270_MESSAGE id) |
| 131 | { | 131 | { |
| 132 | - __android_log_print(ANDROID_LOG_DEBUG, PACKAGE_NAME, "Status changed to %d",(int) id); | ||
| 133 | - post_message(1,(int) id); | 132 | +// __android_log_print(ANDROID_LOG_DEBUG, PACKAGE_NAME, "Status changed to %d",(int) id); |
| 133 | + pw3270_jni_post_message(1,(int) id); | ||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | static int write_buffer(H3270 *session, unsigned const char *buf, int len) | 136 | static int write_buffer(H3270 *session, unsigned const char *buf, int len) |
| @@ -335,6 +335,8 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_set_1connection_1status(JNI | @@ -335,6 +335,8 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_set_1connection_1status(JNI | ||
| 335 | { | 335 | { |
| 336 | PW3270_JNI_BEGIN | 336 | PW3270_JNI_BEGIN |
| 337 | 337 | ||
| 338 | + trace("Host is %s",connected ? "connected" : "disconnected"); | ||
| 339 | + | ||
| 338 | if(connected) | 340 | if(connected) |
| 339 | lib3270_set_connected(PW3270_SESSION); | 341 | lib3270_set_connected(PW3270_SESSION); |
| 340 | else | 342 | else |
android/jni/text.cpp
| @@ -108,43 +108,43 @@ JNIEXPORT jbyteArray JNICALL Java_br_com_bb_pw3270_lib3270_getText(JNIEnv *env, | @@ -108,43 +108,43 @@ JNIEXPORT jbyteArray JNICALL Java_br_com_bb_pw3270_lib3270_getText(JNIEnv *env, | ||
| 108 | 108 | ||
| 109 | JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setTextAt(JNIEnv *env, jobject obj, jint pos, jbyteArray inText, jint szText) | 109 | JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setTextAt(JNIEnv *env, jobject obj, jint pos, jbyteArray inText, jint szText) |
| 110 | { | 110 | { |
| 111 | - unsigned char str[szText+1]; | ||
| 112 | - int f; | ||
| 113 | - jbyte * bt; | ||
| 114 | - | ||
| 115 | PW3270_JNI_BEGIN | 111 | PW3270_JNI_BEGIN |
| 116 | 112 | ||
| 117 | - bt = env->GetByteArrayElements(inText,0); | 113 | + if(lib3270_connected(PW3270_SESSION)) |
| 114 | + { | ||
| 115 | + unsigned char str[szText+1]; | ||
| 116 | + int f; | ||
| 117 | + jbyte * bt = env->GetByteArrayElements(inText,0); | ||
| 118 | + | ||
| 119 | + for(int f=0;f<szText;f++) | ||
| 120 | + str[f] = (char) bt[f]; | ||
| 121 | + str[szText] = 0; | ||
| 118 | 122 | ||
| 119 | - for(int f=0;f<szText;f++) | ||
| 120 | - str[f] = (char) bt[f]; | ||
| 121 | - str[szText] = 0; | 123 | +// trace("Buffer(%d/%d)=\"%s\"",(int) pos, lib3270_field_addr(PW3270_SESSION, (int) pos), str); |
| 122 | 124 | ||
| 123 | - trace("Buffer(%d/%d)=\"%s\"",(int) pos, lib3270_field_addr(PW3270_SESSION, (int) pos), str); | 125 | + if( ((int) pos) == lib3270_field_addr(PW3270_SESSION, (int) pos)) |
| 126 | + { | ||
| 127 | + // Begin of field, clear it first | ||
| 128 | + int sz = lib3270_field_length(PW3270_SESSION,pos); | ||
| 129 | + unsigned char * buffer = (unsigned char *) lib3270_malloc(sz+1); | ||
| 124 | 130 | ||
| 131 | + memset(buffer,' ',sz); | ||
| 125 | 132 | ||
| 126 | - if( ((int) pos) == lib3270_field_addr(PW3270_SESSION, (int) pos)) | ||
| 127 | - { | ||
| 128 | - // Begin of field, clear it first | ||
| 129 | - int sz = lib3270_field_length(PW3270_SESSION,pos); | ||
| 130 | - unsigned char * buffer = (unsigned char *) lib3270_malloc(sz+1); | 133 | + lib3270_clear_operator_error(PW3270_SESSION); |
| 134 | + lib3270_set_cursor_address(PW3270_SESSION,(int) pos); | ||
| 135 | + lib3270_set_string(PW3270_SESSION,buffer); | ||
| 131 | 136 | ||
| 132 | - memset(buffer,' ',sz); | 137 | + lib3270_free(buffer); |
| 138 | + } | ||
| 133 | 139 | ||
| 134 | lib3270_clear_operator_error(PW3270_SESSION); | 140 | lib3270_clear_operator_error(PW3270_SESSION); |
| 135 | lib3270_set_cursor_address(PW3270_SESSION,(int) pos); | 141 | lib3270_set_cursor_address(PW3270_SESSION,(int) pos); |
| 136 | - lib3270_set_string(PW3270_SESSION,buffer); | 142 | + lib3270_set_string(PW3270_SESSION,str); |
| 137 | 143 | ||
| 138 | - lib3270_free(buffer); | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - lib3270_clear_operator_error(PW3270_SESSION); | ||
| 142 | - lib3270_set_cursor_address(PW3270_SESSION,(int) pos); | ||
| 143 | - lib3270_set_string(PW3270_SESSION,str); | ||
| 144 | - | ||
| 145 | - lib3270_clear_operator_error(PW3270_SESSION); | 144 | + lib3270_clear_operator_error(PW3270_SESSION); |
| 146 | 145 | ||
| 147 | - env->ReleaseByteArrayElements(inText,bt,JNI_ABORT); | 146 | + env->ReleaseByteArrayElements(inText,bt,JNI_ABORT); |
| 147 | + } | ||
| 148 | 148 | ||
| 149 | PW3270_JNI_END | 149 | PW3270_JNI_END |
| 150 | } | 150 | } |
android/res/values/drawables.xml
android/res/values/strings.xml
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | <item>X Aguarde</item> | 7 | <item>X Aguarde</item> |
| 8 | <item>Conectado</item> | 8 | <item>Conectado</item> |
| 9 | <item>Desconectado</item> | 9 | <item>Desconectado</item> |
| 10 | - <item>X</item> | 10 | + <item>X Aguardando</item> |
| 11 | <item>X -f</item> | 11 | <item>X -f</item> |
| 12 | <item>X Protegido</item> | 12 | <item>X Protegido</item> |
| 13 | <item>X Numérico</item> | 13 | <item>X Numérico</item> |
android/src/br/com/bb/pw3270/PW3270Activity.java
| @@ -192,20 +192,24 @@ public class PW3270Activity extends Activity | @@ -192,20 +192,24 @@ public class PW3270Activity extends Activity | ||
| 192 | public boolean onOptionsItemSelected(MenuItem item) | 192 | public boolean onOptionsItemSelected(MenuItem item) |
| 193 | { | 193 | { |
| 194 | // Handle item selection | 194 | // Handle item selection |
| 195 | - Log.d(TAG,"Menu item selected"); | ||
| 196 | - /* | ||
| 197 | - switch (item.getItemId()) { | ||
| 198 | - case R.id.new_game: | ||
| 199 | - newGame(); | ||
| 200 | - return true; | ||
| 201 | - case R.id.help: | ||
| 202 | - showHelp(); | ||
| 203 | - return true; | ||
| 204 | - default: | ||
| 205 | - return super.onOptionsItemSelected(item); | 195 | + switch (item.getItemId()) |
| 196 | + { | ||
| 197 | + case R.id.connect: | ||
| 198 | + host.connect(); | ||
| 199 | + break; | ||
| 200 | + | ||
| 201 | + case R.id.disconnect: | ||
| 202 | + host.disconnect(); | ||
| 203 | + break; | ||
| 204 | + | ||
| 205 | + case R.id.settings: | ||
| 206 | + break; | ||
| 207 | + | ||
| 208 | + default: | ||
| 209 | + return super.onOptionsItemSelected(item); | ||
| 206 | } | 210 | } |
| 207 | - */ | ||
| 208 | - return super.onOptionsItemSelected(item); | 211 | + return true; |
| 212 | + | ||
| 209 | } | 213 | } |
| 210 | 214 | ||
| 211 | } | 215 | } |
android/src/br/com/bb/pw3270/lib3270.java
| 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., 51 Franklin | ||
| 19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | + * | ||
| 21 | + * Este programa está nomeado como lib3270.java e possui - linhas de código. | ||
| 22 | + * | ||
| 23 | + * Contatos: | ||
| 24 | + * | ||
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 1 | package br.com.bb.pw3270; | 29 | package br.com.bb.pw3270; |
| 2 | 30 | ||
| 3 | import java.lang.Thread; | 31 | import java.lang.Thread; |
| @@ -13,13 +41,15 @@ import java.io.DataOutputStream; | @@ -13,13 +41,15 @@ import java.io.DataOutputStream; | ||
| 13 | 41 | ||
| 14 | // import java.util.Vector; | 42 | // import java.util.Vector; |
| 15 | 43 | ||
| 16 | -public class lib3270 { | 44 | +public class lib3270 |
| 45 | +{ | ||
| 17 | private NetworkThread mainloop = null; | 46 | private NetworkThread mainloop = null; |
| 18 | private static final String TAG = "lib3270"; | 47 | private static final String TAG = "lib3270"; |
| 19 | 48 | ||
| 20 | protected int screenState = 0; | 49 | protected int screenState = 0; |
| 21 | private boolean connected = false; | 50 | private boolean connected = false; |
| 22 | private boolean refresh = true; | 51 | private boolean refresh = true; |
| 52 | + private Socket sock = null; | ||
| 23 | 53 | ||
| 24 | DataOutputStream outData = null; | 54 | DataOutputStream outData = null; |
| 25 | DataInputStream inData = null; | 55 | DataInputStream inData = null; |
| @@ -28,17 +58,74 @@ public class lib3270 { | @@ -28,17 +58,74 @@ public class lib3270 { | ||
| 28 | protected int port = 8023; | 58 | protected int port = 8023; |
| 29 | protected boolean ssl = false; | 59 | protected boolean ssl = false; |
| 30 | 60 | ||
| 31 | - static { | 61 | + // Define the Handler that receives messages from the thread |
| 62 | + final Handler mHandler = new Handler() | ||
| 63 | + { | ||
| 64 | + public void handleMessage(Message msg) | ||
| 65 | + { | ||
| 66 | + switch (msg.what) | ||
| 67 | + { | ||
| 68 | + case 0: // Connected/Disconnected | ||
| 69 | + set_connection_status(connected); | ||
| 70 | + break; | ||
| 71 | + | ||
| 72 | + case 1: // OIA message has changed | ||
| 73 | + showProgramMessage(msg.arg1); | ||
| 74 | + break; | ||
| 75 | + | ||
| 76 | + case 2: // Screen changed | ||
| 77 | + Log.d(TAG, "Screen changed"); | ||
| 78 | + screenState = 1; | ||
| 79 | + break; | ||
| 80 | + | ||
| 81 | + case 3: // Popup | ||
| 82 | + popupMessageInfo popup = (popupMessageInfo) msg.obj; | ||
| 83 | + popupMessage(msg.arg1, popup.title, popup.text, popup.info); | ||
| 84 | + break; | ||
| 85 | + | ||
| 86 | + case 4: // erase | ||
| 87 | + if(screenState != 2) | ||
| 88 | + { | ||
| 89 | + screenState = 2; | ||
| 90 | + erase(); | ||
| 91 | + } | ||
| 92 | + break; | ||
| 93 | + | ||
| 94 | + case 5: // ctlr_done | ||
| 95 | + Log.d(TAG, "ctlr_done"); | ||
| 96 | + break; | ||
| 97 | + | ||
| 98 | + case 6: // recv_data | ||
| 99 | + procRecvdata(((byteMessage) msg.obj).getMessage(), | ||
| 100 | + ((byteMessage) msg.obj).getLength()); | ||
| 101 | + break; | ||
| 102 | + | ||
| 103 | + case 7: // ready | ||
| 104 | + hideProgressDialog(); | ||
| 105 | + break; | ||
| 106 | + | ||
| 107 | + case 8: // busy | ||
| 108 | + showProgressDialog("Aguarde..."); | ||
| 109 | + break; | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + }; | ||
| 113 | + | ||
| 114 | + | ||
| 115 | + static | ||
| 116 | + { | ||
| 32 | System.loadLibrary("3270"); | 117 | System.loadLibrary("3270"); |
| 33 | init(); | 118 | init(); |
| 34 | } | 119 | } |
| 35 | 120 | ||
| 36 | - lib3270() { | 121 | + lib3270() |
| 122 | + { | ||
| 37 | screenState = 0; | 123 | screenState = 0; |
| 38 | mainloop = null; | 124 | mainloop = null; |
| 39 | } | 125 | } |
| 40 | 126 | ||
| 41 | - private class timer extends CountDownTimer { | 127 | + private class timer extends CountDownTimer |
| 128 | + { | ||
| 42 | private long id; | 129 | private long id; |
| 43 | private lib3270 terminal; | 130 | private lib3270 terminal; |
| 44 | 131 | ||
| @@ -53,17 +140,20 @@ public class lib3270 { | @@ -53,17 +140,20 @@ public class lib3270 { | ||
| 53 | this.start(); | 140 | this.start(); |
| 54 | } | 141 | } |
| 55 | 142 | ||
| 56 | - public void onTick(long millisUntilFinished) { | 143 | + public void onTick(long millisUntilFinished) |
| 144 | + { | ||
| 57 | } | 145 | } |
| 58 | 146 | ||
| 59 | - public void onFinish() { | 147 | + public void onFinish() |
| 148 | + { | ||
| 60 | Log.d(TAG, "Timer " + id + " finished"); | 149 | Log.d(TAG, "Timer " + id + " finished"); |
| 61 | terminal.timerFinish(id); | 150 | terminal.timerFinish(id); |
| 62 | } | 151 | } |
| 63 | 152 | ||
| 64 | } | 153 | } |
| 65 | 154 | ||
| 66 | - private class popupMessageInfo { | 155 | + private class popupMessageInfo |
| 156 | + { | ||
| 67 | public String title; | 157 | public String title; |
| 68 | public String text; | 158 | public String text; |
| 69 | public String info; | 159 | public String info; |
| @@ -75,7 +165,8 @@ public class lib3270 { | @@ -75,7 +165,8 @@ public class lib3270 { | ||
| 75 | } | 165 | } |
| 76 | } | 166 | } |
| 77 | 167 | ||
| 78 | - private class byteMessage { | 168 | + private class byteMessage |
| 169 | + { | ||
| 79 | byte[] msg; | 170 | byte[] msg; |
| 80 | int sz; | 171 | int sz; |
| 81 | 172 | ||
| @@ -93,14 +184,17 @@ public class lib3270 { | @@ -93,14 +184,17 @@ public class lib3270 { | ||
| 93 | } | 184 | } |
| 94 | } | 185 | } |
| 95 | 186 | ||
| 96 | - protected int send_data(byte[] data, int len) { | 187 | + protected int send_data(byte[] data, int len) |
| 188 | + { | ||
| 97 | Log.i(TAG, "Bytes a enviar: " + len); | 189 | Log.i(TAG, "Bytes a enviar: " + len); |
| 98 | 190 | ||
| 99 | try { | 191 | try { |
| 100 | outData.write(data, 0, len); | 192 | outData.write(data, 0, len); |
| 101 | outData.flush(); | 193 | outData.flush(); |
| 102 | return len; | 194 | return len; |
| 103 | - } catch (Exception e) { | 195 | + } |
| 196 | + catch (Exception e) | ||
| 197 | + { | ||
| 104 | String msg = e.getLocalizedMessage(); | 198 | String msg = e.getLocalizedMessage(); |
| 105 | 199 | ||
| 106 | if (msg == null) | 200 | if (msg == null) |
| @@ -111,23 +205,17 @@ public class lib3270 { | @@ -111,23 +205,17 @@ public class lib3270 { | ||
| 111 | 205 | ||
| 112 | Log.i(TAG, "Erro ao enviar dados: " + msg); | 206 | Log.i(TAG, "Erro ao enviar dados: " + msg); |
| 113 | 207 | ||
| 114 | - postPopup(0, "Erro na comunicação", | ||
| 115 | - "Não foi possível enviar dados", msg); | 208 | + postPopup(0, "Erro na comunicação", "Não foi possível enviar dados", msg); |
| 116 | 209 | ||
| 117 | } | 210 | } |
| 118 | return -1; | 211 | return -1; |
| 119 | } | 212 | } |
| 120 | 213 | ||
| 121 | // Main Thread | 214 | // Main Thread |
| 122 | - private class NetworkThread extends Thread { | ||
| 123 | - Handler mHandler; | ||
| 124 | - Socket sock = null; | ||
| 125 | - | ||
| 126 | - NetworkThread(Handler h) { | ||
| 127 | - mHandler = h; | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - private boolean connect() { | 215 | + private class NetworkThread extends Thread |
| 216 | + { | ||
| 217 | + private boolean connect() | ||
| 218 | + { | ||
| 131 | // Connecta no host | 219 | // Connecta no host |
| 132 | SocketFactory socketFactory; | 220 | SocketFactory socketFactory; |
| 133 | 221 | ||
| @@ -148,7 +236,9 @@ public class lib3270 { | @@ -148,7 +236,9 @@ public class lib3270 { | ||
| 148 | outData = new DataOutputStream(sock.getOutputStream()); | 236 | outData = new DataOutputStream(sock.getOutputStream()); |
| 149 | inData = new DataInputStream(sock.getInputStream()); | 237 | inData = new DataInputStream(sock.getInputStream()); |
| 150 | 238 | ||
| 151 | - } catch (Exception e) { | 239 | + } |
| 240 | + catch (Exception e) | ||
| 241 | + { | ||
| 152 | String msg = e.getLocalizedMessage(); | 242 | String msg = e.getLocalizedMessage(); |
| 153 | 243 | ||
| 154 | if (msg == null) | 244 | if (msg == null) |
| @@ -159,8 +249,7 @@ public class lib3270 { | @@ -159,8 +249,7 @@ public class lib3270 { | ||
| 159 | 249 | ||
| 160 | Log.i(TAG, "Erro ao conectar: " + msg); | 250 | Log.i(TAG, "Erro ao conectar: " + msg); |
| 161 | 251 | ||
| 162 | - postPopup(0, "Erro na conexão", "Não foi possível conectar", | ||
| 163 | - msg); | 252 | + postPopup(0, "Erro na conexão", "Não foi possível conectar", msg); |
| 164 | 253 | ||
| 165 | postMessage(0, 0, 0); | 254 | postMessage(0, 0, 0); |
| 166 | 255 | ||
| @@ -172,15 +261,18 @@ public class lib3270 { | @@ -172,15 +261,18 @@ public class lib3270 { | ||
| 172 | 261 | ||
| 173 | } | 262 | } |
| 174 | 263 | ||
| 175 | - public void run() { | 264 | + public void run() |
| 265 | + { | ||
| 176 | 266 | ||
| 177 | info(TAG, "Network thread started"); | 267 | info(TAG, "Network thread started"); |
| 178 | connected = connect(); | 268 | connected = connect(); |
| 179 | 269 | ||
| 180 | - if (connected) { | 270 | + if (connected) |
| 271 | + { | ||
| 181 | postMessage(0, 0, 0); | 272 | postMessage(0, 0, 0); |
| 182 | 273 | ||
| 183 | - while (connected) { | 274 | + while (connected) |
| 275 | + { | ||
| 184 | byte[] in = new byte[4096]; | 276 | byte[] in = new byte[4096]; |
| 185 | int sz = -1; | 277 | int sz = -1; |
| 186 | 278 | ||
| @@ -202,10 +294,13 @@ public class lib3270 { | @@ -202,10 +294,13 @@ public class lib3270 { | ||
| 202 | } | 294 | } |
| 203 | } | 295 | } |
| 204 | 296 | ||
| 205 | - try { | 297 | + Log.v(TAG, "Exiting communication thread"); |
| 298 | + | ||
| 299 | + try | ||
| 300 | + { | ||
| 206 | sock.close(); | 301 | sock.close(); |
| 207 | - } catch (Exception e) { | ||
| 208 | } | 302 | } |
| 303 | + catch (Exception e) { } | ||
| 209 | 304 | ||
| 210 | sock = null; | 305 | sock = null; |
| 211 | outData = null; | 306 | outData = null; |
| @@ -217,15 +312,19 @@ public class lib3270 { | @@ -217,15 +312,19 @@ public class lib3270 { | ||
| 217 | info(TAG, "Network thread stopped"); | 312 | info(TAG, "Network thread stopped"); |
| 218 | } | 313 | } |
| 219 | 314 | ||
| 220 | - public void postMessage(int what, int arg1, int arg2) { | 315 | + /* |
| 316 | + public void postMessage(int what, int arg1, int arg2) | ||
| 317 | + { | ||
| 221 | Message msg = mHandler.obtainMessage(); | 318 | Message msg = mHandler.obtainMessage(); |
| 222 | msg.what = what; | 319 | msg.what = what; |
| 223 | msg.arg1 = arg1; | 320 | msg.arg1 = arg1; |
| 224 | msg.arg2 = arg2; | 321 | msg.arg2 = arg2; |
| 225 | mHandler.sendMessage(msg); | 322 | mHandler.sendMessage(msg); |
| 226 | } | 323 | } |
| 324 | + */ | ||
| 227 | 325 | ||
| 228 | - public void postPopup(int type, String title, String text, String info) { | 326 | + public void postPopup(int type, String title, String text, String info) |
| 327 | + { | ||
| 229 | Message msg = mHandler.obtainMessage(); | 328 | Message msg = mHandler.obtainMessage(); |
| 230 | 329 | ||
| 231 | msg.what = 3; | 330 | msg.what = 3; |
| @@ -236,11 +335,17 @@ public class lib3270 { | @@ -236,11 +335,17 @@ public class lib3270 { | ||
| 236 | 335 | ||
| 237 | } | 336 | } |
| 238 | 337 | ||
| 239 | - public void postMessage(int what, int arg1, int arg2) { | ||
| 240 | - mainloop.postMessage(what, arg1, arg2); | 338 | + public void postMessage(int what, int arg1, int arg2) |
| 339 | + { | ||
| 340 | + Message msg = mHandler.obtainMessage(); | ||
| 341 | + msg.what = what; | ||
| 342 | + msg.arg1 = arg1; | ||
| 343 | + msg.arg2 = arg2; | ||
| 344 | + mHandler.sendMessage(msg); | ||
| 241 | } | 345 | } |
| 242 | 346 | ||
| 243 | - public void postPopup(int type, String title, String text, String info) { | 347 | + public void postPopup(int type, String title, String text, String info) |
| 348 | + { | ||
| 244 | Log.d(TAG, "Type:" + type); | 349 | Log.d(TAG, "Type:" + type); |
| 245 | Log.d(TAG, "Title:" + title); | 350 | Log.d(TAG, "Title:" + title); |
| 246 | Log.d(TAG, "Text:" + text); | 351 | Log.d(TAG, "Text:" + text); |
| @@ -248,124 +353,109 @@ public class lib3270 { | @@ -248,124 +353,109 @@ public class lib3270 { | ||
| 248 | mainloop.postPopup(type, title, text, info); | 353 | mainloop.postPopup(type, title, text, info); |
| 249 | } | 354 | } |
| 250 | 355 | ||
| 251 | - // Define the Handler that receives messages from the thread and update the | ||
| 252 | - // progress | ||
| 253 | - final Handler handler = new Handler() { | ||
| 254 | - public void handleMessage(Message msg) { | ||
| 255 | - switch (msg.what) { | ||
| 256 | - case 0: // Connected/Disconnected | ||
| 257 | - set_connection_status(connected); | ||
| 258 | - Log.d(TAG, connected ? "Connected" : "Disconnected"); | ||
| 259 | - break; | ||
| 260 | - | ||
| 261 | - case 1: // OIA message has changed | ||
| 262 | - showProgramMessage(msg.arg1); | ||
| 263 | - break; | ||
| 264 | - | ||
| 265 | - case 2: // Screen changed | ||
| 266 | - Log.d(TAG, "Screen changed"); | ||
| 267 | - screenState = 1; | ||
| 268 | - break; | ||
| 269 | - | ||
| 270 | - case 3: // Popup | ||
| 271 | - popupMessageInfo popup = (popupMessageInfo) msg.obj; | ||
| 272 | - popupMessage(msg.arg1, popup.title, popup.text, popup.info); | ||
| 273 | - break; | ||
| 274 | - | ||
| 275 | - case 4: // erase | ||
| 276 | - if(screenState != 2) | ||
| 277 | - { | ||
| 278 | - screenState = 2; | ||
| 279 | - erase(); | ||
| 280 | - } | ||
| 281 | - break; | ||
| 282 | - | ||
| 283 | - case 5: // ctlr_done | ||
| 284 | - Log.d(TAG, "ctlr_done"); | ||
| 285 | - break; | ||
| 286 | - | ||
| 287 | - case 6: // recv_data | ||
| 288 | - procRecvdata(((byteMessage) msg.obj).getMessage(), | ||
| 289 | - ((byteMessage) msg.obj).getLength()); | ||
| 290 | - break; | ||
| 291 | - | ||
| 292 | - case 7: // ready | ||
| 293 | - hideProgressDialog(); | ||
| 294 | - break; | ||
| 295 | - | ||
| 296 | - case 8: // busy | ||
| 297 | - showProgressDialog("Aguarde..."); | ||
| 298 | - break; | ||
| 299 | - } | ||
| 300 | - } | ||
| 301 | - }; | ||
| 302 | - | ||
| 303 | /*---[ Signal methods ]--------------------------------------------------*/ | 356 | /*---[ Signal methods ]--------------------------------------------------*/ |
| 304 | 357 | ||
| 305 | - protected boolean showProgramMessage(int id) | 358 | + protected boolean showProgramMessage(int id) |
| 306 | { | 359 | { |
| 307 | - if(id == 0 && screenState != 0) | 360 | + switch(id) |
| 308 | { | 361 | { |
| 309 | - screenState = 0; | ||
| 310 | - updateScreen(); | ||
| 311 | - return true; | 362 | + case 0: // LIB3270_MESSAGE_NONE |
| 363 | + if(screenState != 0) | ||
| 364 | + { | ||
| 365 | + screenState = 0; | ||
| 366 | + updateScreen(); | ||
| 367 | + } | ||
| 368 | + break; | ||
| 369 | + | ||
| 370 | + case 4: // LIB3270_MESSAGE_DISCONNECTED | ||
| 371 | + Log.v(TAG, "Disconnected"); | ||
| 372 | + connected = false; | ||
| 373 | + erase(); | ||
| 374 | + break; | ||
| 375 | + | ||
| 376 | + case 3: // LIB3270_MESSAGE_CONNECTED | ||
| 377 | + Log.v(TAG, "Connected"); | ||
| 378 | + break; | ||
| 379 | + | ||
| 380 | + // 01 LIB3270_MESSAGE_SYSWAIT | ||
| 381 | + // 02 LIB3270_MESSAGE_TWAIT | ||
| 382 | + // 03 LIB3270_MESSAGE_CONNECTED | ||
| 383 | + // 05 LIB3270_MESSAGE_AWAITING_FIRST | ||
| 384 | + // 06 LIB3270_MESSAGE_MINUS | ||
| 385 | + // 07 LIB3270_MESSAGE_PROTECTED | ||
| 386 | + // 08 LIB3270_MESSAGE_NUMERIC | ||
| 387 | + // 09 LIB3270_MESSAGE_OVERFLOW | ||
| 388 | + // 10 LIB3270_MESSAGE_INHIBIT | ||
| 389 | + // 11 LIB3270_MESSAGE_KYBDLOCK | ||
| 390 | + // 12 LIB3270_MESSAGE_X | ||
| 391 | + // 13 LIB3270_MESSAGE_RESOLVING | ||
| 392 | + // 14 LIB3270_MESSAGE_CONNECTING | ||
| 393 | + | ||
| 394 | + default: | ||
| 395 | + return false; | ||
| 312 | } | 396 | } |
| 313 | - | ||
| 314 | - return false; | 397 | + |
| 398 | + return true; | ||
| 315 | } | 399 | } |
| 316 | 400 | ||
| 317 | - protected void popupMessage(int type, String title, String text, String info) { | 401 | + protected void popupMessage(int type, String title, String text, String info) |
| 402 | + { | ||
| 318 | } | 403 | } |
| 319 | 404 | ||
| 320 | - protected void info(String tag, String msg) { | 405 | + protected void info(String tag, String msg) |
| 406 | + { | ||
| 321 | Log.i(tag, msg); | 407 | Log.i(tag, msg); |
| 322 | } | 408 | } |
| 323 | 409 | ||
| 324 | - protected void error(String tag, String msg) { | 410 | + protected void error(String tag, String msg) |
| 411 | + { | ||
| 325 | Log.e(tag, msg); | 412 | Log.e(tag, msg); |
| 326 | } | 413 | } |
| 327 | 414 | ||
| 328 | - protected void erase() | 415 | + protected void erase() |
| 329 | { | 416 | { |
| 330 | } | 417 | } |
| 331 | 418 | ||
| 332 | protected void updateScreen() | 419 | protected void updateScreen() |
| 333 | { | 420 | { |
| 334 | } | 421 | } |
| 335 | - | ||
| 336 | - public void pfkey(int id) | 422 | + |
| 423 | + public void pfkey(int id) | ||
| 337 | { | 424 | { |
| 338 | sendPFkey(id); | 425 | sendPFkey(id); |
| 339 | } | 426 | } |
| 340 | 427 | ||
| 341 | - public void xmit() | 428 | + public void xmit() |
| 342 | { | 429 | { |
| 343 | sendEnter(); | 430 | sendEnter(); |
| 344 | } | 431 | } |
| 345 | 432 | ||
| 346 | - public void ready() | 433 | + public void ready() |
| 347 | { | 434 | { |
| 348 | postMessage(7, 0, 0); | 435 | postMessage(7, 0, 0); |
| 349 | } | 436 | } |
| 350 | 437 | ||
| 351 | - public void busy() | 438 | + public void busy() |
| 352 | { | 439 | { |
| 353 | postMessage(8, 0, 0); | 440 | postMessage(8, 0, 0); |
| 354 | } | 441 | } |
| 355 | 442 | ||
| 356 | - public void hideProgressDialog() | 443 | + public void hideProgressDialog() |
| 357 | { | 444 | { |
| 358 | } | 445 | } |
| 359 | 446 | ||
| 360 | - public void showProgressDialog(String msg) { | 447 | + public void showProgressDialog(String msg) |
| 448 | + { | ||
| 361 | } | 449 | } |
| 362 | 450 | ||
| 363 | /*---[ External methods ]------------------------------------------------*/ | 451 | /*---[ External methods ]------------------------------------------------*/ |
| 364 | 452 | ||
| 365 | - public int connect() { | ||
| 366 | - if (mainloop == null) { | 453 | + public int connect() |
| 454 | + { | ||
| 455 | + if (mainloop == null) | ||
| 456 | + { | ||
| 367 | info(TAG, "Starting comm thread"); | 457 | info(TAG, "Starting comm thread"); |
| 368 | - mainloop = new NetworkThread(handler); | 458 | + mainloop = new NetworkThread(); |
| 369 | mainloop.start(); | 459 | mainloop.start(); |
| 370 | return 0; | 460 | return 0; |
| 371 | } | 461 | } |
| @@ -373,12 +463,25 @@ public class lib3270 { | @@ -373,12 +463,25 @@ public class lib3270 { | ||
| 373 | return -1; | 463 | return -1; |
| 374 | } | 464 | } |
| 375 | 465 | ||
| 376 | - public int disconnect() { | 466 | + public int disconnect() |
| 467 | + { | ||
| 468 | + Log.v(TAG, "Disconnecting"); | ||
| 377 | connected = false; | 469 | connected = false; |
| 470 | + | ||
| 471 | + if(sock != null) | ||
| 472 | + { | ||
| 473 | + try | ||
| 474 | + { | ||
| 475 | + sock.shutdownInput(); | ||
| 476 | + sock.shutdownOutput(); | ||
| 477 | + } catch(Exception e) { } | ||
| 478 | + } | ||
| 479 | + | ||
| 378 | return 0; | 480 | return 0; |
| 379 | } | 481 | } |
| 380 | 482 | ||
| 381 | - public void setStringAt(int offset, String str) { | 483 | + public void setStringAt(int offset, String str) |
| 484 | + { | ||
| 382 | refresh = false; | 485 | refresh = false; |
| 383 | try { | 486 | try { |
| 384 | setTextAt(offset, str.getBytes(getEncoding()), str.length()); | 487 | setTextAt(offset, str.getBytes(getEncoding()), str.length()); |
src/include/lib3270/session.h
| @@ -69,6 +69,10 @@ | @@ -69,6 +69,10 @@ | ||
| 69 | #define SSL void | 69 | #define SSL void |
| 70 | #endif // !HEADER_SSL_H | 70 | #endif // !HEADER_SSL_H |
| 71 | 71 | ||
| 72 | +#ifndef LIB3270_TA | ||
| 73 | + #define LIB3270_TA void | ||
| 74 | +#endif // !LIB3270_TA | ||
| 75 | + | ||
| 72 | struct _h3270 | 76 | struct _h3270 |
| 73 | { | 77 | { |
| 74 | unsigned short sz; /**< Struct size */ | 78 | unsigned short sz; /**< Struct size */ |
| @@ -245,6 +249,8 @@ | @@ -245,6 +249,8 @@ | ||
| 245 | unsigned char aid; /**< current attention ID */ | 249 | unsigned char aid; /**< current attention ID */ |
| 246 | void * unlock_id; | 250 | void * unlock_id; |
| 247 | time_t unlock_delay_time; | 251 | time_t unlock_delay_time; |
| 252 | + LIB3270_TA * ta_head; | ||
| 253 | + LIB3270_TA * ta_tail; | ||
| 248 | 254 | ||
| 249 | // Widget info | 255 | // Widget info |
| 250 | void * widget; | 256 | void * widget; |
src/lib3270/kybd.c
| @@ -35,6 +35,10 @@ | @@ -35,6 +35,10 @@ | ||
| 35 | * This module handles the keyboard for the 3270 emulator. | 35 | * This module handles the keyboard for the 3270 emulator. |
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | +struct ta; | ||
| 39 | + | ||
| 40 | +#define LIB3270_TA struct ta | ||
| 41 | + | ||
| 38 | #include "globals.h" | 42 | #include "globals.h" |
| 39 | 43 | ||
| 40 | #ifndef ANDROID | 44 | #ifndef ANDROID |
| @@ -153,7 +157,7 @@ static int n_composites = 0; | @@ -153,7 +157,7 @@ static int n_composites = 0; | ||
| 153 | #define ak_eq(k1, k2) (((k1).keysym == (k2).keysym) && \ | 157 | #define ak_eq(k1, k2) (((k1).keysym == (k2).keysym) && \ |
| 154 | ((k1).keytype == (k2).keytype)) | 158 | ((k1).keytype == (k2).keytype)) |
| 155 | 159 | ||
| 156 | -static struct ta | 160 | +struct ta |
| 157 | { | 161 | { |
| 158 | struct ta *next; | 162 | struct ta *next; |
| 159 | 163 | ||
| @@ -164,12 +168,15 @@ static struct ta | @@ -164,12 +168,15 @@ static struct ta | ||
| 164 | TA_TYPE_USER | 168 | TA_TYPE_USER |
| 165 | } type; | 169 | } type; |
| 166 | 170 | ||
| 167 | - H3270 * session; | ||
| 168 | void (*fn)(H3270 *, const char *, const char *); | 171 | void (*fn)(H3270 *, const char *, const char *); |
| 169 | char *parm[2]; | 172 | char *parm[2]; |
| 170 | unsigned char aid_code; | 173 | unsigned char aid_code; |
| 171 | -} *ta_head = (struct ta *) NULL, | 174 | +}; |
| 175 | + | ||
| 176 | +/* | ||
| 177 | +*ta_head = (struct ta *) NULL, | ||
| 172 | *ta_tail = (struct ta *) NULL; | 178 | *ta_tail = (struct ta *) NULL; |
| 179 | +*/ | ||
| 173 | 180 | ||
| 174 | 181 | ||
| 175 | #if defined(DEBUG) || defined(ANDROID) | 182 | #if defined(DEBUG) || defined(ANDROID) |
| @@ -238,16 +245,16 @@ static int enq_chk(H3270 *session) | @@ -238,16 +245,16 @@ static int enq_chk(H3270 *session) | ||
| 238 | 245 | ||
| 239 | trace("Adding key %02x on queue",(int) aid_code); | 246 | trace("Adding key %02x on queue",(int) aid_code); |
| 240 | 247 | ||
| 241 | - if (ta_head) | 248 | + if (session->ta_head) |
| 242 | { | 249 | { |
| 243 | - ta_tail->next = ta; | 250 | + session->ta_tail->next = ta; |
| 244 | } | 251 | } |
| 245 | else | 252 | else |
| 246 | { | 253 | { |
| 247 | - ta_head = ta; | 254 | + session->ta_head = ta; |
| 248 | status_typeahead(session,True); | 255 | status_typeahead(session,True); |
| 249 | } | 256 | } |
| 250 | - ta_tail = ta; | 257 | + session->ta_tail = ta; |
| 251 | 258 | ||
| 252 | trace_event(" Key-aid queued (kybdlock 0x%x)\n", session->kybdlock); | 259 | trace_event(" Key-aid queued (kybdlock 0x%x)\n", session->kybdlock); |
| 253 | } | 260 | } |
| @@ -271,7 +278,6 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | @@ -271,7 +278,6 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | ||
| 271 | return; | 278 | return; |
| 272 | 279 | ||
| 273 | ta = (struct ta *) lib3270_malloc(sizeof(*ta)); | 280 | ta = (struct ta *) lib3270_malloc(sizeof(*ta)); |
| 274 | - ta->session = hSession; | ||
| 275 | ta->next = (struct ta *) NULL; | 281 | ta->next = (struct ta *) NULL; |
| 276 | ta->type = TA_TYPE_DEFAULT; | 282 | ta->type = TA_TYPE_DEFAULT; |
| 277 | ta->fn = fn; | 283 | ta->fn = fn; |
| @@ -282,16 +288,16 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | @@ -282,16 +288,16 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char | ||
| 282 | if (parm2) | 288 | if (parm2) |
| 283 | ta->parm[1] = NewString(parm2); | 289 | ta->parm[1] = NewString(parm2); |
| 284 | 290 | ||
| 285 | - if (ta_head) | 291 | + if(hSession->ta_head) |
| 286 | { | 292 | { |
| 287 | - ta_tail->next = ta; | 293 | + hSession->ta_tail->next = ta; |
| 288 | } | 294 | } |
| 289 | else | 295 | else |
| 290 | { | 296 | { |
| 291 | - ta_head = ta; | 297 | + hSession->ta_head = ta; |
| 292 | status_typeahead(hSession,True); | 298 | status_typeahead(hSession,True); |
| 293 | } | 299 | } |
| 294 | - ta_tail = ta; | 300 | + hSession->ta_tail = ta; |
| 295 | 301 | ||
| 296 | trace_event(" action queued (kybdlock 0x%x)\n", h3270.kybdlock); | 302 | trace_event(" action queued (kybdlock 0x%x)\n", h3270.kybdlock); |
| 297 | } | 303 | } |
| @@ -303,30 +309,30 @@ Boolean run_ta(void) | @@ -303,30 +309,30 @@ Boolean run_ta(void) | ||
| 303 | { | 309 | { |
| 304 | struct ta *ta; | 310 | struct ta *ta; |
| 305 | 311 | ||
| 306 | - if (h3270.kybdlock || (ta = ta_head) == (struct ta *)NULL) | 312 | + if (h3270.kybdlock || (ta = h3270.ta_head) == (struct ta *)NULL) |
| 307 | return False; | 313 | return False; |
| 308 | 314 | ||
| 309 | - if ((ta_head = ta->next) == (struct ta *)NULL) | 315 | + if ((h3270.ta_head = ta->next) == (struct ta *)NULL) |
| 310 | { | 316 | { |
| 311 | - ta_tail = (struct ta *)NULL; | 317 | + h3270.ta_tail = (struct ta *)NULL; |
| 312 | status_typeahead(&h3270,False); | 318 | status_typeahead(&h3270,False); |
| 313 | } | 319 | } |
| 314 | 320 | ||
| 315 | switch(ta->type) | 321 | switch(ta->type) |
| 316 | { | 322 | { |
| 317 | case TA_TYPE_DEFAULT: | 323 | case TA_TYPE_DEFAULT: |
| 318 | - ta->fn(ta->session,ta->parm[0],ta->parm[1]); | 324 | + ta->fn(&h3270,ta->parm[0],ta->parm[1]); |
| 319 | lib3270_free(ta->parm[0]); | 325 | lib3270_free(ta->parm[0]); |
| 320 | lib3270_free(ta->parm[1]); | 326 | lib3270_free(ta->parm[1]); |
| 321 | break; | 327 | break; |
| 322 | 328 | ||
| 323 | case TA_TYPE_KEY_AID: | 329 | case TA_TYPE_KEY_AID: |
| 324 | trace("Sending enqueued key %02x",ta->aid_code); | 330 | trace("Sending enqueued key %02x",ta->aid_code); |
| 325 | - key_AID(ta->session,ta->aid_code); | 331 | + key_AID(&h3270,ta->aid_code); |
| 326 | break; | 332 | break; |
| 327 | 333 | ||
| 328 | default: | 334 | default: |
| 329 | - popup_an_error(ta->session, _( "Unexpected type %d in typeahead queue" ), ta->type); | 335 | + popup_an_error(&h3270, _( "Unexpected type %d in typeahead queue" ), ta->type); |
| 330 | 336 | ||
| 331 | } | 337 | } |
| 332 | 338 | ||
| @@ -339,13 +345,12 @@ Boolean run_ta(void) | @@ -339,13 +345,12 @@ Boolean run_ta(void) | ||
| 339 | * Flush the typeahead queue. | 345 | * Flush the typeahead queue. |
| 340 | * Returns whether or not anything was flushed. | 346 | * Returns whether or not anything was flushed. |
| 341 | */ | 347 | */ |
| 342 | -static Boolean | ||
| 343 | -flush_ta(void) | 348 | +static Boolean flush_ta(void) |
| 344 | { | 349 | { |
| 345 | struct ta *ta, *next; | 350 | struct ta *ta, *next; |
| 346 | Boolean any = False; | 351 | Boolean any = False; |
| 347 | 352 | ||
| 348 | - for (ta = ta_head; ta != (struct ta *) NULL; ta = next) | 353 | + for (ta = h3270.ta_head; ta != (struct ta *) NULL; ta = next) |
| 349 | { | 354 | { |
| 350 | lib3270_free(ta->parm[0]); | 355 | lib3270_free(ta->parm[0]); |
| 351 | lib3270_free(ta->parm[1]); | 356 | lib3270_free(ta->parm[1]); |
| @@ -353,7 +358,7 @@ flush_ta(void) | @@ -353,7 +358,7 @@ flush_ta(void) | ||
| 353 | lib3270_free(ta); | 358 | lib3270_free(ta); |
| 354 | any = True; | 359 | any = True; |
| 355 | } | 360 | } |
| 356 | - ta_head = ta_tail = (struct ta *) NULL; | 361 | + h3270.ta_head = h3270.ta_tail = (struct ta *) NULL; |
| 357 | status_typeahead(&h3270,False); | 362 | status_typeahead(&h3270,False); |
| 358 | return any; | 363 | return any; |
| 359 | } | 364 | } |
| @@ -1001,316 +1006,6 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -1001,316 +1006,6 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 1001 | } | 1006 | } |
| 1002 | 1007 | ||
| 1003 | /* | 1008 | /* |
| 1004 | -#if defined(X3270_DBCS) | ||
| 1005 | -static void | ||
| 1006 | -key_WCharacter_wrapper(Widget w unused, XEvent *event unused, String *params, Cardinal *num_params unused) | ||
| 1007 | -{ | ||
| 1008 | - int code; | ||
| 1009 | - unsigned char codebuf[2]; | ||
| 1010 | - | ||
| 1011 | - code = atoi(params[0]); | ||
| 1012 | - trace_event(" %s -> Key(0x%04x)\n", | ||
| 1013 | - ia_name[(int) ia_cause], code); | ||
| 1014 | - codebuf[0] = (code >> 8) & 0xff; | ||
| 1015 | - codebuf[1] = code & 0xff; | ||
| 1016 | - (void) key_WCharacter(codebuf, NULL); | ||
| 1017 | -} | ||
| 1018 | - | ||
| 1019 | -// | ||
| 1020 | -// Input a DBCS character. | ||
| 1021 | -// Returns True if a character was stored in the buffer, False otherwise. | ||
| 1022 | -// | ||
| 1023 | -Boolean key_WCharacter(unsigned char code[], Boolean *skipped) | ||
| 1024 | -{ | ||
| 1025 | - int baddr; | ||
| 1026 | - register unsigned char fa; | ||
| 1027 | - int faddr; | ||
| 1028 | - enum dbcs_state d; | ||
| 1029 | - int xaddr; | ||
| 1030 | - Boolean done = False; | ||
| 1031 | - Boolean no_si = False; | ||
| 1032 | - extern unsigned char reply_mode; // XXX | ||
| 1033 | - | ||
| 1034 | - reset_idle_timer(); | ||
| 1035 | - | ||
| 1036 | - if (kybdlock) { | ||
| 1037 | - char codename[64]; | ||
| 1038 | - | ||
| 1039 | - (void) sprintf(codename, "%d", (code[0] << 8) | code[1]); | ||
| 1040 | - enq_ta(key_WCharacter_wrapper, codename, CN); | ||
| 1041 | - return False; | ||
| 1042 | - } | ||
| 1043 | - | ||
| 1044 | - if (skipped != NULL) | ||
| 1045 | - *skipped = False; | ||
| 1046 | - | ||
| 1047 | - // In DBCS mode? | ||
| 1048 | - if (!dbcs) { | ||
| 1049 | - trace_event("DBCS character received when not in DBCS mode, " | ||
| 1050 | - "ignoring.\n"); | ||
| 1051 | - return True; | ||
| 1052 | - } | ||
| 1053 | - | ||
| 1054 | -#if defined(X3270_ANSI) | ||
| 1055 | - // In ANSI mode? | ||
| 1056 | - if (IN_ANSI) { | ||
| 1057 | - char mb[16]; | ||
| 1058 | - | ||
| 1059 | - dbcs_to_mb(code[0], code[1], mb); | ||
| 1060 | - net_sends(mb); | ||
| 1061 | - return True; | ||
| 1062 | - } | ||
| 1063 | -#endif | ||
| 1064 | - | ||
| 1065 | - baddr = cursor_addr; | ||
| 1066 | - fa = get_field_attribute(baddr); | ||
| 1067 | - faddr = find_field_attribute(baddr); | ||
| 1068 | - | ||
| 1069 | - // Protected? | ||
| 1070 | - if (ea_buf[baddr].fa || FA_IS_PROTECTED(fa)) { | ||
| 1071 | - operator_error(KL_OERR_PROTECTED); | ||
| 1072 | - return False; | ||
| 1073 | - } | ||
| 1074 | - | ||
| 1075 | - // Numeric? | ||
| 1076 | - if (h3270.numeric_lock && FA_IS_NUMERIC(fa)) { | ||
| 1077 | - operator_error(KL_OERR_NUMERIC); | ||
| 1078 | - return False; | ||
| 1079 | - } | ||
| 1080 | - | ||
| 1081 | - // | ||
| 1082 | - // Figure our what to do based on the DBCS state of the buffer. | ||
| 1083 | - // Leaves baddr pointing to the next unmodified position. | ||
| 1084 | - // | ||
| 1085 | -retry: | ||
| 1086 | - switch (d = ctlr_dbcs_state(baddr)) { | ||
| 1087 | - case DBCS_RIGHT: | ||
| 1088 | - case DBCS_RIGHT_WRAP: | ||
| 1089 | - // Back up one position and process it as a LEFT. | ||
| 1090 | - DEC_BA(baddr); | ||
| 1091 | - // fall through... | ||
| 1092 | - case DBCS_LEFT: | ||
| 1093 | - case DBCS_LEFT_WRAP: | ||
| 1094 | - // Overwrite the existing character. | ||
| 1095 | - if (insert) { | ||
| 1096 | - if (!ins_prep(faddr, baddr, 2)) { | ||
| 1097 | - return False; | ||
| 1098 | - } | ||
| 1099 | - } | ||
| 1100 | - ctlr_add(baddr, code[0], ea_buf[baddr].cs); | ||
| 1101 | - INC_BA(baddr); | ||
| 1102 | - ctlr_add(baddr, code[1], ea_buf[baddr].cs); | ||
| 1103 | - INC_BA(baddr); | ||
| 1104 | - done = True; | ||
| 1105 | - break; | ||
| 1106 | - case DBCS_SB: | ||
| 1107 | - // Back up one position and process it as an SI. | ||
| 1108 | - DEC_BA(baddr); | ||
| 1109 | - // fall through... | ||
| 1110 | - case DBCS_SI: | ||
| 1111 | - // Extend the subfield to the right. | ||
| 1112 | - if (insert) { | ||
| 1113 | - if (!ins_prep(faddr, baddr, 2)) { | ||
| 1114 | - return False; | ||
| 1115 | - } | ||
| 1116 | - } else { | ||
| 1117 | - // Don't overwrite a field attribute or an SO. | ||
| 1118 | - xaddr = baddr; | ||
| 1119 | - INC_BA(xaddr); // C1 | ||
| 1120 | - if (ea_buf[xaddr].fa) | ||
| 1121 | - break; | ||
| 1122 | - if (ea_buf[xaddr].cc == EBC_so) | ||
| 1123 | - no_si = True; | ||
| 1124 | - INC_BA(xaddr); // SI | ||
| 1125 | - if (ea_buf[xaddr].fa || ea_buf[xaddr].cc == EBC_so) | ||
| 1126 | - break; | ||
| 1127 | - } | ||
| 1128 | - ctlr_add(baddr, code[0], ea_buf[baddr].cs); | ||
| 1129 | - INC_BA(baddr); | ||
| 1130 | - ctlr_add(baddr, code[1], ea_buf[baddr].cs); | ||
| 1131 | - if (!no_si) { | ||
| 1132 | - INC_BA(baddr); | ||
| 1133 | - ctlr_add(baddr, EBC_si, ea_buf[baddr].cs); | ||
| 1134 | - } | ||
| 1135 | - done = True; | ||
| 1136 | - break; | ||
| 1137 | - case DBCS_DEAD: | ||
| 1138 | - break; | ||
| 1139 | - case DBCS_NONE: | ||
| 1140 | - if (ea_buf[faddr].ic) { | ||
| 1141 | - Boolean extend_left = FALSE; | ||
| 1142 | - | ||
| 1143 | - // Is there room? | ||
| 1144 | - if (insert) { | ||
| 1145 | - if (!ins_prep(faddr, baddr, 4)) { | ||
| 1146 | - return False; | ||
| 1147 | - } | ||
| 1148 | - } else { | ||
| 1149 | - xaddr = baddr; // baddr, SO | ||
| 1150 | - if (ea_buf[xaddr].cc == EBC_so) { | ||
| 1151 | - // | ||
| 1152 | - // (baddr), where we would have put the | ||
| 1153 | - // SO, is already an SO. Move to | ||
| 1154 | - // (baddr+1) and try again. | ||
| 1155 | - // | ||
| 1156 | -#if defined(DBCS_RIGHT_DEBUG) | ||
| 1157 | - printf("SO in position 0\n"); | ||
| 1158 | -#endif | ||
| 1159 | - INC_BA(baddr); | ||
| 1160 | - goto retry; | ||
| 1161 | - } | ||
| 1162 | - | ||
| 1163 | - INC_BA(xaddr); // baddr+1, C0 | ||
| 1164 | - if (ea_buf[xaddr].fa) | ||
| 1165 | - break; | ||
| 1166 | - if (ea_buf[xaddr].cc == EBC_so) { | ||
| 1167 | - enum dbcs_state e; | ||
| 1168 | - | ||
| 1169 | - // | ||
| 1170 | - // (baddr+1), where we would have put | ||
| 1171 | - // the left side of the DBCS, is a SO. | ||
| 1172 | - // If there's room, we can extend the | ||
| 1173 | - // subfield to the left. If not, we're | ||
| 1174 | - // stuck. | ||
| 1175 | - // | ||
| 1176 | - DEC_BA(xaddr); | ||
| 1177 | - DEC_BA(xaddr); | ||
| 1178 | - e = ctlr_dbcs_state(xaddr); | ||
| 1179 | - if (e == DBCS_NONE || e == DBCS_SB) { | ||
| 1180 | - extend_left = True; | ||
| 1181 | - no_si = True; | ||
| 1182 | -#if defined(DBCS_RIGHT_DEBUG) | ||
| 1183 | - printf("SO in position 1, " | ||
| 1184 | - "extend left\n"); | ||
| 1185 | -#endif | ||
| 1186 | - } else { | ||
| 1187 | - // | ||
| 1188 | - // Won't actually happen, | ||
| 1189 | - // because this implies that | ||
| 1190 | - // the buffer addr at baddr | ||
| 1191 | - // is an SB. | ||
| 1192 | - // | ||
| 1193 | -#if defined(DBCS_RIGHT_DEBUG) | ||
| 1194 | - printf("SO in position 1, " | ||
| 1195 | - "no room on left, " | ||
| 1196 | - "fail\n"); | ||
| 1197 | -#endif | ||
| 1198 | - break; | ||
| 1199 | - } | ||
| 1200 | - } | ||
| 1201 | - | ||
| 1202 | - INC_BA(xaddr); // baddr+2, C1 | ||
| 1203 | - if (ea_buf[xaddr].fa) | ||
| 1204 | - break; | ||
| 1205 | - if (ea_buf[xaddr].cc == EBC_so) { | ||
| 1206 | - // | ||
| 1207 | - // (baddr+2), where we want to put the | ||
| 1208 | - // right half of the DBCS character, is | ||
| 1209 | - // a SO. This is a natural extension | ||
| 1210 | - // to the left -- just make sure we | ||
| 1211 | - // don't write an SI. | ||
| 1212 | - // | ||
| 1213 | - no_si = True; | ||
| 1214 | -#if defined(DBCS_RIGHT_DEBUG) | ||
| 1215 | - printf("SO in position 2, no SI\n"); | ||
| 1216 | -#endif | ||
| 1217 | - } | ||
| 1218 | - | ||
| 1219 | - // | ||
| 1220 | - // Check the fourth position only if we're | ||
| 1221 | - // not doing an extend-left. | ||
| 1222 | - /// | ||
| 1223 | - if (!no_si) { | ||
| 1224 | - INC_BA(xaddr); // baddr+3, SI | ||
| 1225 | - if (ea_buf[xaddr].fa) | ||
| 1226 | - break; | ||
| 1227 | - if (ea_buf[xaddr].cc == EBC_so) { | ||
| 1228 | - // | ||
| 1229 | - // (baddr+3), where we want to | ||
| 1230 | - // put an | ||
| 1231 | - // SI, is an SO. Forget it. | ||
| 1232 | - // | ||
| 1233 | -#if defined(DBCS_RIGHT_DEBUG) | ||
| 1234 | - printf("SO in position 3, " | ||
| 1235 | - "retry right\n"); | ||
| 1236 | - INC_BA(baddr); | ||
| 1237 | - goto retry; | ||
| 1238 | -#endif | ||
| 1239 | - break; | ||
| 1240 | - } | ||
| 1241 | - } | ||
| 1242 | - } | ||
| 1243 | - // Yes, add it. | ||
| 1244 | - if (extend_left) | ||
| 1245 | - DEC_BA(baddr); | ||
| 1246 | - ctlr_add(baddr, EBC_so, ea_buf[baddr].cs); | ||
| 1247 | - INC_BA(baddr); | ||
| 1248 | - ctlr_add(baddr, code[0], ea_buf[baddr].cs); | ||
| 1249 | - INC_BA(baddr); | ||
| 1250 | - ctlr_add(baddr, code[1], ea_buf[baddr].cs); | ||
| 1251 | - if (!no_si) { | ||
| 1252 | - INC_BA(baddr); | ||
| 1253 | - ctlr_add(baddr, EBC_si, ea_buf[baddr].cs); | ||
| 1254 | - } | ||
| 1255 | - done = True; | ||
| 1256 | - } else if (reply_mode == SF_SRM_CHAR) { | ||
| 1257 | - // Use the character attribute. | ||
| 1258 | - if (insert) { | ||
| 1259 | - if (!ins_prep(faddr, baddr, 2)) { | ||
| 1260 | - return False; | ||
| 1261 | - } | ||
| 1262 | - } else { | ||
| 1263 | - xaddr = baddr; | ||
| 1264 | - INC_BA(xaddr); | ||
| 1265 | - if (ea_buf[xaddr].fa) | ||
| 1266 | - break; | ||
| 1267 | - } | ||
| 1268 | - ctlr_add(baddr, code[0], CS_DBCS); | ||
| 1269 | - INC_BA(baddr); | ||
| 1270 | - ctlr_add(baddr, code[1], CS_DBCS); | ||
| 1271 | - INC_BA(baddr); | ||
| 1272 | - done = True; | ||
| 1273 | - } | ||
| 1274 | - break; | ||
| 1275 | - } | ||
| 1276 | - | ||
| 1277 | - if (done) { | ||
| 1278 | - // Implement blank fill mode. | ||
| 1279 | - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_BLANK_FILL)) { | ||
| 1280 | - xaddr = faddr; | ||
| 1281 | - INC_BA(xaddr); | ||
| 1282 | - while (xaddr != baddr) { | ||
| 1283 | - if (ea_buf[xaddr].cc == EBC_null) | ||
| 1284 | - ctlr_add(xaddr, EBC_space, CS_BASE); | ||
| 1285 | - else | ||
| 1286 | - break; | ||
| 1287 | - INC_BA(xaddr); | ||
| 1288 | - } | ||
| 1289 | - } | ||
| 1290 | - | ||
| 1291 | - mdt_set(cursor_addr); | ||
| 1292 | - | ||
| 1293 | - // Implement auto-skip. | ||
| 1294 | - while (ea_buf[baddr].fa) { | ||
| 1295 | - if (skipped != NULL) | ||
| 1296 | - *skipped = True; | ||
| 1297 | - if (FA_IS_SKIP(ea_buf[baddr].fa)) | ||
| 1298 | - baddr = next_unprotected(&h3270,baddr); | ||
| 1299 | - else | ||
| 1300 | - INC_BA(baddr); | ||
| 1301 | - } | ||
| 1302 | - cursor_move(baddr); | ||
| 1303 | - (void) ctlr_dbcs_postprocess(); | ||
| 1304 | - return True; | ||
| 1305 | - } else { | ||
| 1306 | - operator_error(KL_OERR_DBCS); | ||
| 1307 | - return False; | ||
| 1308 | - } | ||
| 1309 | -} | ||
| 1310 | -#endif | ||
| 1311 | -*/ | ||
| 1312 | - | ||
| 1313 | -/* | ||
| 1314 | * Handle an ordinary character key, given an ASCII code. | 1009 | * Handle an ordinary character key, given an ASCII code. |
| 1315 | */ | 1010 | */ |
| 1316 | void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped) | 1011 | void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped) |
| @@ -1341,59 +1036,6 @@ void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Bo | @@ -1341,59 +1036,6 @@ void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Bo | ||
| 1341 | } | 1036 | } |
| 1342 | } | 1037 | } |
| 1343 | 1038 | ||
| 1344 | - | ||
| 1345 | -/* | ||
| 1346 | - * Simple toggles. | ||
| 1347 | - */ | ||
| 1348 | -/* | ||
| 1349 | -#if defined(X3270_DISPLAY) | ||
| 1350 | -void | ||
| 1351 | -AltCursor_action(Widget w unused, XEvent *event, String *params, | ||
| 1352 | - Cardinal *num_params) | ||
| 1353 | -{ | ||
| 1354 | - reset_idle_timer(); | ||
| 1355 | - do_toggle(ALT_CURSOR); | ||
| 1356 | -} | ||
| 1357 | -#endif | ||
| 1358 | -*/ | ||
| 1359 | - | ||
| 1360 | -/* | ||
| 1361 | -void | ||
| 1362 | -MonoCase_action(Widget w unused, XEvent *event, String *params, | ||
| 1363 | - Cardinal *num_params) | ||
| 1364 | -{ | ||
| 1365 | - reset_idle_timer(); | ||
| 1366 | - do_toggle(MONOCASE); | ||
| 1367 | -} | ||
| 1368 | -*/ | ||
| 1369 | - | ||
| 1370 | -/* | ||
| 1371 | - * Flip the display left-to-right | ||
| 1372 | - */ | ||
| 1373 | - /* | ||
| 1374 | -void | ||
| 1375 | -Flip_action(Widget w unused, XEvent *event, String *params, | ||
| 1376 | - Cardinal *num_params) | ||
| 1377 | -{ | ||
| 1378 | - | ||
| 1379 | -// reset_idle_timer(); | ||
| 1380 | - | ||
| 1381 | - screen_flip(); | ||
| 1382 | -} | ||
| 1383 | -*/ | ||
| 1384 | - | ||
| 1385 | - | ||
| 1386 | -/* | ||
| 1387 | - * Tab forward to next field. | ||
| 1388 | - */ | ||
| 1389 | -/* | ||
| 1390 | -void | ||
| 1391 | -Tab_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | ||
| 1392 | -{ | ||
| 1393 | - action_NextField(); | ||
| 1394 | -} | ||
| 1395 | -*/ | ||
| 1396 | - | ||
| 1397 | LIB3270_ACTION( nextfield ) | 1039 | LIB3270_ACTION( nextfield ) |
| 1398 | { | 1040 | { |
| 1399 | 1041 | ||
| @@ -1612,13 +1254,6 @@ do_left(void) | @@ -1612,13 +1254,6 @@ do_left(void) | ||
| 1612 | cursor_move(&h3270,baddr); | 1254 | cursor_move(&h3270,baddr); |
| 1613 | } | 1255 | } |
| 1614 | 1256 | ||
| 1615 | -/* | ||
| 1616 | -void Left_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | ||
| 1617 | -{ | ||
| 1618 | - action_CursorLeft(); | ||
| 1619 | -} | ||
| 1620 | -*/ | ||
| 1621 | - | ||
| 1622 | LIB3270_CURSOR_ACTION( left ) | 1257 | LIB3270_CURSOR_ACTION( left ) |
| 1623 | { | 1258 | { |
| 1624 | if (hSession->kybdlock) | 1259 | if (hSession->kybdlock) |
| @@ -2323,116 +1958,6 @@ LIB3270_ACTION( clear ) | @@ -2323,116 +1958,6 @@ LIB3270_ACTION( clear ) | ||
| 2323 | return 0; | 1958 | return 0; |
| 2324 | } | 1959 | } |
| 2325 | 1960 | ||
| 2326 | - | ||
| 2327 | -/* | ||
| 2328 | - * Cursor Select key (light pen simulator). | ||
| 2329 | - */ | ||
| 2330 | - /* | ||
| 2331 | -static void | ||
| 2332 | -lightpen_select(int baddr) | ||
| 2333 | -{ | ||
| 2334 | - int faddr; | ||
| 2335 | - register unsigned char fa; | ||
| 2336 | - int designator; | ||
| 2337 | -#if defined(X3270_DBCS) | ||
| 2338 | - int designator2; | ||
| 2339 | -#endif | ||
| 2340 | - | ||
| 2341 | - faddr = find_field_attribute(baddr); | ||
| 2342 | - fa = ea_buf[faddr].fa; | ||
| 2343 | - if (!FA_IS_SELECTABLE(fa)) { | ||
| 2344 | - lib3270_ring_bell(); | ||
| 2345 | - return; | ||
| 2346 | - } | ||
| 2347 | - designator = faddr; | ||
| 2348 | - INC_BA(designator); | ||
| 2349 | - | ||
| 2350 | -#if defined(X3270_DBCS) | ||
| 2351 | - if (dbcs) { | ||
| 2352 | - if (ea_buf[baddr].cs == CS_DBCS) { | ||
| 2353 | - designator2 = designator; | ||
| 2354 | - INC_BA(designator2); | ||
| 2355 | - if ((ea_buf[designator].db != DBCS_LEFT && | ||
| 2356 | - ea_buf[designator].db != DBCS_LEFT_WRAP) && | ||
| 2357 | - (ea_buf[designator2].db != DBCS_RIGHT && | ||
| 2358 | - ea_buf[designator2].db != DBCS_RIGHT_WRAP)) { | ||
| 2359 | - lib3270_ring_bell(); | ||
| 2360 | - return; | ||
| 2361 | - } | ||
| 2362 | - if (ea_buf[designator].cc == 0x42 && | ||
| 2363 | - ea_buf[designator2].cc == EBC_greater) { | ||
| 2364 | - ctlr_add(designator2, EBC_question, CS_DBCS); | ||
| 2365 | - mdt_clear(faddr); | ||
| 2366 | - } else if (ea_buf[designator].cc == 0x42 && | ||
| 2367 | - ea_buf[designator2].cc == EBC_question) { | ||
| 2368 | - ctlr_add(designator2, EBC_greater, CS_DBCS); | ||
| 2369 | - mdt_clear(faddr); | ||
| 2370 | - } else if ((ea_buf[designator].cc == EBC_space && | ||
| 2371 | - ea_buf[designator2].cc == EBC_space) || | ||
| 2372 | - (ea_buf[designator].cc == EBC_null && | ||
| 2373 | - ea_buf[designator2].cc == EBC_null)) { | ||
| 2374 | - ctlr_add(designator2, EBC_greater, CS_DBCS); | ||
| 2375 | - mdt_set(faddr); | ||
| 2376 | - key_AID(AID_SELECT); | ||
| 2377 | - } else if (ea_buf[designator].cc == 0x42 && | ||
| 2378 | - ea_buf[designator2].cc == EBC_ampersand) { | ||
| 2379 | - mdt_set(faddr); | ||
| 2380 | - key_AID(AID_ENTER); | ||
| 2381 | - } else { | ||
| 2382 | - lib3270_ring_bell(); | ||
| 2383 | - } | ||
| 2384 | - return; | ||
| 2385 | - } | ||
| 2386 | - } | ||
| 2387 | -#endif | ||
| 2388 | - | ||
| 2389 | - switch (ea_buf[designator].cc) { | ||
| 2390 | - case EBC_greater: | ||
| 2391 | - ctlr_add(designator, EBC_question, 0); | ||
| 2392 | - mdt_clear(faddr); | ||
| 2393 | - break; | ||
| 2394 | - case EBC_question: | ||
| 2395 | - ctlr_add(designator, EBC_greater, 0); | ||
| 2396 | - mdt_set(faddr); | ||
| 2397 | - break; | ||
| 2398 | - case EBC_space: | ||
| 2399 | - case EBC_null: | ||
| 2400 | - mdt_set(faddr); | ||
| 2401 | - key_AID(AID_SELECT); | ||
| 2402 | - break; | ||
| 2403 | - case EBC_ampersand: | ||
| 2404 | - mdt_set(faddr); | ||
| 2405 | - key_AID(AID_ENTER); | ||
| 2406 | - break; | ||
| 2407 | - default: | ||
| 2408 | - lib3270_ring_bell(); | ||
| 2409 | - break; | ||
| 2410 | - } | ||
| 2411 | -} | ||
| 2412 | -*/ | ||
| 2413 | - | ||
| 2414 | -/* | ||
| 2415 | - * Cursor Select key (light pen simulator) -- at the current cursor location. | ||
| 2416 | - */ | ||
| 2417 | -/* | ||
| 2418 | -void | ||
| 2419 | -CursorSelect_action(Widget w unused, XEvent *event, String *params, | ||
| 2420 | - Cardinal *num_params) | ||
| 2421 | -{ | ||
| 2422 | -// reset_idle_timer(); | ||
| 2423 | - if (kybdlock) { | ||
| 2424 | - enq_ta(CursorSelect_action, CN, CN); | ||
| 2425 | - return; | ||
| 2426 | - } | ||
| 2427 | - | ||
| 2428 | -#if defined(X3270_ANSI) | ||
| 2429 | - if (IN_ANSI) | ||
| 2430 | - return; | ||
| 2431 | -#endif | ||
| 2432 | - lightpen_select(cursor_addr); | ||
| 2433 | -} | ||
| 2434 | -*/ | ||
| 2435 | - | ||
| 2436 | /** | 1961 | /** |
| 2437 | * Erase End Of Line Key. | 1962 | * Erase End Of Line Key. |
| 2438 | * | 1963 | * |