Commit 683c97daa4cbe930e7e331d0f7c67b21287be4ee
1 parent
d1f2f1f2
Exists in
master
and in
5 other branches
Ajustes para empacotamento, remoção do plugin ooRexx movido para projeto separado.
Showing
26 changed files
with
86 additions
and
2530 deletions
Show diff stats
Makefile.in
... | ... | @@ -91,6 +91,12 @@ $(BINRLS)/%@DLLEXT@: \ |
91 | 91 | |
92 | 92 | @$(MAKE) -C src/$(basename $(notdir $@)) $@ |
93 | 93 | |
94 | +$(BINRLS)/%.a: \ | |
95 | + $(DEPENDS) \ | |
96 | + ./src/%/* | |
97 | + | |
98 | + @$(MAKE) -C src/$(basename $(notdir $@)) $@ | |
99 | + | |
94 | 100 | $(BINRLS)/plugins/%@DLLEXT@: \ |
95 | 101 | $(DEPENDS) \ |
96 | 102 | ./src/plugins/%/* |
... | ... | @@ -170,6 +176,7 @@ $(SRCDIR)/%: \ |
170 | 176 | all: \ |
171 | 177 | $(BINRLS)/lib3270@DLLEXT@ \ |
172 | 178 | $(BINRLS)/$(PACKAGE_TARNAME)@EXEEXT@ \ |
179 | + $(BINRLS)/libpw3270cpp.a \ | |
173 | 180 | $(foreach PLG, $(PLUGINS), $(BINRLS)/plugins/$(PLG)@DLLEXT@) \ |
174 | 181 | locale/$(PACKAGE_TARNAME).pot |
175 | 182 | |
... | ... | @@ -190,10 +197,16 @@ locale/$(PACKAGE_TARNAME).pot: \ |
190 | 197 | @$(MSGCAT) --sort-output $^ > $@ |
191 | 198 | |
192 | 199 | install: \ |
200 | + install-lib \ | |
201 | + install-app \ | |
202 | + install-sdk \ | |
203 | + $(foreach PLG, $(PLUGINS), $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)-plugins/$(PLG)@DLLEXT@) | |
204 | + | |
205 | +install-lib: \ | |
193 | 206 | $(DESTDIR)$(libdir)/lib3270@DLLEXT@ \ |
207 | + | |
208 | +install-app: \ | |
194 | 209 | $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)@EXEEXT@ \ |
195 | - $(DESTDIR)$(libdir)/libpw3270cpp.a \ | |
196 | - $(foreach PLG, $(PLUGINS), $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)-plugins/$(PLG)@DLLEXT@) \ | |
197 | 210 | locale/$(PACKAGE_TARNAME).pot |
198 | 211 | |
199 | 212 | @$(MKDIR) $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME) |
... | ... | @@ -201,7 +214,11 @@ install: \ |
201 | 214 | |
202 | 215 | @$(MAKE) -C ui install |
203 | 216 | @$(MAKE) -C locale install |
217 | + | |
218 | +install-sdk: | |
219 | + | |
204 | 220 | @$(MAKE) -C sdk install |
221 | + @$(MAKE) -C src/libpw3270cpp install | |
205 | 222 | |
206 | 223 | #---[ Debug targets ]---------------------------------------------------------- |
207 | 224 | ... | ... |
debian/control
... | ... | @@ -2,7 +2,7 @@ Source: pw3270 |
2 | 2 | Section: unknown |
3 | 3 | Priority: optional |
4 | 4 | Maintainer: Perry Werneck <perry.werneck@gmail.com> |
5 | -Build-Depends: debhelper (>= 7), autotools-dev, autoconf, libgtk-3-dev, gettext, libssl-dev, desktop-file-utils, libdbus-glib-1-dev, libssl-dev, xsltproc, librsvg2-bin, oorexx-dev, zip, libreoffice-common, libreoffice-core, libreoffice-dev, uno-libs3, ure | |
5 | +Build-Depends: debhelper (>= 7), autotools-dev, autoconf, libgtk-3-dev, gettext, libssl-dev, desktop-file-utils, libdbus-glib-1-dev, libssl-dev, xsltproc, librsvg2-bin | |
6 | 6 | |
7 | 7 | Package: pw3270 |
8 | 8 | Architecture: any |
... | ... | @@ -25,21 +25,16 @@ Depends: ${misc:Depends}, lib3270 (= ${binary:Version}) |
25 | 25 | Description: lib3270 development files. |
26 | 26 | This package contains the files needed for development of lib3270 based applications |
27 | 27 | |
28 | +Package: pw3270-dev | |
29 | +Architecture: any | |
30 | +Section: libdevel | |
31 | +Depends: ${misc:Depends}, lib3270-dev (= ${binary:Version}), pw3270 (= ${binary:Version}) | |
32 | +Description: lib3270 development files. | |
33 | + This package contains the files needed for development of pw3270 extensions and plugins | |
34 | + | |
28 | 35 | Package: pw3270-plugin-dbus |
29 | 36 | Architecture: any |
30 | 37 | Depends: ${misc:Depends}, pw3270 (= ${binary:Version}), libdbus-1-3 |
31 | 38 | Description: DBUS plugin for pw3270. |
32 | 39 | This package contains the plugin allowing scripting of a pw3270 session using dbus calls. |
33 | 40 | |
34 | -Package: pw3270-plugin-rexx | |
35 | -Architecture: any | |
36 | -Depends: ${misc:Depends}, lib3270 (= ${binary:Version}), oorexx (>= 4.1.2) | |
37 | -Description: REXX script support for pw3270. | |
38 | - This package provides Rexx class and associated libraries allowing rexx scripts to access tn3270e hosts. | |
39 | - | |
40 | -Package: libreoffice-extension-pw3270 | |
41 | -Architecture: any | |
42 | -Depends: ${misc:Depends}, pw3270 (= ${binary:Version}), libreoffice-core | |
43 | -Description: DBUS plugin for pw3270. | |
44 | - This package contains the libreoffice modules for acessing 3270 hosts. | |
45 | - | ... | ... |
debian/rules
... | ... | @@ -8,10 +8,6 @@ export DH_VERBOSE=1 |
8 | 8 | # This is the debhelper compatibility version to use. |
9 | 9 | export DH_COMPAT=4 |
10 | 10 | |
11 | -# Libreoffice stuff | |
12 | -export OFFICE_HOME=/usr/lib/libreoffice | |
13 | -export OO_SDK_URE_HOME=/usr/lib/ure | |
14 | - | |
15 | 11 | CFLAGS = -g |
16 | 12 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
17 | 13 | CFLAGS += -O0 |
... | ... | @@ -50,40 +46,37 @@ install: build |
50 | 46 | dh_clean -k |
51 | 47 | dh_installdirs |
52 | 48 | |
49 | + # Build package | |
50 | + make all | |
51 | + | |
53 | 52 | # Install main library |
54 | 53 | make DESTDIR=$(PWD)/debian/lib3270 install-lib |
55 | 54 | |
56 | 55 | # Install pw3270's GUI |
57 | 56 | make DESTDIR=$(PWD)/debian/pw3270 install-app |
58 | 57 | |
59 | - # Install sdk | |
60 | - make DESTDIR=$(PWD)/debian/lib3270-dev install-sdk | |
58 | + # Install lib3270-sdk | |
59 | + make DESTDIR=$(PWD)/debian/lib3270-dev -C sdk install-lib3270 | |
61 | 60 | |
62 | - mkdir -p $(PWD)/debian/lib3270-dev/usr/share/pw3270/ui | |
63 | - mv -f $(PWD)/debian/pw3270/usr/share/pw3270/ui/*debug.xml $(PWD)/debian/lib3270-dev/usr/share/pw3270/ui/ | |
61 | + # Install pw3270-sdk | |
62 | + make DESTDIR=$(PWD)/debian/pw3270-dev -C sdk install-pw3270 | |
63 | + make DESTDIR=$(PWD)/debian/pw3270-dev -C src/libpw3270cpp install | |
64 | 64 | |
65 | - # Install libreoffice extension | |
66 | - make DESTDIR=$(PWD)/debian/libreoffice-extension-pw3270 install-oxt | |
65 | + mkdir -p $(PWD)/debian/lib3270-dev/lib3270 | |
66 | + install --mode=644 src/include/lib3270.h $(PWD)/debian/lib3270-dev | |
67 | + install --mode=644 src/include/lib3270/*.h $(PWD)/debian/lib3270-dev/lib3270 | |
67 | 68 | |
68 | - # Install DBUS plugin | |
69 | - make DESTDIR=$(PWD)/debian/pw3270-plugin-dbus install-plugin-dbus | |
69 | + # Move SDK's ui files | |
70 | 70 | |
71 | - # Install REXX plugin | |
72 | - make DESTDIR=$(PWD)/debian/pw3270-plugin-rexx install-plugin-rexx | |
71 | + # Install DBUS plugin | |
72 | + make DESTDIR=$(PWD)/debian/pw3270-plugin-dbus -C src/plugins/dbus3270/ install | |
73 | 73 | |
74 | - mkdir -p $(PWD)/debian/pw3270-plugin-rexx/usr/share/pw3270/ui/ | |
75 | - mv -f $(PWD)/debian/pw3270/usr/share/pw3270/ui/*rexx.xml $(PWD)/debian/pw3270-plugin-rexx/usr/share/pw3270/ui/ | |
76 | - | |
77 | - # Create updated file lists | |
74 | + # Get file lists | |
78 | 75 | find $(PWD)/debian/lib3270 -type f | sed -e "s@^$(PWD)/debian/lib3270/@/@g" > $(PWD)/debian/lib3270.install |
79 | - | |
80 | 76 | find $(PWD)/debian/pw3270 -type f | sed -e "s@^$(PWD)/debian/pw3270/@/@g" > $(PWD)/debian/pw3270.install |
81 | - | |
82 | - find $(PWD)/debian/libreoffice-extension-pw3270 -type f | sed -e "s@^$(PWD)/debian/libreoffice-extension-pw3270/@/@g" > $(PWD)/debian/libreoffice-extension-pw3270.install | |
83 | - | |
84 | 77 | find $(PWD)/debian/pw3270-plugin-dbus -type f | sed -e "s@^$(PWD)/debian/pw3270-plugin-dbus/@/@g" > $(PWD)/debian/pw3270-plugin-dbus.install |
85 | - find $(PWD)/debian/pw3270-plugin-rexx -type f | sed -e "s@^$(PWD)/debian/pw3270-plugin-rexx/@/@g" > $(PWD)/debian/pw3270-plugin-rexx.install | |
86 | - | |
78 | + find $(PWD)/debian/lib3270-dev -type f | sed -e "s@^$(PWD)/debian/lib3270-dev/@/@g" > $(PWD)/debian/lib3270-dev.install | |
79 | + find $(PWD)/debian/pw3270-dev -type f | sed -e "s@^$(PWD)/debian/pw3270-dev/@/@g" > $(PWD)/debian/pw3270-dev.install | |
87 | 80 | # --- end custom part for installing |
88 | 81 | |
89 | 82 | # Build architecture-independent files here. | ... | ... |
locale/Makefile.in
1 | 1 | # |
2 | -# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
2 | +# Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | 3 | # (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a |
4 | 4 | # aplicativos mainframe. Registro no INPI sob o nome G3270. |
5 | 5 | # |
... | ... | @@ -15,13 +15,13 @@ |
15 | 15 | # obter mais detalhes. |
16 | 16 | # |
17 | 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 | |
18 | +# programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | +# St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | 20 | # |
21 | 21 | # Contatos: |
22 | 22 | # |
23 | -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
24 | -# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
23 | +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
24 | +# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) | |
25 | 25 | # |
26 | 26 | |
27 | 27 | ... | ... |
locale/pw3270.pot
... | ... | @@ -9,7 +9,7 @@ msgstr "" |
9 | 9 | "#-#-#-#-# lib3270.pot (PACKAGE VERSION) #-#-#-#-#\n" |
10 | 10 | "Project-Id-Version: PACKAGE VERSION\n" |
11 | 11 | "Report-Msgid-Bugs-To: \n" |
12 | -"POT-Creation-Date: 2017-01-19 11:07-0200\n" | |
12 | +"POT-Creation-Date: 2017-01-19 15:24-0200\n" | |
13 | 13 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
14 | 14 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
15 | 15 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -20,7 +20,7 @@ msgstr "" |
20 | 20 | "#-#-#-#-# pw3270.pot (PACKAGE VERSION) #-#-#-#-#\n" |
21 | 21 | "Project-Id-Version: PACKAGE VERSION\n" |
22 | 22 | "Report-Msgid-Bugs-To: \n" |
23 | -"POT-Creation-Date: 2017-01-19 11:07-0200\n" | |
23 | +"POT-Creation-Date: 2017-01-19 15:24-0200\n" | |
24 | 24 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
25 | 25 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
26 | 26 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -42,7 +42,7 @@ msgstr "" |
42 | 42 | "#-#-#-#-# dbus3270.pot (PACKAGE VERSION) #-#-#-#-#\n" |
43 | 43 | "Project-Id-Version: PACKAGE VERSION\n" |
44 | 44 | "Report-Msgid-Bugs-To: \n" |
45 | -"POT-Creation-Date: 2017-01-19 11:07-0200\n" | |
45 | +"POT-Creation-Date: 2017-01-19 15:24-0200\n" | |
46 | 46 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
47 | 47 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
48 | 48 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
rpm/pw3270.spec
... | ... | @@ -41,11 +41,8 @@ Source: pw3270-%{version}.tar.bz2 |
41 | 41 | |
42 | 42 | BuildRoot: %{_tmppath}/%{name}-%{version}-build |
43 | 43 | |
44 | -Requires: lib3270-%{_libvrs} = %{version} | |
45 | 44 | Requires: shared-mime-info |
46 | 45 | |
47 | -Requires: libpw3270-%{MAJOR_VERSION}_%{MINOR_VERSION} | |
48 | - | |
49 | 46 | #--[ Setup by distribution ]------------------------------------------------------------------------------------------ |
50 | 47 | # |
51 | 48 | # References: |
... | ... | @@ -154,7 +151,7 @@ This package contains the tn3270 protocol library for %{name} |
154 | 151 | Summary: Devel for 3270 Communication library for %{name} |
155 | 152 | Group: Development/Libraries/C and C++ |
156 | 153 | Provides: lib3270-devel-%{MAJOR_VERSION}_%{MINOR_VERSION} |
157 | -Requires: lib3270-%{MAJOR_VERSION}_%{MINOR_VERSION} | |
154 | +Requires: lib3270-%{MAJOR_VERSION}_%{MINOR_VERSION} = %{version} | |
158 | 155 | |
159 | 156 | %description -n lib3270-devel |
160 | 157 | Open-source GTK-based IBM 3270 terminal emulator with many advanced features. It can be used to communicate with any IBM host that supports 3270-style connections over TELNET. |
... | ... | @@ -163,8 +160,8 @@ This package contains the development files for tn3270 protocol library for %{na |
163 | 160 | %package -n %{name}-devel |
164 | 161 | Summary: Files required for development of %{name} plugins |
165 | 162 | Group: Development/Libraries/C and C++ |
166 | -Requires: lib3270-devel-%{MAJOR_VERSION}_%{MINOR_VERSION} | |
167 | -Requires: libpw3270-%{MAJOR_VERSION}_%{MINOR_VERSION} | |
163 | +Requires: lib3270-devel-%{MAJOR_VERSION}_%{MINOR_VERSION} = %{version} | |
164 | +Requires: libpw3270-%{MAJOR_VERSION}_%{MINOR_VERSION} = %{version} | |
168 | 165 | |
169 | 166 | %description -n %{name}-devel |
170 | 167 | Open-source GTK-based IBM 3270 terminal emulator with many advanced features. It can be used to communicate with any IBM host that supports 3270-style connections over TELNET. | ... | ... |
sdk/Makefile.in
... | ... | @@ -67,14 +67,20 @@ $(SRCDIR)/src/include/%.h: \ |
67 | 67 | #---[ Targets ]-------------------------------------------------------------------------- |
68 | 68 | |
69 | 69 | install: \ |
70 | - $(foreach SRC, $(basename $(wildcard *.pc)), $(DESTDIR)$(libdir)/pkgconfig/$(SRC).pc) \ | |
70 | + install-lib3270 \ | |
71 | + install-pw3270 | |
72 | + | |
73 | +install-lib3270: \ | |
71 | 74 | $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/lib3270/*.h)), $(DESTDIR)$(includedir)/lib3270/$(SRC)) \ |
72 | - $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/pw3270/*.h)), $(DESTDIR)$(includedir)/pw3270/$(SRC)) \ | |
75 | + $(DESTDIR)$(libdir)/pkgconfig/lib3270.pc \ | |
73 | 76 | $(DESTDIR)$(includedir)/lib3270.h \ |
77 | + | |
78 | +install-pw3270: \ | |
79 | + $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/pw3270/*.h)), $(DESTDIR)$(includedir)/pw3270/$(SRC)) \ | |
80 | + $(DESTDIR)$(libdir)/pkgconfig/pw3270.pc \ | |
74 | 81 | $(DESTDIR)$(includedir)/pw3270.h \ |
75 | 82 | $(DESTDIR)$(includedir)/pw3270cpp.h \ |
76 | 83 | |
77 | - | |
78 | 84 | $(SRCDIR)/sdk: \ |
79 | 85 | $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/lib3270/*.h)), $(SRCDIR)/src/include/lib3270/$(SRC)) \ |
80 | 86 | $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/pw3270/*.h)), $(SRCDIR)/src/include/pw3270/$(SRC)) \ | ... | ... |
src/include/pw3270/ipcpackets.h
... | ... | @@ -15,10 +15,10 @@ |
15 | 15 | * obter mais detalhes. |
16 | 16 | * |
17 | 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 | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | 20 | * |
21 | - * Este programa está nomeado como ipcpackets.h e possui - linhas de código. | |
21 | + * Este programa está nomeado como lib3270.h e possui - linhas de código. | |
22 | 22 | * |
23 | 23 | * Contatos: |
24 | 24 | * | ... | ... |
src/libpw3270cpp/Makefile.in
... | ... | @@ -102,20 +102,23 @@ $(POTDIR)/%.pot: %.c |
102 | 102 | |
103 | 103 | #---[ Release Targets ]------------------------------------------------------------------ |
104 | 104 | |
105 | +all: \ | |
106 | + $(BASEDIR)/.bin/Release/$(MODULE_NAME).a | |
107 | + | |
105 | 108 | Release: \ |
106 | - $(BASEDIR)/.obj/Release/$(MODULE_NAME).a | |
109 | + $(BASEDIR)/.bin/Release/$(MODULE_NAME).a | |
107 | 110 | |
108 | 111 | install: \ |
109 | 112 | $(DESTDIR)$(libdir)/$(MODULE_NAME).a |
110 | 113 | |
111 | 114 | $(DESTDIR)$(libdir)/$(MODULE_NAME).a: \ |
112 | - $(BASEDIR)/.obj/Release/$(MODULE_NAME).a | |
115 | + $(BASEDIR)/.bin/Release/$(MODULE_NAME).a | |
113 | 116 | |
114 | 117 | @echo $@ ... |
115 | 118 | @$(MKDIR) `dirname $@` |
116 | - @$(INSTALL_PROGRAM) $^ $@ | |
119 | + @$(INSTALL_DATA) $^ $@ | |
117 | 120 | |
118 | -$(BASEDIR)/.obj/Release/$(MODULE_NAME).a: \ | |
121 | +$(BASEDIR)/.bin/Release/$(MODULE_NAME).a: \ | |
119 | 122 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) |
120 | 123 | |
121 | 124 | @echo $@ ... | ... | ... |
src/plugins/dbus3270/Makefile.in
... | ... | @@ -62,6 +62,7 @@ XGETTEXT=@XGETTEXT@ |
62 | 62 | MSGCAT=@MSGCAT@ |
63 | 63 | INSTALL=@INSTALL@ |
64 | 64 | INSTALL_DATA=@INSTALL_DATA@ |
65 | +INSTALL_PROGRAM=@INSTALL_PROGRAM@ | |
65 | 66 | |
66 | 67 | CFLAGS=@CFLAGS@ @GTK_CFLAGS@ -I$(BASEDIR)/src/include |
67 | 68 | LIBS=@LIBS@ @GTK_LIBS@ @GLIB_LIBS@ @GDBUS_LIBS@ @LIB3270_LIBS@ @PW3270_LIBS@ |
... | ... | @@ -122,18 +123,22 @@ dbus-glue.h: \ |
122 | 123 | Release: \ |
123 | 124 | $(BINRLS)/$(MODULE_NAME)@DLLEXT@ |
124 | 125 | |
125 | -$(BINRLS)/$(MODULE_NAME)@DLLEXT@: \ | |
126 | - $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) | |
126 | +install: \ | |
127 | + $(BINRLS)/$(MODULE_NAME)@DLLEXT@ | |
127 | 128 | |
128 | 129 | @echo $@ ... |
129 | 130 | @$(MKDIR) `dirname $@` |
130 | - @$(LD) \ | |
131 | - -shared \ | |
132 | - -L$(BASEDIR)/.bin/Release \ | |
133 | - -o $@ $^ \ | |
134 | - $(LIBS) | |
131 | + $(INSTALL_PROGRAM) $(BINRLS)/$(MODULE_NAME)@DLLEXT@ $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)-plugins/$(MODULE_NAME)@DLLEXT@ | |
135 | 132 | |
136 | 133 | $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)-plugins/$(MODULE_NAME)@DLLEXT@: \ |
134 | + $(BINRLS)/$(MODULE_NAME)@DLLEXT@ | |
135 | + | |
136 | + @echo $@ ... | |
137 | + @$(MKDIR) `dirname $@` | |
138 | + $(INSTALL_PROGRAM) $(BINRLS)/$(MODULE_NAME)@DLLEXT@ $@ | |
139 | + | |
140 | + | |
141 | +$(BINRLS)/$(MODULE_NAME)@DLLEXT@: \ | |
137 | 142 | $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) |
138 | 143 | |
139 | 144 | @echo $@ ... | ... | ... |
src/plugins/rx3270/Makefile.in
... | ... | @@ -1,89 +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 | -#---[ Sources ]---------------------------------------------------------------- | |
28 | - | |
29 | -MODULE_NAME=rx3270 | |
30 | -DEPENDS=*.h ../../include/*.h ../../include/lib3270/*.h Makefile | |
31 | -PLUGIN_SRC=pluginmain.cc | |
32 | -EXTAPI_SRC=rxapimain.cc typed_routines.cc rexx_methods.cc | |
33 | - | |
34 | -#---[ Tools ]------------------------------------------------------------------ | |
35 | - | |
36 | -REXXCONFIG=@REXXCONFIG@ | |
37 | -LN_S=@LN_S@ | |
38 | - | |
39 | -#---[ Include plugin rules ]--------------------------------------------------- | |
40 | - | |
41 | -CLASSLIBDIR=../../classlib | |
42 | - | |
43 | -include ../../include/plugin.mak | |
44 | -include $(CLASSLIBDIR)/class.mak | |
45 | - | |
46 | -LIBS=@REXX_LIBS@ @LIBICONV@ @DBUS_LIBS@ | |
47 | - | |
48 | -REXX_CFLAGS=@REXX_CFLAGS@ | |
49 | -DBUS_CFLAGS=@DBUS_CFLAGS@ | |
50 | - | |
51 | -CFLAGS=@CFLAGS@ $(REXX_CFLAGS) $(DBUS_CFLAGS) | |
52 | -REXX_HOME=@REXX_HOME@ | |
53 | -REXXLIBDIR=@REXX_LIBDIR@ | |
54 | - | |
55 | -#---[ Debug Targets ]---------------------------------------------------------- | |
56 | - | |
57 | -$(BINDBG)/$(PLUGIN_NAME): $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/$(SRC).o) $(BINDBG)$(DLL_NAME) | |
58 | - @echo " CCLD `basename $@`" | |
59 | - @$(MKDIR) `dirname $@` | |
60 | - @$(CXX) $(DLL_FLAGS) @LDSOFLAGS@ @DBGRPATH@ $(LDFLAGS) -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(GTK_LIBS) $(GLIB_LIBS) $(PW3270_LIBS) | |
61 | - | |
62 | -$(BINDBG)$(DLL_NAME).$(VERSION): $(foreach SRC, $(basename $(EXTAPI_SRC)), $(OBJDBG)/$(SRC)@OBJEXT@) $(CLASS_DEBUG_OBJECTS) | |
63 | - @echo " CCLD `basename $@`" | |
64 | - @$(MKDIR) `dirname $@` | |
65 | - @$(CXX) $(DLL_FLAGS) $(LDFLAGS) @LDSOFLAGS@ @DBGRPATH@ -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(CLASS_LIBS) | |
66 | - | |
67 | -#---[ Release Targets ]-------------------------------------------------------- | |
68 | - | |
69 | -$(BINRLS)/$(PLUGIN_NAME): $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/$(SRC).o) $(BINRLS)$(DLL_NAME) | |
70 | - @echo " CCLD `basename $@`" | |
71 | - @$(MKDIR) `dirname $@` | |
72 | - @$(CXX) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) @RLS_LDFLAGS@ -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(GTK_LIBS) $(GLIB_LIBS) $(PW3270_LIBS) | |
73 | - | |
74 | -$(BINRLS)$(DLL_NAME).$(VERSION): $(foreach SRC, $(basename $(EXTAPI_SRC)), $(OBJRLS)/$(SRC).o) $(CLASS_RELEASE_OBJECTS) | |
75 | - @echo " CCLD `basename $@`" | |
76 | - @$(MKDIR) `dirname $@` | |
77 | - @$(CXX) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) @RLS_LDFLAGS@ -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(CLASS_LIBS) | |
78 | - | |
79 | -install: | |
80 | - @$(MKDIR) $(DESTDIR)$(libdir)/$(PACKAGE_NAME)-plugins | |
81 | - @$(INSTALL_PROGRAM) $(BINRLS)/$(PLUGIN_NAME) $(DESTDIR)$(libdir)/$(PACKAGE_NAME)-plugins | |
82 | - | |
83 | - @$(MKDIR) $(DESTDIR)$(REXXLIBDIR) | |
84 | - @$(INSTALL_PROGRAM) $(BINRLS)$(DLL_NAME).$(VERSION) $(DESTDIR)$(REXXLIBDIR) | |
85 | - @$(LN_S) @DLLPREFIX@$(MODULE_NAME)@DLLEXT@.$(VERSION) $(DESTDIR)$(REXXLIBDIR)/@DLLPREFIX@$(MODULE_NAME)@DLLEXT@ | |
86 | - | |
87 | - @$(MKDIR) $(DESTDIR)$(REXX_HOME) | |
88 | - @$(INSTALL_DATA) rx3270.cls $(DESTDIR)$(REXX_HOME) | |
89 | - |
src/plugins/rx3270/pluginmain.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 pluginmain.c 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 | - * Referencias: | |
29 | - * | |
30 | - * * http://www.oorexx.org/docs/rexxpg/x14097.htm | |
31 | - * * http://www.oorexx.org/docs/rexxpg/c2539.htm | |
32 | - * | |
33 | - */ | |
34 | - | |
35 | - #define ENABLE_NLS | |
36 | - #define GETTEXT_PACKAGE PACKAGE_NAME | |
37 | - | |
38 | - #include "rx3270.h" | |
39 | - | |
40 | - #include <libintl.h> | |
41 | - #include <glib/gi18n.h> | |
42 | - #include <gtk/gtk.h> | |
43 | - | |
44 | - #include <string.h> | |
45 | - #include <pw3270.h> | |
46 | - #include <pw3270/plugin.h> | |
47 | - #include <v3270.h> | |
48 | - #include <pw3270/trace.h> | |
49 | - #include <lib3270/actions.h> | |
50 | - #include <lib3270/log.h> | |
51 | - #include <lib3270/trace.h> | |
52 | - #include <lib3270/charset.h> | |
53 | - #include <pw3270/class.h> | |
54 | - | |
55 | - | |
56 | -/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
57 | - | |
58 | -#if GTK_CHECK_VERSION(2,32,0) | |
59 | - static GMutex mutex; | |
60 | -#else | |
61 | - static GStaticMutex mutex = G_STATIC_MUTEX_INIT; | |
62 | -#endif // GTK_CHECK_VERSION | |
63 | - | |
64 | - static gchar * script_name = NULL; | |
65 | - | |
66 | -/*--[ Rexx application data block ]--------------------------------------------------------------------------*/ | |
67 | - | |
68 | - struct rexx_application_data | |
69 | - { | |
70 | - GtkAction * action; | |
71 | - GtkWidget * widget; | |
72 | - GtkWidget * trace; | |
73 | - const gchar * filename; | |
74 | - }; | |
75 | - | |
76 | -/*--[ Plugin session object ]--------------------------------------------------------------------------------*/ | |
77 | - | |
78 | - using namespace std; | |
79 | - using namespace PW3270_NAMESPACE; | |
80 | - | |
81 | - | |
82 | -/*--[ Running rexx scripts ]---------------------------------------------------------------------------------*/ | |
83 | - | |
84 | - static void trace_cleanup(GtkWidget *widget, gpointer dunno) | |
85 | - { | |
86 | - rexx_application_data *data = (rexx_application_data *) g_object_get_data(G_OBJECT(widget),"rexx_app_data"); | |
87 | - | |
88 | - trace("%s: data=%p",__FUNCTION__,data); | |
89 | - | |
90 | - if(data) | |
91 | - data->trace = NULL; | |
92 | - | |
93 | - } | |
94 | - | |
95 | - static GtkWidget * get_trace_window(rexx_application_data *data) | |
96 | - { | |
97 | - if(data->trace) | |
98 | - return data->trace; | |
99 | - | |
100 | - data->trace = pw3270_trace_new(); | |
101 | - g_signal_connect(G_OBJECT(data->trace), "destroy",G_CALLBACK(trace_cleanup), NULL); | |
102 | - | |
103 | - pw3270_trace_set_destroy_on_close(data->trace,TRUE); | |
104 | - | |
105 | - g_object_set_data(G_OBJECT(data->trace),"rexx_app_data",data); | |
106 | - | |
107 | - gtk_window_set_title(GTK_WINDOW(data->trace),_("Rexx trace")); | |
108 | - | |
109 | - gtk_window_set_transient_for(GTK_WINDOW(data->trace),GTK_WINDOW(gtk_widget_get_toplevel(data->widget))); | |
110 | - gtk_window_set_destroy_with_parent(GTK_WINDOW(data->trace),TRUE); | |
111 | - | |
112 | - | |
113 | - gtk_window_set_default_size(GTK_WINDOW(data->trace),590,430); | |
114 | - gtk_widget_show_all(data->trace); | |
115 | - return data->trace; | |
116 | - } | |
117 | - | |
118 | - static void read_line(struct rexx_application_data *data, PRXSTRING Retstr) | |
119 | - { | |
120 | - gchar *value = pw3270_trace_get_command(get_trace_window(data)); | |
121 | - | |
122 | - if(value) | |
123 | - { | |
124 | - if(strlen(value) > (RXAUTOBUFLEN-1)) | |
125 | - { | |
126 | - Retstr->strptr = (char *) RexxAllocateMemory(strlen(value)+1); | |
127 | - strcpy(Retstr->strptr,value); | |
128 | - } | |
129 | - else | |
130 | - { | |
131 | - g_snprintf(Retstr->strptr,RXAUTOBUFLEN-1,"%s",value); | |
132 | - } | |
133 | - g_free(value); | |
134 | - } | |
135 | - else | |
136 | - { | |
137 | - *Retstr->strptr = 0; | |
138 | - } | |
139 | - | |
140 | - Retstr->strlength = strlen(Retstr->strptr); | |
141 | - | |
142 | - } | |
143 | - | |
144 | - static int REXXENTRY Rexx_IO_exit(RexxExitContext *context, int exitnumber, int subfunction, PEXIT parmBlock) | |
145 | - { | |
146 | -// trace("%s call with ExitNumber: %d Subfunction: %d",__FUNCTION__,(int) exitnumber, (int) subfunction); | |
147 | - | |
148 | - switch(subfunction) | |
149 | - { | |
150 | - case RXSIOSAY: // SAY a line to STDOUT | |
151 | - { | |
152 | - struct rexx_application_data *data = (struct rexx_application_data *) context->GetApplicationData(); | |
153 | - | |
154 | - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(data->widget)), | |
155 | - GTK_DIALOG_DESTROY_WITH_PARENT, | |
156 | - GTK_MESSAGE_INFO, | |
157 | - GTK_BUTTONS_OK_CANCEL, | |
158 | - "%s", (((RXSIOSAY_PARM *) parmBlock)->rxsio_string).strptr ); | |
159 | - | |
160 | - gtk_window_set_title(GTK_WINDOW(dialog), _( "Script message" ) ); | |
161 | - | |
162 | - if(data->trace) | |
163 | - pw3270_trace_printf(data->trace,"%s\n",(((RXSIOSAY_PARM *) parmBlock)->rxsio_string).strptr); | |
164 | - | |
165 | - if(gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_CANCEL) | |
166 | - context->RaiseException0(Rexx_Error_Program_interrupted); | |
167 | - | |
168 | - gtk_widget_destroy(dialog); | |
169 | - } | |
170 | - break; | |
171 | - | |
172 | - case RXSIOTRC: // Trace output | |
173 | - { | |
174 | - struct rexx_application_data *data = (struct rexx_application_data *) context->GetApplicationData(); | |
175 | - lib3270_write_log(NULL, "rx3270", "%s", (((RXSIOTRC_PARM *) parmBlock)->rxsio_string).strptr); | |
176 | - pw3270_trace_printf(get_trace_window(data),"%s\n",(((RXSIOTRC_PARM *) parmBlock)->rxsio_string).strptr); | |
177 | - } | |
178 | - break; | |
179 | - | |
180 | - case RXSIOTRD: // Read from char stream | |
181 | - read_line((struct rexx_application_data *) context->GetApplicationData(), & (((RXSIODTR_PARM *) parmBlock)->rxsiodtr_retc) ); | |
182 | - break; | |
183 | - | |
184 | - case RXSIODTR: // DEBUG read from char stream | |
185 | - read_line((struct rexx_application_data *) context->GetApplicationData(), & (((RXSIODTR_PARM *) parmBlock)->rxsiodtr_retc) ); | |
186 | - break; | |
187 | - | |
188 | - default: | |
189 | - return RXEXIT_NOT_HANDLED; | |
190 | - | |
191 | - } | |
192 | - | |
193 | - return RXEXIT_HANDLED; | |
194 | - } | |
195 | - | |
196 | - static void call_rexx_script(GtkAction *action, GtkWidget *widget, const gchar *filename) | |
197 | - { | |
198 | - const gchar * args = (const gchar *) g_object_get_data(G_OBJECT(action),"args"); | |
199 | - | |
200 | - struct rexx_application_data appdata; | |
201 | - | |
202 | - RexxInstance * instance; | |
203 | - RexxThreadContext * threadContext; | |
204 | - RexxOption options[25]; | |
205 | - RexxContextExit exits[2]; | |
206 | - | |
207 | - memset(&appdata,0,sizeof(appdata)); | |
208 | - appdata.action = action; | |
209 | - appdata.widget = widget; | |
210 | - appdata.filename = filename; | |
211 | - | |
212 | - memset(options,0,sizeof(options)); | |
213 | - memset(exits,0,sizeof(exits)); | |
214 | - | |
215 | - exits[0].sysexit_code = RXSIO; | |
216 | - exits[0].handler = Rexx_IO_exit; | |
217 | - | |
218 | - // http://www.oorexx.org/docs/rexxpg/c2539.htm | |
219 | - | |
220 | - options[0].optionName = DIRECT_EXITS; | |
221 | - options[0].option = (void *) exits; | |
222 | - | |
223 | - options[1].optionName = APPLICATION_DATA; | |
224 | - options[1].option = (void *) &appdata; | |
225 | - | |
226 | - rx3270_set_package_option(&options[2]); | |
227 | - | |
228 | - options[3].optionName = EXTERNAL_CALL_PATH; | |
229 | - options[3].option = pw3270_get_datadir(NULL); | |
230 | - | |
231 | - trace("Rexxdir: \"%s\"",(gchar *) ((void *) options[3].option)); | |
232 | - | |
233 | - if(!RexxCreateInterpreter(&instance, &threadContext, options)) | |
234 | - { | |
235 | - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
236 | - GTK_DIALOG_DESTROY_WITH_PARENT, | |
237 | - GTK_MESSAGE_ERROR, | |
238 | - GTK_BUTTONS_CANCEL, | |
239 | - _( "Can't start %s script" ), "rexx" ); | |
240 | - | |
241 | - gtk_window_set_title(GTK_WINDOW(dialog),_( "Rexx error" )); | |
242 | - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),_( "Can't create %s interpreter instance" ), "rexx"); | |
243 | - | |
244 | - gtk_dialog_run(GTK_DIALOG (dialog)); | |
245 | - gtk_widget_destroy(dialog); | |
246 | - } | |
247 | - else | |
248 | - { | |
249 | - RexxArrayObject rxArgs; | |
250 | - | |
251 | - trace("%s %s(%s)",__FUNCTION__,filename,args); | |
252 | - | |
253 | - if(args) | |
254 | - { | |
255 | - gchar **arg = g_strsplit(args,",",-1); | |
256 | - size_t sz = g_strv_length(arg); | |
257 | - | |
258 | - rxArgs = threadContext->NewArray(sz); | |
259 | - for(unsigned int i = 0; i<sz; i++) | |
260 | - threadContext->ArrayPut(rxArgs, threadContext->String(arg[i]), i + 1); | |
261 | - | |
262 | - g_strfreev(arg); | |
263 | - } | |
264 | - else | |
265 | - { | |
266 | - rxArgs = threadContext->NewArray(1); | |
267 | - threadContext->ArrayPut(rxArgs, threadContext->String(""),1); | |
268 | - } | |
269 | - | |
270 | - v3270_set_script(widget,'R',TRUE); | |
271 | - script_name = g_path_get_basename(filename); | |
272 | - trace("%s: Calling",filename); | |
273 | - RexxObjectPtr result = threadContext->CallProgram(filename, rxArgs); | |
274 | - trace("%s: Returns",filename); | |
275 | - g_free(script_name); | |
276 | - script_name = NULL; | |
277 | - v3270_set_script(widget,'R',FALSE); | |
278 | - | |
279 | - if (threadContext->CheckCondition()) | |
280 | - { | |
281 | - RexxCondition condition; | |
282 | - | |
283 | - // retrieve the error information and get it into a decoded form | |
284 | - RexxDirectoryObject cond = threadContext->GetConditionInfo(); | |
285 | - threadContext->DecodeConditionInfo(cond, &condition); | |
286 | - // display the errors | |
287 | - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
288 | - GTK_DIALOG_DESTROY_WITH_PARENT, | |
289 | - GTK_MESSAGE_ERROR, | |
290 | - GTK_BUTTONS_CANCEL, | |
291 | - _( "%s script failed" ), "Rexx" ); | |
292 | - | |
293 | - gtk_window_set_title(GTK_WINDOW(dialog),_( "Rexx error" )); | |
294 | - | |
295 | - gtk_message_dialog_format_secondary_text( | |
296 | - GTK_MESSAGE_DIALOG(dialog), | |
297 | - _( "%s error %d: %s\n%s" ), | |
298 | - "Rexx", | |
299 | - (int) condition.code, | |
300 | - threadContext->CString(condition.errortext), | |
301 | - threadContext->CString(condition.message) | |
302 | - | |
303 | - ); | |
304 | - | |
305 | - gtk_dialog_run(GTK_DIALOG (dialog)); | |
306 | - gtk_widget_destroy(dialog); | |
307 | - | |
308 | - } | |
309 | - else if (result != NULLOBJECT) | |
310 | - { | |
311 | - CSTRING resultString = threadContext->CString(result); | |
312 | - lib3270_write_log(NULL,"REXX","%s exits with rc=%s",filename,resultString); | |
313 | - } | |
314 | - | |
315 | - instance->Terminate(); | |
316 | - | |
317 | - if(appdata.trace) | |
318 | - { | |
319 | - pw3270_trace_printf(appdata.trace,"%s","** Rexx script ends\n"); | |
320 | - g_object_set_data(G_OBJECT(appdata.trace),"rexx_app_data",NULL); | |
321 | - } | |
322 | - | |
323 | - trace("%s ends",__FUNCTION__); | |
324 | - } | |
325 | - | |
326 | - g_free(options[3].option); | |
327 | - | |
328 | - } | |
329 | - | |
330 | - | |
331 | -extern "C" | |
332 | -{ | |
333 | - LIB3270_EXPORT void pw3270_action_rexx_activated(GtkAction *action, GtkWidget *widget) | |
334 | - { | |
335 | - | |
336 | - gchar *filename = (gchar *) g_object_get_data(G_OBJECT(action),"src"); | |
337 | - | |
338 | - lib3270_trace_event(v3270_get_session(widget),"Action %s activated on widget %p",gtk_action_get_name(action),widget); | |
339 | - | |
340 | -#if GTK_CHECK_VERSION(2,32,0) | |
341 | - if(!g_mutex_trylock(&mutex)) | |
342 | -#else | |
343 | - if(!g_static_mutex_trylock(&mutex)) | |
344 | -#endif // GTK_CHECK_VERSION | |
345 | - { | |
346 | - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), | |
347 | - GTK_DIALOG_DESTROY_WITH_PARENT, | |
348 | - GTK_MESSAGE_ERROR, | |
349 | - GTK_BUTTONS_CANCEL, | |
350 | - "%s", _( "Can't start script" )); | |
351 | - | |
352 | - gtk_window_set_title(GTK_WINDOW(dialog),_( "System busy" )); | |
353 | - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",_( "Please, try again in a few moments" )); | |
354 | - | |
355 | - gtk_dialog_run(GTK_DIALOG (dialog)); | |
356 | - gtk_widget_destroy(dialog); | |
357 | - return; | |
358 | - } | |
359 | - | |
360 | - pw3270_set_action_state(action,FALSE); | |
361 | - | |
362 | - if(filename && *filename) | |
363 | - { | |
364 | - // Has filename, call it directly | |
365 | - call_rexx_script(action,widget,filename); | |
366 | - } | |
367 | - else | |
368 | - { | |
369 | - | |
370 | - filename = pw3270_file_chooser(GTK_FILE_CHOOSER_ACTION_OPEN, "rexx", _( "Select script to run" ), NULL, "rex"); | |
371 | - | |
372 | - if(filename) | |
373 | - { | |
374 | - if(*filename) | |
375 | - { | |
376 | - call_rexx_script(action,widget,filename); | |
377 | - } | |
378 | - g_free(filename); | |
379 | - } | |
380 | - | |
381 | - | |
382 | - } | |
383 | - | |
384 | - pw3270_set_action_state(action,TRUE); | |
385 | - | |
386 | -#if GTK_CHECK_VERSION(2,32,0) | |
387 | - g_mutex_unlock(&mutex); | |
388 | -#else | |
389 | - g_static_mutex_unlock(&mutex); | |
390 | -#endif // GTK_CHECK_VERSION | |
391 | - | |
392 | - } | |
393 | - | |
394 | -} | |
395 | - | |
396 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
397 | - | |
398 | - | |
399 | - LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) | |
400 | - { | |
401 | - trace("%s",__FUNCTION__); | |
402 | -#if GTK_CHECK_VERSION(2,32,0) | |
403 | - g_mutex_init(&mutex); | |
404 | -#endif // GTK_CHECK_VERSION | |
405 | - | |
406 | - rx3270_set_session(lib3270_get_default_session_handle()); | |
407 | - | |
408 | - return 0; | |
409 | - } | |
410 | - | |
411 | - LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) | |
412 | - { | |
413 | -#if GTK_CHECK_VERSION(2,32,0) | |
414 | - g_mutex_clear(&mutex); | |
415 | -#endif // GTK_CHECK_VERSION | |
416 | - trace("%s",__FUNCTION__); | |
417 | - return 0; | |
418 | - } | |
419 | - |
src/plugins/rx3270/rexx_methods.cc
... | ... | @@ -1,647 +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 rexx_methods.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 | - * Referencias: | |
30 | - * | |
31 | - * * http://www.oorexx.org/docs/rexxpg/x2950.htm | |
32 | - * | |
33 | - */ | |
34 | - | |
35 | - #include "rx3270.h" | |
36 | - #include <gtk/gtk.h> | |
37 | - #include <time.h> | |
38 | - #include <string.h> | |
39 | - #include <ctype.h> | |
40 | - #include <pw3270/class.h> | |
41 | - | |
42 | - using namespace std; | |
43 | - using namespace PW3270_NAMESPACE; | |
44 | - | |
45 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
46 | - | |
47 | -RexxMethod1(int, rx3270_method_init, OPTIONAL_CSTRING, type) | |
48 | -{ | |
49 | - // Set session class in rexx object | |
50 | - try | |
51 | - { | |
52 | - if(!(type && *type)) | |
53 | - type = ""; | |
54 | - RexxPointerObject sessionPtr = context->NewPointer(session::create(type)); | |
55 | - context->SetObjectVariable("CSELF", sessionPtr); | |
56 | - } | |
57 | - catch(std::exception &e) | |
58 | - { | |
59 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
60 | - } | |
61 | - | |
62 | - return 0; | |
63 | -} | |
64 | - | |
65 | -RexxMethod1(int, rx3270_method_uninit, CSELF, sessionPtr) | |
66 | -{ | |
67 | - session *hSession = (session *) sessionPtr; | |
68 | - | |
69 | - trace("rx3270_method_uninit hSession=%p",hSession); | |
70 | - | |
71 | - if(hSession) | |
72 | - delete hSession; | |
73 | - | |
74 | - trace("%s","rx3270_method_uninit"); | |
75 | - return 0; | |
76 | -} | |
77 | - | |
78 | -RexxMethod1(RexxStringObject, rx3270_method_version, CSELF, sessionPtr) | |
79 | -{ | |
80 | - session * hSession = (session *) sessionPtr; | |
81 | - | |
82 | - if(hSession) | |
83 | - return context->String((CSTRING) hSession->get_version().c_str()); | |
84 | - | |
85 | - return context->String((CSTRING) PACKAGE_VERSION); | |
86 | -} | |
87 | - | |
88 | -RexxMethod1(RexxStringObject, rx3270_method_revision, CSELF, sessionPtr) | |
89 | -{ | |
90 | - session * hSession = (session *) sessionPtr; | |
91 | - | |
92 | - if(hSession) | |
93 | - return context->String((CSTRING) hSession->get_revision().c_str()); | |
94 | - | |
95 | - return context->String((CSTRING) PACKAGE_REVISION); | |
96 | -} | |
97 | - | |
98 | -RexxMethod3(int, rx3270_method_connect, CSELF, sessionPtr, CSTRING, uri, OPTIONAL_int, wait) | |
99 | -{ | |
100 | - session *hSession = (session *) sessionPtr; | |
101 | - if(!hSession) | |
102 | - return -1; | |
103 | - | |
104 | - return hSession->connect(uri,wait != 0); | |
105 | -} | |
106 | - | |
107 | -RexxMethod1(int, rx3270_method_disconnect, CSELF, sessionPtr) | |
108 | -{ | |
109 | - session *hSession = (session *) sessionPtr; | |
110 | - if(!hSession) | |
111 | - return -1; | |
112 | - return hSession->disconnect(); | |
113 | -} | |
114 | - | |
115 | -RexxMethod2(int, rx3270_method_sleep, CSELF, sessionPtr, int, seconds) | |
116 | -{ | |
117 | - session *hSession = (session *) sessionPtr; | |
118 | - if(!hSession) | |
119 | - return -1; | |
120 | - return hSession->wait(seconds); | |
121 | -} | |
122 | - | |
123 | -RexxMethod1(logical_t, rx3270_method_is_connected, CSELF, sessionPtr) | |
124 | -{ | |
125 | - try | |
126 | - { | |
127 | - session *hSession = (session *) sessionPtr; | |
128 | - if(!hSession) | |
129 | - return false; | |
130 | - return hSession->is_connected(); | |
131 | - } | |
132 | - catch(std::exception &e) | |
133 | - { | |
134 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
135 | - } | |
136 | - | |
137 | - return 0; | |
138 | -} | |
139 | - | |
140 | -RexxMethod1(logical_t, rx3270_method_is_ready, CSELF, sessionPtr) | |
141 | -{ | |
142 | - session *hSession = (session *) sessionPtr; | |
143 | - if(!hSession) | |
144 | - return false; | |
145 | - return hSession->is_ready(); | |
146 | -} | |
147 | - | |
148 | -RexxMethod2(int, rx3270_method_wait_for_ready, CSELF, sessionPtr, OPTIONAL_int, seconds) | |
149 | -{ | |
150 | - session *hSession = (session *) sessionPtr; | |
151 | - if(!hSession) | |
152 | - return -1; | |
153 | - return hSession->wait_for_ready(seconds > 0 ? seconds : 60); | |
154 | -} | |
155 | - | |
156 | -RexxMethod3(int, rx3270_method_set_cursor, CSELF, sessionPtr, int, row, int, col) | |
157 | -{ | |
158 | - session *hSession = (session *) sessionPtr; | |
159 | - if(!hSession) | |
160 | - return -1; | |
161 | - return hSession->set_cursor_position(row,col); | |
162 | -} | |
163 | - | |
164 | -RexxMethod1(int, rx3270_method_get_cursor_addr, CSELF, sessionPtr) | |
165 | -{ | |
166 | - session *hSession = (session *) sessionPtr; | |
167 | - if(!hSession) | |
168 | - return -1; | |
169 | - return hSession->get_cursor_addr(); | |
170 | -} | |
171 | - | |
172 | -RexxMethod2(int, rx3270_method_set_cursor_addr, CSELF, sessionPtr, int, addr) | |
173 | -{ | |
174 | - session *hSession = (session *) sessionPtr; | |
175 | - if(!hSession) | |
176 | - return -1; | |
177 | - return hSession->set_cursor_addr(addr); | |
178 | -} | |
179 | - | |
180 | -RexxMethod1(int, rx3270_method_enter, CSELF, sessionPtr) | |
181 | -{ | |
182 | - session *hSession = (session *) sessionPtr; | |
183 | - if(!hSession) | |
184 | - return -1; | |
185 | - return hSession->enter(); | |
186 | -} | |
187 | - | |
188 | -RexxMethod1(int, rx3270_method_erase, CSELF, sessionPtr) | |
189 | -{ | |
190 | - session *hSession = (session *) sessionPtr; | |
191 | - if(!hSession) | |
192 | - return -1; | |
193 | - return hSession->erase(); | |
194 | -} | |
195 | - | |
196 | -RexxMethod1(int, rx3270_method_erase_eof, CSELF, sessionPtr) | |
197 | -{ | |
198 | - session *hSession = (session *) sessionPtr; | |
199 | - if(!hSession) | |
200 | - return -1; | |
201 | - return hSession->erase_eof(); | |
202 | -} | |
203 | - | |
204 | -RexxMethod1(int, rx3270_method_erase_eol, CSELF, sessionPtr) | |
205 | -{ | |
206 | - session *hSession = (session *) sessionPtr; | |
207 | - if(!hSession) | |
208 | - return -1; | |
209 | - return hSession->erase_eol(); | |
210 | -} | |
211 | - | |
212 | -RexxMethod1(int, rx3270_method_erase_input, CSELF, sessionPtr) | |
213 | -{ | |
214 | - session *hSession = (session *) sessionPtr; | |
215 | - if(!hSession) | |
216 | - return -1; | |
217 | - return hSession->erase_input(); | |
218 | -} | |
219 | - | |
220 | - | |
221 | -RexxMethod2(int, rx3270_method_pfkey, CSELF, sessionPtr, int, key) | |
222 | -{ | |
223 | - session *hSession = (session *) sessionPtr; | |
224 | - if(!hSession) | |
225 | - return -1; | |
226 | - return hSession->pfkey(key); | |
227 | -} | |
228 | - | |
229 | -RexxMethod2(int, rx3270_method_pakey, CSELF, sessionPtr, int, key) | |
230 | -{ | |
231 | - session *hSession = (session *) sessionPtr; | |
232 | - if(!hSession) | |
233 | - return -1; | |
234 | - return hSession->pakey(key); | |
235 | -} | |
236 | - | |
237 | -RexxMethod4(RexxStringObject, rx3270_method_get_text_at, CSELF, sessionPtr, int, row, int, col, int, sz) | |
238 | -{ | |
239 | - | |
240 | - try | |
241 | - { | |
242 | - session * hSession = (session *) sessionPtr; | |
243 | - string str = hSession->get_string_at(row,col,sz); | |
244 | - return context->String((CSTRING) str.c_str()); | |
245 | - | |
246 | - } | |
247 | - catch(std::exception &e) | |
248 | - { | |
249 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
250 | - } | |
251 | - | |
252 | - return context->String(""); | |
253 | -} | |
254 | - | |
255 | - | |
256 | -RexxMethod4(int, rx3270_method_set_text_at, CSELF, sessionPtr, int, row, int, col, CSTRING, text) | |
257 | -{ | |
258 | - try | |
259 | - { | |
260 | - session * hSession = (session *) sessionPtr; | |
261 | - return hSession->set_string_at(row,col,text); | |
262 | - } | |
263 | - catch(std::exception &e) | |
264 | - { | |
265 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
266 | - } | |
267 | - | |
268 | - return -1; | |
269 | -} | |
270 | - | |
271 | -RexxMethod2(int, rx3270_method_input_text, CSELF, sessionPtr, CSTRING, text) | |
272 | -{ | |
273 | - try | |
274 | - { | |
275 | - session * hSession = (session *) sessionPtr; | |
276 | - return hSession->input_string(text); | |
277 | - } | |
278 | - catch(std::exception &e) | |
279 | - { | |
280 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
281 | - } | |
282 | - | |
283 | - return -1; | |
284 | - | |
285 | -} | |
286 | - | |
287 | -RexxMethod4(int, rx3270_method_cmp_text_at, CSELF, sessionPtr, int, row, int, col, CSTRING, key) | |
288 | -{ | |
289 | - try | |
290 | - { | |
291 | - session * hSession = (session *) sessionPtr; | |
292 | - return hSession->cmp_string_at(row,col,key); | |
293 | - } | |
294 | - catch(std::exception &e) | |
295 | - { | |
296 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
297 | - } | |
298 | - return -1; | |
299 | -} | |
300 | - | |
301 | -RexxMethod2(int, rx3270_method_event_trace, CSELF, sessionPtr, int, flag) | |
302 | -{ | |
303 | - session *hSession = (session *) sessionPtr; | |
304 | - if(!hSession) | |
305 | - return -1; | |
306 | - hSession->set_toggle(LIB3270_TOGGLE_EVENT_TRACE,flag); | |
307 | - return 0; | |
308 | -} | |
309 | - | |
310 | -RexxMethod2(int, rx3270_method_screen_trace, CSELF, sessionPtr, int, flag) | |
311 | -{ | |
312 | - session *hSession = (session *) sessionPtr; | |
313 | - if(!hSession) | |
314 | - return -1; | |
315 | - hSession->set_toggle(LIB3270_TOGGLE_SCREEN_TRACE,flag); | |
316 | - return 0; | |
317 | - | |
318 | -} | |
319 | - | |
320 | -RexxMethod2(int, rx3270_method_ds_trace, CSELF, sessionPtr, int, flag) | |
321 | -{ | |
322 | - session *hSession = (session *) sessionPtr; | |
323 | - if(!hSession) | |
324 | - return -1; | |
325 | - hSession->set_toggle(LIB3270_TOGGLE_DS_TRACE,flag); | |
326 | - return 0; | |
327 | -} | |
328 | - | |
329 | -RexxMethod3(int, rx3270_method_set_option, CSELF, sessionPtr, CSTRING, name, int, flag) | |
330 | -{ | |
331 | - static const struct _toggle_info | |
332 | - { | |
333 | - const char * name; | |
334 | - LIB3270_TOGGLE id; | |
335 | - } | |
336 | - toggle[LIB3270_TOGGLE_COUNT] = | |
337 | - { | |
338 | - { "monocase", LIB3270_TOGGLE_MONOCASE }, | |
339 | - { "cursorblink", LIB3270_TOGGLE_CURSOR_BLINK }, | |
340 | - { "showtiming", LIB3270_TOGGLE_SHOW_TIMING }, | |
341 | - { "cursorpos", LIB3270_TOGGLE_CURSOR_POS }, | |
342 | - { "dstrace", LIB3270_TOGGLE_DS_TRACE }, | |
343 | - { "linewrap", LIB3270_TOGGLE_LINE_WRAP }, | |
344 | - { "blankfill", LIB3270_TOGGLE_BLANK_FILL }, | |
345 | - { "screentrace", LIB3270_TOGGLE_SCREEN_TRACE }, | |
346 | - { "eventtrace", LIB3270_TOGGLE_EVENT_TRACE }, | |
347 | - { "marginedpaste", LIB3270_TOGGLE_MARGINED_PASTE }, | |
348 | - { "rectselect", LIB3270_TOGGLE_RECTANGLE_SELECT }, | |
349 | - { "crosshair", LIB3270_TOGGLE_CROSSHAIR }, | |
350 | - { "fullscreen", LIB3270_TOGGLE_FULL_SCREEN }, | |
351 | - { "reconnect", LIB3270_TOGGLE_RECONNECT }, | |
352 | - { "insert", LIB3270_TOGGLE_INSERT }, | |
353 | - { "smartpaste", LIB3270_TOGGLE_SMART_PASTE }, | |
354 | - { "bold", LIB3270_TOGGLE_BOLD }, | |
355 | - { "keepselected", LIB3270_TOGGLE_KEEP_SELECTED }, | |
356 | - { "underline", LIB3270_TOGGLE_UNDERLINE }, | |
357 | - { "autoconnect", LIB3270_TOGGLE_CONNECT_ON_STARTUP }, | |
358 | - { "kpalternative", LIB3270_TOGGLE_KP_ALTERNATIVE }, | |
359 | - { "beep", LIB3270_TOGGLE_BEEP }, | |
360 | - { "fieldattr", LIB3270_TOGGLE_VIEW_FIELD }, | |
361 | - { "altscreen", LIB3270_TOGGLE_ALTSCREEN }, | |
362 | - { "keepalive", LIB3270_TOGGLE_KEEP_ALIVE }, | |
363 | - }; | |
364 | - | |
365 | - session *hSession = (session *) sessionPtr; | |
366 | - if(hSession) | |
367 | - { | |
368 | - for(int f = 0; f < LIB3270_TOGGLE_COUNT; f++) | |
369 | - { | |
370 | - if(!strcasecmp(name,toggle[f].name)) | |
371 | - { | |
372 | - hSession->set_toggle(toggle[f].id,flag); | |
373 | - return 0; | |
374 | - } | |
375 | - } | |
376 | - return ENOENT; | |
377 | - } | |
378 | - return -1; | |
379 | -} | |
380 | - | |
381 | - | |
382 | -RexxMethod4(logical_t, rx3270_method_test, CSELF, sessionPtr, CSTRING, key, int, row, int, col) | |
383 | -{ | |
384 | - try | |
385 | - { | |
386 | - session * hSession = (session *) sessionPtr; | |
387 | - | |
388 | - if(!hSession->is_ready()) | |
389 | - hSession->iterate(false); | |
390 | - | |
391 | - if(hSession->is_ready()) | |
392 | - { | |
393 | - string str = hSession->get_string_at(row,col,strlen(key)); | |
394 | - return (strcasecmp(str.c_str(),key) == 0); | |
395 | - } | |
396 | - | |
397 | - } | |
398 | - catch(std::exception &e) | |
399 | - { | |
400 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
401 | - } | |
402 | - | |
403 | - return false; | |
404 | -} | |
405 | - | |
406 | -RexxMethod5(int, rx3270_method_wait_for_text_at, CSELF, sessionPtr, int, row, int, col, CSTRING, key, int, timeout) | |
407 | -{ | |
408 | - try | |
409 | - { | |
410 | - session * hSession = (session *) sessionPtr; | |
411 | - return hSession->wait_for_string_at(row,col,key,timeout); | |
412 | - | |
413 | - } | |
414 | - catch(std::exception &e) | |
415 | - { | |
416 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
417 | - } | |
418 | - | |
419 | - return -1; | |
420 | -} | |
421 | - | |
422 | -RexxMethod3(RexxStringObject, rx3270_method_get_text, CSELF, sessionPtr, OPTIONAL_int, baddr, OPTIONAL_int, sz) | |
423 | -{ | |
424 | - try | |
425 | - { | |
426 | - session * hSession = (session *) sessionPtr; | |
427 | - string str = hSession->get_string(baddr,sz > 0 ? sz : -1); | |
428 | - return context->String((CSTRING) str.c_str()); | |
429 | - } | |
430 | - catch(std::exception &e) | |
431 | - { | |
432 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
433 | - } | |
434 | - | |
435 | - return context->String(""); | |
436 | -} | |
437 | - | |
438 | - | |
439 | -RexxMethod2(int, rx3270_method_get_field_len, CSELF, sessionPtr, OPTIONAL_int, baddr) | |
440 | -{ | |
441 | - session *hSession = (session *) sessionPtr; | |
442 | - if(!hSession) | |
443 | - return -1; | |
444 | - return hSession->get_field_len(baddr); | |
445 | -} | |
446 | - | |
447 | -RexxMethod2(int, rx3270_method_get_field_start, CSELF, sessionPtr, OPTIONAL_int, baddr) | |
448 | -{ | |
449 | - session *hSession = (session *) sessionPtr; | |
450 | - if(!hSession) | |
451 | - return -1; | |
452 | - return hSession->get_field_start(baddr)+1; | |
453 | -} | |
454 | - | |
455 | -RexxMethod2(int, rx3270_method_get_next_unprotected, CSELF, sessionPtr, OPTIONAL_int, baddr) | |
456 | -{ | |
457 | - session *hSession = (session *) sessionPtr; | |
458 | - if(!hSession) | |
459 | - return -1; | |
460 | - | |
461 | - baddr = hSession->get_next_unprotected(baddr); | |
462 | - if(baddr < 1) | |
463 | - return -1; | |
464 | - | |
465 | - return baddr; | |
466 | -} | |
467 | - | |
468 | -RexxMethod2(int, rx3270_method_get_is_protected, CSELF, sessionPtr, OPTIONAL_int, baddr) | |
469 | -{ | |
470 | - | |
471 | - session *hSession = (session *) sessionPtr; | |
472 | - if(!hSession) | |
473 | - return -1; | |
474 | - | |
475 | - return hSession->get_is_protected(baddr); | |
476 | -} | |
477 | - | |
478 | -RexxMethod3(int, rx3270_method_get_is_protected_at, CSELF, sessionPtr, int, row, int, col) | |
479 | -{ | |
480 | - | |
481 | - session *hSession = (session *) sessionPtr; | |
482 | - if(!hSession) | |
483 | - return -1; | |
484 | - | |
485 | - return hSession->get_is_protected_at(row,col); | |
486 | -} | |
487 | - | |
488 | - | |
489 | -RexxMethod1(RexxStringObject, rx3270_method_get_selection, CSELF, sessionPtr) | |
490 | -{ | |
491 | - try | |
492 | - { | |
493 | - string str = ((session *) sessionPtr)->get_copy(); | |
494 | - return context->String((CSTRING) str.c_str()); | |
495 | - | |
496 | - } | |
497 | - catch(std::exception &e) | |
498 | - { | |
499 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
500 | - } | |
501 | - | |
502 | - return context->String(""); | |
503 | -} | |
504 | - | |
505 | -RexxMethod2(int, rx3270_method_set_selection, CSELF, sessionPtr, CSTRING, text) | |
506 | -{ | |
507 | - try | |
508 | - { | |
509 | - return ((session *) sessionPtr)->set_copy(text); | |
510 | - } | |
511 | - catch(std::exception &e) | |
512 | - { | |
513 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
514 | - } | |
515 | - | |
516 | - return -1; | |
517 | -} | |
518 | - | |
519 | -RexxMethod1(RexxStringObject, rx3270_method_get_clipboard, CSELF, sessionPtr) | |
520 | -{ | |
521 | - session * hSession = (session *) sessionPtr; | |
522 | - | |
523 | - if(hSession) | |
524 | - { | |
525 | - string str = hSession->get_clipboard(); | |
526 | - return context->String((CSTRING) str.c_str()); | |
527 | - } | |
528 | - | |
529 | - trace("%s","rx3270_method_get_clipboard: Clipboard is empty"); | |
530 | - return context->String(""); | |
531 | -} | |
532 | - | |
533 | -RexxMethod2(int, rx3270_method_set_clipboard, CSELF, sessionPtr, CSTRING, text) | |
534 | -{ | |
535 | - return ((session *) sessionPtr)->set_clipboard(text); | |
536 | -} | |
537 | - | |
538 | -RexxMethod5(int, rx3270_method_popup, CSELF, sessionPtr, CSTRING, s_id, CSTRING, title, CSTRING, message, OPTIONAL_CSTRING, det) | |
539 | -{ | |
540 | - LIB3270_NOTIFY id = LIB3270_NOTIFY_INFO; | |
541 | - session * hSession = (session *) sessionPtr; | |
542 | - | |
543 | - if(!hSession) | |
544 | - return -1; | |
545 | - | |
546 | - if(*s_id) | |
547 | - { | |
548 | - static const struct _descr | |
549 | - { | |
550 | - char str; | |
551 | - LIB3270_NOTIFY id; | |
552 | - } descr[] = | |
553 | - { | |
554 | - { 'I', LIB3270_NOTIFY_INFO }, | |
555 | - { 'W', LIB3270_NOTIFY_WARNING }, | |
556 | - { 'E', LIB3270_NOTIFY_ERROR }, | |
557 | - { 'C', LIB3270_NOTIFY_CRITICAL }, | |
558 | - }; | |
559 | - | |
560 | - for(int f=0;f<4;f++) | |
561 | - { | |
562 | - if(toupper(*s_id) == descr[f].str) | |
563 | - { | |
564 | - id = descr[f].id; | |
565 | - trace("Using mode %c (%d)",toupper(*s_id),(int) id); | |
566 | - } | |
567 | - } | |
568 | - } | |
569 | - | |
570 | - return hSession->popup_dialog(id, title, message, "%s", det ? det : ""); | |
571 | -} | |
572 | - | |
573 | -RexxMethod5(RexxStringObject, rx3270_method_get_filename, CSELF, sessionPtr, CSTRING, action_name, CSTRING, title, OPTIONAL_CSTRING, extension, OPTIONAL_CSTRING, filename) | |
574 | -{ | |
575 | - static const struct _action | |
576 | - { | |
577 | - const gchar * action_name; | |
578 | - GtkFileChooserAction id; | |
579 | - } action[] = | |
580 | - { | |
581 | - { "open", GTK_FILE_CHOOSER_ACTION_OPEN }, | |
582 | - { "save", GTK_FILE_CHOOSER_ACTION_SAVE }, | |
583 | - { "folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER }, | |
584 | - { "select_folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER }, | |
585 | - { "create_folder", GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER } | |
586 | - }; | |
587 | - | |
588 | - GtkFileChooserAction id = GTK_FILE_CHOOSER_ACTION_OPEN; | |
589 | - string ret; | |
590 | - | |
591 | - for(int f=0;f<5;f++) | |
592 | - { | |
593 | - if(!strcasecmp(action_name,action[f].action_name)) | |
594 | - { | |
595 | - id = action[f].id; | |
596 | - break; | |
597 | - } | |
598 | - } | |
599 | - | |
600 | - debug("%s(%s)","rx3270_method_get_filename",action_name); | |
601 | - ret = ((session *) sessionPtr)->file_chooser_dialog(id, title, extension,filename); | |
602 | - debug("%s(%s)","rx3270_method_get_filename",action_name); | |
603 | - | |
604 | - return context->String(ret.c_str()); | |
605 | -} | |
606 | - | |
607 | -RexxMethod2(int, rx3270_method_set_host_charset, CSELF, sessionPtr, CSTRING, text) | |
608 | -{ | |
609 | - return ((session *) sessionPtr)->set_host_charset(text); | |
610 | -} | |
611 | - | |
612 | -RexxMethod1(RexxStringObject, rx3270_method_get_host_charset, CSELF, sessionPtr) | |
613 | -{ | |
614 | - string ret = ((session *) sessionPtr)->get_host_charset(); | |
615 | - return context->String(ret.c_str()); | |
616 | -} | |
617 | - | |
618 | -RexxMethod1(RexxStringObject, rx3270_method_get_display_charset, CSELF, sessionPtr) | |
619 | -{ | |
620 | - string ret = ((session *) sessionPtr)->get_display_charset(); | |
621 | - return context->String(ret.c_str()); | |
622 | -} | |
623 | - | |
624 | -RexxMethod2(int, rx3270_method_set_display_charset, CSELF, sessionPtr, CSTRING, text) | |
625 | -{ | |
626 | - ((session *) sessionPtr)->set_display_charset(NULL,text); | |
627 | - return 0; | |
628 | -} | |
629 | - | |
630 | -RexxMethod2(int, rx3270_method_set_unlock_delay, CSELF, sessionPtr, int, delay) | |
631 | -{ | |
632 | - session *hSession = (session *) sessionPtr; | |
633 | - | |
634 | - if(!hSession) | |
635 | - return -1; | |
636 | - | |
637 | - try | |
638 | - { | |
639 | - hSession->set_unlock_delay((unsigned short) delay); | |
640 | - } | |
641 | - catch(std::exception &e) | |
642 | - { | |
643 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
644 | - } | |
645 | - | |
646 | - return 0; | |
647 | -} |
src/plugins/rx3270/rx3270.cc
... | ... | @@ -1,218 +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 rx3270.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 | - * | |
32 | - * Reference: | |
33 | - * | |
34 | - * http://www.oorexx.org/docs/rexxpg/x2950.htm | |
35 | - * | |
36 | - */ | |
37 | - | |
38 | - #include "rx3270.h" | |
39 | - #include <time.h> | |
40 | - #include <lib3270/actions.h> | |
41 | - | |
42 | -#ifdef HAVE_SYSLOG | |
43 | - #include <syslog.h> | |
44 | -#endif // HAVE_SYSLOG | |
45 | - | |
46 | - #include <string.h> | |
47 | - #include <stdarg.h> | |
48 | - | |
49 | - static rx3270 * factory_default(const char *type); | |
50 | - | |
51 | -/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
52 | - | |
53 | - static rx3270 * defSession = NULL; | |
54 | - static rx3270 * (*factory)(const char *type) = factory_default; | |
55 | - | |
56 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
57 | - | |
58 | -rx3270::rx3270(const char *local, const char *remote) | |
59 | -{ | |
60 | -#ifdef HAVE_ICONV | |
61 | - | |
62 | - if(strcmp(local,remote)) | |
63 | - { | |
64 | - // Local and remote charsets aren't the same, setup conversion | |
65 | - this->conv2Local = iconv_open(local, remote); | |
66 | - this->conv2Host = iconv_open(remote,local); | |
67 | - } | |
68 | - else | |
69 | - { | |
70 | - this->conv2Local = this->conv2Host = (iconv_t)(-1); | |
71 | - } | |
72 | -#endif | |
73 | - | |
74 | - if(!defSession) | |
75 | - defSession = this; | |
76 | -} | |
77 | - | |
78 | -rx3270::~rx3270() | |
79 | -{ | |
80 | -#ifdef HAVE_ICONV | |
81 | - | |
82 | - if(conv2Local != (iconv_t) (-1)) | |
83 | - iconv_close(conv2Local); | |
84 | - | |
85 | - if(conv2Host != (iconv_t) (-1)) | |
86 | - iconv_close(conv2Host); | |
87 | -#endif | |
88 | - | |
89 | - | |
90 | - if(defSession == this) | |
91 | - defSession = NULL; | |
92 | - | |
93 | - trace("%s",__FUNCTION__); | |
94 | -} | |
95 | - | |
96 | -static rx3270 * factory_default(const char *type) | |
97 | -{ | |
98 | - trace("%s",__FUNCTION__); | |
99 | - if(type && *type) | |
100 | - return rx3270::create_remote(type); | |
101 | - return rx3270::create_local(); | |
102 | -} | |
103 | - | |
104 | -rx3270 * rx3270::create(const char *type) | |
105 | -{ | |
106 | - return factory(type); | |
107 | -} | |
108 | - | |
109 | -char * rx3270::get_version(void) | |
110 | -{ | |
111 | - return strdup(PACKAGE_VERSION); | |
112 | -} | |
113 | - | |
114 | -char * rx3270::get_revision(void) | |
115 | -{ | |
116 | - return strdup(PACKAGE_REVISION); | |
117 | -} | |
118 | - | |
119 | -rx3270 * rx3270::get_default() | |
120 | -{ | |
121 | - if(defSession) | |
122 | - return defSession; | |
123 | - return create_local(); | |
124 | -} | |
125 | - | |
126 | -void rx3270::log(const char *fmt, ...) | |
127 | -{ | |
128 | - va_list arg_ptr; | |
129 | - va_start(arg_ptr, fmt); | |
130 | - this->logva(fmt,arg_ptr); | |
131 | - va_end(arg_ptr); | |
132 | -} | |
133 | - | |
134 | -void rx3270::logva(const char *fmt, va_list args) | |
135 | -{ | |
136 | -#ifdef HAVE_SYSLOG | |
137 | - openlog(PACKAGE_NAME, LOG_NDELAY, LOG_USER); | |
138 | - vsyslog(LOG_INFO,fmt,args); | |
139 | - closelog(); | |
140 | -#else | |
141 | - vfprintf(stderr,fmt,args); | |
142 | -#endif | |
143 | -} | |
144 | - | |
145 | -int rx3270::wait_for_text_at(int row, int col, const char *key, int timeout) | |
146 | -{ | |
147 | - time_t end = time(0)+timeout; | |
148 | - | |
149 | - while(time(0) < end) | |
150 | - { | |
151 | - if(!is_connected()) | |
152 | - return ENOTCONN; | |
153 | - | |
154 | - if(!cmp_text_at(row,col,key)) | |
155 | - return 0; | |
156 | - | |
157 | - iterate(); | |
158 | - } | |
159 | - | |
160 | - return ETIMEDOUT; | |
161 | -} | |
162 | - | |
163 | -void rx3270::set_plugin(rx3270 * (*ptr)(const char *name)) | |
164 | -{ | |
165 | - trace("%s factory=%p",__FUNCTION__,ptr); | |
166 | - | |
167 | - if(ptr) | |
168 | - factory = ptr; | |
169 | - else | |
170 | - factory = factory_default; | |
171 | - | |
172 | -} | |
173 | - | |
174 | -int rx3270::set_copy(const char *text) | |
175 | -{ | |
176 | - return EINVAL; | |
177 | -} | |
178 | - | |
179 | -char * rx3270::get_copy(void) | |
180 | -{ | |
181 | - errno = EINVAL; | |
182 | - return NULL; | |
183 | -} | |
184 | - | |
185 | -char * rx3270::get_clipboard(void) | |
186 | -{ | |
187 | - errno = EINVAL; | |
188 | - return NULL; | |
189 | -} | |
190 | - | |
191 | -int rx3270::set_clipboard(const char *text) | |
192 | -{ | |
193 | - return EINVAL; | |
194 | -} | |
195 | - | |
196 | -extern "C" | |
197 | -{ | |
198 | - static void memfree(void *ptr) | |
199 | - { | |
200 | - free(ptr); | |
201 | - } | |
202 | -} | |
203 | - | |
204 | -void rx3270::free(void *ptr) | |
205 | -{ | |
206 | - memfree(ptr); | |
207 | -} | |
208 | - | |
209 | -int rx3270::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...) | |
210 | -{ | |
211 | - return -1; | |
212 | -} | |
213 | - | |
214 | -char * rx3270::file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename) | |
215 | -{ | |
216 | - return NULL; | |
217 | -} | |
218 | - |
src/plugins/rx3270/rx3270.cls
... | ... | @@ -1,148 +0,0 @@ |
1 | -/*-- REXX -----------------------------------------------------------------------*/ | |
2 | -/* */ | |
3 | -/* "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 */ | |
4 | -/* (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a */ | |
5 | -/* aplicativos mainframe. Registro no INPI sob o nome G3270. */ | |
6 | -/* */ | |
7 | -/* Copyright (C) <2008> <Banco do Brasil S.A.> */ | |
8 | -/* */ | |
9 | -/* Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob */ | |
10 | -/* os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela */ | |
11 | -/* Free Software Foundation. */ | |
12 | -/* */ | |
13 | -/* Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER */ | |
14 | -/* GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO */ | |
15 | -/* A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para */ | |
16 | -/* obter mais detalhes. */ | |
17 | -/* */ | |
18 | -/* Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este */ | |
19 | -/* programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple */ | |
20 | -/* Place, Suite 330, Boston, MA, 02111-1307, USA */ | |
21 | -/* */ | |
22 | -/* Contatos: */ | |
23 | -/* */ | |
24 | -/* perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) */ | |
25 | -/* erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) */ | |
26 | -/* licinio@bb.com.br (Licínio Luis Branco) */ | |
27 | -/* */ | |
28 | -/*-------------------------------------------------------------------------------*/ | |
29 | - | |
30 | -::requires "rx3270" LIBRARY | |
31 | - | |
32 | -/*-------------------------------------------------------------------------------*/ | |
33 | -/* 3270 class */ | |
34 | -/*-------------------------------------------------------------------------------*/ | |
35 | - | |
36 | -::class rx3270 public subclass object | |
37 | - | |
38 | -::METHOD INIT EXTERNAL "LIBRARY rx3270 rx3270_method_init" | |
39 | -::METHOD UNINIT EXTERNAL "LIBRARY rx3270 rx3270_method_uninit" | |
40 | - | |
41 | -::METHOD VERSION EXTERNAL "LIBRARY rx3270 rx3270_method_version" | |
42 | -::METHOD REVISION EXTERNAL "LIBRARY rx3270 rx3270_method_revision" | |
43 | - | |
44 | -::METHOD CONNECT EXTERNAL "LIBRARY rx3270 rx3270_method_connect" | |
45 | -::METHOD DISCONNECT EXTERNAL "LIBRARY rx3270 rx3270_method_disconnect" | |
46 | - | |
47 | -::METHOD SLEEP EXTERNAL "LIBRARY rx3270 rx3270_method_sleep" | |
48 | - | |
49 | -::METHOD CONNECTED EXTERNAL "LIBRARY rx3270 rx3270_method_is_connected" | |
50 | -::METHOD READY EXTERNAL "LIBRARY rx3270 rx3270_method_is_ready" | |
51 | - | |
52 | -::METHOD WAITFORREADY EXTERNAL "LIBRARY rx3270 rx3270_method_wait_for_ready" | |
53 | - | |
54 | -::METHOD SETCURSOR EXTERNAL "LIBRARY rx3270 rx3270_method_set_cursor" | |
55 | -::METHOD GETCURSORADDR EXTERNAL "LIBRARY rx3270 rx3270_method_get_cursor_addr" | |
56 | -::METHOD SETCURSORADDR EXTERNAL "LIBRARY rx3270 rx3270_method_set_cursor_addr" | |
57 | - | |
58 | -::METHOD ENTER EXTERNAL "LIBRARY rx3270 rx3270_method_enter" | |
59 | -::METHOD PFKEY EXTERNAL "LIBRARY rx3270 rx3270_method_pfkey" | |
60 | -::METHOD PAKEY EXTERNAL "LIBRARY rx3270 rx3270_method_pakey" | |
61 | - | |
62 | -::METHOD ERASE EXTERNAL "LIBRARY rx3270 rx3270_method_erase" | |
63 | -::METHOD ERASEEOF EXTERNAL "LIBRARY rx3270 rx3270_method_erase_eof" | |
64 | -::METHOD ERASEEOL EXTERNAL "LIBRARY rx3270 rx3270_method_erase_eol" | |
65 | -::METHOD ERASEINPUT EXTERNAL "LIBRARY rx3270 rx3270_method_erase_input" | |
66 | - | |
67 | -::METHOD OPTION EXTERNAL "LIBRARY rx3270 rx3270_method_set_option" | |
68 | -::METHOD EVENTTRACE EXTERNAL "LIBRARY rx3270 rx3270_method_event_trace" | |
69 | -::METHOD SCREENTRACE EXTERNAL "LIBRARY rx3270 rx3270_method_screen_trace" | |
70 | -::METHOD DSTRACE EXTERNAL "LIBRARY rx3270 rx3270_method_ds_trace" | |
71 | - | |
72 | -::METHOD GETTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_get_text_at" | |
73 | -::METHOD SETTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_set_text_at" | |
74 | -::METHOD CMPTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_cmp_text_at" | |
75 | - | |
76 | -::METHOD GET EXTERNAL "LIBRARY rx3270 rx3270_method_get_text" | |
77 | -::METHOD INPUT EXTERNAL "LIBRARY rx3270 rx3270_method_input_text" | |
78 | - | |
79 | -::METHOD WAITFORTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_wait_for_text_at" | |
80 | -::METHOD TEST EXTERNAL "LIBRARY rx3270 rx3270_method_test" | |
81 | - | |
82 | -::METHOD GETFIELDSTART EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_start" | |
83 | -::METHOD GETFIELDLEN EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_len" | |
84 | -::METHOD GETNEXTUNPROTECTED EXTERNAL "LIBRARY rx3270 rx3270_method_get_next_unprotected" | |
85 | -::METHOD GETISPROTECTED EXTERNAL "LIBRARY rx3270 rx3270_method_get_is_protected" | |
86 | -::METHOD GETISPROTECTEDAT EXTERNAL "LIBRARY rx3270 rx3270_method_get_is_protected_at" | |
87 | - | |
88 | -::METHOD GETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_get_selection" | |
89 | -::METHOD SETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_set_selection" | |
90 | - | |
91 | -::METHOD GETCLIPBOARD EXTERNAL "LIBRARY rx3270 rx3270_method_get_clipboard" | |
92 | -::METHOD SETCLIPBOARD EXTERNAL "LIBRARY rx3270 rx3270_method_set_clipboard" | |
93 | - | |
94 | -::METHOD POPUP EXTERNAL "LIBRARY rx3270 rx3270_method_popup" | |
95 | -::METHOD GETFILENAME EXTERNAL "LIBRARY rx3270 rx3270_method_get_filename" | |
96 | - | |
97 | -::METHOD GETDISPLAYCHARSET EXTERNAL "LIBRARY rx3270 rx3270_method_get_display_charset" | |
98 | -::METHOD SETDISPLAYCHARSET EXTERNAL "LIBRARY rx3270 rx3270_method_set_display_charset" | |
99 | - | |
100 | -::METHOD GETHOSTCHARSET EXTERNAL "LIBRARY rx3270 rx3270_method_get_host_charset" | |
101 | -::METHOD SETHOSTCHARSET EXTERNAL "LIBRARY rx3270 rx3270_method_set_host_charset" | |
102 | - | |
103 | -::METHOD SETUNLOCKDELAY EXTERNAL "LIBRARY rx3270 rx3270_method_set_unlock_delay" | |
104 | - | |
105 | -::method waitForStringAt | |
106 | - use arg row, col, key, timeout | |
107 | - if datatype(timeout) <> "NUM" | |
108 | - then timeout = 60 | |
109 | -return self~WaitForTextAt(row,col,key,timeout) | |
110 | - | |
111 | -::method getScreenContent | |
112 | -return self~get() | |
113 | - | |
114 | -::method queryStringAt | |
115 | - use arg row, col, key | |
116 | -return self~GetTextAt(row,col,length(key)) == key | |
117 | - | |
118 | -::method waitForTerminalReady | |
119 | - use arg timeout | |
120 | -return self~WaitForReady(timeout) | |
121 | - | |
122 | -::method isTerminalReady | |
123 | -return self~ready() | |
124 | - | |
125 | -::method setStringAt | |
126 | - use arg row, col, str | |
127 | -return self~SetTextAt(row,col,str) | |
128 | - | |
129 | -::method getStringAt | |
130 | - use arg row, col, size | |
131 | -return self~GetTextAt(row,col,size) | |
132 | - | |
133 | -::method sendEnterKey | |
134 | -return self~enter() | |
135 | - | |
136 | -::method sendPFKey | |
137 | - use arg key | |
138 | -return self~pfKey(key) | |
139 | - | |
140 | -::method setCursorPosition | |
141 | - use arg row, col | |
142 | -return self~SetCursor(row,col) | |
143 | - | |
144 | -::method getScreenContentAt | |
145 | - use arg row, col, size | |
146 | -return self~GetTextAt(row,col,size) | |
147 | - | |
148 | - |
src/plugins/rx3270/rx3270.h
... | ... | @@ -1,160 +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 pluginmain.c 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 RX3270_H_INCLUDED | |
31 | - | |
32 | - #define RX3270_H_INCLUDED 1 | |
33 | - | |
34 | - #include <lib3270/config.h> | |
35 | - #include <stdint.h> | |
36 | - | |
37 | - #include <errno.h> | |
38 | - #include <stdio.h> | |
39 | - #include <lib3270.h> | |
40 | - #include <lib3270/log.h> | |
41 | - #include <lib3270/popup.h> | |
42 | - #include <stdarg.h> | |
43 | - #include <gtk/gtk.h> | |
44 | - #include <pw3270/class.h> | |
45 | - | |
46 | -#ifndef ETIMEDOUT | |
47 | - #define ETIMEDOUT -1 | |
48 | -#endif // !ETIMEOUT | |
49 | - | |
50 | -#ifdef HAVE_ICONV | |
51 | - #include <iconv.h> | |
52 | -#endif // HAVE_ICONV | |
53 | - | |
54 | -#ifdef WIN32 | |
55 | - #define REXX_DEFAULT_CHARSET "CP1252" | |
56 | - #define int8_t REXX_INT8_T | |
57 | - #define ssize_t REXX_SSIZE_T | |
58 | -#else | |
59 | - #define REXX_DEFAULT_CHARSET "UTF-8" | |
60 | -#endif // WIN32 | |
61 | - | |
62 | -#include <oorexxapi.h> | |
63 | - | |
64 | -/*---[ Rexx entry points ]-----------------------------------------------------------------------------------*/ | |
65 | - | |
66 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270version); | |
67 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270QueryCState); | |
68 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Disconnect); | |
69 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Connect); | |
70 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270isConnected); | |
71 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270WaitForEvents); | |
72 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Sleep); | |
73 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SendENTERKey); | |
74 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SendPFKey); | |
75 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SendPAKey); | |
76 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270WaitForTerminalReady); | |
77 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270WaitForStringAt); | |
78 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270GetStringAt); | |
79 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsTerminalReady); | |
80 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270queryStringAt); | |
81 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetStringAt); | |
82 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270CloseApplication); | |
83 | - REXX_TYPED_ROUTINE_PROTOTYPE(ebc2asc); | |
84 | - REXX_TYPED_ROUTINE_PROTOTYPE(asc2ebc); | |
85 | - | |
86 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Erase); | |
87 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270EraseEOF); | |
88 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270EraseEOL); | |
89 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270EraseInput); | |
90 | - | |
91 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsProtected); | |
92 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsProtectedAt); | |
93 | - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetUnlockDelay); | |
94 | - | |
95 | - REXX_METHOD_PROTOTYPE(rx3270_method_version); | |
96 | - REXX_METHOD_PROTOTYPE(rx3270_method_revision); | |
97 | - REXX_METHOD_PROTOTYPE(rx3270_method_init); | |
98 | - REXX_METHOD_PROTOTYPE(rx3270_method_uninit); | |
99 | - REXX_METHOD_PROTOTYPE(rx3270_method_connect); | |
100 | - REXX_METHOD_PROTOTYPE(rx3270_method_disconnect); | |
101 | - REXX_METHOD_PROTOTYPE(rx3270_method_sleep); | |
102 | - REXX_METHOD_PROTOTYPE(rx3270_method_is_connected); | |
103 | - REXX_METHOD_PROTOTYPE(rx3270_method_is_ready); | |
104 | - REXX_METHOD_PROTOTYPE(rx3270_method_wait_for_ready); | |
105 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor); | |
106 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_cursor_addr); | |
107 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor_addr); | |
108 | - REXX_METHOD_PROTOTYPE(rx3270_method_enter); | |
109 | - REXX_METHOD_PROTOTYPE(rx3270_method_erase); | |
110 | - REXX_METHOD_PROTOTYPE(rx3270_method_erase_eof); | |
111 | - REXX_METHOD_PROTOTYPE(rx3270_method_erase_eol); | |
112 | - REXX_METHOD_PROTOTYPE(rx3270_method_erase_input); | |
113 | - REXX_METHOD_PROTOTYPE(rx3270_method_pfkey); | |
114 | - REXX_METHOD_PROTOTYPE(rx3270_method_pakey); | |
115 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_text); | |
116 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_text_at); | |
117 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_text_at); | |
118 | - REXX_METHOD_PROTOTYPE(rx3270_method_cmp_text_at); | |
119 | - REXX_METHOD_PROTOTYPE(rx3270_method_event_trace); | |
120 | - REXX_METHOD_PROTOTYPE(rx3270_method_screen_trace); | |
121 | - REXX_METHOD_PROTOTYPE(rx3270_method_ds_trace); | |
122 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_option); | |
123 | - REXX_METHOD_PROTOTYPE(rx3270_method_test); | |
124 | - REXX_METHOD_PROTOTYPE(rx3270_method_wait_for_text_at); | |
125 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_field_len); | |
126 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_field_start); | |
127 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_next_unprotected); | |
128 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_is_protected); | |
129 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_is_protected_at); | |
130 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_selection); | |
131 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_selection); | |
132 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_clipboard); | |
133 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_clipboard); | |
134 | - REXX_METHOD_PROTOTYPE(rx3270_method_popup); | |
135 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_filename); | |
136 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_cursor_addr); | |
137 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor_addr); | |
138 | - REXX_METHOD_PROTOTYPE(rx3270_method_input_text); | |
139 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_display_charset); | |
140 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_display_charset); | |
141 | - REXX_METHOD_PROTOTYPE(rx3270_method_get_host_charset); | |
142 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_host_charset); | |
143 | - REXX_METHOD_PROTOTYPE(rx3270_method_set_unlock_delay); | |
144 | - | |
145 | -/*---[ Globals ]---------------------------------------------------------------------------------------------*/ | |
146 | - | |
147 | -/*--[ 3270 Session ]-----------------------------------------------------------------------------------------*/ | |
148 | - | |
149 | -#ifdef __cplusplus | |
150 | - extern "C" { | |
151 | -#endif | |
152 | - | |
153 | - LIB3270_EXPORT void rx3270_set_package_option(RexxOption *option); | |
154 | - LIB3270_EXPORT void rx3270_set_session(H3270 *hSession); | |
155 | - | |
156 | -#ifdef __cplusplus | |
157 | - } | |
158 | -#endif | |
159 | - | |
160 | -#endif // RX3270_H_INCLUDED |
src/plugins/rx3270/rxapimain.cc
... | ... | @@ -1,208 +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 rxapimain.c 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 | - * | |
32 | - * Reference: | |
33 | - * | |
34 | - * http://www.oorexx.org/docs/rexxpg/x2950.htm | |
35 | - * | |
36 | - */ | |
37 | - | |
38 | - #include "rx3270.h" | |
39 | - #include <time.h> | |
40 | - #include <lib3270/actions.h> | |
41 | - | |
42 | -#ifdef HAVE_SYSLOG | |
43 | - #include <syslog.h> | |
44 | -#endif // HAVE_SYSLOG | |
45 | - | |
46 | - #include <string.h> | |
47 | - | |
48 | -/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
49 | - | |
50 | - static H3270 * default_session = NULL; | |
51 | - | |
52 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
53 | - | |
54 | -static PW3270_NAMESPACE::session * factory(const char *name) | |
55 | -{ | |
56 | - if(!default_session) | |
57 | - return PW3270_NAMESPACE::session::create_local(); | |
58 | - | |
59 | - return PW3270_NAMESPACE::session::create_local(default_session); | |
60 | -} | |
61 | - | |
62 | -void rx3270_set_session(H3270 *session) | |
63 | -{ | |
64 | - default_session = session; | |
65 | - PW3270_NAMESPACE::session::set_plugin(factory); | |
66 | -} | |
67 | - | |
68 | -// now build the actual entry list | |
69 | -RexxRoutineEntry rx3270_functions[] = | |
70 | -{ | |
71 | - REXX_TYPED_ROUTINE(rx3270version, rx3270version), | |
72 | - REXX_TYPED_ROUTINE(rx3270QueryCState, rx3270QueryCState), | |
73 | - REXX_TYPED_ROUTINE(rx3270Disconnect, rx3270Disconnect), | |
74 | - REXX_TYPED_ROUTINE(rx3270Connect, rx3270Connect), | |
75 | - REXX_TYPED_ROUTINE(rx3270isConnected, rx3270isConnected), | |
76 | - REXX_TYPED_ROUTINE(rx3270WaitForEvents, rx3270WaitForEvents), | |
77 | - REXX_TYPED_ROUTINE(rx3270Sleep, rx3270Sleep), | |
78 | - REXX_TYPED_ROUTINE(rx3270SendENTERKey, rx3270SendENTERKey), | |
79 | - REXX_TYPED_ROUTINE(rx3270SendPFKey, rx3270SendPFKey), | |
80 | - REXX_TYPED_ROUTINE(rx3270SendPAKey, rx3270SendPAKey), | |
81 | - REXX_TYPED_ROUTINE(rx3270WaitForTerminalReady, rx3270WaitForTerminalReady), | |
82 | - REXX_TYPED_ROUTINE(rx3270WaitForStringAt, rx3270WaitForStringAt), | |
83 | - REXX_TYPED_ROUTINE(rx3270GetStringAt, rx3270GetStringAt), | |
84 | - REXX_TYPED_ROUTINE(rx3270IsTerminalReady, rx3270IsTerminalReady), | |
85 | - REXX_TYPED_ROUTINE(rx3270queryStringAt, rx3270queryStringAt), | |
86 | - REXX_TYPED_ROUTINE(rx3270SetStringAt, rx3270SetStringAt), | |
87 | - REXX_TYPED_ROUTINE(rx3270CloseApplication, rx3270CloseApplication), | |
88 | - | |
89 | - REXX_TYPED_ROUTINE(rx3270Erase, rx3270Erase), | |
90 | - REXX_TYPED_ROUTINE(rx3270EraseEOF, rx3270EraseEOF), | |
91 | - REXX_TYPED_ROUTINE(rx3270EraseEOL, rx3270EraseEOL), | |
92 | - REXX_TYPED_ROUTINE(rx3270EraseInput, rx3270EraseInput), | |
93 | - | |
94 | - REXX_TYPED_ROUTINE(rx3270IsProtected, rx3270IsProtected), | |
95 | - REXX_TYPED_ROUTINE(rx3270IsProtectedAt, rx3270IsProtectedAt), | |
96 | - REXX_TYPED_ROUTINE(rx3270SetUnlockDelay, rx3270SetUnlockDelay), | |
97 | - | |
98 | - REXX_TYPED_ROUTINE(ebc2asc, ebc2asc), | |
99 | - REXX_TYPED_ROUTINE(asc2ebc, asc2ebc), | |
100 | - | |
101 | - | |
102 | - // rx3270Popup | |
103 | - REXX_LAST_METHOD() | |
104 | -}; | |
105 | - | |
106 | -RexxMethodEntry rx3270_methods[] = | |
107 | -{ | |
108 | - REXX_METHOD(rx3270_method_version, rx3270_method_version ), | |
109 | - REXX_METHOD(rx3270_method_revision, rx3270_method_revision ), | |
110 | - REXX_METHOD(rx3270_method_init, rx3270_method_init ), | |
111 | - REXX_METHOD(rx3270_method_uninit, rx3270_method_uninit ), | |
112 | - REXX_METHOD(rx3270_method_connect, rx3270_method_connect ), | |
113 | - REXX_METHOD(rx3270_method_disconnect, rx3270_method_disconnect ), | |
114 | - REXX_METHOD(rx3270_method_sleep, rx3270_method_sleep ), | |
115 | - REXX_METHOD(rx3270_method_is_connected, rx3270_method_is_connected ), | |
116 | - REXX_METHOD(rx3270_method_is_ready, rx3270_method_is_ready ), | |
117 | - REXX_METHOD(rx3270_method_wait_for_ready, rx3270_method_wait_for_ready ), | |
118 | - REXX_METHOD(rx3270_method_set_cursor, rx3270_method_set_cursor ), | |
119 | - REXX_METHOD(rx3270_method_set_cursor, rx3270_method_get_cursor_addr ), | |
120 | - REXX_METHOD(rx3270_method_set_cursor, rx3270_method_set_cursor_addr ), | |
121 | - REXX_METHOD(rx3270_method_enter, rx3270_method_enter ), | |
122 | - REXX_METHOD(rx3270_method_enter, rx3270_method_erase ), | |
123 | - REXX_METHOD(rx3270_method_enter, rx3270_method_erase_eof ), | |
124 | - REXX_METHOD(rx3270_method_enter, rx3270_method_erase_eol ), | |
125 | - REXX_METHOD(rx3270_method_enter, rx3270_method_erase_input ), | |
126 | - REXX_METHOD(rx3270_method_pfkey, rx3270_method_pfkey ), | |
127 | - REXX_METHOD(rx3270_method_pakey, rx3270_method_pakey ), | |
128 | - REXX_METHOD(rx3270_method_get_text, rx3270_method_get_text ), | |
129 | - REXX_METHOD(rx3270_method_get_text_at, rx3270_method_get_text_at ), | |
130 | - REXX_METHOD(rx3270_method_set_text_at, rx3270_method_set_text_at ), | |
131 | - REXX_METHOD(rx3270_method_cmp_text_at, rx3270_method_cmp_text_at ), | |
132 | - REXX_METHOD(rx3270_method_event_trace, rx3270_method_event_trace ), | |
133 | - REXX_METHOD(rx3270_method_screen_trace, rx3270_method_screen_trace ), | |
134 | - REXX_METHOD(rx3270_method_ds_trace, rx3270_method_ds_trace ), | |
135 | - REXX_METHOD(rx3270_method_set_option, rx3270_method_set_option ), | |
136 | - REXX_METHOD(rx3270_method_test, rx3270_method_test ), | |
137 | - REXX_METHOD(rx3270_method_wait_for_text_at, rx3270_method_wait_for_text_at ), | |
138 | - | |
139 | - REXX_METHOD(rx3270_method_get_field_len, rx3270_method_get_field_len ), | |
140 | - REXX_METHOD(rx3270_method_get_field_start, rx3270_method_get_field_start ), | |
141 | - REXX_METHOD(rx3270_method_get_next_unprotected, rx3270_method_get_next_unprotected ), | |
142 | - | |
143 | - REXX_METHOD(rx3270_method_get_is_protected, rx3270_method_get_is_protected ), | |
144 | - REXX_METHOD(rx3270_method_get_is_protected_at, rx3270_method_get_is_protected_at ), | |
145 | - | |
146 | - REXX_METHOD(rx3270_method_get_selection, rx3270_method_get_selection ), | |
147 | - REXX_METHOD(rx3270_method_set_selection, rx3270_method_set_selection ), | |
148 | - REXX_METHOD(rx3270_method_get_clipboard, rx3270_method_get_clipboard ), | |
149 | - REXX_METHOD(rx3270_method_set_clipboard, rx3270_method_set_clipboard ), | |
150 | - | |
151 | - REXX_METHOD(rx3270_method_erase, rx3270_method_erase ), | |
152 | - REXX_METHOD(rx3270_method_erase_eof, rx3270_method_erase_eof ), | |
153 | - REXX_METHOD(rx3270_method_erase_eol, rx3270_method_erase_eol ), | |
154 | - REXX_METHOD(rx3270_method_erase_input, rx3270_method_erase_input ), | |
155 | - | |
156 | - REXX_METHOD(rx3270_method_popup, rx3270_method_popup ), | |
157 | - REXX_METHOD(rx3270_method_get_filename, rx3270_method_get_filename ), | |
158 | - | |
159 | - REXX_METHOD(rx3270_method_get_cursor_addr, rx3270_method_get_cursor_addr ), | |
160 | - REXX_METHOD(rx3270_method_set_cursor_addr, rx3270_method_set_cursor_addr ), | |
161 | - REXX_METHOD(rx3270_method_input_text, rx3270_method_input_text ), | |
162 | - | |
163 | - REXX_METHOD(rx3270_method_get_display_charset, rx3270_method_get_display_charset ), | |
164 | - REXX_METHOD(rx3270_method_set_display_charset, rx3270_method_set_display_charset ), | |
165 | - | |
166 | - REXX_METHOD(rx3270_method_get_host_charset, rx3270_method_get_host_charset ), | |
167 | - REXX_METHOD(rx3270_method_set_host_charset, rx3270_method_set_host_charset ), | |
168 | - | |
169 | - REXX_METHOD(rx3270_method_set_unlock_delay, rx3270_method_set_unlock_delay ), | |
170 | - | |
171 | - REXX_LAST_METHOD() | |
172 | -}; | |
173 | - | |
174 | -RexxPackageEntry rx3270_package_entry = | |
175 | -{ | |
176 | - STANDARD_PACKAGE_HEADER | |
177 | - REXX_CURRENT_INTERPRETER_VERSION, // anything after 4.0.0 will work | |
178 | - "rx3270", // name of the package | |
179 | - PACKAGE_VERSION, // package information | |
180 | - NULL, // no load/unload functions | |
181 | - NULL, | |
182 | - rx3270_functions, // the exported functions | |
183 | - rx3270_methods // no methods in rx3270. | |
184 | -}; | |
185 | - | |
186 | -// package loading stub. | |
187 | -/* | |
188 | -OOREXX_GET_PACKAGE(rx3270); | |
189 | -*/ | |
190 | - | |
191 | -BEGIN_EXTERN_C() | |
192 | - | |
193 | -LIB3270_EXPORT void rx3270_set_package_option(RexxOption *option) | |
194 | -{ | |
195 | - static const RexxLibraryPackage package = { "rx3270", &rx3270_package_entry }; | |
196 | - | |
197 | - option->optionName = REGISTER_LIBRARY; | |
198 | - option->option = (void *) &package; | |
199 | - | |
200 | -} | |
201 | - | |
202 | -LIB3270_EXPORT RexxPackageEntry * RexxEntry RexxGetPackage(void) | |
203 | -{ | |
204 | - return &rx3270_package_entry; | |
205 | -} | |
206 | -END_EXTERN_C() | |
207 | - | |
208 | - |
src/plugins/rx3270/sample/asc2ebc.rex
src/plugins/rx3270/sample/charset.rex
src/plugins/rx3270/sample/clipboard.rex
... | ... | @@ -1,119 +0,0 @@ |
1 | -/* | |
2 | - * Sample rexx code to justified paste the clipboard contents. | |
3 | - * | |
4 | - * Autor: Perry Werneck <perry.werneck@gmail.com> | |
5 | - * | |
6 | - */ | |
7 | - | |
8 | -trace "?R" | |
9 | - | |
10 | - host = .rx3270~new("pw3270:a") | |
11 | - | |
12 | - if host~connected() = 0 then | |
13 | - do | |
14 | - host~popup("error","Can't start script","Disconnected from host") | |
15 | - return 0 | |
16 | - end | |
17 | - | |
18 | - text = strip(host~GetClipboard()) | |
19 | - if text = "" then | |
20 | - do | |
21 | - say "Clipboard is empty" | |
22 | - return 0 | |
23 | - end | |
24 | - | |
25 | - if host~WaitForReady(60) <> 0 then | |
26 | - do | |
27 | - host~popup("error","Failed","Timeout waiting for host response") | |
28 | - return 0 | |
29 | - end | |
30 | - | |
31 | - cursor = host~GetCursorAddr() | |
32 | - next = cursor | |
33 | - | |
34 | - do while text <> "" | |
35 | - addr = host~GetFieldStart(next) | |
36 | - next = host~GetNextUnprotected(addr) | |
37 | - | |
38 | - host~SetCursorAddr(addr) | |
39 | - | |
40 | - field_len = host~GetFieldLen() | |
41 | - | |
42 | - s = strip(left(text,field_len)) | |
43 | - p = lastpos(" ",s) | |
44 | - n = pos(d2c(10),s) | |
45 | - | |
46 | - select | |
47 | - when n <> 0 then | |
48 | - do | |
49 | - s = strip(left(text,n-1)) | |
50 | - text = strip(substr(text,n+1)) | |
51 | - end | |
52 | - | |
53 | - when length(text) < field_len then | |
54 | - do | |
55 | - s = justify(strip(text),field_len) | |
56 | - text = "" | |
57 | - end | |
58 | - | |
59 | - when p = 0 then | |
60 | - do | |
61 | - s = strip(left(text,field_len)) | |
62 | - text = substr(text,field_len+1) | |
63 | - end | |
64 | - | |
65 | - otherwise | |
66 | - s = strip(left(text,p)) | |
67 | - text = strip(substr(text,p+1)) | |
68 | - end | |
69 | - | |
70 | - /* Insert new string */ | |
71 | - host~input(s) | |
72 | - | |
73 | - if next <= cursor then | |
74 | - do | |
75 | - /* Next field is before the original position */ | |
76 | - host~SetClipboard(text) | |
77 | - return 0 | |
78 | - end | |
79 | - | |
80 | - end | |
81 | - | |
82 | -return 0 | |
83 | - | |
84 | -justify: procedure | |
85 | - | |
86 | - use arg text, len | |
87 | - | |
88 | - wlen = words(text) | |
89 | - if wlen < 3 | |
90 | - then return text | |
91 | - | |
92 | - ln = .array~new() | |
93 | - sz = 0 | |
94 | - | |
95 | - do f = 1 to wlen | |
96 | - ln[f] = word(text,f)||" " | |
97 | - sz = sz + length(ln[f]) | |
98 | - end | |
99 | - | |
100 | - do while sz < len | |
101 | - do f = wlen-1 to 1 by -1 | |
102 | - ln[f] = ln[f]||"." | |
103 | - sz = sz+1 | |
104 | - if sz >= len | |
105 | - then leave | |
106 | - end | |
107 | - end | |
108 | - | |
109 | - str = "" | |
110 | - do f = 1 to wlen | |
111 | - str = str||ln[f] | |
112 | - end | |
113 | - | |
114 | -return strip(str) | |
115 | - | |
116 | -::requires "rx3270.cls" | |
117 | - | |
118 | - | |
119 | - |
src/plugins/rx3270/sample/ebc2asc.rex
src/plugins/rx3270/sample/getversion.rex
src/plugins/rx3270/sample/object.rex
... | ... | @@ -1,44 +0,0 @@ |
1 | - | |
2 | -use arg uri | |
3 | - | |
4 | -if arg(1) <> "" then | |
5 | -do | |
6 | - | |
7 | - /* Has a host URI, create a new session and connect to the host */ | |
8 | - | |
9 | - host = .rx3270~new("") | |
10 | - | |
11 | - if host~connect(uri,1) <> 0 then | |
12 | - do | |
13 | - say "Error connecting to "||uri | |
14 | - return -1 | |
15 | - end | |
16 | -end | |
17 | -else | |
18 | -do | |
19 | - /* No host URI, use the first session */ | |
20 | - host = .rx3270~new("pw3270:A") | |
21 | - | |
22 | -end | |
23 | - | |
24 | -if host~WaitForReady(60) <> 0 then | |
25 | -do | |
26 | - say "Timeout waiting for terminal ready" | |
27 | -end | |
28 | - | |
29 | -say "Text(2,2,23)=["||host~GetTextAt(2,2,23)||"]" | |
30 | -say "Text(3,2,27)=["||host~GetTextAt(3,2,27)||"]" | |
31 | - | |
32 | -host~enter() | |
33 | -if host~WaitForReady(60) <> 0 then | |
34 | -do | |
35 | - say "Timeout waiting for terminal ready" | |
36 | -end | |
37 | - | |
38 | -host~disconnect() | |
39 | - | |
40 | -return 0 | |
41 | - | |
42 | - | |
43 | -::requires "rx3270.cls" | |
44 | - |
src/plugins/rx3270/sample/protected.rex
src/plugins/rx3270/sample/remote.rex
... | ... | @@ -1,26 +0,0 @@ |
1 | - | |
2 | -use arg uri | |
3 | - | |
4 | -trace "?R" | |
5 | - | |
6 | -host = .rx3270~new("pw3270:a") | |
7 | - | |
8 | -say "PW3270 revision is "||host~revision() | |
9 | -say "Connection state is "||host~connected() | |
10 | -say "Ready state is "||host~ready() | |
11 | - | |
12 | -if uri <> "URI" | |
13 | - then say "Connect rc="||host~connect(uri) | |
14 | - | |
15 | -say "Wait for ready is "||host~WaitForReady(60) | |
16 | - | |
17 | -say "Text[3,2,27]="||host~GetTextAt(3,2,27) | |
18 | - | |
19 | -say "ENTER exits with rc="||host~enter() | |
20 | - | |
21 | -say "Wait for ready is "||host~WaitForReady(60) | |
22 | - | |
23 | -return 0 | |
24 | - | |
25 | -::requires "rx3270.cls" | |
26 | - |
src/plugins/rx3270/typed_routines.cc
... | ... | @@ -1,323 +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 typed_routines.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 "rx3270.h" | |
31 | - #include <time.h> | |
32 | - #include <string.h> | |
33 | - #include <exception> | |
34 | - #include <pw3270/class.h> | |
35 | - | |
36 | - using namespace std; | |
37 | - using namespace PW3270_NAMESPACE; | |
38 | - | |
39 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
40 | - | |
41 | -RexxRoutine0(CSTRING, rx3270version) | |
42 | -{ | |
43 | - try | |
44 | - { | |
45 | - return session::get_default()->get_version().c_str(); | |
46 | - } | |
47 | - catch(std::exception& e) | |
48 | - { | |
49 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
50 | - } | |
51 | - | |
52 | - return NULL; | |
53 | -} | |
54 | - | |
55 | -RexxRoutine0(CSTRING, rx3270QueryCState) | |
56 | -{ | |
57 | - #define DECLARE_XLAT_STATE( x ) { x, #x } | |
58 | - | |
59 | - static const struct _xlat_state | |
60 | - { | |
61 | - LIB3270_CSTATE state; | |
62 | - const char * ret; | |
63 | - } xlat_state[] = | |
64 | - { | |
65 | - { LIB3270_NOT_CONNECTED, "NOT_CONNECTED" }, | |
66 | - { LIB3270_RESOLVING, "RESOLVING" }, | |
67 | - { LIB3270_PENDING, "PENDING" }, | |
68 | - { LIB3270_CONNECTED_INITIAL, "CONNECTED_INITIAL" }, | |
69 | - { LIB3270_CONNECTED_ANSI, "CONNECTED_ANSI" }, | |
70 | - { LIB3270_CONNECTED_3270, "CONNECTED_3270" }, | |
71 | - { LIB3270_CONNECTED_INITIAL_E, "CONNECTED_INITIAL_E" }, | |
72 | - { LIB3270_CONNECTED_NVT, "CONNECTED_NVT" }, | |
73 | - { LIB3270_CONNECTED_SSCP, "CONNECTED_SSCP" }, | |
74 | - { LIB3270_CONNECTED_TN3270E, "CONNECTED_TN3270E" }, | |
75 | - }; | |
76 | - | |
77 | - size_t f; | |
78 | - LIB3270_CSTATE state = session::get_default()->get_cstate(); | |
79 | - | |
80 | - for(f=0;f < (sizeof(xlat_state)/sizeof(struct _xlat_state)); f++) | |
81 | - { | |
82 | - if(state == xlat_state[f].state) | |
83 | - return xlat_state[f].ret; | |
84 | - } | |
85 | - | |
86 | - return "UNEXPECTED"; | |
87 | -} | |
88 | - | |
89 | -RexxRoutine0(int, rx3270Disconnect) | |
90 | -{ | |
91 | - return session::get_default()->disconnect(); | |
92 | -} | |
93 | - | |
94 | -RexxRoutine2(int, rx3270Connect, CSTRING, hostname, int, wait) | |
95 | -{ | |
96 | - return session::get_default()->connect(hostname,wait); | |
97 | -} | |
98 | - | |
99 | -RexxRoutine0(int, rx3270isConnected) | |
100 | -{ | |
101 | - return session::get_default()->is_connected(); | |
102 | -} | |
103 | - | |
104 | -RexxRoutine0(int, rx3270WaitForEvents) | |
105 | -{ | |
106 | - return session::get_default()->iterate(); | |
107 | -} | |
108 | - | |
109 | -RexxRoutine1(int, rx3270Sleep, int, seconds) | |
110 | -{ | |
111 | - return session::get_default()->wait(seconds); | |
112 | -} | |
113 | - | |
114 | -RexxRoutine0(int, rx3270SendENTERKey) | |
115 | -{ | |
116 | - return session::get_default()->enter(); | |
117 | -} | |
118 | - | |
119 | -RexxRoutine0(int, rx3270Erase) | |
120 | -{ | |
121 | - return session::get_default()->erase(); | |
122 | -} | |
123 | - | |
124 | -RexxRoutine0(int, rx3270EraseEOF) | |
125 | -{ | |
126 | - return session::get_default()->erase_eof(); | |
127 | -} | |
128 | - | |
129 | -RexxRoutine0(int, rx3270EraseEOL) | |
130 | -{ | |
131 | - return session::get_default()->erase_eol(); | |
132 | -} | |
133 | - | |
134 | -RexxRoutine0(int, rx3270EraseInput) | |
135 | -{ | |
136 | - return session::get_default()->erase_input(); | |
137 | -} | |
138 | - | |
139 | -RexxRoutine1(int, rx3270SendPFKey, int, key) | |
140 | -{ | |
141 | - return session::get_default()->pfkey(key); | |
142 | -} | |
143 | - | |
144 | -RexxRoutine1(int, rx3270SendPAKey, int, key) | |
145 | -{ | |
146 | - return session::get_default()->pakey(key); | |
147 | -} | |
148 | - | |
149 | -RexxRoutine1(int, rx3270WaitForTerminalReady, int, seconds) | |
150 | -{ | |
151 | - return session::get_default()->wait_for_ready(seconds); | |
152 | -} | |
153 | - | |
154 | -RexxRoutine4(int, rx3270WaitForStringAt, int, row, int, col, CSTRING, key, int, timeout) | |
155 | -{ | |
156 | - try | |
157 | - { | |
158 | - return session::get_default()->wait_for_string_at(row,col,key,timeout); | |
159 | - } | |
160 | - catch(std::exception &e) | |
161 | - { | |
162 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
163 | - } | |
164 | - | |
165 | - return ETIMEDOUT; | |
166 | - | |
167 | -} | |
168 | - | |
169 | -RexxRoutine3(RexxStringObject, rx3270GetStringAt, int, row, int, col, int, sz) | |
170 | -{ | |
171 | - try | |
172 | - { | |
173 | - string str = session::get_default()->get_string_at(row,col,(int) sz); | |
174 | - return context->String((CSTRING) str.c_str()); | |
175 | - } | |
176 | - catch(std::exception &e) | |
177 | - { | |
178 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
179 | - } | |
180 | - | |
181 | - return context->String(""); | |
182 | -} | |
183 | - | |
184 | -RexxRoutine0(int, rx3270IsTerminalReady) | |
185 | -{ | |
186 | - return session::get_default()->is_ready(); | |
187 | -} | |
188 | - | |
189 | -RexxRoutine3(int, rx3270queryStringAt, int, row, int, col, CSTRING, key) | |
190 | -{ | |
191 | - try | |
192 | - { | |
193 | - return session::get_default()->cmp_string_at(row,col,key); | |
194 | - } | |
195 | - catch(std::exception &e) | |
196 | - { | |
197 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
198 | - } | |
199 | - | |
200 | - return -1; | |
201 | -} | |
202 | - | |
203 | -RexxRoutine2(int, rx3270SetCursorPosition, int, row, int, col) | |
204 | -{ | |
205 | - try | |
206 | - { | |
207 | - return session::get_default()->set_cursor_position(row,col); | |
208 | - } | |
209 | - catch(std::exception &e) | |
210 | - { | |
211 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
212 | - } | |
213 | - | |
214 | - return -1; | |
215 | -} | |
216 | - | |
217 | -RexxRoutine3(int, rx3270SetStringAt, int, row, int, col, CSTRING, text) | |
218 | -{ | |
219 | - try | |
220 | - { | |
221 | - return session::get_default()->set_string_at(row,col,text); | |
222 | - } | |
223 | - catch(std::exception &e) | |
224 | - { | |
225 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
226 | - } | |
227 | - return -1; | |
228 | -} | |
229 | - | |
230 | -RexxRoutine0(int, rx3270CloseApplication) | |
231 | -{ | |
232 | - return session::get_default()->quit(); | |
233 | -} | |
234 | - | |
235 | - | |
236 | -RexxRoutine2(RexxStringObject, asc2ebc, CSTRING, str, OPTIONAL_int, sz) | |
237 | -{ | |
238 | - try | |
239 | - { | |
240 | - if(sz < 1) | |
241 | - sz = strlen(str); | |
242 | - | |
243 | - if(sz) | |
244 | - { | |
245 | - char buffer[sz+1]; | |
246 | - memcpy(buffer,str,sz); | |
247 | - buffer[sz] = 0; | |
248 | - return context->String((CSTRING) session::get_default()->asc2ebc((unsigned char *)buffer,sz)); | |
249 | - } | |
250 | - } | |
251 | - catch(std::exception &e) | |
252 | - { | |
253 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
254 | - } | |
255 | - | |
256 | - return context->String(""); | |
257 | -} | |
258 | - | |
259 | -RexxRoutine2(RexxStringObject, ebc2asc, CSTRING, str, OPTIONAL_int, sz) | |
260 | -{ | |
261 | - try | |
262 | - { | |
263 | - if(sz < 1) | |
264 | - sz = strlen(str); | |
265 | - | |
266 | - if(sz) | |
267 | - { | |
268 | - char buffer[sz+1]; | |
269 | - memcpy(buffer,str,sz); | |
270 | - buffer[sz] = 0; | |
271 | - return context->String((CSTRING) session::get_default()->ebc2asc((unsigned char *)buffer,sz)); | |
272 | - } | |
273 | - } | |
274 | - catch(std::exception &e) | |
275 | - { | |
276 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
277 | - } | |
278 | - | |
279 | - return context->String(""); | |
280 | -} | |
281 | - | |
282 | -RexxRoutine1(int, rx3270IsProtected, int, baddr) | |
283 | -{ | |
284 | - try | |
285 | - { | |
286 | - return session::get_default()->get_is_protected(baddr); | |
287 | - } | |
288 | - catch(std::exception &e) | |
289 | - { | |
290 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
291 | - } | |
292 | - | |
293 | - return -1; | |
294 | -} | |
295 | - | |
296 | -RexxRoutine2(int, rx3270IsProtectedAt, int, row, int, col) | |
297 | -{ | |
298 | - try | |
299 | - { | |
300 | - return session::get_default()->get_is_protected_at(row,col); | |
301 | - } | |
302 | - catch(std::exception &e) | |
303 | - { | |
304 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
305 | - } | |
306 | - | |
307 | - return -1; | |
308 | -} | |
309 | - | |
310 | -RexxRoutine1(int, rx3270SetUnlockDelay, int, delay) | |
311 | -{ | |
312 | - try | |
313 | - { | |
314 | - session::get_default()->set_unlock_delay((unsigned short) delay); | |
315 | - } | |
316 | - catch(std::exception &e) | |
317 | - { | |
318 | - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); | |
319 | - } | |
320 | - | |
321 | - return 0; | |
322 | -} | |
323 | - |