Commit b19edc1442575b5bddcd30f26a5dad055eb51cea

Authored by perry.werneck@gmail.com
1 parent abc6da8d

Implementando tratamento de cursor e teclado

src/java/Makefile.in
... ... @@ -25,7 +25,7 @@
25 25 #
26 26  
27 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 30 #---[ Paths ]------------------------------------------------------------------
31 31  
... ...
src/java/cursor.cc 0 → 100644
... ... @@ -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 42 <Unit filename="../include/pw3270/class.h" />
43 43 <Unit filename="Makefile.in" />
44 44 <Unit filename="connect.cc" />
  45 + <Unit filename="cursor.cc" />
45 46 <Unit filename="getset.cc" />
46 47 <Unit filename="info.cc" />
47 48 <Unit filename="jni3270.h" />
  49 + <Unit filename="keyboard.cc" />
48 50 <Unit filename="main.cc" />
49 51 <Unit filename="private.h" />
50 52 <Unit filename="terminal.java" />
... ...
src/java/keyboard.cc 0 → 100644
... ... @@ -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 51 public native int cmp_string_at(int row, int col, String text);
52 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 64 // Connect/Disconnect
55 65 public native int connect(String host, int seconds);
56 66 public native int disconnect();
... ...