Commit 6ac153bd2447b5570493dcf782b32e5cd0585d1c

Authored by Perry Werneck
1 parent 5a480fbe

Removendo fontes que foram movidos para projetos separados.

.gitignore
... ... @@ -27,7 +27,6 @@ aclocal.m4
27 27 configure
28 28 autom4te.cache
29 29 makegtkruntime.sh
30   -pw3270.spec
31 30 revision
32 31 revision.m4
33 32 stamp-h1
... ... @@ -35,5 +34,7 @@ marshal.c
35 34 marshal.h
36 35 fallbacks.c
37 36 version.c
  37 +config.h
  38 +mkversion.sh
38 39  
39 40  
... ...
src/java/Makefile.in
... ... @@ -1,339 +0,0 @@
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=main.cc info.cc connect.cc getset.cc cursor.cc keyboard.cc actions.cc field.cc dialog.cc clipboard.cc
29   -PLUGIN_SRC=plugin.cc startstop.cc call.cc
30   -
31   -#---[ Paths ]------------------------------------------------------------------
32   -
33   -prefix=@prefix@
34   -exec_prefix=@exec_prefix@
35   -bindir=@bindir@
36   -sbindir=@sbindir@
37   -libdir=@libdir@
38   -datadir=@datadir@
39   -includedir=@includedir@
40   -sysconfdir=@sysconfdir@
41   -jnidir=@jnidir@
42   -jvmjardir=@jvmjardir@
43   -javadocdir=@javadocdir@
44   -
45   -#---[ Tools ]------------------------------------------------------------------
46   -
47   -CXX=@CXX@
48   -MKDIR=@MKDIR_P@
49   -INSTALL=@INSTALL@
50   -INSTALL_DATA=@INSTALL_DATA@
51   -INSTALL_PROGRAM=@INSTALL_PROGRAM@
52   -JAVAC=@JAVAC@
53   -JAVAH=@JAVAH@
54   -JAR=@JAR@
55   -JAVADOC=@JAVADOC@
56   -JDK_HOME=@JDK_HOME@
57   -JRE_HOME=@JRE_HOME@
58   -JVMDIR=@JVMDIR@
59   -
60   -#---[ Paths ]------------------------------------------------------------------
61   -
62   -ROOTDIR ?= .
63   -OBJDIR ?= $(ROOTDIR)/.obj
64   -BINDIR ?= $(ROOTDIR)/.bin
65   -
66   -BINDBG ?= $(BINDIR)/Debug
67   -BINRLS ?= $(BINDIR)/Release
68   -
69   -OBJDBG ?= $(OBJDIR)/Debug
70   -OBJRLS ?= $(OBJDIR)/Release
71   -
72   -#---[ lib3270 common class ]---------------------------------------------------
73   -
74   -DEBUG_CFLAGS=-DDEBUG=1 -g -Wall
75   -CLASSLIBDIR=../classlib
76   -include $(CLASSLIBDIR)/class.mak
77   -
78   -#---[ Build options ]----------------------------------------------------------
79   -
80   -LIB3270_LIBS=@LIB3270_LIBS@
81   -PW3270_LIBS=@PW3270_LIBS@
82   -
83   -PLUGIN_CFLAGS=@CXXFLAGS@ -DPW3270_PLUGIN -Wno-deprecated-declarations @DLL_CFLAGS@ @JNI_CPPFLAGS@ -DJNIDIR="\"$(jnidir)\"" \
84   - -DJARDIR="\"$(jvmjardir)\"" @GTK_CFLAGS@ @GTKMAC_CFLAGS@ \
85   - @PW3270_CFLAGS@ @LIB3270_CFLAGS@
86   -
87   -CXXFLAGS=@CFLAGS@ @CXXFLAGS@ @DLL_CFLAGS@ @JNI_CPPFLAGS@ @PW3270_CFLAGS@
88   -
89   -
90   -PLUGIN_LIBS=@GTK_LIBS@ @GTKMAC_LIBS@ @INTL_LIBS@ @JVM_LIBS@ @PW3270_LIBS@ @LIB3270_LIBS@
91   -
92   -#---[ Rules ]------------------------------------------------------------------
93   -
94   -$(OBJDBG)/%.o: %.cc Makefile private.h jni3270.h
95   - @echo " CC `basename $@`"
96   - @mkdir -p `dirname $@`
97   - @$(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $<
98   -
99   -$(OBJDBG)/j3270/%.o: %.cc Makefile private.h
100   - @echo " CC `basename $@`"
101   - @mkdir -p `dirname $@`
102   - @$(CXX) -DDEBUG=1 $(PLUGIN_CFLAGS) -o $@ -c $<
103   -
104   -$(OBJRLS)/%.o: %.cc Makefile private.h jni3270.h
105   - @echo " CC `basename $@`"
106   - @mkdir -p `dirname $@`
107   - @$(CXX) -DNDEBUG=1 $(CXXFLAGS) -o $@ -c $<
108   -
109   -$(OBJRLS)/j3270/%.o: %.cc Makefile private.h
110   - @echo " CC `basename $@`"
111   - @mkdir -p `dirname $@`
112   - @$(CXX) -DNDEBUG=1 $(PLUGIN_CFLAGS) -o $@ -c $<
113   -
114   -$(BINDIR)/java/%.class: \
115   - %.java \
116   - $(BINDIR)/java/pw3270/terminal.class
117   -
118   - @echo $< ...
119   - @mkdir -p `dirname $@`
120   - @$(JAVAC) -encoding utf-8 -cp $(BINDIR)/java -d $(BINDIR)/java $<
121   -
122   -$(BINDIR)/java/%.class: \
123   - sample/%.java \
124   - $(BINDIR)/java/pw3270/terminal.class
125   -
126   - @echo $< ...
127   - @mkdir -p `dirname $@`
128   - @$(JAVAC) -encoding utf-8 -cp $(BINDIR)/java -d $(BINDIR)/java $<
129   -
130   -$(BINDIR)/%.class: \
131   - sample/%.java \
132   - $(BINDIR)/java/pw3270/terminal.class
133   -
134   - @echo $< ...
135   - @mkdir -p `dirname $@`
136   - @$(JAVAC) -encoding utf-8 -cp $(BINDIR)/java -d $(BINDIR)/java $<
137   -
138   -%.class: \
139   - sample/%.java \
140   - $(BINDIR)/java/pw3270/terminal.class
141   -
142   - @echo $< ...
143   - @mkdir -p `dirname $@`
144   - @$(JAVAC) -encoding utf-8 -cp $(BINDIR)/java -d `dirname $@` $<
145   -
146   -$(BINDIR)/java/pw3270/%.class: \
147   - %.java
148   -
149   - @echo $< ...
150   - @mkdir -p `dirname $@`
151   - @$(JAVAC) -encoding utf-8 -d $(BINDIR)/java $^
152   -
153   -$(BINRLS)/pw3270.jar: \
154   - $(BINDIR)/java/pw3270/terminal.class
155   -
156   - @echo $@ ...
157   - @mkdir -p `dirname $@`
158   - @$(JAR) -cvf "$@" -C "$(BINDIR)/java" "pw3270"
159   -
160   -#---[ Release targets ]--------------------------------------------------------
161   -
162   -all: \
163   - @PACKAGE_NAME@-java-@PACKAGE_VERSION@.@PACKAGE_REVISION@.@jvm_arch@.zip
164   -
165   -Release: \
166   - $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \
167   - $(BINDIR)/java/testprogram.class \
168   - $(BINRLS)/plugins/j3270@DLLEXT@
169   -
170   -zip: \
171   - jni3270-@PACKAGE_VERSION@.@PACKAGE_REVISION@.@jvm_arch@.zip
172   -
173   -@PACKAGE_NAME@-java-@PACKAGE_VERSION@.@PACKAGE_REVISION@.@jvm_arch@.zip: \
174   - $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \
175   - $(BINRLS)/plugins/j3270@DLLEXT@ \
176   - $(BINRLS)/pw3270.jar \
177   - javadoc
178   -
179   - @rm -f $@
180   -
181   - @rm -fr jvm-exports
182   - @mkdir jvm-exports
183   - @cp $(BINRLS)/pw3270.jar jvm-exports/pw3270.jar
184   - @zip -9 -m -r $@ jvm-exports
185   - @rm -fr jvm-exports
186   -
187   - @rm -fr ui
188   - @mkdir ui
189   - @cp ../../ui/*java*.xml ui
190   - @zip -9 -m -r $@ ui
191   - @rm -fr ui
192   -
193   - @rm -fr plugins
194   - @mkdir plugins
195   - @cp $(BINRLS)/plugins/j3270@DLLEXT@ plugins
196   - @zip -9 -m -r $@ plugins
197   - @rm -fr plugins
198   -
199   - @zip -9 -j $@ \
200   - $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@
201   -
202   - @zip -9 -r $@ \
203   - javadoc sample/efglobe.java sample/popup.java
204   -
205   -
206   -jni3270-@PACKAGE_VERSION@.@PACKAGE_REVISION@.@jvm_arch@.zip: \
207   - $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \
208   - $(BINRLS)/pw3270.jar \
209   - testprogram.java \
210   - javadoc \
211   - Makefile
212   -
213   - @rm -f $@
214   -
215   - @rm -fr jvm-exports
216   - @mkdir jvm-exports
217   - @cp $(BINRLS)/pw3270.jar jvm-exports/pw3270.jar
218   - @zip -9 -m -r $@ jvm-exports
219   - @rm -fr jvm-exports
220   -
221   - @rm -fr ui
222   - @mkdir ui
223   - @cp ../../ui/*java*.xml ui
224   - @zip -9 -m -r $@ ui
225   - @rm -fr ui
226   -
227   - @zip -9 -j $@ $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@
228   - @zip -9 -r $@ javadoc sample/efglobe.java sample/popup.java
229   -
230   -javadoc: terminal.java
231   - @$(JAVADOC) -encoding utf-8 -d $@ $^
232   -
233   -$(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@: \
234   - $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC)@OBJEXT@) \
235   - $(CLASS_RELEASE_OBJECTS)
236   -
237   - @echo " LD `basename $@`"
238   - @$(MKDIR) `dirname $@`
239   - @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) -Wl,-soname,`basename $@` -o $@ $^ $(CLASS_LIBS) @INTL_LIBS@
240   -
241   -$(BINRLS)/plugins/j3270@DLLEXT@: \
242   - ../../.bin/Release@DLLDIR@/lib3270@DLLEXT@ \
243   - $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/j3270/$(SRC)@OBJEXT@) \
244   - $(CLASS_RELEASE_OBJECTS)
245   -
246   - @echo " LD `basename $@`"
247   - @$(MKDIR) `dirname $@`
248   - @$(CXX) @SYSDLL_FLAGS@ \
249   - -Wl,--rpath,$(jnidir) $(LDFLAGS) -Wl,-soname,`basename $@` \
250   - -o $@ $^ \
251   - $(CLASS_LIBS) \
252   - $(PLUGIN_LIBS) \
253   - -L$(BINRLS)@DLLDIR@ -ljni3270
254   -
255   -../../.bin/Release@DLLDIR@/lib3270@DLLEXT@:
256   - make -C ../.. .bin/Release@DLLDIR@/lib3270@DLLEXT@
257   -
258   -#---[ Debug targets ]----------------------------------------------------------
259   -
260   -Debug: $(BINDBG)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \
261   - $(BINDIR)/java/testprogram.class \
262   - $(BINDBG)/plugins/j3270@DLLEXT@
263   -
264   -$(BINDBG)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@: \
265   - $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) \
266   - $(CLASS_DEBUG_OBJECTS)
267   -
268   - @echo " LD `basename $@`"
269   - @$(MKDIR) `dirname $@`
270   - @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) -Wl,-soname,`basename $@` -o $@ $^ $(CLASS_LIBS) @INTL_LIBS@
271   -
272   -$(BINDBG)/plugins/j3270@DLLEXT@: \
273   - $(BINDBG)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \
274   - $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/j3270/$(SRC)@OBJEXT@) \
275   - $(CLASS_DEBUG_OBJECTS)
276   -
277   - @echo " LD `basename $@`"
278   - @$(MKDIR) `dirname $@`
279   -
280   - @$(CXX) @SYSDLL_FLAGS@ \
281   - -Wl,--rpath,.bin/Debug@DLLDIR@ $(LDFLAGS) -Wl,-soname,`basename $@` \
282   - -o $@ $^ \
283   - $(CLASS_LIBS) \
284   - $(PLUGIN_LIBS) \
285   - -L$(BINDBG)@DLLDIR@ -ljni3270
286   -
287   -run: \
288   - $(BINDBG)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \
289   - $(BINDIR)/java/testprogram.class
290   -
291   - @LD_LIBRARY_PATH=../../.bin/Debug@DLLDIR@/ java -Djava.library.path=$(BINDBG)@DLLDIR@ -cp .bin/java/ testprogram
292   -
293   -#---[ Misc targets ]-----------------------------------------------------------
294   -
295   -install-plugin: \
296   - $(BINRLS)/plugins/j3270@DLLEXT@
297   -
298   - @$(MKDIR) $(DESTDIR)$(libdir)/$(PACKAGE_NAME)-plugins
299   - @$(INSTALL_PROGRAM) $(BINRLS)/plugins/j3270@DLLEXT@ $(DESTDIR)$(libdir)/$(PACKAGE_NAME)-plugins
300   -
301   -install-extension: \
302   - $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ \
303   - $(BINRLS)/pw3270.jar \
304   -
305   - @$(MKDIR) $(DESTDIR)/$(jnidir)
306   - @$(INSTALL_PROGRAM) $(BINRLS)@DLLDIR@/@DLLPREFIX@jni3270@DLLEXT@ $(DESTDIR)/$(jnidir)
307   -
308   - @mkdir -p $(DESTDIR)/$(jvmjardir)
309   - @$(INSTALL_DATA) $(BINRLS)/pw3270.jar $(DESTDIR)/$(jvmjardir)
310   -
311   -install-doc: \
312   - javadoc
313   -
314   - @echo "javadocdir=$(javadocdir)"
315   -
316   - @$(MKDIR) $(DESTDIR)/$(javadocdir)/$(PACKAGE_NAME)
317   - @cp -r javadoc/* $(DESTDIR)/$(javadocdir)/$(PACKAGE_NAME)
318   - @find $(DESTDIR)/$(javadocdir)/$(PACKAGE_NAME) -type f -exec chmod 644 {} \;
319   - @find $(DESTDIR)/$(javadocdir)/$(PACKAGE_NAME) -type d -exec chmod 755 {} \;
320   -
321   -install: \
322   - install-extension \
323   - install-plugin \
324   - install-doc
325   -
326   -jni3270.h: \
327   - $(BINDIR)/java/pw3270/terminal.class
328   -
329   - @echo $< ...
330   - @mkdir -p `dirname $@`
331   - @$(JAVAH) -o $@ -classpath $(BINDIR)/java pw3270.terminal
332   -
333   -cleanDebug: clean
334   -
335   -clean:
336   - @rm -fr $(OBJDIR)
337   - @rm -fr $(BINDIR)
338   - @rm -fr javadoc
339   - @rm -f jni3270.h
src/java/actions.cc
... ... @@ -1,171 +0,0 @@
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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -using namespace PW3270_NAMESPACE;
36   -
37   -JNIEXPORT jint JNICALL Java_pw3270_terminal_quit(JNIEnv *env, jobject obj) {
38   -
39   - jint rc = -1;
40   -
41   - try {
42   -
43   - rc = java::getHandle(env,obj)->quit();
44   -
45   - } catch(std::exception &e) {
46   -
47   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
48   - return -1;
49   -
50   - }
51   -
52   - return rc;
53   -
54   -}
55   -
56   -JNIEXPORT jint JNICALL Java_pw3270_terminal_erase_1eof(JNIEnv *env, jobject obj) {
57   -
58   - jint rc = -1;
59   -
60   - try {
61   -
62   - rc = java::getHandle(env,obj)->erase_eof();
63   -
64   - } catch(std::exception &e) {
65   -
66   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
67   - return -1;
68   -
69   - }
70   -
71   - return rc;
72   -
73   -}
74   -
75   -JNIEXPORT jint JNICALL Java_pw3270_terminal_erase(JNIEnv *env, jobject obj) {
76   -
77   - jint rc = -1;
78   -
79   - try {
80   -
81   - rc = java::getHandle(env,obj)->erase();
82   -
83   - } catch(std::exception &e) {
84   -
85   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
86   - return -1;
87   -
88   - }
89   -
90   - return rc;
91   -
92   -}
93   -JNIEXPORT jint JNICALL Java_pw3270_terminal_erase_1eol(JNIEnv *env, jobject obj) {
94   -
95   - jint rc = -1;
96   -
97   - try {
98   -
99   - rc = java::getHandle(env,obj)->erase_eol();
100   -
101   - } catch(std::exception &e) {
102   -
103   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
104   - return -1;
105   -
106   - }
107   -
108   - return rc;
109   -
110   -}
111   -
112   -JNIEXPORT jint JNICALL Java_pw3270_terminal_erase_1input(JNIEnv *env, jobject obj) {
113   -
114   - jint rc = -1;
115   -
116   - try {
117   -
118   - rc = java::getHandle(env,obj)->erase_input();
119   -
120   - } catch(std::exception &e) {
121   -
122   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
123   - return -1;
124   -
125   - }
126   -
127   - return rc;
128   -
129   -}
130   -
131   -
132   -JNIEXPORT jint JNICALL Java_pw3270_terminal_print(JNIEnv *env, jobject obj) {
133   -
134   - jint rc = -1;
135   -
136   - try {
137   -
138   - rc = java::getHandle(env,obj)->print();
139   -
140   - } catch(std::exception &e) {
141   -
142   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
143   - return -1;
144   -
145   - }
146   -
147   - return rc;
148   -
149   -}
150   -
151   -JNIEXPORT jint JNICALL Java_pw3270_terminal_action(JNIEnv *env, jobject obj, jstring j_name) {
152   -
153   - jint rc = -1;
154   - const char * name = env->GetStringUTFChars(j_name, 0);
155   -
156   - try {
157   -
158   - rc = java::getHandle(env,obj)->action(name);
159   -
160   - } catch(std::exception &e) {
161   -
162   - env->ReleaseStringUTFChars( j_name, name);
163   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
164   - return -1;
165   -
166   - }
167   -
168   - env->ReleaseStringUTFChars( j_name, name);
169   - return rc;
170   -
171   -}
src/java/call.cc
... ... @@ -1,165 +0,0 @@
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 call.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   -
31   - #include "private.h"
32   - #include <v3270.h>
33   - #include <lib3270/trace.h>
34   - #include <lib3270/log.h>
35   -
36   -
37   -/*---[ Implement ]----------------------------------------------------------------------------------*/
38   -
39   -namespace PW3270_NAMESPACE {
40   -
41   -
42   - void java::call(GtkWidget *widget, const char *classname) {
43   -
44   - debug("%s(%s)",__FUNCTION__,classname);
45   -
46   - if(!trylock()) {
47   -
48   - failed(widget, _( "Can't access java virtual machine" ), "%s", strerror(EBUSY));
49   - return;
50   -
51   - }
52   -
53   - if(jvm || load_jvm(widget)) {
54   -
55   - v3270_set_script(widget,'J',TRUE);
56   -
57   - try {
58   -
59   - jclass cls;
60   - jmethodID mid;
61   -
62   - /*
63   -
64   - DONT WORK!!
65   - http://stackoverflow.com/questions/271506/why-cant-system-setproperty-change-the-classpath-at-runtime
66   -
67   - // Atualizar o classpath
68   - cls = env->FindClass("java/lang/System");
69   - if(!cls) {
70   - throw exception( _( "Can't find class %s" ), "java/lang/System");
71   - }
72   -
73   - mid = env->GetStaticMethodID(cls, "setProperty", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
74   - if(!mid) {
75   - throw exception( _( "Can't find method %s/%s" ), "java/lang/System","setProperty");
76   - }
77   -
78   - lib3270_trace_event(v3270_get_session(widget),"java.class.path=%s\n",classpath);
79   -
80   - jstring name = env->NewStringUTF("java.class.path");
81   - jstring path = env->NewStringUTF(classpath);
82   -
83   - jstring rc = (jstring) env->CallObjectMethod(cls,mid,name,path);
84   -
85   - env->DeleteLocalRef(name);
86   - env->DeleteLocalRef(path);
87   - env->DeleteLocalRef(rc);
88   - */
89   -
90   - // Get application entry point.
91   - cls = env->FindClass(classname);
92   - if(!cls) {
93   - throw exception( _( "Can't find class %s" ), classname);
94   - }
95   -
96   - mid = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
97   - if(!mid) {
98   - throw exception( _( "Can't find method %s/%s" ), classname, "main");
99   - }
100   -
101   - // Build arguments
102   - jobjectArray args = env->NewObjectArray(0, env->FindClass("java/lang/String"), env->NewStringUTF(""));
103   -
104   - // Call main()
105   - env->CallStaticVoidMethod(cls, mid, args);
106   -
107   - // Check for exception
108   - jthrowable exc = env->ExceptionOccurred();
109   - env->ExceptionClear();
110   -
111   - if (exc) {
112   - jclass throwable_class = env->FindClass("java/lang/Throwable");
113   -
114   - jmethodID jni_getMessage = env->GetMethodID(throwable_class,"getMessage","()Ljava/lang/String;");
115   - jstring j_msg = (jstring) env->CallObjectMethod(exc,jni_getMessage);
116   -
117   - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)),
118   - GTK_DIALOG_DESTROY_WITH_PARENT,
119   - GTK_MESSAGE_ERROR,
120   - GTK_BUTTONS_OK_CANCEL,
121   - _( "Java application \"%s\" has failed." ), classname );
122   -
123   - gtk_window_set_title(GTK_WINDOW(dialog), _( "Java error" ));
124   -
125   - if(!env->IsSameObject(j_msg,NULL)) {
126   -
127   - const char * msg = env->GetStringUTFChars(j_msg, 0);
128   -
129   - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",msg);
130   -
131   - env->ReleaseStringUTFChars( j_msg, msg);
132   - }
133   -
134   - if(gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_CANCEL)
135   - gtk_main_quit();
136   - gtk_widget_destroy(dialog);
137   -
138   -
139   - }
140   -
141   - // And finish
142   - env->DeleteLocalRef(args);
143   -
144   - } catch(std::exception &e) {
145   -
146   - failed(widget,_("Can't start java application"),"%s", e.what());
147   -
148   - }
149   -
150   -/*
151   - g_free(dirname);
152   - g_free(classname);
153   - g_free(classpath);
154   -*/
155   -
156   - v3270_set_script(widget,'J',FALSE);
157   -
158   - }
159   -
160   - unlock();
161   -
162   -
163   - }
164   -
165   -}
src/java/clipboard.cc
... ... @@ -1,120 +0,0 @@
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 dialog.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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -using namespace std;
36   -using namespace PW3270_NAMESPACE::java;
37   -
38   -JNIEXPORT jint JNICALL Java_pw3270_terminal_set_1copy(JNIEnv *env, jobject obj, jstring j_str) {
39   -
40   - const char * str = env->GetStringUTFChars(j_str, 0);
41   - jint rc = -1;
42   -
43   - try {
44   -
45   - rc = getHandle(env,obj)->set_copy(str);
46   -
47   - } catch(std::exception &e) {
48   -
49   - env->ReleaseStringUTFChars( j_str, str);
50   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
51   - return -1;
52   -
53   - }
54   -
55   - env->ReleaseStringUTFChars( j_str, str);
56   - return rc;
57   -
58   -}
59   -
60   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1copy(JNIEnv *env, jobject obj) {
61   -
62   - string str;
63   -
64   - try {
65   -
66   - str = getHandle(env,obj)->get_copy();
67   -
68   -
69   - } catch(std::exception &e) {
70   -
71   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
72   -
73   - }
74   -
75   - return env->NewStringUTF(str.c_str());
76   -
77   -
78   -}
79   -
80   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1clipboard(JNIEnv *env, jobject obj) {
81   -
82   - string str;
83   -
84   - try {
85   -
86   - str = getHandle(env,obj)->get_clipboard();
87   -
88   -
89   - } catch(std::exception &e) {
90   -
91   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
92   -
93   - }
94   -
95   - return env->NewStringUTF(str.c_str());
96   -
97   -}
98   -
99   -JNIEXPORT jint JNICALL Java_pw3270_terminal_set_1clipboard(JNIEnv *env, jobject obj, jstring j_str) {
100   -
101   - const char * str = env->GetStringUTFChars(j_str, 0);
102   - jint rc = -1;
103   -
104   - try {
105   -
106   - rc = getHandle(env,obj)->set_clipboard(str);
107   -
108   - } catch(std::exception &e) {
109   -
110   - env->ReleaseStringUTFChars( j_str, str);
111   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
112   - return -1;
113   -
114   - }
115   -
116   - env->ReleaseStringUTFChars( j_str, str);
117   - return rc;
118   -
119   -
120   -}
src/java/connect.cc
... ... @@ -1,73 +0,0 @@
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 info.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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -using namespace PW3270_NAMESPACE;
36   -
37   -JNIEXPORT jint JNICALL Java_pw3270_terminal_connect(JNIEnv *env, jobject obj, jstring j_host, jint seconds) {
38   -
39   - const char * host = env->GetStringUTFChars(j_host, 0);
40   - jint rc = -1;
41   -
42   - try {
43   -
44   - rc = java::getHandle(env,obj)->connect(host,(time_t) seconds);
45   -
46   - } catch(std::exception &e) {
47   -
48   - env->ReleaseStringUTFChars( j_host, host);
49   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
50   - return -1;
51   -
52   - }
53   -
54   - env->ReleaseStringUTFChars( j_host, host);
55   - return rc;
56   -
57   -}
58   -
59   -JNIEXPORT jint JNICALL Java_pw3270_terminal_disconnect(JNIEnv *env, jobject obj) {
60   -
61   - try {
62   -
63   - return (jint) java::getHandle(env,obj)->disconnect();
64   -
65   - } catch(std::exception &e) {
66   -
67   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
68   -
69   - }
70   -
71   - return -1;
72   -
73   -}
src/java/cursor.cc
... ... @@ -1,95 +0,0 @@
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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -using namespace PW3270_NAMESPACE;
36   -
37   -JNIEXPORT jint JNICALL Java_pw3270_terminal_set_1cursor_1position(JNIEnv *env, jobject obj, jint row, jint col) {
38   -
39   - jint rc = -1;
40   -
41   - try {
42   -
43   - rc = java::getHandle(env,obj)->set_cursor_position((int) row, (int) col);
44   -
45   - } catch(std::exception &e) {
46   -
47   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
48   - return -1;
49   -
50   - }
51   -
52   - return rc;
53   -
54   -}
55   -
56   -JNIEXPORT jint JNICALL Java_pw3270_terminal_set_1cursor_1addr(JNIEnv *env, jobject obj, jint addr) {
57   -
58   - jint rc = -1;
59   -
60   - try {
61   -
62   - rc = java::getHandle(env,obj)->set_cursor_addr((int) addr);
63   -
64   - } catch(std::exception &e) {
65   -
66   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
67   - return -1;
68   -
69   - }
70   -
71   - return rc;
72   -
73   -
74   -}
75   -
76   -JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1cursor_1addr(JNIEnv *env, jobject obj) {
77   -
78   - jint rc = -1;
79   -
80   - try {
81   -
82   - rc = java::getHandle(env,obj)->get_cursor_addr();
83   -
84   - } catch(std::exception &e) {
85   -
86   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
87   - return -1;
88   -
89   - }
90   -
91   - return rc;
92   -
93   -}
94   -
95   -
src/java/dialog.cc
... ... @@ -1,92 +0,0 @@
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 dialog.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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -using namespace PW3270_NAMESPACE;
36   -
37   -JNIEXPORT jint JNICALL Java_pw3270_terminal_popup_1dialog(JNIEnv *env, jobject obj, jint id, jstring j_title, jstring j_message, jstring j_secondary) {
38   -
39   - const char * title = env->GetStringUTFChars(j_title, 0);
40   - const char * message = env->GetStringUTFChars(j_message, 0);
41   - const char * secondary = env->GetStringUTFChars(j_secondary, 0);
42   - jint rc = -1;
43   -
44   - try {
45   -
46   - rc = (jint) java::getHandle(env,obj)->popup_dialog((LIB3270_NOTIFY) id, title, message, secondary);
47   -
48   - } catch(std::exception &e) {
49   -
50   - env->ReleaseStringUTFChars( j_title, title);
51   - env->ReleaseStringUTFChars( j_message, message);
52   - env->ReleaseStringUTFChars( j_secondary, secondary);
53   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
54   -
55   - }
56   -
57   - env->ReleaseStringUTFChars( j_title, title);
58   - env->ReleaseStringUTFChars( j_message, message);
59   - env->ReleaseStringUTFChars( j_secondary, secondary);
60   -
61   - return rc;
62   -
63   -}
64   -
65   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_file_1chooser_1dialog(JNIEnv *env, jobject obj, jint action, jstring j_title, jstring j_extension, jstring j_filename) {
66   -
67   - string str;
68   - const char * title = env->GetStringUTFChars(j_title, 0);
69   - const char * extension = env->GetStringUTFChars(j_extension, 0);
70   - const char * filename = env->GetStringUTFChars(j_filename, 0);
71   -
72   - try {
73   -
74   - str = java::getHandle(env,obj)->file_chooser_dialog((int) action, title, extension, filename);
75   -
76   - } catch(std::exception &e) {
77   -
78   - env->ReleaseStringUTFChars( j_title, title);
79   - env->ReleaseStringUTFChars( j_extension, extension);
80   - env->ReleaseStringUTFChars( j_filename, filename);
81   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
82   -
83   - }
84   -
85   - env->ReleaseStringUTFChars( j_title, title);
86   - env->ReleaseStringUTFChars( j_extension, extension);
87   - env->ReleaseStringUTFChars( j_filename, filename);
88   -
89   - return env->NewStringUTF(str.c_str());
90   -
91   -
92   -}
src/java/field.cc
... ... @@ -1,132 +0,0 @@
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 field.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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -using namespace PW3270_NAMESPACE;
36   -
37   -JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1field_1start (JNIEnv *env, jobject obj, jint baddr) {
38   -
39   - jint rc = -1;
40   -
41   - try {
42   -
43   - rc = java::getHandle(env,obj)->get_field_start((int) baddr);
44   -
45   -
46   - } catch(std::exception &e) {
47   -
48   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
49   -
50   - }
51   -
52   - return rc;
53   -
54   -}
55   -
56   -JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1field_1len (JNIEnv *env, jobject obj, jint baddr) {
57   -
58   - jint rc = -1;
59   -
60   - try {
61   -
62   - rc = java::getHandle(env,obj)->get_field_len((int) baddr);
63   -
64   -
65   - } catch(std::exception &e) {
66   -
67   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
68   -
69   - }
70   -
71   - return rc;
72   -
73   -}
74   -
75   -JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1next_1unprotected(JNIEnv *env, jobject obj, jint baddr) {
76   -
77   - jint rc = -1;
78   -
79   - try {
80   -
81   - rc = java::getHandle(env,obj)->get_next_unprotected((int) baddr);
82   -
83   -
84   - } catch(std::exception &e) {
85   -
86   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
87   -
88   - }
89   -
90   - return rc;
91   -
92   -
93   -}
94   -
95   -JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1is_1protected(JNIEnv *env, jobject obj, jint baddr) {
96   -
97   - jint rc = -1;
98   -
99   - try {
100   -
101   - rc = java::getHandle(env,obj)->get_is_protected((int) baddr);
102   -
103   -
104   - } catch(std::exception &e) {
105   -
106   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
107   -
108   - }
109   -
110   - return rc;
111   -
112   -
113   -}
114   -
115   -JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1is_1protected_1at(JNIEnv *env, jobject obj, jint row, jint col) {
116   -
117   - jint rc = -1;
118   -
119   - try {
120   -
121   - rc = java::getHandle(env,obj)->get_is_protected_at((int) row, (int) col);
122   -
123   - } catch(std::exception &e) {
124   -
125   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
126   -
127   - }
128   -
129   - return rc;
130   -
131   -
132   -}
src/java/getset.cc
... ... @@ -1,237 +0,0 @@
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 info.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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -using namespace std;
36   -using namespace PW3270_NAMESPACE;
37   -
38   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_toString(JNIEnv *env, jobject obj) {
39   -
40   - string str;
41   -
42   - try {
43   -
44   - str = java::getHandle(env,obj)->get_string();
45   -
46   - } catch(std::exception &e) {
47   -
48   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
49   -
50   - }
51   -
52   - return env->NewStringUTF(str.c_str());
53   -
54   -}
55   -
56   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1string(JNIEnv *env, jobject obj, jint baddr, jint len) {
57   -
58   - string str;
59   -
60   - try {
61   -
62   - str = java::getHandle(env,obj)->get_string((int) baddr, (int) len);
63   -
64   -
65   - } catch(std::exception &e) {
66   -
67   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
68   -
69   - }
70   -
71   - return env->NewStringUTF(str.c_str());
72   -
73   -}
74   -
75   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1string_1at(JNIEnv *env, jobject obj, jint row, jint col, jint sz) {
76   -
77   - string str;
78   -
79   - try {
80   -
81   - str = java::getHandle(env,obj)->get_string_at((int) row, (int) col, (int) sz);
82   -
83   -
84   - } catch(std::exception &e) {
85   -
86   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
87   -
88   - }
89   -
90   - return env->NewStringUTF(str.c_str());
91   -
92   -}
93   -
94   -JNIEXPORT jint JNICALL Java_pw3270_terminal_set_1string_1at(JNIEnv *env, jobject obj, jint row, jint col, jstring j_str) {
95   -
96   - const char * str = env->GetStringUTFChars(j_str, 0);
97   - jint rc = -1;
98   -
99   - try {
100   -
101   - rc = java::getHandle(env,obj)->set_string_at((int) row, (int) col, str);
102   -
103   - } catch(std::exception &e) {
104   -
105   - env->ReleaseStringUTFChars( j_str, str);
106   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
107   - return -1;
108   -
109   - }
110   -
111   - env->ReleaseStringUTFChars( j_str, str);
112   - return rc;
113   -
114   -
115   -}
116   -
117   -JNIEXPORT jint JNICALL Java_pw3270_terminal_cmp_1string_1at(JNIEnv *env, jobject obj, jint row, jint col, jstring j_str) {
118   -
119   - const char * str = env->GetStringUTFChars(j_str, 0);
120   - jint rc = -1;
121   -
122   - try {
123   -
124   - rc = java::getHandle(env,obj)->cmp_string_at((int) row, (int) col, str);
125   -
126   - } catch(std::exception &e) {
127   -
128   - env->ReleaseStringUTFChars( j_str, str);
129   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
130   - return -1;
131   -
132   - }
133   -
134   - trace("cmp_string_at(%d,%d,\"%s\") = %d",(int) row, (int) col, str, (int) rc);
135   -
136   - env->ReleaseStringUTFChars( j_str, str);
137   - return rc;
138   -
139   -}
140   -
141   -JNIEXPORT jint JNICALL Java_pw3270_terminal_wait_1for_1string_1at(JNIEnv *env, jobject obj, jint row, jint col, jstring j_str, jint timeout) {
142   -
143   - const char * str = env->GetStringUTFChars(j_str, 0);
144   - jint rc = -1;
145   -
146   - try {
147   -
148   - rc = java::getHandle(env,obj)->wait_for_string_at((int) row, (int) col, str, timeout);
149   -
150   - } catch(std::exception &e) {
151   -
152   - env->ReleaseStringUTFChars( j_str, str);
153   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
154   - return -1;
155   -
156   - }
157   -
158   - env->ReleaseStringUTFChars( j_str, str);
159   - return rc;
160   -
161   -
162   -}
163   -
164   -JNIEXPORT jint JNICALL Java_pw3270_terminal_input_1string(JNIEnv *env, jobject obj, jstring j_str) {
165   -
166   - const char * str = env->GetStringUTFChars(j_str, 0);
167   - jint rc = -1;
168   -
169   - try {
170   -
171   - rc = java::getHandle(env,obj)->input_string(str);
172   -
173   - } catch(std::exception &e) {
174   -
175   - env->ReleaseStringUTFChars( j_str, str);
176   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
177   - return -1;
178   -
179   - }
180   -
181   - env->ReleaseStringUTFChars( j_str, str);
182   - return rc;
183   -
184   -}
185   -
186   -JNIEXPORT jboolean JNICALL Java_pw3270_terminal_is_1connected(JNIEnv *env, jobject obj) {
187   -
188   - jboolean rc = false;
189   -
190   - try {
191   -
192   - rc = java::getHandle(env,obj)->is_connected();
193   -
194   - } catch(std::exception &e) {
195   -
196   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
197   - return rc;
198   -
199   - }
200   -
201   -
202   - return rc;
203   -
204   -}
205   -
206   -JNIEXPORT jboolean JNICALL Java_pw3270_terminal_is_1ready(JNIEnv *env, jobject obj) {
207   -
208   - jboolean rc = false;
209   -
210   - try {
211   -
212   - rc = java::getHandle(env,obj)->is_ready();
213   -
214   - } catch(std::exception &e) {
215   -
216   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
217   - return rc;
218   -
219   - }
220   -
221   - return rc;
222   -
223   -}
224   -
225   -JNIEXPORT void JNICALL Java_pw3270_terminal_set_1unlock_1delay(JNIEnv *env, jobject obj, jint ms) {
226   -
227   - try {
228   -
229   - java::getHandle(env,obj)->set_unlock_delay((unsigned short) ms);
230   -
231   - } catch(std::exception &e) {
232   -
233   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
234   -
235   - }
236   -
237   -}
src/java/info.cc
... ... @@ -1,75 +0,0 @@
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 info.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 "jni3270.h"
31   - #include "private.h"
32   -
33   -
34   -/*---[ Implement ]----------------------------------------------------------------------------------*/
35   -
36   -using namespace PW3270_NAMESPACE;
37   -
38   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1version (JNIEnv *env, jobject obj) {
39   -
40   - session *s = java::getHandle(env,obj);
41   - return env->NewStringUTF(s->get_version().c_str());
42   -
43   -}
44   -
45   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1revision(JNIEnv *env, jobject obj) {
46   -
47   - session *s = java::getHandle(env,obj);
48   - return env->NewStringUTF(s->get_revision().c_str());
49   -
50   -}
51   -
52   -JNIEXPORT jstring JNICALL Java_pw3270_terminal_get_1encoding(JNIEnv *env, jobject obj) {
53   -
54   - session *s = java::getHandle(env,obj);
55   - return env->NewStringUTF(s->get_encoding());
56   -
57   -}
58   -
59   -JNIEXPORT jint JNICALL Java_pw3270_terminal_get_1secure(JNIEnv *env, jobject obj) {
60   -
61   - jint rc = -1;
62   -
63   - try {
64   -
65   - rc = java::getHandle(env,obj)->get_secure();
66   -
67   - } catch(std::exception &e) {
68   -
69   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
70   -
71   - }
72   -
73   - return rc;
74   -
75   -}
src/java/jni3270.cbp
... ... @@ -1,76 +0,0 @@
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=".bin/Debug/jni3270" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="1" extension_auto="1" />
12   - <Option object_output=".obj/Debug/" />
13   - <Option type="3" />
14   - <Option compiler="gcc" />
15   - <Option parameters="-Djava.library.path=.bin/Debug -cp .bin/java/ testprogram " />
16   - <Option host_application="java" />
17   - <Option run_host_application_in_terminal="1" />
18   - <Compiler>
19   - <Add option="-g" />
20   - </Compiler>
21   - </Target>
22   - <Target title="Release">
23   - <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="1" extension_auto="1" />
24   - <Option object_output=".obj/Release/" />
25   - <Option type="3" />
26   - <Option compiler="gcc" />
27   - <Option parameters="-Djava.library.path=.bin/Release -cp .bin/java/ testprogram" />
28   - <Option host_application="java" />
29   - <Option run_host_application_in_terminal="1" />
30   - <Compiler>
31   - <Add option="-O2" />
32   - </Compiler>
33   - <Linker>
34   - <Add option="-s" />
35   - </Linker>
36   - </Target>
37   - </Build>
38   - <Compiler>
39   - <Add option="-Wall" />
40   - </Compiler>
41   - <Unit filename="../../configure.ac" />
42   - <Unit filename="../classlib/exception.cc" />
43   - <Unit filename="../classlib/local.cc" />
44   - <Unit filename="../classlib/module.cc" />
45   - <Unit filename="../classlib/private.h" />
46   - <Unit filename="../classlib/remote.cc" />
47   - <Unit filename="../classlib/session.cc" />
48   - <Unit filename="../classlib/testprogram.cc" />
49   - <Unit filename="../include/lib3270.h" />
50   - <Unit filename="../include/pw3270/class.h" />
51   - <Unit filename="../include/pw3270/ipcpackets.h" />
52   - <Unit filename="Makefile.in" />
53   - <Unit filename="actions.cc" />
54   - <Unit filename="clipboard.cc" />
55   - <Unit filename="connect.cc" />
56   - <Unit filename="cursor.cc" />
57   - <Unit filename="dialog.cc" />
58   - <Unit filename="field.cc" />
59   - <Unit filename="getset.cc" />
60   - <Unit filename="info.cc" />
61   - <Unit filename="jni3270.h" />
62   - <Unit filename="keyboard.cc" />
63   - <Unit filename="main.cc" />
64   - <Unit filename="plugin.cc" />
65   - <Unit filename="private.h" />
66   - <Unit filename="startstop.cc" />
67   - <Unit filename="terminal.java" />
68   - <Unit filename="testprogram.java" />
69   - <Extensions>
70   - <code_completion />
71   - <envvars />
72   - <debugger />
73   - <lib_finder disable_auto="1" />
74   - </Extensions>
75   - </Project>
76   -</CodeBlocks_project_file>
src/java/keyboard.cc
... ... @@ -1,93 +0,0 @@
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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -using namespace PW3270_NAMESPACE;
36   -
37   -JNIEXPORT jint JNICALL Java_pw3270_terminal_enter(JNIEnv *env, jobject obj) {
38   -
39   - jint rc = -1;
40   -
41   - try {
42   -
43   - rc = java::getHandle(env,obj)->enter();
44   -
45   - } catch(std::exception &e) {
46   -
47   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
48   - return -1;
49   -
50   - }
51   -
52   - return rc;
53   -
54   -}
55   -
56   -JNIEXPORT jint JNICALL Java_pw3270_terminal_pfkey(JNIEnv *env, jobject obj, jint key) {
57   -
58   - jint rc = -1;
59   -
60   - try {
61   -
62   - rc = java::getHandle(env,obj)->pfkey((int) key);
63   -
64   - } catch(std::exception &e) {
65   -
66   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
67   - return -1;
68   -
69   - }
70   -
71   - return rc;
72   -
73   -}
74   -
75   -JNIEXPORT jint JNICALL Java_pw3270_terminal_pakey(JNIEnv *env, jobject obj, jint key) {
76   -
77   - jint rc = -1;
78   -
79   - try {
80   -
81   - rc = java::getHandle(env,obj)->pakey((int) key);
82   -
83   - } catch(std::exception &e) {
84   -
85   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
86   - return -1;
87   -
88   - }
89   -
90   - return rc;
91   -
92   -}
93   -
src/java/main.cc
... ... @@ -1,167 +0,0 @@
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 main.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 "jni3270.h"
31   - #include "private.h"
32   -
33   -/*---[ Implement ]----------------------------------------------------------------------------------*/
34   -
35   -namespace PW3270_NAMESPACE {
36   -
37   - jfieldID java::getHandleField(JNIEnv *env, jobject obj) {
38   - jclass c = env->GetObjectClass(obj);
39   - // J is the type signature for long:
40   - return env->GetFieldID(c, "nativeHandle", "J");
41   - }
42   -
43   - session * java::getHandle(JNIEnv *env, jobject obj) {
44   - jlong handle = env->GetLongField(obj, getHandleField(env, obj));
45   - return reinterpret_cast<PW3270_NAMESPACE::session *>(handle);
46   - }
47   -
48   -}
49   -
50   -using namespace PW3270_NAMESPACE;
51   -using namespace PW3270_NAMESPACE::java;
52   -
53   -JNIEXPORT jint JNICALL Java_pw3270_terminal_init__(JNIEnv *env, jobject obj) {
54   -
55   - trace("%s",__FUNCTION__);
56   -
57   - try {
58   -
59   - jlong handle = reinterpret_cast<jlong>(session::create());
60   - env->SetLongField(obj, getHandleField(env, obj), handle);
61   -
62   - } catch(std::exception &e) {
63   -
64   - trace("%s: %s",__FUNCTION__,e.what());
65   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
66   -
67   - }
68   -
69   - return 0;
70   -}
71   -
72   -
73   -JNIEXPORT jint JNICALL Java_pw3270_terminal_init__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring j_id) {
74   -
75   - const char * id = env->GetStringUTFChars(j_id, 0);
76   -
77   - try {
78   -
79   - jlong handle = reinterpret_cast<jlong>(session::create(id));
80   - env->SetLongField(obj, getHandleField(env, obj), handle);
81   - env->ReleaseStringUTFChars( j_id, id);
82   -
83   - } catch(std::exception &e) {
84   -
85   - env->ReleaseStringUTFChars( j_id, id);
86   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
87   -
88   - }
89   -
90   -
91   - return 0;
92   -}
93   -
94   -JNIEXPORT jint JNICALL Java_pw3270_terminal_deinit(JNIEnv *env, jobject obj) {
95   -
96   - try {
97   -
98   - session *s = getHandle(env,obj);
99   -
100   - if(s) {
101   - delete s;
102   - }
103   -
104   - env->SetLongField(obj, getHandleField(env, obj), 0);
105   -
106   -
107   - } catch(std::exception &e) {
108   -
109   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
110   -
111   - }
112   -
113   - return 0;
114   -}
115   -
116   -JNIEXPORT jint JNICALL Java_pw3270_terminal_wait_1for_1ready(JNIEnv *env, jobject obj, jint seconds) {
117   -
118   - try {
119   -
120   - return getHandle(env,obj)->wait_for_ready((int) seconds);
121   -
122   - } catch(std::exception &e) {
123   -
124   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
125   -
126   - }
127   -
128   - return 0;
129   -
130   -}
131   -
132   -JNIEXPORT jint JNICALL Java_pw3270_terminal_wait(JNIEnv *env, jobject obj, jint seconds) {
133   -
134   - try {
135   -
136   - return getHandle(env,obj)->wait((int) seconds);
137   -
138   - } catch(std::exception &e) {
139   -
140   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
141   -
142   - }
143   -
144   - return 0;
145   -
146   -}
147   -
148   -
149   -JNIEXPORT void JNICALL Java_pw3270_terminal_log(JNIEnv *env, jobject obj, jstring j_str) {
150   -
151   - const char * str = env->GetStringUTFChars(j_str, 0);
152   -
153   - try {
154   -
155   - getHandle(env,obj)->log("%s", str);
156   -
157   - } catch(std::exception &e) {
158   -
159   - env->ReleaseStringUTFChars( j_str, str);
160   - env->ThrowNew(env->FindClass("java/lang/Exception"), e.what());
161   - return;
162   -
163   - }
164   -
165   - env->ReleaseStringUTFChars( j_str, str);
166   -
167   -}
src/java/plugin.cc
... ... @@ -1,147 +0,0 @@
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 plugin.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   -#if defined WIN32
31   -
32   - // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx
33   - #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
34   - #define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
35   - #endif // LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
36   -
37   - #ifndef LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
38   - #define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x00000100
39   - #endif // LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
40   -
41   - #include <windows.h>
42   -
43   -#endif
44   -
45   - #include "private.h"
46   -
47   - #include <malloc.h>
48   - #include <libintl.h>
49   - #include <glib/gi18n.h>
50   - #include <gtk/gtk.h>
51   -
52   - #include <pw3270.h>
53   - #include <pw3270/plugin.h>
54   - #include <v3270.h>
55   - #include <lib3270/actions.h>
56   - #include <lib3270/log.h>
57   - #include <lib3270/trace.h>
58   - #include <lib3270/charset.h>
59   - #include <pw3270/class.h>
60   - #include <pw3270/trace.h>
61   -
62   -
63   -/*--[ Globals ]--------------------------------------------------------------------------------------*/
64   -
65   -#if GTK_CHECK_VERSION(2,32,0)
66   - static GMutex mutex;
67   -#else
68   - static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
69   -#endif // GTK_CHECK_VERSION
70   -
71   - using namespace std;
72   -
73   -
74   -/*---[ Implement ]----------------------------------------------------------------------------------*/
75   -
76   -namespace PW3270_NAMESPACE {
77   -
78   - void java::lock() {
79   -#if GTK_CHECK_VERSION(2,32,0)
80   - g_mutex_lock(&mutex);
81   -#else
82   - g_static_mutex_lock(&mutex);
83   -#endif // GTK_CHECK_VERSION
84   - }
85   -
86   - void java::unlock() {
87   -#if GTK_CHECK_VERSION(2,32,0)
88   - g_mutex_unlock(&mutex);
89   -#else
90   - g_static_mutex_unlock(&mutex);
91   -#endif // GTK_CHECK_VERSION
92   - }
93   -
94   - bool java::trylock() {
95   -#if GTK_CHECK_VERSION(2,32,0)
96   - return g_mutex_trylock(&mutex);
97   -#else
98   - return g_static_mutex_trylock(&mutex);
99   -#endif // GTK_CHECK_VERSION
100   - }
101   -
102   -}
103   -
104   -using namespace PW3270_NAMESPACE;
105   -
106   -extern "C" {
107   -
108   - static PW3270_NAMESPACE::session * factory(const char *name) {
109   - return session::create_local(lib3270_get_default_session_handle());
110   - }
111   -
112   - LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) {
113   -
114   - trace("JAVA: %s",__FUNCTION__);
115   -
116   - #if GTK_CHECK_VERSION(2,32,0)
117   - g_mutex_init(&mutex);
118   - #endif // GTK_CHECK_VERSION
119   -
120   - session::set_plugin(factory);
121   -
122   - return 0;
123   - }
124   -
125   - LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) {
126   -
127   - java::lock();
128   -
129   - if(java::jvm) {
130   - java::jvm->DestroyJavaVM();
131   - java::jvm = NULL;
132   - }
133   -
134   - java::unlock();
135   -
136   - #if GTK_CHECK_VERSION(2,32,0)
137   - g_mutex_clear(&mutex);
138   - #endif // GTK_CHECK_VERSION
139   -
140   - trace("JAVA: %s",__FUNCTION__);
141   -
142   - return 0;
143   - }
144   -
145   -
146   -}
147   -
src/java/private.h
... ... @@ -1,83 +0,0 @@
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 private.h 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   - * Referências:
29   - *
30   - * http://thebreakfastpost.com/2012/01/26/wrapping-a-c-library-with-jni-part-2/
31   - *
32   - */
33   -#ifndef PRIVATE_H_INCLUDED
34   -
35   - #define PRIVATE_H_INCLUDED
36   -
37   - #include <jni.h>
38   - #include <pw3270/class.h>
39   -
40   - #include <malloc.h>
41   - #include <libintl.h>
42   -
43   -#ifdef PW3270_PLUGIN
44   - #include <glib/gi18n.h>
45   - #include <gtk/gtk.h>
46   -#endif // PW3270_PLUGIN
47   -
48   - namespace PW3270_NAMESPACE {
49   -
50   - namespace java {
51   -
52   -#ifdef _WIN32
53   - extern HMODULE hModule;
54   -#endif // WIN32
55   -
56   - extern JavaVM * jvm;
57   - extern JNIEnv * env;
58   -
59   - PW3270_NAMESPACE::session * getHandle(JNIEnv *env, jobject obj);
60   - jfieldID getHandleField(JNIEnv *env, jobject obj);
61   -
62   - void lock();
63   - void unlock();
64   - bool trylock();
65   -
66   -#ifdef PW3270_PLUGIN
67   - bool load_jvm(GtkWidget *widget);
68   - void call(GtkWidget *widget, const char *filename);
69   - void failed(GtkWidget *widget, const char *msg, const char *format, ...);
70   -#endif // PW3270_PLUGIN
71   -
72   -
73   -
74   -
75   - }
76   -
77   -
78   - }
79   -
80   -
81   -
82   -
83   -#endif // PRIVATE_H_INCLUDED
src/java/run.sh
... ... @@ -1,7 +0,0 @@
1   -#!/bin/bash
2   -make -C ../.. Debug
3   -make Debug
4   -make .bin/java/${1}.class
5   -
6   -LD_LIBRARY_PATH=../../.bin/Debug/lib/ java -Djava.library.path=/usr/local/lib64/java:.bin/Debug/lib -cp .bin/java/ ${1}
7   -
src/java/sample/efglobe.java
... ... @@ -1,26 +0,0 @@
1   -
2   -import pw3270.*;
3   -
4   -public class efglobe
5   -{
6   - public static void main (String[] args)
7   - {
8   - try
9   - {
10   - terminal host = new terminal();
11   -
12   - host.connect("tn3270://zos.efglobe.com:telnet",10);
13   -
14   - host.wait_for_ready(10);
15   -
16   - System.out.println("Read: [" + host.get_string_at(14,19,38)+"]");
17   -
18   - host.disconnect();
19   -
20   - }
21   - catch( Exception e )
22   - {
23   - System.err.println(e);
24   - }
25   - }
26   -};
src/java/sample/except.java
... ... @@ -1,11 +0,0 @@
1   -public class except
2   -{
3   - public static void main (String[] args) throws Exception
4   - {
5   - throw new Exception("Testing exceptions");
6   - }
7   -};
8   -
9   -
10   -
11   -
src/java/sample/out.java
... ... @@ -1,9 +0,0 @@
1   -
2   -public class out
3   -{
4   - public static void main (String[] args)
5   - {
6   - System.out.println("Test out");
7   - System.err.println("Test err");
8   - }
9   -};
src/java/sample/popup.java
... ... @@ -1,23 +0,0 @@
1   -
2   -import pw3270.*;
3   -
4   -public class popup
5   -{
6   - public static void main (String[] args)
7   - {
8   - System.out.println("Begin");
9   -
10   - try {
11   -
12   - terminal host = new terminal();
13   - System.out.println("Output: " + host.popup_dialog(0,"Title","This is a popup message", "And this is a secondary and more detailed text"));
14   -
15   - } catch( Exception e ) {
16   -
17   - System.out.println("Error: " + e);
18   -
19   - }
20   -
21   - System.out.println("End");
22   - }
23   -};
src/java/sample/prot.java
... ... @@ -1,26 +0,0 @@
1   -
2   -import pw3270.*;
3   -
4   -public class prot
5   -{
6   - public static void main (String[] args)
7   - {
8   - System.out.println("Begin");
9   -
10   - try {
11   -
12   - terminal host = new terminal();
13   -
14   - host.popup_dialog(0,"19,39","Testing","Position 19,39 is " + (host.get_is_protected_at(19,39) == 0 ? "un" : "") + "protected");
15   - host.popup_dialog(0,"20,39","Testing","Position 19,39 is " + (host.get_is_protected_at(20,39) == 0 ? "un" : "") + "protected");
16   -
17   -
18   - } catch( Exception e ) {
19   -
20   - System.out.println("Error: " + e);
21   -
22   - }
23   -
24   - System.out.println("End");
25   - }
26   -};
src/java/startstop.cc
... ... @@ -1,419 +0,0 @@
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 startstop.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   -#if defined WIN32
31   -
32   - // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx
33   - #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
34   - #define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
35   - #endif // LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
36   -
37   - #ifndef LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
38   - #define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x00000100
39   - #endif // LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
40   -
41   - #include <windows.h>
42   -
43   -#else
44   -
45   - #include <dlfcn.h>
46   -
47   -#endif
48   -
49   - #include "private.h"
50   -
51   - #include <pw3270.h>
52   - #include <pw3270/plugin.h>
53   - #include <v3270.h>
54   - #include <lib3270/actions.h>
55   - #include <lib3270/log.h>
56   - #include <lib3270/trace.h>
57   - #include <lib3270/charset.h>
58   - #include <pw3270/class.h>
59   - #include <pw3270/trace.h>
60   -
61   -/*---[ Implement ]----------------------------------------------------------------------------------*/
62   -
63   -using namespace PW3270_NAMESPACE::java;
64   -
65   -extern "C" {
66   -
67   - static void trace_cleanup(GtkWidget *widget, GtkWidget **window) {
68   - *window = NULL;
69   - }
70   -
71   - static jint JNICALL jni_vfprintf(FILE *fp, const char *fmt, va_list args) {
72   -
73   - char * msg = NULL;
74   - static GtkWidget * trace = NULL;
75   -
76   - if(vasprintf(&msg,fmt,args) < 1) {
77   - lib3270_write_log(lib3270_get_default_session_handle(),"java","vasprintf() error on \"%s\"",fmt);
78   - return 0;
79   - }
80   -
81   - fprintf(fp,"%s",msg);
82   - lib3270_write_log(lib3270_get_default_session_handle(),"java","%s",msg);
83   -
84   - if(!trace) {
85   - // Cria janela de trace.
86   - trace = pw3270_trace_new();
87   - g_signal_connect(G_OBJECT(trace), "destroy",G_CALLBACK(trace_cleanup), &trace);
88   -
89   - pw3270_trace_set_destroy_on_close(trace,TRUE);
90   -
91   - // gtk_window_set_transient_for(GTK_WINDOW(trace),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
92   - gtk_window_set_destroy_with_parent(GTK_WINDOW(trace),TRUE);
93   -
94   - gtk_window_set_default_size(GTK_WINDOW(trace),590,430);
95   - gtk_widget_show_all(trace);
96   -
97   - pw3270_trace_printf(trace,"%s",msg);
98   -
99   - free(msg);
100   - }
101   -
102   - return 0;
103   - }
104   -
105   - LIB3270_EXPORT void pw3270_action_java_activated(GtkAction *action, GtkWidget *widget) {
106   -
107   - gchar *classname = (gchar *) g_object_get_data(G_OBJECT(action),"src");
108   -
109   - lib3270_trace_event(v3270_get_session(widget),"Action %s activated on widget %p\n",gtk_action_get_name(action),widget);
110   -
111   - if(classname)
112   - {
113   - // Has filename, call it directly
114   - call(widget,classname);
115   - }
116   - else
117   - {
118   -/*
119   - // No classname, ask user
120   - filename = pw3270_file_chooser(GTK_FILE_CHOOSER_ACTION_OPEN, "java", _( "Select script to run" ), "", "class");
121   -
122   - if(filename)
123   - {
124   - call(widget,filename);
125   - g_free(filename);
126   - }
127   -*/
128   - }
129   -
130   - }
131   - }
132   -
133   -
134   - namespace PW3270_NAMESPACE {
135   -
136   - JavaVM * java::jvm = NULL;
137   - JNIEnv * java::env = NULL;
138   -#ifdef _WIN32
139   - HMODULE java::hModule = NULL;
140   -#endif // _WIN32
141   -
142   - void java::failed(GtkWidget *widget, const char *msg, const char *format, ...) {
143   -
144   - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)),
145   - GTK_DIALOG_DESTROY_WITH_PARENT,
146   - GTK_MESSAGE_ERROR,
147   - GTK_BUTTONS_OK_CANCEL,
148   - "%s", msg );
149   -
150   - gtk_window_set_title(GTK_WINDOW(dialog), _( "Java error" ));
151   -
152   - if(format) {
153   -
154   - va_list arg_ptr;
155   - va_start(arg_ptr, format);
156   - gchar *msg = g_strdup_vprintf(format,arg_ptr);
157   - va_end(arg_ptr);
158   - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",msg);
159   - g_free(msg);
160   -
161   - }
162   -
163   - if(gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_CANCEL)
164   - gtk_main_quit();
165   - gtk_widget_destroy(dialog);
166   -
167   - }
168   -
169   -
170   -#ifdef WIN32
171   -
172   - bool java::load_jvm(GtkWidget *widget) {
173   -
174   - if(jvm != NULL) {
175   - return true;
176   - }
177   -
178   - // Dynamically load jvm library to avoid naming and path problems.
179   - HMODULE kernel;
180   - HANDLE WINAPI (*AddDllDirectory)(PCWSTR NewDirectory);
181   - BOOL WINAPI (*RemoveDllDirectory)(HANDLE Cookie);
182   -
183   - struct _dlldir {
184   - const gchar * env;
185   - const gchar * path;
186   - HANDLE cookie;
187   - } dlldir[] = {
188   - { "JRE_HOME", "bin\\client", 0 },
189   - { "JDK_HOME", "jre\\bin\\client", 0 }
190   - };
191   -
192   - kernel = LoadLibrary("kernel32.dll");
193   -
194   - if(kernel) {
195   -
196   - AddDllDirectory = (HANDLE WINAPI (*)(PCWSTR)) GetProcAddress(kernel,"AddDllDirectory");
197   - if(AddDllDirectory) {
198   -
199   - // Acrescenta mais caminhos para achar a dll
200   - for(size_t f = 0; f < G_N_ELEMENTS(dlldir); f++) {
201   -
202   - const char *env = getenv(dlldir[f].env);
203   -
204   - debug("%s=\"%s\"",dlldir[f].env,env);
205   -
206   - if(env) {
207   -
208   - gchar *p = g_build_filename(env,dlldir[f].path,NULL);
209   -
210   - lib3270_trace_event(v3270_get_session(widget),"Adding \"%s\" to DLL search path",p);
211   -
212   - wchar_t *path = (wchar_t *) malloc(4096*sizeof(wchar_t));
213   - mbstowcs(path, p, 4095);
214   - dlldir[f].cookie = AddDllDirectory(path);
215   - free(path);
216   -
217   - g_free(p);
218   -
219   - }
220   - }
221   -
222   - } else {
223   -
224   - lib3270_trace_event(v3270_get_session(widget),"Can't find %s: %s","AddDllDirectory",session::win32_strerror(GetLastError()).c_str());
225   -
226   - }
227   -
228   - } else {
229   -
230   - lib3270_trace_event(v3270_get_session(widget),"Can't load %s: %s\n","kernel32.dll",session::win32_strerror(GetLastError()).c_str());
231   -
232   - }
233   -
234   - hModule = LoadLibrary("jvm.dll");
235   - if(!hModule) {
236   - lib3270_trace_event(v3270_get_session(widget),"Can't load %s\n","jvm.dll",session::win32_strerror(GetLastError()).c_str());
237   -
238   - for(size_t f = 0; !hModule && f < G_N_ELEMENTS(dlldir); f++) {
239   -
240   - const char *env = getenv(dlldir[f].env);
241   -
242   - debug("%s=\"%s\"",dlldir[f].env,env);
243   -
244   - if(env) {
245   -
246   - gchar *p = g_build_filename(env,dlldir[f].path,"jvm.dll",NULL);
247   - hModule = LoadLibrary(p);
248   - if(!hModule) {
249   - lib3270_trace_event(v3270_get_session(widget),"Can't load %s: %s\n",p,session::win32_strerror(GetLastError()).c_str());
250   - }
251   - g_free(p);
252   -
253   - }
254   - }
255   - }
256   -
257   - if(!hModule) {
258   - failed(widget, _( "Can't load java virtual machine" ), "%s", session::win32_strerror(GetLastError()).c_str());
259   - }
260   -
261   - if(kernel) {
262   -
263   - RemoveDllDirectory = (BOOL WINAPI (*)(HANDLE)) GetProcAddress(kernel,"RemoveDllDirectory");
264   - if(RemoveDllDirectory) {
265   -
266   - for(size_t f = 0; f < G_N_ELEMENTS(dlldir); f++) {
267   -
268   - if(dlldir[f].cookie) {
269   -
270   - RemoveDllDirectory(dlldir[f].cookie);
271   -
272   - }
273   - }
274   -
275   - }
276   -
277   - FreeLibrary(kernel);
278   -
279   - }
280   -
281   - if(!hModule) {
282   - return false;
283   - }
284   -
285   - // Consegui carregar a JVM, obtenho o método de controle
286   - jint JNICALL (*CreateJavaVM)(JavaVM **, void **, void *) = (jint JNICALL (*)(JavaVM **, void **, void *)) GetProcAddress(hModule,"JNI_CreateJavaVM");
287   -
288   - if(!CreateJavaVM) {
289   - failed(widget, _( "Can't load java virtual machine creation method" ), "%s", session::win32_strerror(GetLastError()).c_str());
290   - return false;
291   - }
292   -
293   - // Crio a JVM
294   - JavaVMInitArgs vm_args;
295   - JavaVMOption options[5];
296   -
297   - jint rc = 0;
298   -
299   - memset(&vm_args,0,sizeof(vm_args));
300   - memset(options,0,sizeof(options));
301   -
302   - vm_args.version = JNI_VERSION_1_4;
303   - vm_args.nOptions = 0;
304   - vm_args.options = options;
305   - vm_args.ignoreUnrecognized = JNI_FALSE;
306   -
307   - options[vm_args.nOptions].optionString = g_strdup("vfprintf");
308   - options[vm_args.nOptions].extraInfo = (void *) jni_vfprintf;
309   - vm_args.nOptions++;
310   -
311   - gchar * exports = NULL;
312   - char buffer[1024];
313   - gchar * myDir;
314   -
315   - if(GetModuleFileName(NULL,buffer,sizeof(buffer)) < sizeof(buffer)) {
316   -
317   - gchar * ptr = strrchr(buffer,G_DIR_SEPARATOR);
318   - if(ptr) {
319   - *ptr = 0;
320   - myDir = g_strdup(buffer);
321   - } else {
322   - myDir = g_strdup(".");
323   - }
324   -
325   -
326   - } else {
327   -
328   - myDir = g_strdup(".");
329   -
330   - }
331   -
332   - debug("myDir=%s",myDir);
333   -
334   - exports = g_build_filename(myDir,"jvm-exports",NULL);
335   - g_mkdir_with_parents(exports,0777);
336   -
337   - lib3270_trace_event(v3270_get_session(widget),"java.class.path=%s",exports);
338   - lib3270_trace_event(v3270_get_session(widget),"java.library.path=%s",myDir);
339   -
340   - options[vm_args.nOptions++].optionString = g_strdup_printf("-Djava.class.path=%s",exports);
341   - options[vm_args.nOptions++].optionString = g_strdup_printf("-Djava.library.path=%s",myDir);
342   -
343   - g_free(myDir);
344   - g_free(exports);
345   -
346   - rc = CreateJavaVM(&jvm,(void **)&env,&vm_args);
347   - if(rc < 0) {
348   - failed(widget, _( "Can't create java VM" ), _( "The error code was %d" ), (int) rc);
349   - jvm = NULL;
350   - }
351   -
352   - for(int f=0;f<vm_args.nOptions;f++) {
353   - trace("Releasing option %d: %s",f,options[f].optionString);
354   - g_free(options[f].optionString);
355   - }
356   -
357   -
358   - return jvm != NULL;
359   -
360   - }
361   -
362   -
363   -
364   -#else
365   -
366   - bool java::load_jvm(GtkWidget *widget) {
367   -
368   - if(jvm != NULL) {
369   - return true;
370   - }
371   -
372   - // Start JNI
373   - JavaVMInitArgs vm_args;
374   - JavaVMOption options[5];
375   - jint rc = 0;
376   -
377   -
378   - memset(&vm_args,0,sizeof(vm_args));
379   - memset(options,0,sizeof(options));
380   -
381   - vm_args.version = JNI_VERSION_1_4;
382   - vm_args.nOptions = 0;
383   - vm_args.options = options;
384   - vm_args.ignoreUnrecognized = JNI_FALSE;
385   -
386   - options[vm_args.nOptions].optionString = g_strdup("vfprintf");
387   - options[vm_args.nOptions].extraInfo = (void *) jni_vfprintf;
388   - vm_args.nOptions++;
389   -
390   -#if defined(DEBUG)
391   -
392   -// options[vm_args.nOptions++].optionString = g_strdup("-verbose");
393   - options[vm_args.nOptions++].optionString = g_strdup_printf("-Djava.library.path=.bin/Debug:.bin/Debug/lib:%s",JNIDIR);
394   - options[vm_args.nOptions++].optionString = g_strdup_printf("-Djava.class.path=./src/java:.bin/java:%s",JARDIR);
395   -
396   -#else
397   -
398   - options[vm_args.nOptions++].optionString = g_strdup_printf("-Djava.library.path=%s",JNIDIR);
399   - options[vm_args.nOptions++].optionString = g_strdup_printf("-Djava.class.path=%s",JARDIR);
400   -
401   -#endif // JNIDIR
402   -
403   - // Linux, just create JVM
404   - rc = JNI_CreateJavaVM(&jvm,(void **)&env,&vm_args);
405   -
406   - if(rc) {
407   - jvm = NULL;
408   - failed(widget, _( "Can't create java virtual machine" ), _( "The return code was %d" ), (int) rc);
409   - }
410   -
411   - return jvm != NULL;
412   - }
413   -
414   -
415   -#endif // WIN32
416   -
417   - }
418   -
419   -
src/java/terminal.java
... ... @@ -1,479 +0,0 @@
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 terminal.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   - // Is native library loaded?
35   - private static boolean loaded = false;
36   -
37   - // lib3270's session handle
38   - private long nativeHandle;
39   -
40   - // Init/Deinit
41   - private native int init();
42   - private native int init(String id);
43   - private native int deinit();
44   -
45   - /**
46   - * Wait for an specified amount of time.
47   - * <p>
48   - * Wait for the specified time keeping the main loop active.
49   - *
50   - * @param seconds Number of seconds to wait.
51   - *
52   - */
53   - public native int wait(int seconds);
54   -
55   - /**
56   - * Wait for terminal negociation.
57   - * <p>
58   - * Wait on a loop until the terminal contents are
59   - * ready for reading.
60   - *
61   - * @param seconds Maximum time (in seconds) to wait for.
62   - *
63   - * @return 0 for success, error code if not.
64   - *
65   - */
66   - public native int wait_for_ready(int seconds);
67   -
68   - /**
69   - * Wait for text at defined position
70   - *
71   - * @param row Row for text to compare.
72   - * @param col Column for text to compare.
73   - * @param text String to compare.
74   - * @param seconds Maximum time (in seconds) to wait for.
75   - *
76   - * @return 0 for success, error code if not.
77   - *
78   - */
79   - public native int wait_for_string_at(int row, int col, String text, int seconds);
80   -
81   - /**
82   - * Get the current lib3270 version.
83   - *
84   - * @return String with the current lib3270 version.
85   - *
86   - */
87   - public native String get_version();
88   -
89   - /**
90   - * Get the current lib3270 revision.
91   - *
92   - * @return String with the current lib3270 revision.
93   - *
94   - */
95   - public native String get_revision();
96   -
97   - /**
98   - * Get the current lib3270 encoding.
99   - *
100   - * @return String with the current lib3270 encoding (ISO-8859-1).
101   - *
102   - */
103   - public native String get_encoding();
104   -
105   - // Get/Set/Text with charset translation
106   -
107   - /**
108   - * Get terminal contents starting at desired address.
109   - *
110   - * @param baddr Address of the beginning of the string.
111   - * @param len Length of the string.
112   - *
113   - * @return Terminal contents with "len" bytes starting at "baddr" position.
114   - *
115   - */
116   - public native String get_string(int baddr, int len);
117   -
118   - /**
119   - * Get terminal contents starting at row, col.
120   - *
121   - * @param row Row of the text.
122   - * @param col Column of the text.
123   - * @param sz Size to read.
124   - *
125   - * @return Contents of terminal at row, col with sz bytes.
126   - *
127   - */
128   - public native String get_string_at(int row, int col, int sz);
129   -
130   - /**
131   - * Set terminal contents at position.
132   - *
133   - * @param row Row for starting of change.
134   - * @param col Column for starting of change.
135   - * @param str Text to set.
136   - *
137   - * @return 0 if ok, error code if not.
138   - *
139   - */
140   - public native int set_string_at(int row, int col, String str);
141   -
142   - /**
143   - * Compare terminal contents.
144   - *
145   - * @param row Row for text to compare.
146   - * @param col Column for text to compare.
147   - * @param text String to compare.
148   - *
149   - * @return result of strcmp() from text and terminal contents.
150   - *
151   - */
152   - public native int cmp_string_at(int row, int col, String text);
153   -
154   -
155   - public native int input_string(String str);
156   -
157   - // Cursor management
158   -
159   - /**
160   - * Move cursor to selected position.
161   - *
162   - * @param row Row of the new cursor position.
163   - * @param col Column of the new cursor position.
164   - *
165   - * @return Address of current cursor position.
166   - *
167   - */
168   - public native int set_cursor_position(int row, int col);
169   -
170   - /**
171   - * Set cursor offset in the terminal buffer.
172   - *
173   - * @param addr New cursor offset.
174   - *
175   - * @return Original cursor offset.
176   - *
177   - */
178   - public native int set_cursor_addr(int addr);
179   -
180   - /**
181   - * Get cursor offset
182   - *
183   - * @return Current cursor offset.
184   - *
185   - */
186   - public native int get_cursor_addr();
187   -
188   - // Keyboard actions
189   -
190   - /**
191   - * Send an "ENTER" action.
192   - *
193   - * @return reserved.
194   - *
195   - */
196   - public native int enter();
197   -
198   - /**
199   - * Send a pfkey to host.
200   - *
201   - * @param key PFkey number.
202   - *
203   - * @return reserved.
204   - *
205   - */
206   - public native int pfkey(int key);
207   -
208   - /**
209   - * Send a pakey to host.
210   - *
211   - * @param key PFkey number.
212   - *
213   - * @return reserved.
214   - *
215   - */
216   - public native int pakey(int key);
217   -
218   - // Actions
219   -
220   - /**
221   - * quit remote pw3270 window.
222   - * <p>
223   - * Only valid if connected to a remote window
224   - *
225   - * @return reserved.
226   - *
227   - */
228   - public native int quit();
229   -
230   - public native int erase();
231   - public native int erase_eol();
232   - public native int erase_input();
233   -
234   -
235   - /**
236   - * Erase from cursor position until the end of the field.
237   - *
238   - * @return reserved.
239   - *
240   - */
241   - public native int erase_eof();
242   -
243   -
244   - /**
245   - * Open print dialog.
246   - * <p>
247   - * Only valid if connected to a remote window
248   - *
249   - * @return reserved
250   - *
251   - */
252   - public native int print();
253   -
254   - // Connect/Disconnect
255   -
256   - /**
257   - * Connect to 3270 host.
258   - * <p>
259   - * Connect to the 3270 host
260   - * <p>
261   - * URI formats:
262   - * <ul>
263   - * <li>tn3270://[HOSTNAME]:[HOSTPORT] for non SSL connections.</li>
264   - * <li>tn3270s://[HOSTNAME]:[HOSTPORT] for ssl connection.</li>
265   - * </ul>
266   - *
267   - * @param host Host URI.
268   - * @param seconds How many seconds to wait for a connection.
269   - *
270   - * @return 0 if ok, error code if not.
271   - *
272   - */
273   - public native int connect(String host, int seconds);
274   -
275   - /**
276   - * Disconnect from host.
277   - *
278   - * @return 0 if ok, error code if not.
279   - *
280   - */
281   - public native int disconnect();
282   -
283   - /**
284   - * Load native module.
285   - *
286   - */
287   - private synchronized void load() {
288   -
289   - if(!loaded) {
290   - System.loadLibrary("jni3270");
291   - loaded = true;
292   - }
293   -
294   - }
295   -
296   - /**
297   - * Creates a tn3270 terminal without associating it
298   - * with any pw3270 window.
299   - *
300   - */
301   - public terminal() {
302   -
303   - load();
304   - init();
305   -
306   - }
307   -
308   - /**
309   - * Get the field start address.
310   - *
311   - * @param baddr address of the field.
312   - *
313   - * @return Address of current field start.
314   - *
315   - */
316   - public native int get_field_start(int baddr);
317   -
318   - /**
319   - * Get the current field start address.
320   - *
321   - * @return Current field start address.
322   - *
323   - */
324   - public int get_field_start() {
325   - return get_field_start(-1);
326   - }
327   -
328   - /**
329   - * Get the field length.
330   - *
331   - * @param baddr Address of the field.
332   - *
333   - * @return Field length.
334   - *
335   - */
336   - public native int get_field_len(int baddr);
337   -
338   - /**
339   - * Get the current field length.
340   - *
341   - * @return Current field length.
342   - *
343   - */
344   - public int get_field_len() {
345   - return get_field_len(-1);
346   - }
347   -
348   - /**
349   - * Get next field address from informed position.
350   - *
351   - * @param baddr Field address.
352   - *
353   - * @return Address of the next field.
354   - *
355   - */
356   - public native int get_next_unprotected(int baddr);
357   -
358   - /**
359   - * Check if the address is protected.
360   - *
361   - * @param baddr Field address.
362   - *
363   - * @return Protect state.
364   - *
365   - */
366   - public native int get_is_protected(int baddr);
367   -
368   - /**
369   - * Check if the address is protected.
370   - *
371   - * @param row Screen row.
372   - * @param col Screen col.
373   - *
374   - * @return Protect state.
375   - *
376   - */
377   - public native int get_is_protected_at(int row, int col);
378   -
379   - /**
380   - * Get next field address.
381   - *
382   - * @return Address of the next field.
383   - *
384   - */
385   - public int get_next_unprotected() {
386   - return get_next_unprotected(-1);
387   - }
388   -
389   - /**
390   - * Open popup dialog.
391   - *
392   - * @param id Dialog type.
393   - * @param title Window title.
394   - * @param message Dialog message.
395   - * @param secondary Dialog secondary text.
396   - *
397   - * @return reserved.
398   - *
399   - */
400   - public native int popup_dialog(int id, String title, String message, String secondary);
401   -
402   - /**
403   - * Launch a lib3270 action by name.
404   - *
405   - * @param name Name of the action to fire.
406   - *
407   - * @return Return code of the action call.
408   - *
409   - */
410   - public native int action(String name);
411   -
412   - /**
413   - * File selection dialog.
414   - *
415   - * @param action Dialog action.
416   - * @param title Window title.
417   - * @param extension File extension.
418   - * @param filename Default file name;
419   - *
420   - * @return Selected file name.
421   - *
422   - */
423   - public native String file_chooser_dialog(int action, String title, String extension, String filename);
424   -
425   - public native int set_copy(String text);
426   - public native String get_copy();
427   -
428   - public native String get_clipboard();
429   - public native int set_clipboard(String text);
430   -
431   - public native boolean is_connected();
432   - public native boolean is_ready();
433   -
434   - /**
435   - * Set unlock delay in milliseconds.
436   - *
437   - * Overrides the default value for the unlock delay (the delay between the host unlocking the
438   - * keyboard and lib3270 actually performing the unlock).
439   - *
440   - * The value is in milliseconds; use 0 to turn off the delay completely.
441   - *
442   - * @param ms Delay in milliseconds.
443   - *
444   - */
445   - public native void set_unlock_delay(int ms);
446   -
447   - public native void log(String msg);
448   -
449   - /**
450   - * Get Screen contents.
451   - *
452   - */
453   - public native String toString();
454   -
455   - /**
456   - * Get connection SSL state
457   - *
458   - * @return State of SSL connection (0 = Unsafe, 1 = Valid CA, 2 = Invalid CA or self-signed, 3 = Negotiating, 4 = Undefined)
459   - *
460   - */
461   - public native int get_secure();
462   -
463   - /**
464   - * Creates a tn3270 terminal associated with a
465   - * pw3270 window.
466   - *
467   - * @param id String identifying the target window ("pw3270:a") or "" to run without window.
468   - *
469   - */
470   - public terminal(String id) {
471   - load();
472   - init(id);
473   - }
474   -
475   - protected void finalize( ) throws Throwable {
476   - deinit();
477   - }
478   -
479   -};
src/java/testprogram.java
... ... @@ -1,54 +0,0 @@
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   -import pw3270.*;
31   -
32   -public class testprogram
33   -{
34   - public static void main (String[] args)
35   - {
36   - try
37   - {
38   - System.err.println("Begin");
39   -
40   - terminal host = new terminal();
41   -
42   - host.log("Sample message");
43   -
44   - System.err.println("pw3270 version " + host.get_version() + " revision " + host.get_revision() + " encoding " + host.get_encoding());
45   - System.err.println("SSL state is " + host.get_secure());
46   -
47   - System.err.println("End");
48   - }
49   - catch( Exception e )
50   - {
51   - System.err.println(e);
52   - }
53   - }
54   -};
src/loffice/Makefile.in
... ... @@ -1,263 +0,0 @@
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=info.cc get.cc set.cc service.cc init.cc connect.cc
29   -
30   -UNO_CLASSES= /com/sun/star/uno/XWeak \
31   - /com/sun/star/uno/RuntimeException \
32   - /com/sun/star/lang/WrappedTargetException
33   -
34   -
35   -#---[ LibreOffice SDK ]--------------------------------------------------------
36   -
37   -OO_SDK_HOME=@OO_SDK_HOME@
38   -OO_SDK_URE_HOME=@OO_SDK_URE_HOME@
39   -
40   -UNO=@UNO@
41   -UNOPKG=@UNOPKG@
42   -IDLC=@IDLC@
43   -REGMERGE=@REGMERGE@
44   -CPPUMAKER=@CPPUMAKER@
45   -CONVERT=@CONVERT@
46   -ZIP=@ZIP@
47   -
48   -TYPES_RDB=@OO_TYPES@
49   -
50   -#---[ Paths ]------------------------------------------------------------------
51   -
52   -prefix=@prefix@
53   -exec_prefix=@exec_prefix@
54   -bindir=@bindir@
55   -sbindir=@sbindir@
56   -libdir=@libdir@
57   -includedir=@includedir@
58   -instdir=$(DESTDIR)/$(libdir)/libreoffice/share/extensions/$(PACKAGE_NAME)
59   -
60   -#---[ Tools ]------------------------------------------------------------------
61   -
62   -CXX=@CXX@
63   -MKDIR=@MKDIR_P@
64   -INSTALL=@INSTALL@
65   -INSTALL_DATA=@INSTALL_DATA@
66   -INSTALL_PROGRAM=@INSTALL_PROGRAM@
67   -
68   -#---[ Paths ]------------------------------------------------------------------
69   -
70   -OBJDIR ?= .obj
71   -BINDIR ?= .bin
72   -RDBDIR ?= .rdb
73   -URDDIR ?= .urd
74   -
75   -OBJDBG ?= $(OBJDIR)/Debug
76   -BINDBG ?= $(BINDIR)/Debug
77   -
78   -OBJRLS ?= $(OBJDIR)/Release
79   -BINRLS ?= $(BINDIR)/Release
80   -
81   -#---[ lib3270 common class ]---------------------------------------------------
82   -
83   -DEBUG_CFLAGS=-DDEBUG=1 -g -Wall
84   -PW3270_CFLAGS=-I../include
85   -CLASSLIBDIR=../classlib
86   -include $(CLASSLIBDIR)/class.mak
87   -
88   -#---[ Build options ]----------------------------------------------------------
89   -
90   -CXXFLAGS=@CXXFLAGS@ @OO_CXXFLAGS@ -I../include -I./include -DLANGUAGE_BINDING_NAME=\"gcc3\"
91   -
92   -OO_LDFLAGS=-L$(OO_SDK_HOME)/lib -L$(OO_SDK_URE_HOME)/lib \
93   - -Wl,-rpath-link=$(OO_SDK_URE_HOME)/lib,-rpath=$(OO_SDK_URE_HOME)/lib \
94   - @OO_LDFLAGS@
95   -
96   -#---[ Rules ]------------------------------------------------------------------
97   -
98   -$(URDDIR)/%.urd: %.idl
99   - @echo " IDLC `basename $@`"
100   - @$(MKDIR) `dirname $@`
101   - @$(IDLC) -w -C -I$(OO_SDK_HOME)/idl -O`dirname $@` $<
102   -
103   -$(URDDIR)/%.urd: @IDLDIR@/%.idl
104   - @echo " IDLC `basename $@`"
105   - @$(MKDIR) `dirname $@`
106   - @$(IDLC) -w -C -I$(OO_SDK_HOME)/idl -O`dirname $@` $<
107   -
108   -$(RDBDIR)/%.rdb: $(URDDIR)/%.urd
109   - @echo " REGM `basename $@`"
110   - @$(MKDIR) `dirname $@`
111   - @$(REGMERGE) $@ /UCR $<
112   -
113   -include/%.hpp: $(RDBDIR)/%.rdb
114   - @echo " CPPU `basename $@`"
115   - @$(MKDIR) `dirname $@`
116   - @$(CPPUMAKER) -O./include $(TYPES_RDB) $<
117   -
118   -$(OBJDBG)/%.o: %.cc include/$(PACKAGE_NAME)/lib3270.hpp \
119   - $(foreach CLS, $(UNO_CLASSES), include/$(CLS).hpp) \
120   - globals.hpp \
121   - Makefile
122   - @echo " CC `basename $@`"
123   - @mkdir -p `dirname $@`
124   - @$(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $<
125   -
126   -$(OBJRLS)/%.o: %.cc include/$(PACKAGE_NAME)/lib3270.hpp \
127   - $(foreach CLS, $(UNO_CLASSES), include/$(CLS).hpp) \
128   - globals.hpp \
129   - Makefile
130   - @echo " CC `basename $@`"
131   - @mkdir -p `dirname $@`
132   - @$(CXX) -DNDEBUG=1 $(CXXFLAGS) -o $@ -c $<
133   -
134   -#---[ UNO targets ]------------------------------------------------------------
135   -
136   -include/$(PACKAGE_NAME)/lib3270.hpp: $(RDBDIR)/$(PACKAGE_NAME).rdb
137   - @echo " CPPU `basename $@`"
138   - @$(MKDIR) `dirname $@`
139   - @$(CPPUMAKER) -O./include -T$(PACKAGE_NAME).lib3270 $(TYPES_RDB) $<
140   -
141   -#---[ Release targets ]--------------------------------------------------------
142   -
143   -all: $(BINDIR)/$(PACKAGE_NAME).oxt
144   -
145   -Release: include/$(PACKAGE_NAME)/lib3270.hpp \
146   - $(foreach CLS, $(UNO_CLASSES), include/$(CLS).hpp) \
147   - $(RDBDIR)/$(PACKAGE_NAME).rdb \
148   - $(BINDIR)/$(PACKAGE_NAME).oxt
149   -
150   -install: $(BINRLS)/$(PACKAGE_NAME).uno@DLLEXT@ \
151   - $(RDBDIR)/$(PACKAGE_NAME).rdb \
152   - description.xml \
153   - manifest.xml \
154   - description.txt
155   - @$(MKDIR) $(instdir)
156   - @$(MKDIR) $(instdir)/META-INF
157   - @$(INSTALL_DATA) manifest.xml $(instdir)/META-INF
158   -
159   - @$(INSTALL_DATA) description.xml $(instdir)
160   - @$(INSTALL_DATA) description.txt $(instdir)
161   -
162   - @$(INSTALL_PROGRAM) $(BINRLS)/$(PACKAGE_NAME).uno@DLLEXT@ $(instdir)
163   - @$(INSTALL_DATA) $(RDBDIR)/$(PACKAGE_NAME).rdb $(instdir)
164   -
165   - @$(CONVERT) ../$(PACKAGE_NAME)/pixmaps/$(PACKAGE_NAME).svg --format=png > $(instdir)/$(PACKAGE_NAME).png
166   - @chmod 644 $(instdir)/$(PACKAGE_NAME).png
167   -
168   -$(BINDIR)/$(PACKAGE_NAME).oxt: \
169   - $(BINRLS)/$(PACKAGE_NAME).uno@DLLEXT@ \
170   - $(RDBDIR)/$(PACKAGE_NAME).rdb \
171   - description.xml \
172   - manifest.xml \
173   - description.txt
174   - @rm -f $@
175   - @$(MKDIR) `dirname $@`
176   -
177   - @$(MKDIR) $(BINRLS)/$(PACKAGE).oxt.tmp
178   -
179   - @cp $(RDBDIR)/$(PACKAGE_NAME).rdb $(BINRLS)/$(PACKAGE).oxt.tmp
180   - @cp $(BINRLS)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINRLS)/$(PACKAGE).oxt.tmp
181   -
182   - @$(MKDIR) $(BINRLS)/$(PACKAGE).oxt.tmp/META-INF
183   - @cp manifest.xml $(BINRLS)/$(PACKAGE).oxt.tmp/META-INF
184   -
185   - @cp description.xml $(BINRLS)/$(PACKAGE).oxt.tmp
186   - @cp description.txt $(BINRLS)/$(PACKAGE).oxt.tmp
187   -
188   - @$(CONVERT) ../$(PACKAGE_NAME)/pixmaps/$(PACKAGE_NAME).svg --format=png > $(BINRLS)/$(PACKAGE).oxt.tmp/$(PACKAGE_NAME).png
189   -
190   - @cd $(BINRLS)/$(PACKAGE).oxt.tmp ; $(ZIP) -r -m ../$(PACKAGE_NAME).oxt .
191   - @rm -fr $(BINRLS)/$(PACKAGE).oxt.tmp
192   - @echo $@ Ok.
193   -
194   -$(BINRLS)/$(PACKAGE_NAME).uno@DLLEXT@: \
195   - $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC)@OBJEXT@) \
196   - $(CLASS_RELEASE_OBJECTS)
197   - @echo " LD `basename $@`"
198   - @$(MKDIR) `dirname $@`
199   - @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) $(OO_LDFLAGS) $(CLASS_LIBS) -o $@ $^
200   -
201   -
202   -#---[ Debug targets ]----------------------------------------------------------
203   -
204   -Debug: $(BINDBG)/$(PACKAGE_NAME).oxt
205   -
206   -run: $(BINDBG)/$(PACKAGE_NAME).oxt
207   - @SHARED=false $(UNOPKG) add --verbose --force $(BINDBG)/$(PACKAGE_NAME).oxt
208   - @libreoffice testmacros.odt
209   - @SHARED=false $(UNOPKG) remove $(PACKAGE_NAME)
210   -
211   -add: $(BINDBG)/$(PACKAGE_NAME).oxt
212   - @SHARED=false $(UNOPKG) add --verbose --force $(BINDBG)/$(PACKAGE_NAME).oxt
213   -
214   -$(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@: \
215   - $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) \
216   - $(CLASS_DEBUG_OBJECTS)
217   - @echo " LD `basename $@`"
218   - @$(MKDIR) `dirname $@`
219   - @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) $(OO_LDFLAGS) $(CLASS_LIBS) -o $@ $^
220   -
221   -
222   -$(BINDBG)/$(PACKAGE_NAME).oxt: \
223   - $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ \
224   - $(RDBDIR)/$(PACKAGE_NAME).rdb \
225   - description.xml \
226   - manifest.xml \
227   - description.txt
228   - @rm -f $@
229   - @$(MKDIR) `dirname $@`
230   -
231   - @$(MKDIR) $(BINDBG)/$(PACKAGE).oxt.tmp
232   -
233   - @cp $(RDBDIR)/$(PACKAGE_NAME).rdb $(BINDBG)/$(PACKAGE).oxt.tmp
234   - @cp $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINDBG)/$(PACKAGE).oxt.tmp
235   -
236   - @$(MKDIR) $(BINDBG)/$(PACKAGE).oxt.tmp/META-INF
237   - @cp manifest.xml $(BINDBG)/$(PACKAGE).oxt.tmp/META-INF
238   -
239   - @cp description.xml $(BINDBG)/$(PACKAGE).oxt.tmp
240   - @cp description.txt $(BINDBG)/$(PACKAGE).oxt.tmp
241   -
242   - @$(CONVERT) ../$(PACKAGE_NAME)/pixmaps/$(PACKAGE_NAME).svg --format=png > $(BINDBG)/$(PACKAGE).oxt.tmp/$(PACKAGE_NAME).png
243   -
244   - @cp $(BINDBG)/$(PACKAGE_NAME).uno@DLLEXT@ $(BINDBG)/$(PACKAGE_NAME).oxt.tmp
245   - @cd $(BINDBG)/$(PACKAGE).oxt.tmp ; $(ZIP) -r -m ../$(PACKAGE_NAME).oxt .
246   - @rm -fr $(BINDBG)/$(PACKAGE).oxt.tmp
247   - @echo $@ Ok.
248   -
249   -
250   -#---[ Misc targets ]-----------------------------------------------------------
251   -
252   -cleanDebug: clean
253   -
254   -clean:
255   - @rm -f *.urd
256   - @rm -fr $(RDBDIR)
257   - @rm -fr $(URDDIR)
258   - @rm -fr include
259   - @rm -f *.rdb
260   - @rm -fr $(OBJDIR)
261   - @rm -fr $(BINDIR)
262   -
263   -
src/loffice/connect.cc
... ... @@ -1,175 +0,0 @@
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 connect.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   -
31   - #include "globals.hpp"
32   - #include "pw3270/lib3270.hpp"
33   - #include <exception>
34   - #include <com/sun/star/uno/RuntimeException.hdl>
35   -
36   -/*---[ Implement ]-----------------------------------------------------------------------------------------*/
37   -
38   - using namespace pw3270_impl;
39   -
40   -/*
41   -::sal_Int16 SAL_CALL session_impl::Reconnect() throw (::com::sun::star::uno::RuntimeException)
42   - {
43   - trace("%s: hSession=%p",__FUNCTION__,hSession);
44   -
45   - try
46   - {
47   - if(!hSession)
48   - hSession = h3270::session::get_default();
49   -
50   - return hSession->connect();
51   -
52   - } catch(std::exception &e)
53   - {
54   - trace("%s failed: %s",__FUNCTION__,e.what());
55   -
56   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
57   -
58   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
59   -
60   - }
61   -
62   - return -1;
63   -
64   -
65   - }
66   -*/
67   -
68   - ::sal_Int16 SAL_CALL session_impl::Connect(const ::rtl::OUString& url, ::sal_Bool wait) throw (::com::sun::star::uno::RuntimeException)
69   - {
70   - trace("%s: hSession=%p",__FUNCTION__,hSession);
71   -
72   - OString vlr = rtl::OUStringToOString( url , RTL_TEXTENCODING_UNICODE );
73   -
74   - try
75   - {
76   - if(!hSession)
77   - hSession = h3270::session::get_default();
78   -
79   - return hSession->connect(vlr.getStr(),wait);
80   -
81   - } catch(std::exception &e)
82   - {
83   - trace("%s failed: %s",__FUNCTION__,e.what());
84   -
85   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
86   -
87   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
88   -
89   - }
90   -
91   - return -1;
92   -
93   -
94   - }
95   -
96   - ::sal_Int16 SAL_CALL session_impl::Disconnect() throw (::com::sun::star::uno::RuntimeException)
97   - {
98   - try
99   - {
100   - CHECK_SESSION_HANDLE
101   -
102   - return hSession->disconnect();
103   -
104   - } catch(std::exception &e)
105   - {
106   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
107   -
108   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
109   -
110   - }
111   -
112   - return -1;
113   -
114   - }
115   -
116   - ::sal_Bool SAL_CALL session_impl::isConnected() throw (::com::sun::star::uno::RuntimeException)
117   - {
118   - try
119   - {
120   - CHECK_SESSION_HANDLE
121   -
122   - return hSession->is_connected();
123   -
124   - } catch(std::exception &e)
125   - {
126   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
127   -
128   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
129   -
130   - }
131   -
132   - return -1;
133   - }
134   -
135   - ::sal_Bool SAL_CALL session_impl::isReady() throw (::com::sun::star::uno::RuntimeException)
136   - {
137   - try
138   - {
139   - CHECK_SESSION_HANDLE
140   -
141   - return hSession->is_ready();
142   -
143   - } catch(std::exception &e)
144   - {
145   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
146   -
147   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
148   -
149   - }
150   -
151   - return -1;
152   -
153   - }
154   -
155   - ::sal_Int16 SAL_CALL session_impl::waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException)
156   - {
157   - try
158   - {
159   - CHECK_SESSION_HANDLE
160   -
161   - return hSession->wait_for_ready(seconds);
162   -
163   - } catch(std::exception &e)
164   - {
165   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
166   -
167   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
168   -
169   - }
170   -
171   - return -1;
172   -
173   - }
174   -
175   -
src/loffice/description.txt
... ... @@ -1,2 +0,0 @@
1   -Uno/OpenOffice library allowing 3270 access from StarBasic
2   -
src/loffice/description.xml.in
... ... @@ -1,30 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<description xmlns="http://openoffice.org/extensions/description/2006"
3   -xmlns:d="http://openoffice.org/extensions/description/2006"
4   -xmlns:xlink="http://www.w3.org/1999/xlink">
5   -
6   - <version value="@PACKAGE_VERSION@" />
7   -
8   - <identifier value="@PACKAGE_NAME@" />
9   -
10   - <platform value="linux_@host_cpu@" />
11   -
12   - <dependencies>
13   - <OpenOffice.org-minimal-version value="2.2" d:name="OpenOffice.org 2.2"/>
14   - </dependencies>
15   -
16   - <display-name>
17   - <name lang="en">3270 access extension</name>
18   - </display-name>
19   -
20   - <icon>
21   - <default xlink:href="@PACKAGE_NAME@.png" />
22   - </icon>
23   -
24   - <extension-description>
25   - <src xlink:href="description.txt" lang="en" />
26   - </extension-description>
27   -
28   -
29   -
30   -</description>
src/loffice/get.cc
... ... @@ -1,156 +0,0 @@
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 get.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   - * Referência:
29   - *
30   - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes
31   - *
32   - */
33   -
34   - #include "globals.hpp"
35   - #include <lib3270/config.h>
36   - #include "pw3270/lib3270.hpp"
37   -
38   -/*---[ Implement ]-----------------------------------------------------------------------------------------*/
39   -
40   - using namespace pw3270_impl;
41   -
42   - ::rtl::OUString session_impl::getVersion() throw (RuntimeException)
43   - {
44   - trace("%s: hSession=%p",__FUNCTION__,hSession);
45   - return OUString( RTL_CONSTASCII_USTRINGPARAM(PACKAGE_VERSION) );
46   - }
47   -
48   - ::rtl::OUString session_impl::getRevision() throw (RuntimeException)
49   - {
50   - trace("%s: hSession=%p",__FUNCTION__,hSession);
51   - return OUString( RTL_CONSTASCII_USTRINGPARAM(PACKAGE_REVISION) );
52   - }
53   -
54   - ::rtl::OUString SAL_CALL session_impl::getTextAt( ::sal_Int16 row, ::sal_Int16 col, ::sal_Int16 size ) throw (::com::sun::star::uno::RuntimeException)
55   - {
56   - string s;
57   -
58   - try
59   - {
60   - CHECK_SESSION_HANDLE
61   - s = hSession->get_text_at(row,col,size);
62   -
63   - } catch(std::exception &e)
64   - {
65   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
66   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
67   - }
68   -
69   - return OUString(s.c_str(), s.length(), encoding, RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
70   - }
71   -
72   - ::sal_Int16 SAL_CALL session_impl::waitForTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str, ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException)
73   - {
74   - try
75   - {
76   - CHECK_SESSION_HANDLE
77   - OString vlr = rtl::OUStringToOString(str,encoding);
78   - return hSession->wait_for_text_at(row,col,vlr.getStr(),seconds);
79   -
80   - } catch(std::exception &e)
81   - {
82   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
83   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
84   - }
85   -
86   - return -1;
87   -
88   - }
89   -
90   - ::sal_Int32 SAL_CALL session_impl::getCursorAddress() throw (::com::sun::star::uno::RuntimeException)
91   - {
92   - try
93   - {
94   - CHECK_SESSION_HANDLE
95   - return hSession->get_cursor_addr();
96   -
97   - } catch(std::exception &e)
98   - {
99   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
100   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
101   - }
102   -
103   - return -1;
104   -
105   - }
106   -
107   - ::sal_Int32 SAL_CALL session_impl::getFieldStart( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException)
108   - {
109   - try
110   - {
111   - CHECK_SESSION_HANDLE
112   - return hSession->get_field_start(addr);
113   -
114   - } catch(std::exception &e)
115   - {
116   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
117   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
118   - }
119   -
120   - return -1;
121   -
122   - }
123   -
124   - ::sal_Int32 SAL_CALL session_impl::getFieldLen( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException)
125   - {
126   - try
127   - {
128   - CHECK_SESSION_HANDLE
129   - return hSession->get_field_len(addr);
130   -
131   - } catch(std::exception &e)
132   - {
133   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
134   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
135   - }
136   -
137   - return -1;
138   -
139   - }
140   -
141   - ::sal_Int32 SAL_CALL session_impl::getNextUnprotected( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException)
142   - {
143   - try
144   - {
145   - CHECK_SESSION_HANDLE
146   - return hSession->get_next_unprotected(addr);
147   -
148   - } catch(std::exception &e)
149   - {
150   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
151   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
152   - }
153   -
154   - return -1;
155   -
156   - }
src/loffice/globals.hpp
... ... @@ -1,151 +0,0 @@
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 globals.hpp 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 de Mendonça)
27   - *
28   - * Referências:
29   - *
30   - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/C%2B%2B_Component
31   - *
32   - *
33   - */
34   -
35   -#ifndef PW3270_OXT_GLOBALS_HPP_INCLUDED
36   -
37   - #define PW3270_OXT_GLOBALS_HPP_INCLUDED 1
38   -
39   - #define CPPUENV "gcc3"
40   -
41   - #ifdef _WIN32
42   - #define SAL_W32
43   - #else
44   - #define UNX 1
45   - #define GCC 1
46   - #define LINUX 1
47   - #define HAVE_GCC_VISIBILITY_FEATURE 1
48   - #endif
49   -
50   -
51   - #include <cppuhelper/implbase4.hxx>
52   - #include <cppuhelper/factory.hxx>
53   - #include <com/sun/star/lang/XInitialization.hpp>
54   - #include <com/sun/star/lang/XServiceInfo.hpp>
55   - #include <com/sun/star/lang/XMain.hpp>
56   -
57   - #include <com/sun/star/uno/RuntimeException.hpp>
58   -
59   - #ifdef DEBUG
60   - #include <stdio.h>
61   - #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr);
62   - #else
63   - #define trace(x, ...) // __VA_ARGS__
64   - #endif
65   -
66   - #include <pw3270/lib3270.hpp>
67   - #include <pw3270/class.h>
68   -
69   - #define DLL_PUBLIC __attribute__((visibility("default")))
70   -
71   - #define CHECK_SESSION_HANDLE if(!hSession) hSession = h3270::session::get_default();
72   -
73   -
74   - using namespace ::rtl; // for OUString
75   - using namespace ::com::sun::star; // for sdk interfaces
76   - using namespace ::com::sun::star::lang; // for sdk interfaces
77   - using namespace ::com::sun::star::uno; // for basic types
78   - using namespace PW3270_NAMESPACE;
79   -
80   - namespace pw3270_impl
81   - {
82   - // https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes
83   - class DLL_PUBLIC session_impl : public ::cppu::WeakImplHelper4< ::pw3270::lib3270, XServiceInfo, XMain, XInitialization >
84   - {
85   - public:
86   -
87   - session_impl();
88   - virtual ~session_impl();
89   -
90   - // XMain
91   - virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aArguments ) throw (Exception);
92   -
93   - // XInitialization will be called upon createInstanceWithArguments[AndContext]()
94   - virtual void SAL_CALL initialize( Sequence< Any > const & args ) throw (Exception);
95   -
96   - // XServiceInfo
97   - virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
98   - virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName ) throw (RuntimeException);
99   - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
100   -
101   - // lib3270
102   - virtual ::rtl::OUString SAL_CALL getVersion() throw (RuntimeException);
103   - virtual ::rtl::OUString SAL_CALL getRevision() throw (RuntimeException);
104   - virtual ::sal_Int16 SAL_CALL iterate( ::sal_Bool wait ) throw (::com::sun::star::uno::RuntimeException);
105   -
106   - virtual ::sal_Int16 SAL_CALL setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException);
107   -
108   - virtual ::sal_Int16 SAL_CALL Connect( const ::rtl::OUString& url, ::sal_Bool wait) throw (::com::sun::star::uno::RuntimeException);
109   - virtual ::sal_Int16 SAL_CALL Disconnect() throw (::com::sun::star::uno::RuntimeException);
110   -
111   - // State
112   - virtual ::sal_Bool SAL_CALL isConnected() throw (::com::sun::star::uno::RuntimeException);
113   - virtual ::sal_Bool SAL_CALL isReady() throw (::com::sun::star::uno::RuntimeException);
114   -
115   - // Screen contents
116   - virtual ::rtl::OUString SAL_CALL getTextAt( ::sal_Int16 row, ::sal_Int16 col, ::sal_Int16 size ) throw (::com::sun::star::uno::RuntimeException);
117   - virtual ::sal_Int16 SAL_CALL setTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str ) throw (::com::sun::star::uno::RuntimeException);
118   - virtual ::sal_Int32 SAL_CALL getFieldStart( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException);
119   - virtual ::sal_Int32 SAL_CALL getFieldLen( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException);
120   - virtual ::sal_Int32 SAL_CALL getNextUnprotected( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException);
121   -
122   - // Wait
123   - virtual ::sal_Int16 SAL_CALL waitForReady( ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException);
124   - virtual ::sal_Int16 SAL_CALL waitForTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str, ::sal_Int16 seconds ) throw (::com::sun::star::uno::RuntimeException);
125   -
126   - // Actions
127   - virtual ::sal_Int16 SAL_CALL enter() throw (::com::sun::star::uno::RuntimeException);
128   - virtual ::sal_Int16 SAL_CALL pfkey( ::sal_Int16 key ) throw (::com::sun::star::uno::RuntimeException);
129   - virtual ::sal_Int16 SAL_CALL pakey( ::sal_Int16 key ) throw (::com::sun::star::uno::RuntimeException);
130   - virtual ::sal_Int16 SAL_CALL quit() throw (::com::sun::star::uno::RuntimeException);
131   - virtual ::sal_Int16 SAL_CALL eraseEOF() throw (::com::sun::star::uno::RuntimeException);
132   -
133   - // Cursor
134   - virtual ::sal_Int32 SAL_CALL setCursorAt( ::sal_Int16 row, ::sal_Int16 col ) throw (::com::sun::star::uno::RuntimeException);
135   - virtual ::sal_Int32 SAL_CALL setCursorAddress( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException);
136   - virtual ::sal_Int32 SAL_CALL getCursorAddress() throw (::com::sun::star::uno::RuntimeException);
137   -
138   - private:
139   - h3270::session * hSession;
140   - rtl_TextEncoding encoding;
141   -
142   - };
143   -
144   - extern Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl();
145   - extern OUString SAL_CALL getImplementationName_session_impl();
146   - extern Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () );
147   -
148   - };
149   -
150   -
151   -#endif // PW3270_OXT_GLOBALS_HPP_INCLUDED
src/loffice/info.cc
... ... @@ -1,58 +0,0 @@
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 info.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   - * Referência:
29   - *
30   - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes
31   - *
32   - */
33   -
34   - #include "globals.hpp"
35   - #include "pw3270/lib3270.hpp"
36   -
37   -/*---[ Implement ]-----------------------------------------------------------------------------------------*/
38   -
39   -using namespace pw3270_impl;
40   -
41   -// XServiceInfo implementation
42   -OUString session_impl::getImplementationName() throw (RuntimeException)
43   -{
44   - // unique implementation name
45   - return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.pw3270_impl.session") );
46   -}
47   -
48   -sal_Bool session_impl::supportsService( OUString const & serviceName ) throw (RuntimeException)
49   -{
50   - // this object only supports one service, so the test is simple
51   - return serviceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("pw3270.session") );
52   -}
53   -
54   -Sequence< OUString > session_impl::getSupportedServiceNames() throw (RuntimeException)
55   -{
56   - return getSupportedServiceNames_session_impl();
57   -}
58   -
src/loffice/init.cc
... ... @@ -1,121 +0,0 @@
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 init.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   - * Referência:
29   - *
30   - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Create_Instance_with_Arguments
31   - *
32   - */
33   -
34   - #include "globals.hpp"
35   - #include <com/sun/star/lang/IllegalArgumentException.hpp>
36   - #include "pw3270/lib3270.hpp"
37   -
38   -/*---[ Implement ]-----------------------------------------------------------------------------------------*/
39   -
40   -using namespace pw3270_impl;
41   -
42   -
43   -session_impl::session_impl()
44   -{
45   - this->hSession = NULL;
46   - this->encoding = RTL_TEXTENCODING_ISO_8859_1;
47   -}
48   -
49   -session_impl::~session_impl()
50   -{
51   - if(this->hSession)
52   - delete this->hSession;
53   -}
54   -
55   -
56   -// XInitialization implementation
57   -void session_impl::initialize( Sequence< Any > const & args ) throw (Exception)
58   -{
59   - /*
60   - if (1 != args.getLength())
61   - {
62   - throw lang::IllegalArgumentException(
63   - OUString( RTL_CONSTASCII_USTRINGPARAM("give a string instanciating this component!") ),
64   - (::cppu::OWeakObject *)this,
65   - 0 );
66   - }
67   - */
68   -
69   - trace("%s args=%d",__FUNCTION__,(int) args.getLength());
70   -
71   - // Process arguments
72   - for(int f = 0; f < args.getLength();f++)
73   - {
74   - trace("Arg(%d) is %s",f,args[f].getValueType().getTypeName().getStr());
75   -
76   - }
77   -
78   -
79   -}
80   -
81   -// XMain
82   -::sal_Int32 SAL_CALL session_impl::run( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aArguments ) throw (Exception)
83   -{
84   -
85   -
86   - return 0;
87   -}
88   -
89   -::sal_Int16 SAL_CALL session_impl::iterate( ::sal_Bool wait ) throw (::com::sun::star::uno::RuntimeException)
90   -{
91   - try
92   - {
93   - CHECK_SESSION_HANDLE
94   - return hSession->iterate(wait);
95   -
96   - } catch(std::exception &e)
97   - {
98   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
99   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
100   - }
101   - return -1;
102   -}
103   -
104   - ::sal_Int16 SAL_CALL session_impl::quit() throw (::com::sun::star::uno::RuntimeException)
105   - {
106   - try
107   - {
108   - CHECK_SESSION_HANDLE
109   - return hSession->quit();
110   - } catch(std::exception &e)
111   - {
112   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
113   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
114   - }
115   -
116   - return -1;
117   -
118   - }
119   -
120   -
121   -
src/loffice/loffice3270.cbp
... ... @@ -1,64 +0,0 @@
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 openOffice" />
6   - <Option makefile_is_custom="1" />
7   - <Option pch_mode="2" />
8   - <Option compiler="gcc" />
9   - <Build>
10   - <Target title="Debug">
11   - <Option output=".bin/Debug/pw3270 LibreOffice" prefix_auto="1" extension_auto="1" />
12   - <Option object_output=".obj/Debug/" />
13   - <Option type="1" />
14   - <Option compiler="gcc" />
15   - <Compiler>
16   - <Add option="-g" />
17   - </Compiler>
18   - </Target>
19   - <Target title="Release">
20   - <Option output=".bin/Release/pw3270 LibreOffice" prefix_auto="1" extension_auto="1" />
21   - <Option object_output=".obj/Release/" />
22   - <Option type="1" />
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="../../configure.ac" />
36   - <Unit filename="../classlib/Makefile.in" />
37   - <Unit filename="../classlib/class.mak" />
38   - <Unit filename="../classlib/class.mak.in" />
39   - <Unit filename="../classlib/exception.cc" />
40   - <Unit filename="../classlib/local.cc" />
41   - <Unit filename="../classlib/remote.cc" />
42   - <Unit filename="../classlib/session.cc" />
43   - <Unit filename="../include/pw3270/class.h" />
44   - <Unit filename="Makefile.in" />
45   - <Unit filename="connect.cc" />
46   - <Unit filename="get.cc" />
47   - <Unit filename="globals.hpp" />
48   - <Unit filename="include/pw3270/lib3270.hdl" />
49   - <Unit filename="include/pw3270/lib3270.hpp" />
50   - <Unit filename="info.cc" />
51   - <Unit filename="init.cc" />
52   - <Unit filename="manifest.xml.in" />
53   - <Unit filename="pw3270.idl" />
54   - <Unit filename="service.cc" />
55   - <Unit filename="set.cc" />
56   - <Unit filename="testprogram.cc" />
57   - <Extensions>
58   - <code_completion />
59   - <envvars />
60   - <debugger />
61   - <lib_finder disable_auto="1" />
62   - </Extensions>
63   - </Project>
64   -</CodeBlocks_project_file>
src/loffice/manifest.xml.in
... ... @@ -1,6 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<manifest:manifest>
3   -<manifest:file-entry manifest:media-type= "application/vnd.sun.star.uno-component;type=native;platform=Linux_@host_cpu@" manifest:full-path="@PACKAGE_NAME@.uno.so"/>
4   -<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB" manifest:full-path="@PACKAGE_NAME@.rdb"/>
5   -</manifest:manifest>
6   -
src/loffice/pw3270.idl
... ... @@ -1,97 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como pw3270.idl 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   - * Referências:
29   - *
30   - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C++/C++_Component
31   - *
32   - */
33   -
34   -#include <com/sun/star/uno/XInterface.idl>
35   -#include <com/sun/star/lang/XInitialization.idl>
36   -#include <com/sun/star/lang/XMain.idl>
37   -
38   -module pw3270
39   -{
40   - /*
41   - * Interface to lib3270
42   - */
43   - interface lib3270 : com::sun::star::uno::XInterface
44   - {
45   - // Constants
46   - string getVersion();
47   - string getRevision();
48   -
49   - // Host definition
50   - short Connect([in] string url, [in] boolean wait);
51   - short Disconnect();
52   - short iterate([in] boolean wait);
53   -
54   - // Screen contents
55   - string getTextAt([in] short row, [in] short col, [in] short size);
56   - short setTextAt([in] short row, [in] short col, [in] string str);
57   - short waitForTextAt([in] short row, [in] short col, [in] string str, [in] short seconds);
58   -
59   - // Cursor
60   - long setCursorAt([in] short row, [in] short col);
61   - long setCursorAddress([in] long addr);
62   - long getCursorAddress();
63   -
64   - // Field positioning
65   - long getFieldStart([in] long addr);
66   - long getFieldLen([in] long addr);
67   - long getNextUnprotected([in] long addr);
68   -
69   - // Keyboard actions
70   - short enter();
71   - short pfkey([in] short key);
72   - short pakey([in] short key);
73   -
74   - // Misc actions
75   - short quit();
76   - short eraseEOF();
77   -
78   - // Misc Settings
79   - short setSessionName([in] string name);
80   -
81   - // State
82   - boolean isConnected();
83   - boolean isReady();
84   -
85   - // Waiting
86   - short waitForReady([in] short seconds);
87   -
88   - };
89   -
90   - service session
91   - {
92   - interface lib3270;
93   - interface com::sun::star::lang::XInitialization;
94   - interface com::sun::star::lang::XMain;
95   - };
96   -};
97   -
src/loffice/research.sh
... ... @@ -1,44 +0,0 @@
1   -#!/bin/bash
2   -
3   -OO_SDK_HOME=/usr/lib64/libreoffice/sdk
4   -IDLC=/usr/lib64/libreoffice/sdk/bin/idlc
5   -CPPUMAKER=/usr/lib64/libreoffice/sdk/bin/cppumaker
6   -TYPES_RDB=/usr/lib64/libreoffice/ure/share/misc/types.rdb
7   -REGMERGE=/usr/lib64/libreoffice/ure/bin/regmerge
8   -
9   -$IDLC -C -I$OO_SDK_HOME/idl -O. pw3270.idl
10   -if [ "$?" != "0" ]; then
11   - exit -1
12   -fi
13   -
14   -
15   -$REGMERGE pw3270.rdb /UCR pw3270.urd
16   -if [ "$?" != "0" ]; then
17   - exit -1
18   -fi
19   -
20   -
21   -$CPPUMAKER -O./include -Tpw3270.lib3270 $TYPES_RDB pw3270.rdb
22   -if [ "$?" != "0" ]; then
23   - exit -1
24   -fi
25   -
26   -# XWeak
27   -$IDLC -C -I$OO_SDK_HOME/idl -O. /usr/share/idl/libreoffice/com/sun/star/uno/XWeak.idl
28   -if [ "$?" != "0" ]; then
29   - exit -1
30   -fi
31   -
32   -$REGMERGE XWeak.rdb /UCR XWeak.urd
33   -if [ "$?" != "0" ]; then
34   - exit -1
35   -fi
36   -
37   -$CPPUMAKER -O./include $TYPES_RDB XWeak.rdb
38   -if [ "$?" != "0" ]; then
39   - exit -1
40   -fi
41   -
42   -
43   -echo ok
44   -
src/loffice/service.cc
... ... @@ -1,98 +0,0 @@
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 info.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   - * Referência:
29   - *
30   - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Providing_a_Single_Factory_Using_a_Helper_Method
31   - *
32   - */
33   -
34   - #include "globals.hpp"
35   - #include <cppuhelper/implementationentry.hxx>
36   - #include "pw3270/lib3270.hpp"
37   -
38   -/*---[ Implement ]-----------------------------------------------------------------------------------------*/
39   -
40   -namespace pw3270_impl
41   -{
42   - Sequence< OUString > SAL_CALL getSupportedServiceNames_session_impl()
43   - {
44   - Sequence<OUString> names(1);
45   - names[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("pw3270.session"));
46   - return names;
47   - }
48   -
49   - OUString SAL_CALL getImplementationName_session_impl()
50   - {
51   - return OUString( RTL_CONSTASCII_USTRINGPARAM("pw3270.lib3270.session") );
52   - }
53   -
54   - Reference< XInterface > SAL_CALL create_session_impl(Reference< XComponentContext > const & xContext ) SAL_THROW( () )
55   - {
56   - return static_cast< lang::XTypeProvider * >( new session_impl() );
57   - }
58   -
59   - static struct ::cppu::ImplementationEntry s_component_entries [] =
60   - {
61   - {
62   - create_session_impl,
63   - getImplementationName_session_impl,
64   - getSupportedServiceNames_session_impl,
65   - ::cppu::createSingleComponentFactory,
66   - 0,
67   - 0
68   - },
69   - {
70   - 0,
71   - 0,
72   - 0,
73   - 0,
74   - 0,
75   - 0
76   - }
77   - };
78   -
79   -}
80   -
81   -extern "C"
82   -{
83   - DLL_PUBLIC void * SAL_CALL component_getFactory(sal_Char const * implName, lang::XMultiServiceFactory * xMgr,registry::XRegistryKey * xRegistry )
84   - {
85   - return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, ::pw3270_impl::s_component_entries );
86   - }
87   -
88   - DLL_PUBLIC sal_Bool SAL_CALL component_writeInfo(lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry )
89   - {
90   - return ::cppu::component_writeInfoHelper(xMgr, xRegistry, ::pw3270_impl::s_component_entries );
91   - }
92   -
93   - DLL_PUBLIC void SAL_CALL component_getImplementationEnvironment(sal_Char const ** ppEnvTypeName, uno_Environment ** ppEnv )
94   - {
95   - * ppEnvTypeName = LANGUAGE_BINDING_NAME;
96   - }
97   -
98   -}
src/loffice/set.cc
... ... @@ -1,246 +0,0 @@
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 get.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   - * Referência:
29   - *
30   - * https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/C%2B%2B/Class_Definition_with_Helper_Template_Classes
31   - *
32   - */
33   -
34   - #include "globals.hpp"
35   - #include <exception>
36   - #include <com/sun/star/uno/RuntimeException.hdl>
37   - #include <com/sun/star/lang/IllegalArgumentException.hpp>
38   - #include "pw3270/lib3270.hpp"
39   -
40   -/*---[ Implement ]-----------------------------------------------------------------------------------------*/
41   -
42   - using namespace pw3270_impl;
43   - using namespace com::sun::star::uno;
44   -
45   - ::sal_Int16 SAL_CALL session_impl::setSessionName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException)
46   - {
47   - if(hSession)
48   - {
49   - // Remove old session
50   - delete hSession;
51   - hSession = NULL;
52   - }
53   -
54   - OString vlr = rtl::OUStringToOString( name , RTL_TEXTENCODING_UNICODE );
55   -
56   - trace("%s(\"%s\")",__FUNCTION__,vlr.getStr());
57   -
58   - try
59   - {
60   - string charset;
61   -
62   - hSession = h3270::session::create(((const char *) vlr.getStr()));
63   -
64   - trace("%s: hSession(\"%s\"=%p",__FUNCTION__,vlr.getStr(),hSession);
65   -
66   - } catch(std::exception &e)
67   - {
68   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
69   -
70   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
71   -
72   - return -1;
73   -
74   - }
75   -
76   - string charset = hSession->get_display_charset();
77   -
78   - trace("Charset=\"%s\"",charset.c_str());
79   -
80   - if(!charset.compare("ISO-8859-1"))
81   - {
82   - encoding = RTL_TEXTENCODING_ISO_8859_1;
83   - }
84   - else if(!charset.compare("UTF-8"))
85   - {
86   - encoding = RTL_TEXTENCODING_UTF8;
87   - }
88   - else
89   - {
90   - string s = "Unable to convert the host's display charset " + charset + ".";
91   -
92   - throw lang::IllegalArgumentException(
93   - OUString( RTL_CONSTASCII_USTRINGPARAM(s.c_str()) ),
94   - (::cppu::OWeakObject *)this,
95   - 0 );
96   -
97   - }
98   -
99   - return 0;
100   -
101   - }
102   -
103   -/*
104   - ::sal_Int16 SAL_CALL session_impl::setHost( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException)
105   - {
106   - if(!hSession)
107   - hSession = h3270::session::get_default();
108   -
109   - OString vlr = rtl::OUStringToOString( url , RTL_TEXTENCODING_UNICODE );
110   -
111   - try
112   - {
113   -
114   - return hSession->set_url(vlr.getStr());
115   -
116   - } catch(std::exception &e)
117   - {
118   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
119   -
120   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
121   -
122   - }
123   -
124   - return -1;
125   - }
126   -*/
127   -
128   - ::sal_Int16 SAL_CALL session_impl::setTextAt( ::sal_Int16 row, ::sal_Int16 col, const ::rtl::OUString& str ) throw (::com::sun::star::uno::RuntimeException)
129   - {
130   - try
131   - {
132   - CHECK_SESSION_HANDLE
133   - OString vlr = rtl::OUStringToOString(str,encoding);
134   - return hSession->set_text_at(row,col,vlr.getStr());
135   -
136   - } catch(std::exception &e)
137   - {
138   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
139   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
140   - }
141   -
142   - return -1;
143   -
144   - }
145   -
146   - ::sal_Int16 SAL_CALL session_impl::enter() throw (::com::sun::star::uno::RuntimeException)
147   - {
148   - try
149   - {
150   - CHECK_SESSION_HANDLE
151   - return hSession->enter();
152   -
153   - } catch(std::exception &e)
154   - {
155   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
156   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
157   - }
158   -
159   - return -1;
160   -
161   - }
162   -
163   - ::sal_Int16 SAL_CALL session_impl::pfkey( ::sal_Int16 key ) throw (::com::sun::star::uno::RuntimeException)
164   - {
165   - try
166   - {
167   - CHECK_SESSION_HANDLE
168   - return hSession->pfkey(key);
169   -
170   - } catch(std::exception &e)
171   - {
172   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
173   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
174   - }
175   -
176   - return -1;
177   -
178   - }
179   -
180   - ::sal_Int16 SAL_CALL session_impl::pakey( ::sal_Int16 key ) throw (::com::sun::star::uno::RuntimeException)
181   - {
182   - try
183   - {
184   - CHECK_SESSION_HANDLE
185   - return hSession->pakey(key);
186   -
187   - } catch(std::exception &e)
188   - {
189   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
190   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
191   - }
192   -
193   - return -1;
194   -
195   - }
196   -
197   -::sal_Int32 SAL_CALL session_impl::setCursorAt( ::sal_Int16 row, ::sal_Int16 col ) throw (::com::sun::star::uno::RuntimeException)
198   - {
199   - try
200   - {
201   - CHECK_SESSION_HANDLE
202   - return hSession->set_cursor_position(row,col);
203   -
204   - } catch(std::exception &e)
205   - {
206   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
207   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
208   - }
209   -
210   - return -1;
211   -
212   - }
213   -
214   - ::sal_Int32 SAL_CALL session_impl::setCursorAddress( ::sal_Int32 addr ) throw (::com::sun::star::uno::RuntimeException)
215   - {
216   - try
217   - {
218   - CHECK_SESSION_HANDLE
219   - return hSession->set_cursor_addr(addr);
220   -
221   - } catch(std::exception &e)
222   - {
223   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
224   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
225   - }
226   -
227   - return -1;
228   -
229   - }
230   -
231   - ::sal_Int16 SAL_CALL session_impl::eraseEOF() throw (::com::sun::star::uno::RuntimeException)
232   - {
233   - try
234   - {
235   - CHECK_SESSION_HANDLE
236   - return hSession->erase_eof();
237   -
238   - } catch(std::exception &e)
239   - {
240   - OUString msg = OUString(e.what(),strlen(e.what()),RTL_TEXTENCODING_UTF8,RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE);
241   - throw css::uno::RuntimeException(msg,static_cast< cppu::OWeakObject * >(this));
242   - }
243   -
244   - return -1;
245   -
246   - }
src/loffice/testmacros.odt
No preview for this file type
src/loffice/testprogram.cc
... ... @@ -1,148 +0,0 @@
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 testprogram.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 "globals.hpp"
31   -
32   - #include <cppuhelper/bootstrap.hxx>
33   - #include <com/sun/star/bridge/XUnoUrlResolver.hpp>
34   - #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35   -
36   - #include "pw3270/lib3270.hpp"
37   -
38   -/*---[ Implement ]-----------------------------------------------------------------------------------------*/
39   -
40   -using namespace com::sun::star::uno;
41   -using namespace com::sun::star::lang;
42   -using namespace com::sun::star::bridge;
43   -using namespace rtl;
44   -using namespace cppu;
45   -
46   -int SAL_CALL main(int argc, char **argv)
47   -{
48   - Reference< XComponentContext > rComponentContext = defaultBootstrap_InitialComponentContext();
49   - OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" );
50   -
51   -/*
52   - Reference< XSimpleRegistry > xReg = DefaultRegistry();
53   -
54   - Reference< XSimpleRegistry > xReg = createSimpleRegistry();
55   -
56   - OSL_ENSURE( xReg.is(), "### cannot get service instance of \"SimpleRegistry\"!" );
57   -
58   - xReg->open(OUString::createFromAscii("pw3270.rdb"), sal_False, sal_False);
59   -
60   - OSL_ENSURE( xReg->isValid(), "### cannot open test registry \"pw3270.rdb\"!" );
61   -
62   -
63   - TRACE("%s","Calling bootstrap_InitialComponentContext");
64   - Reference< XComponentContext > xContext = bootstrap_InitialComponentContext(xReg);
65   - OSL_ENSURE( xContext.is(), "### cannot creage intial component context!" );
66   -
67   - TRACE("%s","Calling getServiceManager\n");
68   - Reference< XMultiComponentFactory > xMgr = xContext->getServiceManager();
69   - OSL_ENSURE( xMgr.is(), "### cannot get initial service manager!" );
70   -
71   - // register my component
72   - TRACE("%s","Calling createInstanceWithContext");
73   -
74   - Reference< XImplementationRegistration > xImplReg(
75   - xMgr->createInstanceWithContext(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration"), xContext), UNO_QUERY);
76   - OSL_ENSURE( xImplReg.is(), "### cannot get service instance of \"com.sun.star.registry.ImplementationRegistration\"!" );
77   -
78   - if (xImplReg.is())
79   - {
80   - const char *libname = LIBNAME;
81   -
82   - TRACE("Loading %s",libname);
83   -
84   - xImplReg->registerImplementation(
85   - OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), // loader for component
86   - OUString::createFromAscii(libname), // component location
87   - Reference< XSimpleRegistry >() // registry omitted,
88   - // defaulting to service manager registry used
89   - );
90   -
91   - // get an object instance
92   - printf("Calling createInstanceWithContext(%s)\n",IMPLNAME);
93   -
94   - Reference< XInterface > xx ;
95   - xx = xMgr->createInstanceWithContext(OUString::createFromAscii(IMPLNAME), xContext);
96   -
97   - printf("Instance: %p\n",&xx);
98   -
99   - Reference< pw3270intf > srv( xx, UNO_QUERY );
100   -
101   - OSL_ENSURE( srv.is(), "### cannot get service instance!");
102   -
103   - printf("object.is(): %d\n",srv.is());
104   -
105   - if(srv.is())
106   - {
107   - // Wait for commands
108   - OString str;
109   - char buffer[80];
110   - printf("getConnectionState: %d\n", srv->getConnectionState());
111   -
112   - str = OUStringToOString( srv->getVersion(),RTL_TEXTENCODING_UTF8);
113   - printf("Version:\t%s\n",str.pData->buffer);
114   -
115   - str = OUStringToOString( srv->getRevision(),RTL_TEXTENCODING_UTF8);
116   - printf("Revision:\t%s\n",str.pData->buffer);
117   -
118   - printf("Connect(): %d\n" , srv->Connect(OUString::createFromAscii("L:3270.df.bb:9023"),10));
119   -
120   - sleep(5);
121   -
122   - //str = OUStringToOString( srv->getScreenContentAt(20,39,5),RTL_TEXTENCODING_UTF8);
123   - //Trace("ContentsAt(20,39): \"%s\"",str.pData->buffer);
124   - printf("waitForStringAt(SISBB) returned %d\n",srv->waitForStringAt(20,39,OUString::createFromAscii("SISBB"),20));
125   - printf("sendEnterKey() returned %d\n",srv->sendEnterKey());
126   - printf("waitForStringAt(Senha) returned %d\n",srv->waitForStringAt(14,2,OUString::createFromAscii("Senha"),20));
127   - printf("setStringAt returned %d\n",srv->setStringAt(13,21,OUString::createFromAscii("c1103788")));
128   -
129   - str = OUStringToOString( srv->getScreenContent(),RTL_TEXTENCODING_UTF8);
130   - printf("Entire screen:\n%s\n",str.pData->buffer);
131   -
132   - printf("Enter to exit...\n");
133   - fgets(buffer,80,stdin);
134   -
135   - printf("Disconnect(): %d\n" , srv->Disconnect());
136   -
137   - sleep(5);
138   -
139   - }
140   - }
141   -
142   -
143   - Reference< XComponent >::query( xContext )->dispose();
144   -
145   -*/
146   -
147   - return 0;
148   -}
src/php/Makefile.in
... ... @@ -1,124 +0,0 @@
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=get.cc init.cc main.cc misc.cc set.cc
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   -PHPCONFIG=@PHPCONFIG@
48   -
49   -#---[ Paths ]------------------------------------------------------------------
50   -
51   -OBJDIR = .obj
52   -BINDIR = .bin
53   -
54   -OBJDBG = $(OBJDIR)/Debug
55   -BINDBG = $(BINDIR)/Debug
56   -
57   -OBJRLS = $(OBJDIR)/Release
58   -BINRLS = $(BINDIR)/Release
59   -
60   -#---[ lib3270 common class ]---------------------------------------------------
61   -
62   -DEBUG_CFLAGS=-DDEBUG=1 -g -Wall
63   -PW3270_CFLAGS=-I../include
64   -CLASSLIBDIR=../classlib
65   -include $(CLASSLIBDIR)/class.mak
66   -
67   -#---[ Build options ]----------------------------------------------------------
68   -
69   -CXXFLAGS=@CXXFLAGS@ @DLL_CFLAGS@ `$(PHPCONFIG) --includes` -I../include
70   -
71   -#---[ Rules ]------------------------------------------------------------------
72   -
73   -$(OBJDBG)/%.o: %.cc php3270.h Makefile
74   - @echo " CC `basename $@`"
75   - @mkdir -p `dirname $@`
76   - @$(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $<
77   -
78   -$(OBJRLS)/%.o: %.cc php3270.h Makefile
79   - @echo " CC `basename $@`"
80   - @mkdir -p `dirname $@`
81   - @$(CXX) -DNDEBUG=1 $(CXXFLAGS) -o $@ -c $<
82   -
83   -#---[ Release targets ]--------------------------------------------------------
84   -
85   -all: $(BINRLS)/php3270@DLLEXT@
86   -
87   -Release: $(BINRLS)/php3270@DLLEXT@
88   -
89   -$(BINRLS)/php3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC)@OBJEXT@) \
90   - $(CLASS_RELEASE_OBJECTS)
91   - @echo " LD `basename $@`"
92   - @$(MKDIR) `dirname $@`
93   - @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) $(OO_LDFLAGS) -o $@ $^ $(CLASS_LIBS)
94   -
95   -
96   -#---[ Debug targets ]----------------------------------------------------------
97   -
98   -Debug: $(BINDBG)/php3270@DLLEXT@
99   -
100   -$(BINDBG)/php3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) \
101   - $(CLASS_DEBUG_OBJECTS)
102   - @echo " LD `basename $@`"
103   - @$(MKDIR) `dirname $@`
104   - @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) $(OO_LDFLAGS) -o $@ $^ $(CLASS_LIBS)
105   -
106   -
107   -run: $(BINDBG)/php3270@DLLEXT@
108   - php -d extension=$(BINDBG)/php3270@DLLEXT@ sample.php
109   -
110   -#---[ Misc targets ]-----------------------------------------------------------
111   -
112   -install: $(BINRLS)/php3270@DLLEXT@
113   - @$(MKDIR) $(DESTDIR)/`$(PHPCONFIG) --extension-dir`
114   - @$(INSTALL_PROGRAM) $(BINRLS)/php3270@DLLEXT@ $(DESTDIR)/`$(PHPCONFIG) --extension-dir`/tn3270@DLLEXT@
115   -
116   - @$(MKDIR) $(DESTDIR)/@PHPCONFDIR@
117   - @$(INSTALL_DATA) php.ini $(DESTDIR)/@PHPCONFDIR@/tn3270.ini
118   -
119   -cleanDebug: clean
120   -
121   -clean:
122   - @rm -fr $(OBJDIR)
123   - @rm -fr $(BINDIR)
124   -
src/php/get.cc
... ... @@ -1,108 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como get.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   - * Referências:
29   - *
30   - * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
31   - *
32   - */
33   -
34   - #include "php3270.h"
35   -
36   -/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
37   -
38   -PHP_METHOD(tn3270, isconnected)
39   -{
40   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
41   - RETURN_BOOL(obj->hSession->is_connected());
42   -}
43   -
44   -PHP_METHOD(tn3270, isready)
45   -{
46   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
47   - RETURN_BOOL(obj->hSession->is_ready());
48   -}
49   -
50   -PHP_METHOD(tn3270, getstringat)
51   -{
52   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
53   - long row;
54   - long col;
55   - long sz;
56   -
57   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &row, &col, &sz) == FAILURE)
58   - RETURN_NULL();
59   -
60   - string str = obj->hSession->get_string_at(row,col,sz);
61   -
62   - trace("String = [%s]",str.c_str());
63   - RETURN_STRING(str.c_str(),1);
64   -}
65   -
66   -PHP_METHOD(tn3270, cmpstringat)
67   -{
68   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
69   - long row;
70   - long col;
71   - const char * text;
72   - int szText;
73   -
74   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &row, &col, &text, &szText) == FAILURE)
75   - RETURN_NULL();
76   -
77   - if(!szText)
78   - RETURN_NULL();
79   -
80   - char buffer[szText+1];
81   - memcpy(buffer,text,szText);
82   - buffer[szText] = 0;
83   -
84   - RETURN_LONG(obj->hSession->cmp_string_at(row,col,buffer));
85   -}
86   -
87   -PHP_METHOD(tn3270, getisprotected)
88   -{
89   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
90   - long baddr;
91   -
92   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &baddr) == FAILURE)
93   - RETURN_NULL();
94   -
95   - RETURN_LONG(obj->hSession->get_is_protected(baddr));
96   -}
97   -
98   -PHP_METHOD(tn3270, getisprotectedat)
99   -{
100   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
101   - long row;
102   - long col;
103   -
104   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &row, &col) == FAILURE)
105   - RETURN_NULL();
106   -
107   - RETURN_LONG(obj->hSession->get_is_protected_at(row,col));
108   -}
src/php/init.cc
... ... @@ -1,86 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como init.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   - * Referências:
29   - *
30   - * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
31   - *
32   - */
33   -
34   - #include "php3270.h"
35   - #include <Zend/zend_exceptions.h>
36   -
37   -/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
38   -
39   -PHP_METHOD(tn3270, __construct)
40   -{
41   - char * name;
42   - int szName = 0;
43   - char * url;
44   - int szURL = 0;
45   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
46   -
47   - trace("%s %d",__FUNCTION__,ZEND_NUM_ARGS());
48   -
49   - // http://www.php.net/manual/pt_BR/internals2.funcs.php
50   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &name, &szName, &url, &szURL) == FAILURE)
51   - RETURN_NULL();
52   -
53   - trace("szName=%d",szName);
54   -
55   - try
56   - {
57   -
58   - if(szName)
59   - {
60   - char text[szName+1];
61   - strncpy(text,name,szName);
62   - text[szName] = 0;
63   - trace("session_name=\"%s\"",text);
64   - obj->hSession = session::start(text);
65   - }
66   - else
67   - {
68   - obj->hSession = session::start();
69   - }
70   -
71   - if(szURL)
72   - {
73   - char text[szURL+1];
74   - strncpy(text,url,szURL);
75   - text[szURL] = 0;
76   - obj->hSession->set_url(text);
77   - }
78   -
79   - }
80   - catch(std::exception &e)
81   - {
82   - zend_throw_error_exception(zend_exception_get_default(), (char *) e.what(), 0, 0 TSRMLS_DC);
83   - }
84   -
85   -}
86   -
src/php/main.cc
... ... @@ -1,151 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como main.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   - * Referências:
29   - *
30   - * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
31   - *
32   - */
33   -
34   - #include "php3270.h"
35   -
36   -/*--[ Globals ]----------------------------------------------------------------------------------------------------*/
37   -
38   -static zend_class_entry * tn3270_ce = NULL;
39   -static zend_object_handlers tn3270_object_handlers;
40   -
41   -/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
42   -
43   -zend_function_entry tn3270_methods[] =
44   -{
45   - PHP_ME( tn3270, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
46   -
47   - PHP_ME( tn3270, connect, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
48   - PHP_ME( tn3270, disconnect, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
49   -
50   - PHP_ME( tn3270, isconnected, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
51   - PHP_ME( tn3270, isready, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
52   -
53   - PHP_ME( tn3270, waitforready, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
54   - PHP_ME( tn3270, wait, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
55   - PHP_ME( tn3270, iterate, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
56   -
57   - PHP_ME( tn3270, pfkey, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
58   - PHP_ME( tn3270, pakey, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
59   - PHP_ME( tn3270, enter, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
60   -
61   - PHP_ME( tn3270, getstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
62   - PHP_ME( tn3270, setstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
63   - PHP_ME( tn3270, cmpstringat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
64   -
65   - PHP_ME( tn3270, getisprotected, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
66   - PHP_ME( tn3270, getisprotectedat, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
67   -
68   - PHP_ME( tn3270, action, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
69   -
70   - {NULL, NULL, NULL}
71   -};
72   -
73   -void tn3270_free_storage(void *object TSRMLS_DC)
74   -{
75   - tn3270_object *obj = (tn3270_object *)object;
76   -
77   - trace("%s",__FUNCTION__);
78   -
79   - zend_object_std_dtor(&obj->std TSRMLS_CC);
80   - delete obj->hSession;
81   -
82   - efree(obj);
83   -}
84   -
85   -zend_object_value tn3270_create_handler(zend_class_entry *type TSRMLS_DC)
86   -{
87   - zend_object_value retval;
88   - tn3270_object * obj = (tn3270_object *) emalloc(sizeof(tn3270_object));
89   -
90   - trace("%s",__FUNCTION__);
91   -
92   - memset(obj, 0, sizeof(tn3270_object));
93   -
94   - zend_object_std_init( &(obj->std), type TSRMLS_CC );
95   -
96   - // http://stackoverflow.com/questions/14105529/writing-a-c-extension-for-php-5-4-example-code-is-obsolete
97   - // object_properties_init((zend_object*) &(obj->std), type);
98   -#if PHP_VERSION_ID < 50399
99   - zend_hash_copy(obj->std.properties, &(type->default_properties),(copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
100   -#else
101   - object_properties_init(&obj->std, type);
102   -#endif
103   -
104   - retval.handle = zend_objects_store_put(obj, NULL, tn3270_free_storage, NULL TSRMLS_CC);
105   - retval.handlers = &tn3270_object_handlers;
106   -
107   - return retval;
108   -}
109   -
110   -PHP_MINIT_FUNCTION(tn3270)
111   -{
112   - zend_class_entry ce;
113   -
114   - trace("%s",__FUNCTION__);
115   -
116   - INIT_CLASS_ENTRY(ce, "tn3270", tn3270_methods);
117   -
118   - tn3270_ce = zend_register_internal_class(&ce TSRMLS_CC);
119   - tn3270_ce->create_object = tn3270_create_handler;
120   -
121   - memcpy(&tn3270_object_handlers,zend_get_std_object_handlers(), sizeof(zend_object_handlers));
122   - tn3270_object_handlers.clone_obj = NULL;
123   -
124   - return SUCCESS;
125   -}
126   -
127   -zend_module_entry lib3270_module_entry =
128   -{
129   -#if ZEND_MODULE_API_NO >= 20010901
130   - STANDARD_MODULE_HEADER,
131   -#endif
132   - PHP3270_EXTNAME,
133   - NULL, /* Functions */
134   - PHP_MINIT(tn3270),
135   - NULL, /* MSHUTDOWN */
136   - NULL, /* RINIT */
137   - NULL, /* RSHUTDOWN */
138   - NULL, /* MINFO */
139   -#if ZEND_MODULE_API_NO >= 20010901
140   - PHP3270_EXTVER,
141   -#endif
142   - STANDARD_MODULE_PROPERTIES
143   -};
144   -
145   -// #ifdef COMPILE_DL_LIB3270
146   -extern "C"
147   -{
148   - ZEND_GET_MODULE(lib3270)
149   -}
150   -// #endif
151   -
src/php/misc.cc
... ... @@ -1,139 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como main.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   - * Referências:
29   - *
30   - * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
31   - *
32   - */
33   -
34   - #include "php3270.h"
35   -
36   -/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
37   -
38   -PHP_METHOD(tn3270, connect)
39   -{
40   - const char * host;
41   - int szHost;
42   - zend_bool wait = 0;
43   - int rc = 0;
44   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
45   -
46   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &host, &szHost, &wait) == FAILURE)
47   - RETURN_NULL();
48   -
49   - if(szHost)
50   - {
51   - char text[szHost+1];
52   - strncpy(text,host,szHost);
53   - text[szHost] = 0;
54   - rc = obj->hSession->connect(text,wait);
55   - }
56   - else
57   - {
58   - rc = obj->hSession->connect();
59   - }
60   -
61   - RETURN_LONG(rc);
62   -}
63   -
64   -PHP_METHOD(tn3270, disconnect)
65   -{
66   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
67   - RETURN_LONG(obj->hSession->disconnect());
68   -}
69   -
70   -PHP_METHOD(tn3270, waitforready)
71   -{
72   - long seconds;
73   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
74   -
75   - // http://www.php.net/manual/pt_BR/internals2.funcs.php
76   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
77   - RETURN_NULL();
78   -
79   - RETURN_LONG(obj->hSession->wait_for_ready((int) seconds));
80   -}
81   -
82   -PHP_METHOD(tn3270, waity)
83   -{
84   - long seconds;
85   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
86   -
87   - // http://www.php.net/manual/pt_BR/internals2.funcs.php
88   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
89   - RETURN_NULL();
90   -
91   - RETURN_LONG(obj->hSession->wait((int) seconds));
92   -}
93   -
94   -PHP_METHOD(tn3270, wait)
95   -{
96   - long seconds;
97   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
98   -
99   - // http://www.php.net/manual/pt_BR/internals2.funcs.php
100   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
101   - RETURN_NULL();
102   -
103   - RETURN_LONG(obj->hSession->wait((int) seconds));
104   -}
105   -
106   -
107   -PHP_METHOD(tn3270, iterate)
108   -{
109   - zend_bool wait = 0;
110   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
111   -
112   - // http://www.php.net/manual/pt_BR/internals2.funcs.php
113   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &wait) == FAILURE)
114   - RETURN_NULL();
115   -
116   - RETURN_LONG(obj->hSession->iterate(wait));
117   -}
118   -
119   -PHP_METHOD(tn3270, action)
120   -{
121   -
122   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
123   -
124   - const char * text;
125   - int szText;
126   -
127   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &text, &szText) == FAILURE)
128   - RETURN_NULL();
129   -
130   - if(!szText)
131   - RETURN_NULL();
132   -
133   - char buffer[szText+1];
134   - memcpy(buffer,text,szText);
135   - buffer[szText] = 0;
136   -
137   - RETURN_LONG(obj->hSession->action(buffer));
138   -
139   -}
src/php/php.ini
... ... @@ -1,2 +0,0 @@
1   -; comment out next line to disable pdo extension in php
2   -extension=tn3270.so
src/php/php3270.cbp
... ... @@ -1,65 +0,0 @@
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="php3270" />
6   - <Option pch_mode="2" />
7   - <Option compiler="gcc" />
8   - <Build>
9   - <Target title="Debug">
10   - <Option output=".bin/Debug/php3270" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" />
11   - <Option object_output=".obj/Debug/" />
12   - <Option type="3" />
13   - <Option compiler="gcc" />
14   - <Option parameters="-d extension=$PWD/.bin/Debug/php3270.so sample.php" />
15   - <Option host_application="php" />
16   - <Option run_host_application_in_terminal="1" />
17   - <Compiler>
18   - <Add option="-g" />
19   - <Add option="-DDEBUG=1" />
20   - </Compiler>
21   - </Target>
22   - <Target title="Release">
23   - <Option output=".bin/Release/php3270" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" />
24   - <Option object_output=".obj/Release/" />
25   - <Option type="3" />
26   - <Option compiler="gcc" />
27   - <Compiler>
28   - <Add option="-O2" />
29   - <Add option="-DNDEBUG=1" />
30   - </Compiler>
31   - <Linker>
32   - <Add option="-s" />
33   - </Linker>
34   - </Target>
35   - </Build>
36   - <Compiler>
37   - <Add option="-Wall" />
38   - <Add option="-fPIC" />
39   - <Add option="`php-config --includes`" />
40   - <Add option="`pkg-config --cflags dbus-1`" />
41   - <Add directory="../include" />
42   - </Compiler>
43   - <Linker>
44   - <Add option="`pkg-config --libs dbus-1`" />
45   - </Linker>
46   - <Unit filename="../classlib/exception.cc" />
47   - <Unit filename="../classlib/local.cc" />
48   - <Unit filename="../classlib/remote.cc" />
49   - <Unit filename="../classlib/session.cc" />
50   - <Unit filename="../include/pw3270/class.h" />
51   - <Unit filename="get.cc" />
52   - <Unit filename="init.cc" />
53   - <Unit filename="main.cc" />
54   - <Unit filename="misc.cc" />
55   - <Unit filename="php3270.h" />
56   - <Unit filename="php3270.h.in" />
57   - <Unit filename="sample.php" />
58   - <Unit filename="set.cc" />
59   - <Extensions>
60   - <code_completion />
61   - <envvars />
62   - <debugger />
63   - </Extensions>
64   - </Project>
65   -</CodeBlocks_project_file>
src/php/php3270.h.in
... ... @@ -1,87 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como php3270.h 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   - * Referências:
29   - *
30   - * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
31   - *
32   - */
33   -
34   -#ifndef PHP3270_INCLUDED
35   -
36   - #define PHP3270_INCLUDED 1
37   -
38   - #define PHP3270_EXTNAME "@PACKAGE_NAME@"
39   - #define PHP3270_EXTVER "@PACKAGE_VERSION@"
40   -
41   - extern "C"
42   - {
43   - #include "php.h"
44   - }
45   -
46   - extern zend_module_entry lib3270_module_entry;
47   - #define phpext_lib3270_ptr &lib3270_module_entry;
48   -
49   - // 3270 session methods
50   - PHP_METHOD(tn3270,__construct);
51   - PHP_METHOD(tn3270,connect);
52   - PHP_METHOD(tn3270,disconnect);
53   - PHP_METHOD(tn3270,isconnected);
54   - PHP_METHOD(tn3270,isready);
55   - PHP_METHOD(tn3270,waitforready);
56   - PHP_METHOD(tn3270,wait);
57   - PHP_METHOD(tn3270,iterate);
58   -
59   - PHP_METHOD(tn3270,pfkey);
60   - PHP_METHOD(tn3270,pakey);
61   - PHP_METHOD(tn3270,enter);
62   -
63   - PHP_METHOD(tn3270,getstringat);
64   - PHP_METHOD(tn3270,setstringat);
65   - PHP_METHOD(tn3270,cmpstringat);
66   -
67   - PHP_METHOD(tn3270,getisprotected);
68   - PHP_METHOD(tn3270,getisprotectedat);
69   -
70   - PHP_METHOD(tn3270,action);
71   -
72   - #undef PACKAGE_NAME
73   - #undef PACKAGE_VERSION
74   - #undef HAVE_MALLOC_H
75   - #include <pw3270/class.h>
76   -
77   - // PHP object
78   - using namespace PW3270_NAMESPACE;
79   -
80   - struct tn3270_object
81   - {
82   - zend_object std;
83   - session * hSession;
84   - };
85   -
86   -
87   -#endif // PHP_LIB3270_INCLUDED
src/php/sample.php
... ... @@ -1,28 +0,0 @@
1   -<?php
2   -
3   - printf("PW3270 PHP sample\n");
4   -
5   - $host = new tn3270("pw3270:a");
6   -
7   - $rc = $host->connect();
8   - print("connect() exits with rc=" . $rc . "\n");
9   -
10   - $rc = $host->waitforready(10);
11   - print("waitforready() exits with rc=" . $rc . "\n");
12   -
13   - $str = $host->getstringat(3,2,14);
14   - print("Getstring(3,2,14) saiu com \"" . $str . "\"\n");
15   -
16   - $rc = $host->getisprotectedat(19,39);
17   - print("GetIsprotectedAt(19,39) saiu com \"" . $rc . "\"\n");
18   -
19   - $rc = $host->getisprotectedat(20,39);
20   - print("GetIsprotectedAt(20,39) saiu com \"" . $rc . "\"\n");
21   -
22   - $rc = $host->action("clear");
23   - print("Action(\"clear\") saiu com \"" . $rc . "\"\n");
24   -
25   - $rc = $host->disconnect();
26   - print("disconnect() exits with rc=" . $rc . "\n");
27   -
28   -?>
src/php/set.cc
... ... @@ -1,88 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como set.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   - * Referências:
29   - *
30   - * http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
31   - *
32   - */
33   -
34   - #include "php3270.h"
35   -
36   -/*--[ Implement ]--------------------------------------------------------------------------------------------------*/
37   -
38   -PHP_METHOD(tn3270, pfkey)
39   -{
40   - long id;
41   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
42   -
43   - // http://www.php.net/manual/pt_BR/internals2.funcs.php
44   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE)
45   - RETURN_NULL();
46   -
47   - RETURN_LONG(obj->hSession->pfkey((int) id));
48   -}
49   -
50   -PHP_METHOD(tn3270, pakey)
51   -{
52   - long id;
53   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
54   -
55   - // http://www.php.net/manual/pt_BR/internals2.funcs.php
56   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE)
57   - RETURN_NULL();
58   -
59   - RETURN_LONG(obj->hSession->pakey((int) id));
60   -}
61   -
62   -PHP_METHOD(tn3270, enter)
63   -{
64   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
65   - RETURN_LONG(obj->hSession->enter());
66   -}
67   -
68   -PHP_METHOD(tn3270, setstringat)
69   -{
70   - tn3270_object * obj = (tn3270_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
71   - long row;
72   - long col;
73   - const char * text;
74   - int szText;
75   -
76   - if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &row, &col, &text, &szText) == FAILURE)
77   - RETURN_NULL();
78   -
79   - if(!szText)
80   - RETURN_NULL();
81   -
82   - char buffer[szText+1];
83   - memcpy(buffer,text,szText);
84   - buffer[szText] = 0;
85   -
86   - RETURN_LONG(obj->hSession->set_string_at(row,col,buffer));
87   -}
88   -
src/python/Makefile.in
... ... @@ -1,144 +0,0 @@
1   -
2   -
3   -#
4   -# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
5   -# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
6   -# aplicativos mainframe. Registro no INPI sob o nome G3270.
7   -#
8   -# Copyright (C) <2008> <Banco do Brasil S.A.>
9   -#
10   -# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
11   -# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
12   -# Free Software Foundation.
13   -#
14   -# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
15   -# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
16   -# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
17   -# obter mais detalhes.
18   -#
19   -# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
20   -# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
21   -# Place, Suite 330, Boston, MA, 02111-1307, USA
22   -#
23   -# Contatos:
24   -#
25   -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   -# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
27   -#
28   -
29   -PACKAGE_NAME=@PACKAGE_NAME@
30   -SOURCES=py3270.cc actions.cc get.cc init.cc misc.cc set.cc
31   -
32   -#---[ Paths ]------------------------------------------------------------------
33   -
34   -prefix=@prefix@
35   -exec_prefix=@exec_prefix@
36   -bindir=@bindir@
37   -sbindir=@sbindir@
38   -libdir=@libdir@
39   -includedir=@includedir@
40   -sysconfdir=@sysconfdir@
41   -PYTHONLIBPATH=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`
42   -
43   -#---[ Tools ]------------------------------------------------------------------
44   -
45   -CXX=@CXX@
46   -MKDIR=@MKDIR_P@
47   -INSTALL=@INSTALL@
48   -INSTALL_DATA=@INSTALL_DATA@
49   -INSTALL_PROGRAM=@INSTALL_PROGRAM@
50   -ZIP=@ZIP@
51   -
52   -#---[ Paths ]------------------------------------------------------------------
53   -
54   -OBJDIR = .obj
55   -BINDIR = .bin
56   -
57   -OBJDBG = $(OBJDIR)/Debug
58   -BINDBG = $(BINDIR)/Debug
59   -
60   -OBJRLS = $(OBJDIR)/Release
61   -BINRLS = $(BINDIR)/Release
62   -
63   -#---[ lib3270 common class ]---------------------------------------------------
64   -
65   -DEBUG_CFLAGS=-DDEBUG=1 -g -Wall
66   -PW3270_CFLAGS=-I../include
67   -CLASSLIBDIR=../classlib
68   -include $(CLASSLIBDIR)/class.mak
69   -
70   -#---[ Build options ]----------------------------------------------------------
71   -
72   -CXXFLAGS=@PYTHON_CFLAGS@ @DLL_CFLAGS@ -I../include
73   -
74   -#---[ Rules ]------------------------------------------------------------------
75   -
76   -$(OBJRLS)/%.o: \
77   - %.cc private.h Makefile
78   -
79   - @echo " CC `basename $@`"
80   - @mkdir -p `dirname $@`
81   - @$(CXX) -DNDEBUG=1 $(CXXFLAGS) -o $@ -c $<
82   -
83   -$(OBJDBG)/%.o: \
84   - %.cc private.h Makefile
85   -
86   - @echo " CC `basename $@`"
87   - @mkdir -p `dirname $@`
88   - @$(CXX) -DDEBUG=1 $(CXXFLAGS) -o $@ -c $<
89   -
90   -#---[ Release targets ]--------------------------------------------------------
91   -
92   -all: $(BINRLS)/py3270@DLLEXT@
93   -
94   -Release: $(BINRLS)/py3270@DLLEXT@
95   -
96   -$(BINRLS)/py3270@DLLEXT@: \
97   - $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC)@OBJEXT@) \
98   - $(CLASS_RELEASE_OBJECTS)
99   -
100   - @echo " LD `basename $@`"
101   - @$(MKDIR) `dirname $@`
102   - @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) $(OO_LDFLAGS) -o $@ $^ $(CLASS_LIBS) @PYTHON_LIBS@
103   -
104   -
105   -#---[ Debug targets ]----------------------------------------------------------
106   -
107   -Debug: $(BINDBG)/py3270@DLLEXT@
108   -
109   -$(BINDBG)/py3270@DLLEXT@: \
110   - $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) \
111   - $(CLASS_DEBUG_OBJECTS)
112   -
113   - @echo " LD `basename $@`"
114   - @$(MKDIR) `dirname $@`
115   - @$(CXX) @SYSDLL_FLAGS@ $(LDFLAGS) $(OO_LDFLAGS) -o $@ $^ $(CLASS_LIBS) @PYTHON_LIBS@
116   -
117   -
118   -run: $(BINDBG)/py3270@DLLEXT@
119   -
120   -#---[ Misc targets ]-----------------------------------------------------------
121   -
122   -install: \
123   - $(BINRLS)/py3270@DLLEXT@
124   -
125   - @$(MKDIR) $(DESTDIR)/$(PYTHONLIBPATH)
126   - @$(INSTALL_PROGRAM) $(BINRLS)/py3270@DLLEXT@ $(DESTDIR)/$(PYTHONLIBPATH)/py3270@DLLEXT@
127   -
128   -zip: \
129   - py3270-@PACKAGE_VERSION@.@PACKAGE_REVISION@.@host_cpu@.zip
130   -
131   -py3270-@PACKAGE_VERSION@.@PACKAGE_REVISION@.@host_cpu@.zip: \
132   - Makefile \
133   - $(BINRLS)/py3270@DLLEXT@
134   -
135   - @rm -f $@
136   - @zip -9 -j $@ $(BINRLS)/py3270@DLLEXT@
137   -
138   -
139   -cleanDebug: clean
140   -
141   -clean:
142   - @rm -fr $(OBJDIR)
143   - @rm -fr $(BINDIR)
144   -
src/python/actions.cc
... ... @@ -1,129 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 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   - * Referências:
29   - *
30   - * <https://docs.python.org/2/extending/newtypes.html>
31   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
32   - *
33   - */
34   -
35   - #include "private.h"
36   -
37   -
38   -/*---[ Implement ]----------------------------------------------------------------------------------*/
39   -
40   - PyObject * terminal_pfkey(PyObject *self, PyObject *args) {
41   -
42   - int rc, key;
43   -
44   - if (!PyArg_ParseTuple(args, "i", &key)) {
45   - PyErr_SetString(terminalError, strerror(EINVAL));
46   - return NULL;
47   - }
48   -
49   - try {
50   -
51   - rc = ((pw3270_TerminalObject *) self)->session->pfkey(key);
52   -
53   - } catch(std::exception &e) {
54   -
55   - PyErr_SetString(terminalError, e.what());
56   - return NULL;
57   - }
58   -
59   - return PyLong_FromLong(rc);
60   -
61   - }
62   -
63   - PyObject * terminal_pakey(PyObject *self, PyObject *args) {
64   -
65   - int rc, key;
66   -
67   - if (!PyArg_ParseTuple(args, "i", &key)) {
68   - PyErr_SetString(terminalError, strerror(EINVAL));
69   - return NULL;
70   - }
71   -
72   - try {
73   -
74   - rc = ((pw3270_TerminalObject *) self)->session->pakey(key);
75   -
76   - } catch(std::exception &e) {
77   -
78   - PyErr_SetString(terminalError, e.what());
79   - return NULL;
80   - }
81   -
82   - return PyLong_FromLong(rc);
83   -
84   - }
85   -
86   - PyObject * terminal_enter(PyObject *self, PyObject *args) {
87   -
88   - int rc;
89   -
90   - try {
91   -
92   - rc = ((pw3270_TerminalObject *) self)->session->enter();
93   -
94   - } catch(std::exception &e) {
95   -
96   - PyErr_SetString(terminalError, e.what());
97   - return NULL;
98   - }
99   -
100   - return PyLong_FromLong(rc);
101   -
102   -
103   - }
104   -
105   - PyObject * terminal_action(PyObject *self, PyObject *args) {
106   -
107   - int rc;
108   - const char *name;
109   -
110   - if (!PyArg_ParseTuple(args, "s", &name)) {
111   - PyErr_SetString(terminalError, strerror(EINVAL));
112   - return NULL;
113   - }
114   -
115   - try {
116   -
117   - rc = ((pw3270_TerminalObject *) self)->session->action(name);
118   -
119   - } catch(std::exception &e) {
120   -
121   - PyErr_SetString(terminalError, e.what());
122   - return NULL;
123   - }
124   -
125   - return PyLong_FromLong(rc);
126   -
127   -
128   - }
129   -
src/python/get.cc
... ... @@ -1,154 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como get.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   - * Referências:
29   - *
30   - * <https://docs.python.org/2/extending/newtypes.html>
31   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
32   - *
33   - */
34   -
35   - #include "private.h"
36   -
37   -
38   -/*---[ Implement ]----------------------------------------------------------------------------------*/
39   -
40   -PyObject * terminal_get_version(PyObject *self, PyObject *args) {
41   -
42   - return PyString_FromString( ((pw3270_TerminalObject *) self)->session->get_version().c_str() );
43   -
44   -}
45   -
46   -PyObject * terminal_get_revision(PyObject *self, PyObject *args) {
47   -
48   - return PyString_FromString( ((pw3270_TerminalObject *) self)->session->get_revision().c_str() );
49   -
50   -}
51   -
52   -PyObject * terminal_is_connected(PyObject *self, PyObject *args) {
53   -
54   - return PyBool_FromLong( ((pw3270_TerminalObject *) self)->session->is_connected() );
55   -
56   -}
57   -
58   -PyObject * terminal_is_ready(PyObject *self, PyObject *args) {
59   -
60   - return PyBool_FromLong( ((pw3270_TerminalObject *) self)->session->is_ready() );
61   -
62   -}
63   -
64   -PyObject * terminal_is_protected_at(PyObject *self, PyObject *args) {
65   -
66   - int rc, row, col;
67   -
68   - if (!PyArg_ParseTuple(args, "ii", &row, &col)) {
69   - PyErr_SetString(terminalError, strerror(EINVAL));
70   - return NULL;
71   - }
72   -
73   - try {
74   -
75   - rc = ((pw3270_TerminalObject *) self)->session->get_is_protected_at(row,col);
76   -
77   - } catch(std::exception &e) {
78   -
79   - PyErr_SetString(terminalError, e.what());
80   - return NULL;
81   - }
82   -
83   - return PyBool_FromLong( rc );
84   -
85   -}
86   -
87   -
88   -PyObject * terminal_cmp_string_at(PyObject *self, PyObject *args) {
89   -
90   - int row, col, rc;
91   - const char *text;
92   -
93   - if (!PyArg_ParseTuple(args, "iis", &row, &col, &text)) {
94   - PyErr_SetString(terminalError, strerror(EINVAL));
95   - return NULL;
96   - }
97   -
98   - try {
99   -
100   - rc = ((pw3270_TerminalObject *) self)->session->cmp_string_at(row,col,text);
101   -
102   - } catch(std::exception &e) {
103   -
104   - PyErr_SetString(terminalError, e.what());
105   - return NULL;
106   - }
107   -
108   - return PyLong_FromLong(rc);
109   -
110   -}
111   -
112   -PyObject * terminal_get_string_at(PyObject *self, PyObject *args) {
113   -
114   - int row, col, sz;
115   - string rc;
116   -
117   - if (!PyArg_ParseTuple(args, "iii", &row, &col, &sz)) {
118   - PyErr_SetString(terminalError, strerror(EINVAL));
119   - return NULL;
120   - }
121   -
122   - try {
123   -
124   - rc = ((pw3270_TerminalObject *) self)->session->get_string_at(row,col,sz);
125   -
126   - } catch(std::exception &e) {
127   -
128   - PyErr_SetString(terminalError, e.what());
129   - return NULL;
130   - }
131   -
132   - return PyString_FromString(rc.c_str());
133   -
134   -}
135   -
136   -PyObject * terminal_get_contents(PyObject *self) {
137   -
138   - string rc;
139   -
140   - try {
141   -
142   - rc = ((pw3270_TerminalObject *) self)->session->get_string();
143   -
144   - } catch(std::exception &e) {
145   -
146   - PyErr_SetString(terminalError, e.what());
147   - return NULL;
148   - }
149   -
150   - return PyString_FromString(rc.c_str());
151   -
152   -
153   -
154   -}
src/python/init.cc
... ... @@ -1,87 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como py3270.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   - * Implementa métodos básicos inicio/final do objeto python
29   - *
30   - * Referências:
31   - *
32   - * <https://docs.python.org/2/extending/newtypes.html>
33   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
34   - *
35   - */
36   -
37   - #include "private.h"
38   -
39   -
40   -/*---[ Implement ]----------------------------------------------------------------------------------*/
41   -
42   -PyObject * terminal_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
43   -
44   - PW3270_NAMESPACE::session * session;
45   - const char *id = "";
46   -
47   - if (!PyArg_ParseTuple(args, "s", &id)) {
48   - id = "";
49   - }
50   -
51   - trace("%s(%s)",__FUNCTION__,id);
52   -
53   - try {
54   -
55   - session = PW3270_NAMESPACE::session::create(id);
56   -
57   - } catch(std::exception &e) {
58   -
59   - trace("%s failed: %s",__FUNCTION__,e.what());
60   - PyErr_SetString(terminalError, e.what());
61   - return NULL;
62   -
63   - }
64   -
65   - pw3270_TerminalObject *self = (pw3270_TerminalObject *) type->tp_alloc(type, 0);
66   -
67   - self->session = session;
68   -
69   - return (PyObject *)self;
70   -}
71   -
72   -
73   -int terminal_init(pw3270_TerminalObject *self, PyObject *args, PyObject *kwds) {
74   -
75   - return 0;
76   -
77   -}
78   -
79   -void terminal_dealloc(pw3270_TerminalObject * self) {
80   -
81   - trace("%s",__FUNCTION__);
82   -
83   - delete self->session;
84   -
85   - self->ob_type->tp_free((PyObject*)self);
86   -
87   -}
src/python/misc.cc
... ... @@ -1,134 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como misc.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   - * Implementa métodos básicos inicio/final do objeto python
29   - *
30   - * Referências:
31   - *
32   - * <https://docs.python.org/2/extending/newtypes.html>
33   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
34   - *
35   - */
36   -
37   - #include "private.h"
38   -
39   -
40   -/*---[ Implement ]----------------------------------------------------------------------------------*/
41   -
42   - PyObject * terminal_connect(PyObject *self, PyObject *args) {
43   -
44   - int rc = -1;
45   - int wait = 60;
46   - const char * host = "";
47   -
48   - if (!PyArg_ParseTuple(args, "s|i", &host, &wait)) {
49   - PyErr_SetString(terminalError, "connect requires a host URL");
50   - return NULL;
51   - }
52   -
53   - try {
54   -
55   - rc = ((pw3270_TerminalObject *) self)->session->connect(host,wait);
56   -
57   - } catch(std::exception &e) {
58   -
59   - PyErr_SetString(terminalError, e.what());
60   - return NULL;
61   - }
62   -
63   - return PyLong_FromLong(rc);
64   -
65   - }
66   -
67   - PyObject * terminal_disconnect(PyObject *self, PyObject *args) {
68   -
69   - int rc = -1;
70   -
71   - try {
72   -
73   - rc = ((pw3270_TerminalObject *) self)->session->disconnect();
74   -
75   - } catch(std::exception &e) {
76   -
77   - PyErr_SetString(terminalError, e.what());
78   - return NULL;
79   - }
80   -
81   - return PyLong_FromLong(rc);
82   -
83   - }
84   -
85   - PyObject * terminal_wait_for_ready(PyObject *self, PyObject *args) {
86   -
87   - int rc;
88   - int timeout = 60;
89   -
90   - if (!PyArg_ParseTuple(args, "|i", &timeout)) {
91   - PyErr_SetString(terminalError, strerror(EINVAL));
92   - return NULL;
93   - }
94   -
95   - try {
96   -
97   - rc = ((pw3270_TerminalObject *) self)->session->wait_for_ready(timeout);
98   -
99   - } catch(std::exception &e) {
100   -
101   - PyErr_SetString(terminalError, e.what());
102   - return NULL;
103   - }
104   -
105   - return PyLong_FromLong(rc);
106   -
107   - }
108   -
109   -
110   - PyObject * terminal_wait_for_string_at(PyObject *self, PyObject *args) {
111   -
112   - int row, col, rc;
113   - int timeout = 10;
114   - const char *text;
115   -
116   - if (!PyArg_ParseTuple(args, "iis|i", &row, &col, &text, &timeout)) {
117   - PyErr_SetString(terminalError, strerror(EINVAL));
118   - return NULL;
119   - }
120   -
121   - try {
122   -
123   - rc = ((pw3270_TerminalObject *) self)->session->wait_for_string_at(row,col,text,timeout);
124   -
125   - } catch(std::exception &e) {
126   -
127   - PyErr_SetString(terminalError, e.what());
128   - return NULL;
129   - }
130   -
131   - return PyLong_FromLong(rc);
132   -
133   - }
134   -
src/python/private.h
... ... @@ -1,87 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como private.h 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   -#ifndef PRIVATE_H_INCLUDED
31   -
32   - #define PRIVATE_H_INCLUDED
33   -
34   - // http://stackoverflow.com/questions/28683358/error-hypot-has-not-been-declared-in-cmath-while-trying-to-embed-python
35   - #include <cmath>
36   -
37   - #include <Python.h>
38   -
39   - #include <lib3270/config.h>
40   - #include <pw3270/class.h>
41   -
42   - using namespace std;
43   -
44   - typedef struct {
45   -
46   - PyObject_HEAD
47   -
48   - PW3270_NAMESPACE::session * session;
49   -
50   - } pw3270_TerminalObject;
51   -
52   - extern PyObject * terminalError;
53   -
54   - extern "C" {
55   -
56   - PyObject * terminal_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
57   - int terminal_init(pw3270_TerminalObject *self, PyObject *args, PyObject *kwds);
58   - void terminal_dealloc(pw3270_TerminalObject * self);
59   -
60   - PyObject * terminal_get_version(PyObject *self, PyObject *args);
61   - PyObject * terminal_get_revision(PyObject *self, PyObject *args);
62   -
63   - PyObject * terminal_is_connected(PyObject *self, PyObject *args);
64   - PyObject * terminal_is_ready(PyObject *self, PyObject *args);
65   -
66   - PyObject * terminal_connect(PyObject *self, PyObject *args);
67   - PyObject * terminal_disconnect(PyObject *self, PyObject *args);
68   -
69   - PyObject * terminal_get_string_at(PyObject *self, PyObject *args);
70   - PyObject * terminal_get_contents(PyObject *self);
71   - PyObject * terminal_set_string_at(PyObject *self, PyObject *args);
72   - PyObject * terminal_cmp_string_at(PyObject *self, PyObject *args);
73   -
74   - PyObject * terminal_pfkey(PyObject *self, PyObject *args);
75   - PyObject * terminal_pakey(PyObject *self, PyObject *args);
76   - PyObject * terminal_enter(PyObject *self, PyObject *args);
77   - PyObject * terminal_action(PyObject *self, PyObject *args);
78   -
79   - PyObject * terminal_is_protected_at(PyObject *self, PyObject *args);
80   - PyObject * terminal_set_cursor_at(PyObject *self, PyObject *args);
81   -
82   - PyObject * terminal_wait_for_ready(PyObject *self, PyObject *args);
83   - PyObject * terminal_wait_for_string_at(PyObject *self, PyObject *args);
84   -
85   - }
86   -
87   -#endif // PRIVATE_H_INCLUDED
src/python/py3270.cbp
... ... @@ -1,70 +0,0 @@
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="Python bindings for pw3270" />
6   - <Option pch_mode="2" />
7   - <Option compiler="gcc" />
8   - <Build>
9   - <Target title="Debug">
10   - <Option output=".bin/Debug/py3270" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" />
11   - <Option object_output=".obj/Debug/" />
12   - <Option type="3" />
13   - <Option compiler="gcc" />
14   - <Option host_application="./test.sh" />
15   - <Option run_host_application_in_terminal="1" />
16   - <Compiler>
17   - <Add option="-g" />
18   - <Add option="-DDEBUG=1" />
19   - <Add directory="../include" />
20   - </Compiler>
21   - <Linker>
22   - <Add directory="../../.bin/Debug/lib" />
23   - </Linker>
24   - </Target>
25   - <Target title="Release">
26   - <Option output=".bin/Release/py3270" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="0" extension_auto="1" />
27   - <Option object_output=".obj/Release/" />
28   - <Option type="3" />
29   - <Option compiler="gcc" />
30   - <Compiler>
31   - <Add option="-O2" />
32   - <Add option="-DNDEBUG=1" />
33   - </Compiler>
34   - <Linker>
35   - <Add option="-s" />
36   - </Linker>
37   - </Target>
38   - </Build>
39   - <Compiler>
40   - <Add option="-Wall" />
41   - <Add option="-fPIC" />
42   - <Add option="`pkg-config --cflags dbus-1`" />
43   - <Add option="`python2-config --cflags`" />
44   - </Compiler>
45   - <Linker>
46   - <Add option="`python2-config --libs`" />
47   - <Add option="`pkg-config --libs dbus-1`" />
48   - </Linker>
49   - <Unit filename="../classlib/exception.cc" />
50   - <Unit filename="../classlib/local.cc" />
51   - <Unit filename="../classlib/module.cc" />
52   - <Unit filename="../classlib/remote.cc" />
53   - <Unit filename="../classlib/session.cc" />
54   - <Unit filename="../include/lib3270/config.h" />
55   - <Unit filename="../include/pw3270/class.h" />
56   - <Unit filename="actions.cc" />
57   - <Unit filename="get.cc" />
58   - <Unit filename="init.cc" />
59   - <Unit filename="misc.cc" />
60   - <Unit filename="private.h" />
61   - <Unit filename="py3270.cc" />
62   - <Unit filename="sample.py" />
63   - <Unit filename="set.cc" />
64   - <Extensions>
65   - <code_completion />
66   - <envvars />
67   - <debugger />
68   - </Extensions>
69   - </Project>
70   -</CodeBlocks_project_file>
src/python/py3270.cc
... ... @@ -1,162 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como py3270.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   - * Implementa métodos básicos para a extensão python.
29   - *
30   - * Referências:
31   - *
32   - * <https://docs.python.org/2/extending/newtypes.html>
33   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
34   - *
35   - */
36   -
37   - #include "private.h"
38   -
39   -/*---[ Globals ]------------------------------------------------------------------------------------*/
40   -
41   - PyObject * terminalError = NULL;
42   -
43   -/*---[ Implement ]----------------------------------------------------------------------------------*/
44   -
45   -static PyObject * get_revision(PyObject *self, PyObject *args) {
46   -
47   - return PyLong_FromLong(atoi(PACKAGE_REVISION));
48   -
49   -}
50   -
51   -static PyMethodDef terminal_methods[] = {
52   -
53   - { "Version", terminal_get_version, METH_NOARGS, "Get the lib3270 version string." },
54   - { "Revision", terminal_get_revision, METH_NOARGS, "Get the lib3270 revision number." },
55   -
56   - { "IsConnected", terminal_is_connected, METH_NOARGS, "True if the terminal is connected to the host." },
57   - { "IsReady", terminal_is_ready, METH_NOARGS, "True if the terminal has finished network activity." },
58   - { "IsProtected", terminal_is_protected_at, METH_VARARGS, "True if the position is read-only." },
59   -
60   - { "SetCursorPosition", terminal_set_cursor_at, METH_VARARGS, "Set cursor position." },
61   -
62   - { "WaitForStringAt", terminal_wait_for_string_at, METH_VARARGS, "Wait for string at position" },
63   - { "WaitForReady", terminal_wait_for_ready, METH_VARARGS, "Wait for network communication to finish" },
64   -
65   - { "Connect", terminal_connect, METH_VARARGS, "Connect to the host." },
66   - { "Disconnect", terminal_disconnect, METH_NOARGS, "Disconnect from host." },
67   -
68   - { "CmpStringAt", terminal_cmp_string_at, METH_VARARGS, "Compare string with terminal buffer at the position." },
69   - { "GetStringAt", terminal_get_string_at, METH_VARARGS, "Get string from terminal buffer." },
70   - { "SetStringAt", terminal_set_string_at, METH_VARARGS, "Set string in terminal buffer." },
71   -
72   - { "PFKey", terminal_pfkey, METH_VARARGS, "Send PF key." },
73   - { "PAKey", terminal_pakey, METH_VARARGS, "Send PA key." },
74   - { "Enter", terminal_enter, METH_NOARGS, "Send Enter Key." },
75   - { "Action", terminal_action, METH_VARARGS, "Send Action by name." },
76   -
77   - {NULL} // Sentinel
78   -
79   -};
80   -
81   -/*
82   -static PyMemberDef terminal_members[] = {
83   -
84   - { NULL } // Sentinel
85   -
86   -};
87   -*/
88   -
89   -static PyTypeObject pw3270_TerminalType = {
90   - PyObject_HEAD_INIT(NULL)
91   - 0, /*ob_size*/
92   - "py3270.terminal", /*tp_name*/
93   - sizeof(pw3270_TerminalObject), /*tp_basicsize*/
94   - 0, /*tp_itemsize*/
95   - (destructor) terminal_dealloc, /*tp_dealloc*/
96   - 0, /*tp_print*/
97   - 0, /*tp_getattr*/
98   - 0, /*tp_setattr*/
99   - 0, /*tp_compare*/
100   - 0, /*tp_repr*/
101   - 0, /*tp_as_number*/
102   - 0, /*tp_as_sequence*/
103   - 0, /*tp_as_mapping*/
104   - 0, /*tp_hash */
105   - 0, /*tp_call*/
106   - terminal_get_contents, /*tp_str*/
107   - 0, /*tp_getattro*/
108   - 0, /*tp_setattro*/
109   - 0, /*tp_as_buffer*/
110   - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
111   - "3270 terminal object", /* tp_doc */
112   - 0, /* tp_traverse */
113   - 0, /* tp_clear */
114   - 0, /* tp_richcompare */
115   - 0, /* tp_weaklistoffset */
116   - 0, /* tp_iter */
117   - 0, /* tp_iternext */
118   - terminal_methods, /* tp_methods */
119   - 0, // terminal_members, /* tp_members */
120   - 0, /* tp_getset */
121   - 0, /* tp_base */
122   - 0, /* tp_dict */
123   - 0, /* tp_descr_get */
124   - 0, /* tp_descr_set */
125   - 0, /* tp_dictoffset */
126   - (initproc) terminal_init, /* tp_init */
127   - 0, /* tp_alloc */
128   - terminal_new, /* tp_new */
129   -
130   -};
131   -
132   -static PyMethodDef MyMethods[] = {
133   -
134   - { "Revision", get_revision, METH_VARARGS, "Get module revision." },
135   -
136   - {NULL, NULL, 0, NULL} /* Sentinel */
137   -
138   -};
139   -
140   -PyMODINIT_FUNC initpy3270(void) {
141   -
142   - // Cria o módulo
143   -
144   - PyObject *m = Py_InitModule("py3270", MyMethods);
145   -
146   - if (m == NULL)
147   - return;
148   -
149   - // Adiciona objeto para tratamento de erros.
150   - terminalError = PyErr_NewException((char *) "py3270.error", NULL, NULL);
151   -
152   - (void) Py_INCREF(terminalError);
153   - PyModule_AddObject(m, "error", terminalError);
154   -
155   - // Adiciona terminal
156   - if(PyType_Ready(&pw3270_TerminalType) < 0)
157   - return
158   -
159   - (void) Py_INCREF(&pw3270_TerminalType);
160   - PyModule_AddObject(m, "Terminal", (PyObject *)&pw3270_TerminalType);
161   -
162   -}
src/python/sample.py
... ... @@ -1,31 +0,0 @@
1   -#!/usr/bin/python
2   -#-*- coding: utf-8
3   -
4   -import py3270
5   -
6   -print "Teste extensão pw3270"
7   -
8   -print py3270.Revision()
9   -
10   -term = py3270.Terminal("")
11   -
12   -print "Using pw3270 version " + term.Version() + " revision " + term.Revision()
13   -
14   -term.Connect("tn3270://zos.efglobe.com:telnet",10);
15   -
16   -print term.IsConnected()
17   -print term.IsReady()
18   -
19   -print term.GetStringAt(14,19,38)
20   -
21   -print "-----------------------------------------------------------------------"
22   -print term
23   -print "-----------------------------------------------------------------------"
24   -
25   -
26   -
27   -
28   -
29   -
30   -
31   -
src/python/set.cc
... ... @@ -1,86 +0,0 @@
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., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como set.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   - * Referências:
29   - *
30   - * <https://docs.python.org/2/extending/newtypes.html>
31   - * <https://docs.python.org/2.7/extending/extending.html#a-simple-example>
32   - *
33   - */
34   -
35   - #include "private.h"
36   -
37   -
38   -/*---[ Implement ]----------------------------------------------------------------------------------*/
39   -
40   - PyObject * terminal_set_string_at(PyObject *self, PyObject *args) {
41   -
42   - int row, col, rc;
43   - const char *text;
44   -
45   - if (!PyArg_ParseTuple(args, "iis", &row, &col, &text)) {
46   - PyErr_SetString(terminalError, strerror(EINVAL));
47   - return NULL;
48   - }
49   -
50   - try {
51   -
52   - rc = ((pw3270_TerminalObject *) self)->session->set_string_at(row,col,text);
53   -
54   - } catch(std::exception &e) {
55   -
56   - PyErr_SetString(terminalError, e.what());
57   - return NULL;
58   - }
59   -
60   - return PyLong_FromLong(rc);
61   -
62   - }
63   -
64   - PyObject * terminal_set_cursor_at(PyObject *self, PyObject *args) {
65   -
66   - int row, col, rc;
67   -
68   - if (!PyArg_ParseTuple(args, "ii", &row, &col)) {
69   - PyErr_SetString(terminalError, strerror(EINVAL));
70   - return NULL;
71   - }
72   -
73   - try {
74   -
75   - rc = ((pw3270_TerminalObject *) self)->session->set_cursor_position(row,col);
76   -
77   - } catch(std::exception &e) {
78   -
79   - PyErr_SetString(terminalError, e.what());
80   - return NULL;
81   - }
82   -
83   - return PyLong_FromLong(rc);
84   -
85   - }
86   -
src/python/test.sh
... ... @@ -1,6 +0,0 @@
1   -#!/bin/bash
2   -
3   -export PYTHONPATH=${PWD}/.bin/Debug:${PYTHONPATH}
4   -
5   -python ./sample.py
6   -