Commit 2b54938791504a74995555232ad7db99a67e9c73
1 parent
b19edc14
Exists in
master
and in
5 other branches
Implementando jni
Showing
5 changed files
with
100 additions
and
5 deletions
Show diff stats
src/include/pw3270/class.h
| @@ -177,9 +177,9 @@ | @@ -177,9 +177,9 @@ | ||
| 177 | virtual int enter(void) = 0; | 177 | virtual int enter(void) = 0; |
| 178 | virtual int pfkey(int key) = 0; | 178 | virtual int pfkey(int key) = 0; |
| 179 | virtual int pakey(int key) = 0; | 179 | virtual int pakey(int key) = 0; |
| 180 | - virtual int quit(void) = 0; | ||
| 181 | 180 | ||
| 182 | // Actions | 181 | // Actions |
| 182 | + virtual int quit(void) = 0; | ||
| 183 | virtual int erase_eof(void) = 0; | 183 | virtual int erase_eof(void) = 0; |
| 184 | virtual int print(void) = 0; | 184 | virtual int print(void) = 0; |
| 185 | 185 |
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 cursor.cc keyboard.cc | 28 | +SOURCES=main.cc info.cc connect.cc getset.cc cursor.cc keyboard.cc actions.cc |
| 29 | 29 | ||
| 30 | #---[ Paths ]------------------------------------------------------------------ | 30 | #---[ Paths ]------------------------------------------------------------------ |
| 31 | 31 |
| @@ -0,0 +1,89 @@ | @@ -0,0 +1,89 @@ | ||
| 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 actions.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_quit(JNIEnv *env, jobject obj) { | ||
| 35 | + | ||
| 36 | + jint rc = -1; | ||
| 37 | + | ||
| 38 | + try { | ||
| 39 | + | ||
| 40 | + rc = getHandle(env,obj)->quit(); | ||
| 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_erase_1eof(JNIEnv *env, jobject obj) { | ||
| 54 | + | ||
| 55 | + jint rc = -1; | ||
| 56 | + | ||
| 57 | + try { | ||
| 58 | + | ||
| 59 | + rc = getHandle(env,obj)->erase_eof(); | ||
| 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_print(JNIEnv *env, jobject obj) { | ||
| 73 | + | ||
| 74 | + jint rc = -1; | ||
| 75 | + | ||
| 76 | + try { | ||
| 77 | + | ||
| 78 | + rc = getHandle(env,obj)->print(); | ||
| 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 | +} |
src/java/jni3270.cbp
| @@ -41,6 +41,7 @@ | @@ -41,6 +41,7 @@ | ||
| 41 | <Unit filename="../../configure.ac" /> | 41 | <Unit filename="../../configure.ac" /> |
| 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="actions.cc" /> | ||
| 44 | <Unit filename="connect.cc" /> | 45 | <Unit filename="connect.cc" /> |
| 45 | <Unit filename="cursor.cc" /> | 46 | <Unit filename="cursor.cc" /> |
| 46 | <Unit filename="getset.cc" /> | 47 | <Unit filename="getset.cc" /> |
src/java/terminal.java
| @@ -35,9 +35,9 @@ public class terminal | @@ -35,9 +35,9 @@ public class terminal | ||
| 35 | private long nativeHandle; | 35 | private long nativeHandle; |
| 36 | 36 | ||
| 37 | // Init/Deinit | 37 | // Init/Deinit |
| 38 | - private native int init(); | ||
| 39 | - private native int init(String id); | ||
| 40 | - private native int deinit(); | 38 | + private native int init(); |
| 39 | + private native int init(String id); | ||
| 40 | + private native int deinit(); | ||
| 41 | 41 | ||
| 42 | // Get library/extension info | 42 | // Get library/extension info |
| 43 | public native String get_version(); | 43 | public native String get_version(); |
| @@ -61,6 +61,11 @@ public class terminal | @@ -61,6 +61,11 @@ public class terminal | ||
| 61 | public native int pfkey(int key); | 61 | public native int pfkey(int key); |
| 62 | public native int pakey(int key); | 62 | public native int pakey(int key); |
| 63 | 63 | ||
| 64 | + // Actions | ||
| 65 | + public native int quit(); | ||
| 66 | + public native int erase_eof(); | ||
| 67 | + public native int print(); | ||
| 68 | + | ||
| 64 | // Connect/Disconnect | 69 | // Connect/Disconnect |
| 65 | public native int connect(String host, int seconds); | 70 | public native int connect(String host, int seconds); |
| 66 | public native int disconnect(); | 71 | public native int disconnect(); |