Commit 4fb74d6cce935c813fa0bb1407d82fd663c3459e
1 parent
4b24296f
Exists in
master
and in
5 other branches
Reimplementando módulo java
Showing
4 changed files
with
257 additions
and
0 deletions
Show diff stats
configure.ac
| @@ -667,6 +667,8 @@ AC_CONFIG_FILES([ | @@ -667,6 +667,8 @@ AC_CONFIG_FILES([ | ||
| 667 | mac/pw3270.bundle | 667 | mac/pw3270.bundle |
| 668 | src/php/Makefile | 668 | src/php/Makefile |
| 669 | src/php/php3270.h | 669 | src/php/php3270.h |
| 670 | + src/java/Makefile | ||
| 671 | + | ||
| 670 | ]) | 672 | ]) |
| 671 | 673 | ||
| 672 | dnl Output the generated config.status script. | 674 | dnl Output the generated config.status script. |
| @@ -0,0 +1,133 @@ | @@ -0,0 +1,133 @@ | ||
| 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 | +# Contatos: | ||
| 22 | +# | ||
| 23 | +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
| 24 | +# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | ||
| 25 | +# | ||
| 26 | + | ||
| 27 | +PACKAGE_NAME=@PACKAGE_NAME@ | ||
| 28 | +SOURCES= | ||
| 29 | + | ||
| 30 | +#---[ Paths ]------------------------------------------------------------------ | ||
| 31 | + | ||
| 32 | +prefix=@prefix@ | ||
| 33 | +exec_prefix=@exec_prefix@ | ||
| 34 | +bindir=@bindir@ | ||
| 35 | +sbindir=@sbindir@ | ||
| 36 | +libdir=@libdir@ | ||
| 37 | +includedir=@includedir@ | ||
| 38 | +sysconfdir=@sysconfdir@ | ||
| 39 | + | ||
| 40 | +#---[ Tools ]------------------------------------------------------------------ | ||
| 41 | + | ||
| 42 | +CXX=@CXX@ | ||
| 43 | +MKDIR=@MKDIR_P@ | ||
| 44 | +INSTALL=@INSTALL@ | ||
| 45 | +INSTALL_DATA=@INSTALL_DATA@ | ||
| 46 | +INSTALL_PROGRAM=@INSTALL_PROGRAM@ | ||
| 47 | +JAVAC=@JAVAC@ | ||
| 48 | +JAVAH=@JAVAH@ | ||
| 49 | +JAR=@JAR@ | ||
| 50 | +JDK_HOME=@JDK_HOME@ | ||
| 51 | +JRE_HOME=@JRE_HOME@ | ||
| 52 | + | ||
| 53 | +#---[ Paths ]------------------------------------------------------------------ | ||
| 54 | + | ||
| 55 | +OBJDIR = .obj | ||
| 56 | +BINDIR = .bin | ||
| 57 | + | ||
| 58 | +OBJDBG = $(OBJDIR)/Debug | ||
| 59 | +BINDBG = $(BINDIR)/Debug | ||
| 60 | + | ||
| 61 | +OBJRLS = $(OBJDIR)/Release | ||
| 62 | +BINRLS = $(BINDIR)/Release | ||
| 63 | + | ||
| 64 | +#---[ lib3270 common class ]--------------------------------------------------- | ||
| 65 | + | ||
| 66 | +DEBUG_CFLAGS=-DDEBUG=1 -g -Wall | ||
| 67 | +PW3270_CFLAGS=-I../include | ||
| 68 | +CLASSLIBDIR=../classlib | ||
| 69 | +include $(CLASSLIBDIR)/class.mak | ||
| 70 | + | ||
| 71 | +#---[ Build options ]---------------------------------------------------------- | ||
| 72 | + | ||
| 73 | +CXXFLAGS=@CXXFLAGS@ @DLL_CFLAGS@ | ||
| 74 | + | ||
| 75 | +#---[ Rules ]------------------------------------------------------------------ | ||
| 76 | + | ||
| 77 | +$(OBJDBG)/%.o: %.cc Makefile jni3270.h | ||
| 78 | + @echo " CC `basename $@`" | ||
| 79 | + @mkdir -p `dirname $@` | ||
| 80 | + @$(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $< | ||
| 81 | + | ||
| 82 | +$(OBJRLS)/%.o: %.cc Makefile jni3270.h | ||
| 83 | + @echo " CC `basename $@`" | ||
| 84 | + @mkdir -p `dirname $@` | ||
| 85 | + @$(CXX) -DNDEBUG=1 $(CXXFLAGS) -o $@ -c $< | ||
| 86 | + | ||
| 87 | +$(BINDIR)/java/$(PACKAGE)/%.class: %.java | ||
| 88 | + @echo $< ... | ||
| 89 | + @mkdir -p `dirname $@` | ||
| 90 | + $(JAVAC) -encoding utf-8 -cp $(BINDIR)/java -sourcepath $(PWD) -d $(BINDIR)/java $^ | ||
| 91 | + | ||
| 92 | +#---[ Release targets ]-------------------------------------------------------- | ||
| 93 | + | ||
| 94 | +all: $(BINRLS)/jni3270@DLLEXT@ | ||
| 95 | + | ||
| 96 | +Release: $(BINRLS)/jni3270@DLLEXT@ | ||
| 97 | + | ||
| 98 | +$(BINRLS)/jni3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC)@OBJEXT@) \ | ||
| 99 | + $(CLASS_RELEASE_OBJECTS) | ||
| 100 | + @echo " LD `basename $@`" | ||
| 101 | + @$(MKDIR) `dirname $@` | ||
| 102 | + $(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) $(OO_LDFLAGS) -o $@ $^ $(CLASS_LIBS) | ||
| 103 | + | ||
| 104 | + | ||
| 105 | +#---[ Debug targets ]---------------------------------------------------------- | ||
| 106 | + | ||
| 107 | +Debug: $(BINDBG)/jni3270@DLLEXT@ | ||
| 108 | + | ||
| 109 | +$(BINDBG)/jni3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) \ | ||
| 110 | + $(CLASS_DEBUG_OBJECTS) | ||
| 111 | + @echo " LD `basename $@`" | ||
| 112 | + @$(MKDIR) `dirname $@` | ||
| 113 | + @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) $(OO_LDFLAGS) -o $@ $^ $(CLASS_LIBS) | ||
| 114 | + | ||
| 115 | + | ||
| 116 | +run: $(BINDBG)/jni3270@DLLEXT@ | ||
| 117 | + | ||
| 118 | +#---[ Misc targets ]----------------------------------------------------------- | ||
| 119 | + | ||
| 120 | +jni3270.h: $(BINDIR)/java/$(PACKAGE)/terminal.class | ||
| 121 | + @echo $< ... | ||
| 122 | + @mkdir -p `dirname $@` | ||
| 123 | + @$(JAVAH) -o $@ -classpath $(BINDIR)/java $(PACKAGE).terminal | ||
| 124 | + | ||
| 125 | + | ||
| 126 | +install: $(BINRLS)/jni3270@DLLEXT@ | ||
| 127 | + | ||
| 128 | +cleanDebug: clean | ||
| 129 | + | ||
| 130 | +clean: | ||
| 131 | + @rm -fr $(OBJDIR) | ||
| 132 | + @rm -fr $(BINDIR) | ||
| 133 | + @rm -f jni3270.h |
| @@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
| 2 | +<CodeBlocks_project_file> | ||
| 3 | + <FileVersion major="1" minor="6" /> | ||
| 4 | + <Project> | ||
| 5 | + <Option title="pw3270 Java extension" /> | ||
| 6 | + <Option makefile_is_custom="1" /> | ||
| 7 | + <Option pch_mode="2" /> | ||
| 8 | + <Option compiler="gcc" /> | ||
| 9 | + <Build> | ||
| 10 | + <Target title="Debug"> | ||
| 11 | + <Option output="jni3270" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" /> | ||
| 12 | + <Option object_output=".obj/Debug/" /> | ||
| 13 | + <Option type="3" /> | ||
| 14 | + <Option compiler="gcc" /> | ||
| 15 | + <Compiler> | ||
| 16 | + <Add option="-g" /> | ||
| 17 | + </Compiler> | ||
| 18 | + </Target> | ||
| 19 | + <Target title="Release"> | ||
| 20 | + <Option output=".bin/Release/jni3270" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" /> | ||
| 21 | + <Option object_output=".obj/Release/" /> | ||
| 22 | + <Option type="3" /> | ||
| 23 | + <Option compiler="gcc" /> | ||
| 24 | + <Compiler> | ||
| 25 | + <Add option="-O2" /> | ||
| 26 | + </Compiler> | ||
| 27 | + <Linker> | ||
| 28 | + <Add option="-s" /> | ||
| 29 | + </Linker> | ||
| 30 | + </Target> | ||
| 31 | + </Build> | ||
| 32 | + <Compiler> | ||
| 33 | + <Add option="-Wall" /> | ||
| 34 | + </Compiler> | ||
| 35 | + <Unit filename="Makefile.in" /> | ||
| 36 | + <Unit filename="jni3270.h" /> | ||
| 37 | + <Unit filename="terminal.java" /> | ||
| 38 | + <Extensions> | ||
| 39 | + <code_completion /> | ||
| 40 | + <envvars /> | ||
| 41 | + <debugger /> | ||
| 42 | + <lib_finder disable_auto="1" /> | ||
| 43 | + </Extensions> | ||
| 44 | + </Project> | ||
| 45 | +</CodeBlocks_project_file> |
| @@ -0,0 +1,77 @@ | @@ -0,0 +1,77 @@ | ||
| 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 lib3270.java 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 | +package pw3270; | ||
| 31 | + | ||
| 32 | +public class terminal | ||
| 33 | +{ | ||
| 34 | + /* Get library/extension info */ | ||
| 35 | + public native String getVersion(); | ||
| 36 | + public native String getRevision(); | ||
| 37 | + | ||
| 38 | + /* Connect/Disconnect */ | ||
| 39 | + public native int Connect( String uri, int timeout ); | ||
| 40 | + public native int Disconnect(); | ||
| 41 | + public native int getConnectionState(); | ||
| 42 | + | ||
| 43 | + /* Get Status */ | ||
| 44 | + public native boolean isConnected(); | ||
| 45 | + public native boolean isTerminalReady(); | ||
| 46 | + public native String getEncoding(); | ||
| 47 | + | ||
| 48 | + /* Get/Query Screen contents */ | ||
| 49 | + public native String getScreenContentAt(int row, int col, int size); | ||
| 50 | + public native String getScreenContent(); | ||
| 51 | + public native boolean queryStringAt(int row, int col, String key); | ||
| 52 | + | ||
| 53 | + /* Actions/Screen changes */ | ||
| 54 | + public native int sendEnterKey(); | ||
| 55 | + public native int setStringAt(int row, int col, String str); | ||
| 56 | + public native int sendPFKey(int key); | ||
| 57 | + | ||
| 58 | + /* Waiting */ | ||
| 59 | + public native int wait(int seconds); | ||
| 60 | + public native int waitForTerminalReady(int timeout); | ||
| 61 | + public native int waitForStringAt(int row, int col, String key, int timeout); | ||
| 62 | + | ||
| 63 | + /* Non-native methods */ | ||
| 64 | + public int Connect(String hostinfo) | ||
| 65 | + { | ||
| 66 | + int rc = Connect(hostinfo,10); | ||
| 67 | + if(rc != 0) | ||
| 68 | + return rc; | ||
| 69 | + return waitForTerminalReady(10); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + static | ||
| 73 | + { | ||
| 74 | + System.loadLibrary("jni3270"); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | +}; |