Commit b19edc1442575b5bddcd30f26a5dad055eb51cea
1 parent
abc6da8d
Exists in
master
and in
5 other branches
Implementando tratamento de cursor e teclado
Showing
5 changed files
with
195 additions
and
1 deletions
Show diff stats
src/java/Makefile.in
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | # | 25 | # |
26 | 26 | ||
27 | PACKAGE_NAME=@PACKAGE_NAME@ | 27 | PACKAGE_NAME=@PACKAGE_NAME@ |
28 | -SOURCES=main.cc info.cc connect.cc getset.cc | 28 | +SOURCES=main.cc info.cc connect.cc getset.cc cursor.cc keyboard.cc |
29 | 29 | ||
30 | #---[ Paths ]------------------------------------------------------------------ | 30 | #---[ Paths ]------------------------------------------------------------------ |
31 | 31 |
@@ -0,0 +1,92 @@ | @@ -0,0 +1,92 @@ | ||
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. | ||
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 cursor.cc e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | + #include "private.h" | ||
31 | + | ||
32 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | ||
33 | + | ||
34 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_set_1cursor_1position(JNIEnv *env, jobject obj, jint row, jint col) { | ||
35 | + | ||
36 | + jint rc = -1; | ||
37 | + | ||
38 | + try { | ||
39 | + | ||
40 | + rc = getHandle(env,obj)->set_cursor_position((int) row, (int) col); | ||
41 | + | ||
42 | + } catch(std::exception &e) { | ||
43 | + | ||
44 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | ||
45 | + return -1; | ||
46 | + | ||
47 | + } | ||
48 | + | ||
49 | + return rc; | ||
50 | + | ||
51 | +} | ||
52 | + | ||
53 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_set_1cursor_1addr(JNIEnv *env, jobject obj, jint addr) { | ||
54 | + | ||
55 | + jint rc = -1; | ||
56 | + | ||
57 | + try { | ||
58 | + | ||
59 | + rc = getHandle(env,obj)->set_cursor_addr((int) addr); | ||
60 | + | ||
61 | + } catch(std::exception &e) { | ||
62 | + | ||
63 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | ||
64 | + return -1; | ||
65 | + | ||
66 | + } | ||
67 | + | ||
68 | + return rc; | ||
69 | + | ||
70 | + | ||
71 | +} | ||
72 | + | ||
73 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1cursor_1addr(JNIEnv *env, jobject obj) { | ||
74 | + | ||
75 | + jint rc = -1; | ||
76 | + | ||
77 | + try { | ||
78 | + | ||
79 | + rc = getHandle(env,obj)->get_cursor_addr(); | ||
80 | + | ||
81 | + } catch(std::exception &e) { | ||
82 | + | ||
83 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | ||
84 | + return -1; | ||
85 | + | ||
86 | + } | ||
87 | + | ||
88 | + return rc; | ||
89 | + | ||
90 | +} | ||
91 | + | ||
92 | + |
src/java/jni3270.cbp
@@ -42,9 +42,11 @@ | @@ -42,9 +42,11 @@ | ||
42 | <Unit filename="../include/pw3270/class.h" /> | 42 | <Unit filename="../include/pw3270/class.h" /> |
43 | <Unit filename="Makefile.in" /> | 43 | <Unit filename="Makefile.in" /> |
44 | <Unit filename="connect.cc" /> | 44 | <Unit filename="connect.cc" /> |
45 | + <Unit filename="cursor.cc" /> | ||
45 | <Unit filename="getset.cc" /> | 46 | <Unit filename="getset.cc" /> |
46 | <Unit filename="info.cc" /> | 47 | <Unit filename="info.cc" /> |
47 | <Unit filename="jni3270.h" /> | 48 | <Unit filename="jni3270.h" /> |
49 | + <Unit filename="keyboard.cc" /> | ||
48 | <Unit filename="main.cc" /> | 50 | <Unit filename="main.cc" /> |
49 | <Unit filename="private.h" /> | 51 | <Unit filename="private.h" /> |
50 | <Unit filename="terminal.java" /> | 52 | <Unit filename="terminal.java" /> |
@@ -0,0 +1,90 @@ | @@ -0,0 +1,90 @@ | ||
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. | ||
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 keyboard.cc e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | + #include "private.h" | ||
31 | + | ||
32 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | ||
33 | + | ||
34 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_enter(JNIEnv *env, jobject obj) { | ||
35 | + | ||
36 | + jint rc = -1; | ||
37 | + | ||
38 | + try { | ||
39 | + | ||
40 | + rc = getHandle(env,obj)->enter(); | ||
41 | + | ||
42 | + } catch(std::exception &e) { | ||
43 | + | ||
44 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | ||
45 | + return -1; | ||
46 | + | ||
47 | + } | ||
48 | + | ||
49 | + return rc; | ||
50 | + | ||
51 | +} | ||
52 | + | ||
53 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_pfkey(JNIEnv *env, jobject obj, jint key) { | ||
54 | + | ||
55 | + jint rc = -1; | ||
56 | + | ||
57 | + try { | ||
58 | + | ||
59 | + rc = getHandle(env,obj)->pfkey((int) key); | ||
60 | + | ||
61 | + } catch(std::exception &e) { | ||
62 | + | ||
63 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | ||
64 | + return -1; | ||
65 | + | ||
66 | + } | ||
67 | + | ||
68 | + return rc; | ||
69 | + | ||
70 | +} | ||
71 | + | ||
72 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_pakey(JNIEnv *env, jobject obj, jint key) { | ||
73 | + | ||
74 | + jint rc = -1; | ||
75 | + | ||
76 | + try { | ||
77 | + | ||
78 | + rc = getHandle(env,obj)->pakey((int) key); | ||
79 | + | ||
80 | + } catch(std::exception &e) { | ||
81 | + | ||
82 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | ||
83 | + return -1; | ||
84 | + | ||
85 | + } | ||
86 | + | ||
87 | + return rc; | ||
88 | + | ||
89 | +} | ||
90 | + |
src/java/terminal.java
@@ -51,6 +51,16 @@ public class terminal | @@ -51,6 +51,16 @@ public class terminal | ||
51 | public native int cmp_string_at(int row, int col, String text); | 51 | public native int cmp_string_at(int row, int col, String text); |
52 | public native int input_string(String str); | 52 | public native int input_string(String str); |
53 | 53 | ||
54 | + // Cursor management | ||
55 | + public native int set_cursor_position(int row, int col); | ||
56 | + public native int set_cursor_addr(int addr); | ||
57 | + public native int get_cursor_addr(); | ||
58 | + | ||
59 | + // Keyboard actions | ||
60 | + public native int enter(); | ||
61 | + public native int pfkey(int key); | ||
62 | + public native int pakey(int key); | ||
63 | + | ||
54 | // Connect/Disconnect | 64 | // Connect/Disconnect |
55 | public native int connect(String host, int seconds); | 65 | public native int connect(String host, int seconds); |
56 | public native int disconnect(); | 66 | public native int disconnect(); |