diff --git a/Makefile.in b/Makefile.in index f2dea0b..b71c811 100644 --- a/Makefile.in +++ b/Makefile.in @@ -91,6 +91,12 @@ $(BINRLS)/%@DLLEXT@: \ @$(MAKE) -C src/$(basename $(notdir $@)) $@ +$(BINRLS)/%.a: \ + $(DEPENDS) \ + ./src/%/* + + @$(MAKE) -C src/$(basename $(notdir $@)) $@ + $(BINRLS)/plugins/%@DLLEXT@: \ $(DEPENDS) \ ./src/plugins/%/* @@ -170,6 +176,7 @@ $(SRCDIR)/%: \ all: \ $(BINRLS)/lib3270@DLLEXT@ \ $(BINRLS)/$(PACKAGE_TARNAME)@EXEEXT@ \ + $(BINRLS)/libpw3270cpp.a \ $(foreach PLG, $(PLUGINS), $(BINRLS)/plugins/$(PLG)@DLLEXT@) \ locale/$(PACKAGE_TARNAME).pot @@ -190,10 +197,16 @@ locale/$(PACKAGE_TARNAME).pot: \ @$(MSGCAT) --sort-output $^ > $@ install: \ + install-lib \ + install-app \ + install-sdk \ + $(foreach PLG, $(PLUGINS), $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)-plugins/$(PLG)@DLLEXT@) + +install-lib: \ $(DESTDIR)$(libdir)/lib3270@DLLEXT@ \ + +install-app: \ $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)@EXEEXT@ \ - $(DESTDIR)$(libdir)/libpw3270cpp.a \ - $(foreach PLG, $(PLUGINS), $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)-plugins/$(PLG)@DLLEXT@) \ locale/$(PACKAGE_TARNAME).pot @$(MKDIR) $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME) @@ -201,7 +214,11 @@ install: \ @$(MAKE) -C ui install @$(MAKE) -C locale install + +install-sdk: + @$(MAKE) -C sdk install + @$(MAKE) -C src/libpw3270cpp install #---[ Debug targets ]---------------------------------------------------------- diff --git a/debian/control b/debian/control index 923df0d..ff16078 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: pw3270 Section: unknown Priority: optional Maintainer: Perry Werneck -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 +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 Package: pw3270 Architecture: any @@ -25,21 +25,16 @@ Depends: ${misc:Depends}, lib3270 (= ${binary:Version}) Description: lib3270 development files. This package contains the files needed for development of lib3270 based applications +Package: pw3270-dev +Architecture: any +Section: libdevel +Depends: ${misc:Depends}, lib3270-dev (= ${binary:Version}), pw3270 (= ${binary:Version}) +Description: lib3270 development files. + This package contains the files needed for development of pw3270 extensions and plugins + Package: pw3270-plugin-dbus Architecture: any Depends: ${misc:Depends}, pw3270 (= ${binary:Version}), libdbus-1-3 Description: DBUS plugin for pw3270. This package contains the plugin allowing scripting of a pw3270 session using dbus calls. -Package: pw3270-plugin-rexx -Architecture: any -Depends: ${misc:Depends}, lib3270 (= ${binary:Version}), oorexx (>= 4.1.2) -Description: REXX script support for pw3270. - This package provides Rexx class and associated libraries allowing rexx scripts to access tn3270e hosts. - -Package: libreoffice-extension-pw3270 -Architecture: any -Depends: ${misc:Depends}, pw3270 (= ${binary:Version}), libreoffice-core -Description: DBUS plugin for pw3270. - This package contains the libreoffice modules for acessing 3270 hosts. - diff --git a/debian/rules b/debian/rules index 6040f21..c9ea65a 100644 --- a/debian/rules +++ b/debian/rules @@ -8,10 +8,6 @@ export DH_VERBOSE=1 # This is the debhelper compatibility version to use. export DH_COMPAT=4 -# Libreoffice stuff -export OFFICE_HOME=/usr/lib/libreoffice -export OO_SDK_URE_HOME=/usr/lib/ure - CFLAGS = -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 @@ -50,40 +46,37 @@ install: build dh_clean -k dh_installdirs + # Build package + make all + # Install main library make DESTDIR=$(PWD)/debian/lib3270 install-lib # Install pw3270's GUI make DESTDIR=$(PWD)/debian/pw3270 install-app - # Install sdk - make DESTDIR=$(PWD)/debian/lib3270-dev install-sdk + # Install lib3270-sdk + make DESTDIR=$(PWD)/debian/lib3270-dev -C sdk install-lib3270 - mkdir -p $(PWD)/debian/lib3270-dev/usr/share/pw3270/ui - mv -f $(PWD)/debian/pw3270/usr/share/pw3270/ui/*debug.xml $(PWD)/debian/lib3270-dev/usr/share/pw3270/ui/ + # Install pw3270-sdk + make DESTDIR=$(PWD)/debian/pw3270-dev -C sdk install-pw3270 + make DESTDIR=$(PWD)/debian/pw3270-dev -C src/libpw3270cpp install - # Install libreoffice extension - make DESTDIR=$(PWD)/debian/libreoffice-extension-pw3270 install-oxt + mkdir -p $(PWD)/debian/lib3270-dev/lib3270 + install --mode=644 src/include/lib3270.h $(PWD)/debian/lib3270-dev + install --mode=644 src/include/lib3270/*.h $(PWD)/debian/lib3270-dev/lib3270 - # Install DBUS plugin - make DESTDIR=$(PWD)/debian/pw3270-plugin-dbus install-plugin-dbus + # Move SDK's ui files - # Install REXX plugin - make DESTDIR=$(PWD)/debian/pw3270-plugin-rexx install-plugin-rexx + # Install DBUS plugin + make DESTDIR=$(PWD)/debian/pw3270-plugin-dbus -C src/plugins/dbus3270/ install - mkdir -p $(PWD)/debian/pw3270-plugin-rexx/usr/share/pw3270/ui/ - mv -f $(PWD)/debian/pw3270/usr/share/pw3270/ui/*rexx.xml $(PWD)/debian/pw3270-plugin-rexx/usr/share/pw3270/ui/ - - # Create updated file lists + # Get file lists find $(PWD)/debian/lib3270 -type f | sed -e "s@^$(PWD)/debian/lib3270/@/@g" > $(PWD)/debian/lib3270.install - find $(PWD)/debian/pw3270 -type f | sed -e "s@^$(PWD)/debian/pw3270/@/@g" > $(PWD)/debian/pw3270.install - - find $(PWD)/debian/libreoffice-extension-pw3270 -type f | sed -e "s@^$(PWD)/debian/libreoffice-extension-pw3270/@/@g" > $(PWD)/debian/libreoffice-extension-pw3270.install - find $(PWD)/debian/pw3270-plugin-dbus -type f | sed -e "s@^$(PWD)/debian/pw3270-plugin-dbus/@/@g" > $(PWD)/debian/pw3270-plugin-dbus.install - find $(PWD)/debian/pw3270-plugin-rexx -type f | sed -e "s@^$(PWD)/debian/pw3270-plugin-rexx/@/@g" > $(PWD)/debian/pw3270-plugin-rexx.install - + find $(PWD)/debian/lib3270-dev -type f | sed -e "s@^$(PWD)/debian/lib3270-dev/@/@g" > $(PWD)/debian/lib3270-dev.install + find $(PWD)/debian/pw3270-dev -type f | sed -e "s@^$(PWD)/debian/pw3270-dev/@/@g" > $(PWD)/debian/pw3270-dev.install # --- end custom part for installing # Build architecture-independent files here. diff --git a/locale/Makefile.in b/locale/Makefile.in index 7e05238..a1f54c7 100644 --- a/locale/Makefile.in +++ b/locale/Makefile.in @@ -1,5 +1,5 @@ # -# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 +# Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 # (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a # aplicativos mainframe. Registro no INPI sob o nome G3270. # @@ -15,13 +15,13 @@ # obter mais detalhes. # # Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este -# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple -# Place, Suite 330, Boston, MA, 02111-1307, USA +# programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin +# St, Fifth Floor, Boston, MA 02110-1301 USA # # Contatos: # -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) -# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) +# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) # diff --git a/locale/pw3270.pot b/locale/pw3270.pot index ebc8fb3..558799b 100644 --- a/locale/pw3270.pot +++ b/locale/pw3270.pot @@ -9,7 +9,7 @@ msgstr "" "#-#-#-#-# lib3270.pot (PACKAGE VERSION) #-#-#-#-#\n" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-01-19 11:07-0200\n" +"POT-Creation-Date: 2017-01-19 15:24-0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,7 @@ msgstr "" "#-#-#-#-# pw3270.pot (PACKAGE VERSION) #-#-#-#-#\n" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-01-19 11:07-0200\n" +"POT-Creation-Date: 2017-01-19 15:24-0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -42,7 +42,7 @@ msgstr "" "#-#-#-#-# dbus3270.pot (PACKAGE VERSION) #-#-#-#-#\n" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-01-19 11:07-0200\n" +"POT-Creation-Date: 2017-01-19 15:24-0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/rpm/pw3270.spec b/rpm/pw3270.spec index fec4956..bd06782 100644 --- a/rpm/pw3270.spec +++ b/rpm/pw3270.spec @@ -41,11 +41,8 @@ Source: pw3270-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build -Requires: lib3270-%{_libvrs} = %{version} Requires: shared-mime-info -Requires: libpw3270-%{MAJOR_VERSION}_%{MINOR_VERSION} - #--[ Setup by distribution ]------------------------------------------------------------------------------------------ # # References: @@ -154,7 +151,7 @@ This package contains the tn3270 protocol library for %{name} Summary: Devel for 3270 Communication library for %{name} Group: Development/Libraries/C and C++ Provides: lib3270-devel-%{MAJOR_VERSION}_%{MINOR_VERSION} -Requires: lib3270-%{MAJOR_VERSION}_%{MINOR_VERSION} +Requires: lib3270-%{MAJOR_VERSION}_%{MINOR_VERSION} = %{version} %description -n lib3270-devel 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 %package -n %{name}-devel Summary: Files required for development of %{name} plugins Group: Development/Libraries/C and C++ -Requires: lib3270-devel-%{MAJOR_VERSION}_%{MINOR_VERSION} -Requires: libpw3270-%{MAJOR_VERSION}_%{MINOR_VERSION} +Requires: lib3270-devel-%{MAJOR_VERSION}_%{MINOR_VERSION} = %{version} +Requires: libpw3270-%{MAJOR_VERSION}_%{MINOR_VERSION} = %{version} %description -n %{name}-devel 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. diff --git a/sdk/Makefile.in b/sdk/Makefile.in index 32dd0b9..2411978 100644 --- a/sdk/Makefile.in +++ b/sdk/Makefile.in @@ -67,14 +67,20 @@ $(SRCDIR)/src/include/%.h: \ #---[ Targets ]-------------------------------------------------------------------------- install: \ - $(foreach SRC, $(basename $(wildcard *.pc)), $(DESTDIR)$(libdir)/pkgconfig/$(SRC).pc) \ + install-lib3270 \ + install-pw3270 + +install-lib3270: \ $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/lib3270/*.h)), $(DESTDIR)$(includedir)/lib3270/$(SRC)) \ - $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/pw3270/*.h)), $(DESTDIR)$(includedir)/pw3270/$(SRC)) \ + $(DESTDIR)$(libdir)/pkgconfig/lib3270.pc \ $(DESTDIR)$(includedir)/lib3270.h \ + +install-pw3270: \ + $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/pw3270/*.h)), $(DESTDIR)$(includedir)/pw3270/$(SRC)) \ + $(DESTDIR)$(libdir)/pkgconfig/pw3270.pc \ $(DESTDIR)$(includedir)/pw3270.h \ $(DESTDIR)$(includedir)/pw3270cpp.h \ - $(SRCDIR)/sdk: \ $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/lib3270/*.h)), $(SRCDIR)/src/include/lib3270/$(SRC)) \ $(foreach SRC, $(notdir $(wildcard $(BASEDIR)/src/include/pw3270/*.h)), $(SRCDIR)/src/include/pw3270/$(SRC)) \ diff --git a/src/include/pw3270/ipcpackets.h b/src/include/pw3270/ipcpackets.h index 661166c..911e0f2 100644 --- a/src/include/pw3270/ipcpackets.h +++ b/src/include/pw3270/ipcpackets.h @@ -15,10 +15,10 @@ * obter mais detalhes. * * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA * - * Este programa está nomeado como ipcpackets.h e possui - linhas de código. + * Este programa está nomeado como lib3270.h e possui - linhas de código. * * Contatos: * diff --git a/src/libpw3270cpp/Makefile.in b/src/libpw3270cpp/Makefile.in index 0d6aedc..c90cf97 100644 --- a/src/libpw3270cpp/Makefile.in +++ b/src/libpw3270cpp/Makefile.in @@ -102,20 +102,23 @@ $(POTDIR)/%.pot: %.c #---[ Release Targets ]------------------------------------------------------------------ +all: \ + $(BASEDIR)/.bin/Release/$(MODULE_NAME).a + Release: \ - $(BASEDIR)/.obj/Release/$(MODULE_NAME).a + $(BASEDIR)/.bin/Release/$(MODULE_NAME).a install: \ $(DESTDIR)$(libdir)/$(MODULE_NAME).a $(DESTDIR)$(libdir)/$(MODULE_NAME).a: \ - $(BASEDIR)/.obj/Release/$(MODULE_NAME).a + $(BASEDIR)/.bin/Release/$(MODULE_NAME).a @echo $@ ... @$(MKDIR) `dirname $@` - @$(INSTALL_PROGRAM) $^ $@ + @$(INSTALL_DATA) $^ $@ -$(BASEDIR)/.obj/Release/$(MODULE_NAME).a: \ +$(BASEDIR)/.bin/Release/$(MODULE_NAME).a: \ $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) @echo $@ ... diff --git a/src/plugins/dbus3270/Makefile.in b/src/plugins/dbus3270/Makefile.in index 00bead4..23da4ee 100644 --- a/src/plugins/dbus3270/Makefile.in +++ b/src/plugins/dbus3270/Makefile.in @@ -62,6 +62,7 @@ XGETTEXT=@XGETTEXT@ MSGCAT=@MSGCAT@ INSTALL=@INSTALL@ INSTALL_DATA=@INSTALL_DATA@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ CFLAGS=@CFLAGS@ @GTK_CFLAGS@ -I$(BASEDIR)/src/include LIBS=@LIBS@ @GTK_LIBS@ @GLIB_LIBS@ @GDBUS_LIBS@ @LIB3270_LIBS@ @PW3270_LIBS@ @@ -122,18 +123,22 @@ dbus-glue.h: \ Release: \ $(BINRLS)/$(MODULE_NAME)@DLLEXT@ -$(BINRLS)/$(MODULE_NAME)@DLLEXT@: \ - $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) +install: \ + $(BINRLS)/$(MODULE_NAME)@DLLEXT@ @echo $@ ... @$(MKDIR) `dirname $@` - @$(LD) \ - -shared \ - -L$(BASEDIR)/.bin/Release \ - -o $@ $^ \ - $(LIBS) + $(INSTALL_PROGRAM) $(BINRLS)/$(MODULE_NAME)@DLLEXT@ $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)-plugins/$(MODULE_NAME)@DLLEXT@ $(DESTDIR)$(libdir)/$(PACKAGE_TARNAME)-plugins/$(MODULE_NAME)@DLLEXT@: \ + $(BINRLS)/$(MODULE_NAME)@DLLEXT@ + + @echo $@ ... + @$(MKDIR) `dirname $@` + $(INSTALL_PROGRAM) $(BINRLS)/$(MODULE_NAME)@DLLEXT@ $@ + + +$(BINRLS)/$(MODULE_NAME)@DLLEXT@: \ $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) @echo $@ ... diff --git a/src/plugins/rx3270/Makefile.in b/src/plugins/rx3270/Makefile.in deleted file mode 100644 index c6b526c..0000000 --- a/src/plugins/rx3270/Makefile.in +++ /dev/null @@ -1,89 +0,0 @@ -# -# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 -# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a -# aplicativos mainframe. Registro no INPI sob o nome G3270. -# -# Copyright (C) <2008> -# -# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob -# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela -# Free Software Foundation. -# -# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER -# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO -# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para -# obter mais detalhes. -# -# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este -# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple -# Place, Suite 330, Boston, MA, 02111-1307, USA -# -# Contatos: -# -# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) -# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) -# - -#---[ Sources ]---------------------------------------------------------------- - -MODULE_NAME=rx3270 -DEPENDS=*.h ../../include/*.h ../../include/lib3270/*.h Makefile -PLUGIN_SRC=pluginmain.cc -EXTAPI_SRC=rxapimain.cc typed_routines.cc rexx_methods.cc - -#---[ Tools ]------------------------------------------------------------------ - -REXXCONFIG=@REXXCONFIG@ -LN_S=@LN_S@ - -#---[ Include plugin rules ]--------------------------------------------------- - -CLASSLIBDIR=../../classlib - -include ../../include/plugin.mak -include $(CLASSLIBDIR)/class.mak - -LIBS=@REXX_LIBS@ @LIBICONV@ @DBUS_LIBS@ - -REXX_CFLAGS=@REXX_CFLAGS@ -DBUS_CFLAGS=@DBUS_CFLAGS@ - -CFLAGS=@CFLAGS@ $(REXX_CFLAGS) $(DBUS_CFLAGS) -REXX_HOME=@REXX_HOME@ -REXXLIBDIR=@REXX_LIBDIR@ - -#---[ Debug Targets ]---------------------------------------------------------- - -$(BINDBG)/$(PLUGIN_NAME): $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJDBG)/$(SRC).o) $(BINDBG)$(DLL_NAME) - @echo " CCLD `basename $@`" - @$(MKDIR) `dirname $@` - @$(CXX) $(DLL_FLAGS) @LDSOFLAGS@ @DBGRPATH@ $(LDFLAGS) -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(GTK_LIBS) $(GLIB_LIBS) $(PW3270_LIBS) - -$(BINDBG)$(DLL_NAME).$(VERSION): $(foreach SRC, $(basename $(EXTAPI_SRC)), $(OBJDBG)/$(SRC)@OBJEXT@) $(CLASS_DEBUG_OBJECTS) - @echo " CCLD `basename $@`" - @$(MKDIR) `dirname $@` - @$(CXX) $(DLL_FLAGS) $(LDFLAGS) @LDSOFLAGS@ @DBGRPATH@ -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(CLASS_LIBS) - -#---[ Release Targets ]-------------------------------------------------------- - -$(BINRLS)/$(PLUGIN_NAME): $(foreach SRC, $(basename $(PLUGIN_SRC)), $(OBJRLS)/$(SRC).o) $(BINRLS)$(DLL_NAME) - @echo " CCLD `basename $@`" - @$(MKDIR) `dirname $@` - @$(CXX) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) @RLS_LDFLAGS@ -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(GTK_LIBS) $(GLIB_LIBS) $(PW3270_LIBS) - -$(BINRLS)$(DLL_NAME).$(VERSION): $(foreach SRC, $(basename $(EXTAPI_SRC)), $(OBJRLS)/$(SRC).o) $(CLASS_RELEASE_OBJECTS) - @echo " CCLD `basename $@`" - @$(MKDIR) `dirname $@` - @$(CXX) $(DLL_FLAGS) @LDSOFLAGS@ $(LDFLAGS) @RLS_LDFLAGS@ -o $@ $^ $(LIBS) $(LIB3270_LIBS) $(CLASS_LIBS) - -install: - @$(MKDIR) $(DESTDIR)$(libdir)/$(PACKAGE_NAME)-plugins - @$(INSTALL_PROGRAM) $(BINRLS)/$(PLUGIN_NAME) $(DESTDIR)$(libdir)/$(PACKAGE_NAME)-plugins - - @$(MKDIR) $(DESTDIR)$(REXXLIBDIR) - @$(INSTALL_PROGRAM) $(BINRLS)$(DLL_NAME).$(VERSION) $(DESTDIR)$(REXXLIBDIR) - @$(LN_S) @DLLPREFIX@$(MODULE_NAME)@DLLEXT@.$(VERSION) $(DESTDIR)$(REXXLIBDIR)/@DLLPREFIX@$(MODULE_NAME)@DLLEXT@ - - @$(MKDIR) $(DESTDIR)$(REXX_HOME) - @$(INSTALL_DATA) rx3270.cls $(DESTDIR)$(REXX_HOME) - diff --git a/src/plugins/rx3270/pluginmain.cc b/src/plugins/rx3270/pluginmain.cc deleted file mode 100644 index 0643228..0000000 --- a/src/plugins/rx3270/pluginmain.cc +++ /dev/null @@ -1,419 +0,0 @@ -/* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como pluginmain.c e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - * Referencias: - * - * * http://www.oorexx.org/docs/rexxpg/x14097.htm - * * http://www.oorexx.org/docs/rexxpg/c2539.htm - * - */ - - #define ENABLE_NLS - #define GETTEXT_PACKAGE PACKAGE_NAME - - #include "rx3270.h" - - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - -/*--[ Globals ]--------------------------------------------------------------------------------------*/ - -#if GTK_CHECK_VERSION(2,32,0) - static GMutex mutex; -#else - static GStaticMutex mutex = G_STATIC_MUTEX_INIT; -#endif // GTK_CHECK_VERSION - - static gchar * script_name = NULL; - -/*--[ Rexx application data block ]--------------------------------------------------------------------------*/ - - struct rexx_application_data - { - GtkAction * action; - GtkWidget * widget; - GtkWidget * trace; - const gchar * filename; - }; - -/*--[ Plugin session object ]--------------------------------------------------------------------------------*/ - - using namespace std; - using namespace PW3270_NAMESPACE; - - -/*--[ Running rexx scripts ]---------------------------------------------------------------------------------*/ - - static void trace_cleanup(GtkWidget *widget, gpointer dunno) - { - rexx_application_data *data = (rexx_application_data *) g_object_get_data(G_OBJECT(widget),"rexx_app_data"); - - trace("%s: data=%p",__FUNCTION__,data); - - if(data) - data->trace = NULL; - - } - - static GtkWidget * get_trace_window(rexx_application_data *data) - { - if(data->trace) - return data->trace; - - data->trace = pw3270_trace_new(); - g_signal_connect(G_OBJECT(data->trace), "destroy",G_CALLBACK(trace_cleanup), NULL); - - pw3270_trace_set_destroy_on_close(data->trace,TRUE); - - g_object_set_data(G_OBJECT(data->trace),"rexx_app_data",data); - - gtk_window_set_title(GTK_WINDOW(data->trace),_("Rexx trace")); - - gtk_window_set_transient_for(GTK_WINDOW(data->trace),GTK_WINDOW(gtk_widget_get_toplevel(data->widget))); - gtk_window_set_destroy_with_parent(GTK_WINDOW(data->trace),TRUE); - - - gtk_window_set_default_size(GTK_WINDOW(data->trace),590,430); - gtk_widget_show_all(data->trace); - return data->trace; - } - - static void read_line(struct rexx_application_data *data, PRXSTRING Retstr) - { - gchar *value = pw3270_trace_get_command(get_trace_window(data)); - - if(value) - { - if(strlen(value) > (RXAUTOBUFLEN-1)) - { - Retstr->strptr = (char *) RexxAllocateMemory(strlen(value)+1); - strcpy(Retstr->strptr,value); - } - else - { - g_snprintf(Retstr->strptr,RXAUTOBUFLEN-1,"%s",value); - } - g_free(value); - } - else - { - *Retstr->strptr = 0; - } - - Retstr->strlength = strlen(Retstr->strptr); - - } - - static int REXXENTRY Rexx_IO_exit(RexxExitContext *context, int exitnumber, int subfunction, PEXIT parmBlock) - { -// trace("%s call with ExitNumber: %d Subfunction: %d",__FUNCTION__,(int) exitnumber, (int) subfunction); - - switch(subfunction) - { - case RXSIOSAY: // SAY a line to STDOUT - { - struct rexx_application_data *data = (struct rexx_application_data *) context->GetApplicationData(); - - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(data->widget)), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK_CANCEL, - "%s", (((RXSIOSAY_PARM *) parmBlock)->rxsio_string).strptr ); - - gtk_window_set_title(GTK_WINDOW(dialog), _( "Script message" ) ); - - if(data->trace) - pw3270_trace_printf(data->trace,"%s\n",(((RXSIOSAY_PARM *) parmBlock)->rxsio_string).strptr); - - if(gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_CANCEL) - context->RaiseException0(Rexx_Error_Program_interrupted); - - gtk_widget_destroy(dialog); - } - break; - - case RXSIOTRC: // Trace output - { - struct rexx_application_data *data = (struct rexx_application_data *) context->GetApplicationData(); - lib3270_write_log(NULL, "rx3270", "%s", (((RXSIOTRC_PARM *) parmBlock)->rxsio_string).strptr); - pw3270_trace_printf(get_trace_window(data),"%s\n",(((RXSIOTRC_PARM *) parmBlock)->rxsio_string).strptr); - } - break; - - case RXSIOTRD: // Read from char stream - read_line((struct rexx_application_data *) context->GetApplicationData(), & (((RXSIODTR_PARM *) parmBlock)->rxsiodtr_retc) ); - break; - - case RXSIODTR: // DEBUG read from char stream - read_line((struct rexx_application_data *) context->GetApplicationData(), & (((RXSIODTR_PARM *) parmBlock)->rxsiodtr_retc) ); - break; - - default: - return RXEXIT_NOT_HANDLED; - - } - - return RXEXIT_HANDLED; - } - - static void call_rexx_script(GtkAction *action, GtkWidget *widget, const gchar *filename) - { - const gchar * args = (const gchar *) g_object_get_data(G_OBJECT(action),"args"); - - struct rexx_application_data appdata; - - RexxInstance * instance; - RexxThreadContext * threadContext; - RexxOption options[25]; - RexxContextExit exits[2]; - - memset(&appdata,0,sizeof(appdata)); - appdata.action = action; - appdata.widget = widget; - appdata.filename = filename; - - memset(options,0,sizeof(options)); - memset(exits,0,sizeof(exits)); - - exits[0].sysexit_code = RXSIO; - exits[0].handler = Rexx_IO_exit; - - // http://www.oorexx.org/docs/rexxpg/c2539.htm - - options[0].optionName = DIRECT_EXITS; - options[0].option = (void *) exits; - - options[1].optionName = APPLICATION_DATA; - options[1].option = (void *) &appdata; - - rx3270_set_package_option(&options[2]); - - options[3].optionName = EXTERNAL_CALL_PATH; - options[3].option = pw3270_get_datadir(NULL); - - trace("Rexxdir: \"%s\"",(gchar *) ((void *) options[3].option)); - - if(!RexxCreateInterpreter(&instance, &threadContext, options)) - { - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CANCEL, - _( "Can't start %s script" ), "rexx" ); - - gtk_window_set_title(GTK_WINDOW(dialog),_( "Rexx error" )); - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),_( "Can't create %s interpreter instance" ), "rexx"); - - gtk_dialog_run(GTK_DIALOG (dialog)); - gtk_widget_destroy(dialog); - } - else - { - RexxArrayObject rxArgs; - - trace("%s %s(%s)",__FUNCTION__,filename,args); - - if(args) - { - gchar **arg = g_strsplit(args,",",-1); - size_t sz = g_strv_length(arg); - - rxArgs = threadContext->NewArray(sz); - for(unsigned int i = 0; iArrayPut(rxArgs, threadContext->String(arg[i]), i + 1); - - g_strfreev(arg); - } - else - { - rxArgs = threadContext->NewArray(1); - threadContext->ArrayPut(rxArgs, threadContext->String(""),1); - } - - v3270_set_script(widget,'R',TRUE); - script_name = g_path_get_basename(filename); - trace("%s: Calling",filename); - RexxObjectPtr result = threadContext->CallProgram(filename, rxArgs); - trace("%s: Returns",filename); - g_free(script_name); - script_name = NULL; - v3270_set_script(widget,'R',FALSE); - - if (threadContext->CheckCondition()) - { - RexxCondition condition; - - // retrieve the error information and get it into a decoded form - RexxDirectoryObject cond = threadContext->GetConditionInfo(); - threadContext->DecodeConditionInfo(cond, &condition); - // display the errors - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CANCEL, - _( "%s script failed" ), "Rexx" ); - - gtk_window_set_title(GTK_WINDOW(dialog),_( "Rexx error" )); - - gtk_message_dialog_format_secondary_text( - GTK_MESSAGE_DIALOG(dialog), - _( "%s error %d: %s\n%s" ), - "Rexx", - (int) condition.code, - threadContext->CString(condition.errortext), - threadContext->CString(condition.message) - - ); - - gtk_dialog_run(GTK_DIALOG (dialog)); - gtk_widget_destroy(dialog); - - } - else if (result != NULLOBJECT) - { - CSTRING resultString = threadContext->CString(result); - lib3270_write_log(NULL,"REXX","%s exits with rc=%s",filename,resultString); - } - - instance->Terminate(); - - if(appdata.trace) - { - pw3270_trace_printf(appdata.trace,"%s","** Rexx script ends\n"); - g_object_set_data(G_OBJECT(appdata.trace),"rexx_app_data",NULL); - } - - trace("%s ends",__FUNCTION__); - } - - g_free(options[3].option); - - } - - -extern "C" -{ - LIB3270_EXPORT void pw3270_action_rexx_activated(GtkAction *action, GtkWidget *widget) - { - - gchar *filename = (gchar *) g_object_get_data(G_OBJECT(action),"src"); - - lib3270_trace_event(v3270_get_session(widget),"Action %s activated on widget %p",gtk_action_get_name(action),widget); - -#if GTK_CHECK_VERSION(2,32,0) - if(!g_mutex_trylock(&mutex)) -#else - if(!g_static_mutex_trylock(&mutex)) -#endif // GTK_CHECK_VERSION - { - GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(gtk_widget_get_toplevel(widget)), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CANCEL, - "%s", _( "Can't start script" )); - - gtk_window_set_title(GTK_WINDOW(dialog),_( "System busy" )); - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",_( "Please, try again in a few moments" )); - - gtk_dialog_run(GTK_DIALOG (dialog)); - gtk_widget_destroy(dialog); - return; - } - - pw3270_set_action_state(action,FALSE); - - if(filename && *filename) - { - // Has filename, call it directly - call_rexx_script(action,widget,filename); - } - else - { - - filename = pw3270_file_chooser(GTK_FILE_CHOOSER_ACTION_OPEN, "rexx", _( "Select script to run" ), NULL, "rex"); - - if(filename) - { - if(*filename) - { - call_rexx_script(action,widget,filename); - } - g_free(filename); - } - - - } - - pw3270_set_action_state(action,TRUE); - -#if GTK_CHECK_VERSION(2,32,0) - g_mutex_unlock(&mutex); -#else - g_static_mutex_unlock(&mutex); -#endif // GTK_CHECK_VERSION - - } - -} - -/*--[ Implement ]------------------------------------------------------------------------------------*/ - - - LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) - { - trace("%s",__FUNCTION__); -#if GTK_CHECK_VERSION(2,32,0) - g_mutex_init(&mutex); -#endif // GTK_CHECK_VERSION - - rx3270_set_session(lib3270_get_default_session_handle()); - - return 0; - } - - LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) - { -#if GTK_CHECK_VERSION(2,32,0) - g_mutex_clear(&mutex); -#endif // GTK_CHECK_VERSION - trace("%s",__FUNCTION__); - return 0; - } - diff --git a/src/plugins/rx3270/rexx_methods.cc b/src/plugins/rx3270/rexx_methods.cc deleted file mode 100644 index c0003dc..0000000 --- a/src/plugins/rx3270/rexx_methods.cc +++ /dev/null @@ -1,647 +0,0 @@ -/* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como rexx_methods.cc e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - * - * Referencias: - * - * * http://www.oorexx.org/docs/rexxpg/x2950.htm - * - */ - - #include "rx3270.h" - #include - #include - #include - #include - #include - - using namespace std; - using namespace PW3270_NAMESPACE; - -/*--[ Implement ]------------------------------------------------------------------------------------*/ - -RexxMethod1(int, rx3270_method_init, OPTIONAL_CSTRING, type) -{ - // Set session class in rexx object - try - { - if(!(type && *type)) - type = ""; - RexxPointerObject sessionPtr = context->NewPointer(session::create(type)); - context->SetObjectVariable("CSELF", sessionPtr); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return 0; -} - -RexxMethod1(int, rx3270_method_uninit, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - - trace("rx3270_method_uninit hSession=%p",hSession); - - if(hSession) - delete hSession; - - trace("%s","rx3270_method_uninit"); - return 0; -} - -RexxMethod1(RexxStringObject, rx3270_method_version, CSELF, sessionPtr) -{ - session * hSession = (session *) sessionPtr; - - if(hSession) - return context->String((CSTRING) hSession->get_version().c_str()); - - return context->String((CSTRING) PACKAGE_VERSION); -} - -RexxMethod1(RexxStringObject, rx3270_method_revision, CSELF, sessionPtr) -{ - session * hSession = (session *) sessionPtr; - - if(hSession) - return context->String((CSTRING) hSession->get_revision().c_str()); - - return context->String((CSTRING) PACKAGE_REVISION); -} - -RexxMethod3(int, rx3270_method_connect, CSELF, sessionPtr, CSTRING, uri, OPTIONAL_int, wait) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - - return hSession->connect(uri,wait != 0); -} - -RexxMethod1(int, rx3270_method_disconnect, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->disconnect(); -} - -RexxMethod2(int, rx3270_method_sleep, CSELF, sessionPtr, int, seconds) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->wait(seconds); -} - -RexxMethod1(logical_t, rx3270_method_is_connected, CSELF, sessionPtr) -{ - try - { - session *hSession = (session *) sessionPtr; - if(!hSession) - return false; - return hSession->is_connected(); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return 0; -} - -RexxMethod1(logical_t, rx3270_method_is_ready, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return false; - return hSession->is_ready(); -} - -RexxMethod2(int, rx3270_method_wait_for_ready, CSELF, sessionPtr, OPTIONAL_int, seconds) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->wait_for_ready(seconds > 0 ? seconds : 60); -} - -RexxMethod3(int, rx3270_method_set_cursor, CSELF, sessionPtr, int, row, int, col) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->set_cursor_position(row,col); -} - -RexxMethod1(int, rx3270_method_get_cursor_addr, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->get_cursor_addr(); -} - -RexxMethod2(int, rx3270_method_set_cursor_addr, CSELF, sessionPtr, int, addr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->set_cursor_addr(addr); -} - -RexxMethod1(int, rx3270_method_enter, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->enter(); -} - -RexxMethod1(int, rx3270_method_erase, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->erase(); -} - -RexxMethod1(int, rx3270_method_erase_eof, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->erase_eof(); -} - -RexxMethod1(int, rx3270_method_erase_eol, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->erase_eol(); -} - -RexxMethod1(int, rx3270_method_erase_input, CSELF, sessionPtr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->erase_input(); -} - - -RexxMethod2(int, rx3270_method_pfkey, CSELF, sessionPtr, int, key) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->pfkey(key); -} - -RexxMethod2(int, rx3270_method_pakey, CSELF, sessionPtr, int, key) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->pakey(key); -} - -RexxMethod4(RexxStringObject, rx3270_method_get_text_at, CSELF, sessionPtr, int, row, int, col, int, sz) -{ - - try - { - session * hSession = (session *) sessionPtr; - string str = hSession->get_string_at(row,col,sz); - return context->String((CSTRING) str.c_str()); - - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return context->String(""); -} - - -RexxMethod4(int, rx3270_method_set_text_at, CSELF, sessionPtr, int, row, int, col, CSTRING, text) -{ - try - { - session * hSession = (session *) sessionPtr; - return hSession->set_string_at(row,col,text); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return -1; -} - -RexxMethod2(int, rx3270_method_input_text, CSELF, sessionPtr, CSTRING, text) -{ - try - { - session * hSession = (session *) sessionPtr; - return hSession->input_string(text); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return -1; - -} - -RexxMethod4(int, rx3270_method_cmp_text_at, CSELF, sessionPtr, int, row, int, col, CSTRING, key) -{ - try - { - session * hSession = (session *) sessionPtr; - return hSession->cmp_string_at(row,col,key); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - return -1; -} - -RexxMethod2(int, rx3270_method_event_trace, CSELF, sessionPtr, int, flag) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - hSession->set_toggle(LIB3270_TOGGLE_EVENT_TRACE,flag); - return 0; -} - -RexxMethod2(int, rx3270_method_screen_trace, CSELF, sessionPtr, int, flag) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - hSession->set_toggle(LIB3270_TOGGLE_SCREEN_TRACE,flag); - return 0; - -} - -RexxMethod2(int, rx3270_method_ds_trace, CSELF, sessionPtr, int, flag) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - hSession->set_toggle(LIB3270_TOGGLE_DS_TRACE,flag); - return 0; -} - -RexxMethod3(int, rx3270_method_set_option, CSELF, sessionPtr, CSTRING, name, int, flag) -{ - static const struct _toggle_info - { - const char * name; - LIB3270_TOGGLE id; - } - toggle[LIB3270_TOGGLE_COUNT] = - { - { "monocase", LIB3270_TOGGLE_MONOCASE }, - { "cursorblink", LIB3270_TOGGLE_CURSOR_BLINK }, - { "showtiming", LIB3270_TOGGLE_SHOW_TIMING }, - { "cursorpos", LIB3270_TOGGLE_CURSOR_POS }, - { "dstrace", LIB3270_TOGGLE_DS_TRACE }, - { "linewrap", LIB3270_TOGGLE_LINE_WRAP }, - { "blankfill", LIB3270_TOGGLE_BLANK_FILL }, - { "screentrace", LIB3270_TOGGLE_SCREEN_TRACE }, - { "eventtrace", LIB3270_TOGGLE_EVENT_TRACE }, - { "marginedpaste", LIB3270_TOGGLE_MARGINED_PASTE }, - { "rectselect", LIB3270_TOGGLE_RECTANGLE_SELECT }, - { "crosshair", LIB3270_TOGGLE_CROSSHAIR }, - { "fullscreen", LIB3270_TOGGLE_FULL_SCREEN }, - { "reconnect", LIB3270_TOGGLE_RECONNECT }, - { "insert", LIB3270_TOGGLE_INSERT }, - { "smartpaste", LIB3270_TOGGLE_SMART_PASTE }, - { "bold", LIB3270_TOGGLE_BOLD }, - { "keepselected", LIB3270_TOGGLE_KEEP_SELECTED }, - { "underline", LIB3270_TOGGLE_UNDERLINE }, - { "autoconnect", LIB3270_TOGGLE_CONNECT_ON_STARTUP }, - { "kpalternative", LIB3270_TOGGLE_KP_ALTERNATIVE }, - { "beep", LIB3270_TOGGLE_BEEP }, - { "fieldattr", LIB3270_TOGGLE_VIEW_FIELD }, - { "altscreen", LIB3270_TOGGLE_ALTSCREEN }, - { "keepalive", LIB3270_TOGGLE_KEEP_ALIVE }, - }; - - session *hSession = (session *) sessionPtr; - if(hSession) - { - for(int f = 0; f < LIB3270_TOGGLE_COUNT; f++) - { - if(!strcasecmp(name,toggle[f].name)) - { - hSession->set_toggle(toggle[f].id,flag); - return 0; - } - } - return ENOENT; - } - return -1; -} - - -RexxMethod4(logical_t, rx3270_method_test, CSELF, sessionPtr, CSTRING, key, int, row, int, col) -{ - try - { - session * hSession = (session *) sessionPtr; - - if(!hSession->is_ready()) - hSession->iterate(false); - - if(hSession->is_ready()) - { - string str = hSession->get_string_at(row,col,strlen(key)); - return (strcasecmp(str.c_str(),key) == 0); - } - - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return false; -} - -RexxMethod5(int, rx3270_method_wait_for_text_at, CSELF, sessionPtr, int, row, int, col, CSTRING, key, int, timeout) -{ - try - { - session * hSession = (session *) sessionPtr; - return hSession->wait_for_string_at(row,col,key,timeout); - - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return -1; -} - -RexxMethod3(RexxStringObject, rx3270_method_get_text, CSELF, sessionPtr, OPTIONAL_int, baddr, OPTIONAL_int, sz) -{ - try - { - session * hSession = (session *) sessionPtr; - string str = hSession->get_string(baddr,sz > 0 ? sz : -1); - return context->String((CSTRING) str.c_str()); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return context->String(""); -} - - -RexxMethod2(int, rx3270_method_get_field_len, CSELF, sessionPtr, OPTIONAL_int, baddr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->get_field_len(baddr); -} - -RexxMethod2(int, rx3270_method_get_field_start, CSELF, sessionPtr, OPTIONAL_int, baddr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - return hSession->get_field_start(baddr)+1; -} - -RexxMethod2(int, rx3270_method_get_next_unprotected, CSELF, sessionPtr, OPTIONAL_int, baddr) -{ - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - - baddr = hSession->get_next_unprotected(baddr); - if(baddr < 1) - return -1; - - return baddr; -} - -RexxMethod2(int, rx3270_method_get_is_protected, CSELF, sessionPtr, OPTIONAL_int, baddr) -{ - - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - - return hSession->get_is_protected(baddr); -} - -RexxMethod3(int, rx3270_method_get_is_protected_at, CSELF, sessionPtr, int, row, int, col) -{ - - session *hSession = (session *) sessionPtr; - if(!hSession) - return -1; - - return hSession->get_is_protected_at(row,col); -} - - -RexxMethod1(RexxStringObject, rx3270_method_get_selection, CSELF, sessionPtr) -{ - try - { - string str = ((session *) sessionPtr)->get_copy(); - return context->String((CSTRING) str.c_str()); - - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return context->String(""); -} - -RexxMethod2(int, rx3270_method_set_selection, CSELF, sessionPtr, CSTRING, text) -{ - try - { - return ((session *) sessionPtr)->set_copy(text); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return -1; -} - -RexxMethod1(RexxStringObject, rx3270_method_get_clipboard, CSELF, sessionPtr) -{ - session * hSession = (session *) sessionPtr; - - if(hSession) - { - string str = hSession->get_clipboard(); - return context->String((CSTRING) str.c_str()); - } - - trace("%s","rx3270_method_get_clipboard: Clipboard is empty"); - return context->String(""); -} - -RexxMethod2(int, rx3270_method_set_clipboard, CSELF, sessionPtr, CSTRING, text) -{ - return ((session *) sessionPtr)->set_clipboard(text); -} - -RexxMethod5(int, rx3270_method_popup, CSELF, sessionPtr, CSTRING, s_id, CSTRING, title, CSTRING, message, OPTIONAL_CSTRING, det) -{ - LIB3270_NOTIFY id = LIB3270_NOTIFY_INFO; - session * hSession = (session *) sessionPtr; - - if(!hSession) - return -1; - - if(*s_id) - { - static const struct _descr - { - char str; - LIB3270_NOTIFY id; - } descr[] = - { - { 'I', LIB3270_NOTIFY_INFO }, - { 'W', LIB3270_NOTIFY_WARNING }, - { 'E', LIB3270_NOTIFY_ERROR }, - { 'C', LIB3270_NOTIFY_CRITICAL }, - }; - - for(int f=0;f<4;f++) - { - if(toupper(*s_id) == descr[f].str) - { - id = descr[f].id; - trace("Using mode %c (%d)",toupper(*s_id),(int) id); - } - } - } - - return hSession->popup_dialog(id, title, message, "%s", det ? det : ""); -} - -RexxMethod5(RexxStringObject, rx3270_method_get_filename, CSELF, sessionPtr, CSTRING, action_name, CSTRING, title, OPTIONAL_CSTRING, extension, OPTIONAL_CSTRING, filename) -{ - static const struct _action - { - const gchar * action_name; - GtkFileChooserAction id; - } action[] = - { - { "open", GTK_FILE_CHOOSER_ACTION_OPEN }, - { "save", GTK_FILE_CHOOSER_ACTION_SAVE }, - { "folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER }, - { "select_folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER }, - { "create_folder", GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER } - }; - - GtkFileChooserAction id = GTK_FILE_CHOOSER_ACTION_OPEN; - string ret; - - for(int f=0;f<5;f++) - { - if(!strcasecmp(action_name,action[f].action_name)) - { - id = action[f].id; - break; - } - } - - debug("%s(%s)","rx3270_method_get_filename",action_name); - ret = ((session *) sessionPtr)->file_chooser_dialog(id, title, extension,filename); - debug("%s(%s)","rx3270_method_get_filename",action_name); - - return context->String(ret.c_str()); -} - -RexxMethod2(int, rx3270_method_set_host_charset, CSELF, sessionPtr, CSTRING, text) -{ - return ((session *) sessionPtr)->set_host_charset(text); -} - -RexxMethod1(RexxStringObject, rx3270_method_get_host_charset, CSELF, sessionPtr) -{ - string ret = ((session *) sessionPtr)->get_host_charset(); - return context->String(ret.c_str()); -} - -RexxMethod1(RexxStringObject, rx3270_method_get_display_charset, CSELF, sessionPtr) -{ - string ret = ((session *) sessionPtr)->get_display_charset(); - return context->String(ret.c_str()); -} - -RexxMethod2(int, rx3270_method_set_display_charset, CSELF, sessionPtr, CSTRING, text) -{ - ((session *) sessionPtr)->set_display_charset(NULL,text); - return 0; -} - -RexxMethod2(int, rx3270_method_set_unlock_delay, CSELF, sessionPtr, int, delay) -{ - session *hSession = (session *) sessionPtr; - - if(!hSession) - return -1; - - try - { - hSession->set_unlock_delay((unsigned short) delay); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return 0; -} diff --git a/src/plugins/rx3270/rx3270.cc b/src/plugins/rx3270/rx3270.cc deleted file mode 100644 index d884ec5..0000000 --- a/src/plugins/rx3270/rx3270.cc +++ /dev/null @@ -1,218 +0,0 @@ -/* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como rx3270.cc e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - */ - - /* - * - * Reference: - * - * http://www.oorexx.org/docs/rexxpg/x2950.htm - * - */ - - #include "rx3270.h" - #include - #include - -#ifdef HAVE_SYSLOG - #include -#endif // HAVE_SYSLOG - - #include - #include - - static rx3270 * factory_default(const char *type); - -/*--[ Globals ]--------------------------------------------------------------------------------------*/ - - static rx3270 * defSession = NULL; - static rx3270 * (*factory)(const char *type) = factory_default; - -/*--[ Implement ]------------------------------------------------------------------------------------*/ - -rx3270::rx3270(const char *local, const char *remote) -{ -#ifdef HAVE_ICONV - - if(strcmp(local,remote)) - { - // Local and remote charsets aren't the same, setup conversion - this->conv2Local = iconv_open(local, remote); - this->conv2Host = iconv_open(remote,local); - } - else - { - this->conv2Local = this->conv2Host = (iconv_t)(-1); - } -#endif - - if(!defSession) - defSession = this; -} - -rx3270::~rx3270() -{ -#ifdef HAVE_ICONV - - if(conv2Local != (iconv_t) (-1)) - iconv_close(conv2Local); - - if(conv2Host != (iconv_t) (-1)) - iconv_close(conv2Host); -#endif - - - if(defSession == this) - defSession = NULL; - - trace("%s",__FUNCTION__); -} - -static rx3270 * factory_default(const char *type) -{ - trace("%s",__FUNCTION__); - if(type && *type) - return rx3270::create_remote(type); - return rx3270::create_local(); -} - -rx3270 * rx3270::create(const char *type) -{ - return factory(type); -} - -char * rx3270::get_version(void) -{ - return strdup(PACKAGE_VERSION); -} - -char * rx3270::get_revision(void) -{ - return strdup(PACKAGE_REVISION); -} - -rx3270 * rx3270::get_default() -{ - if(defSession) - return defSession; - return create_local(); -} - -void rx3270::log(const char *fmt, ...) -{ - va_list arg_ptr; - va_start(arg_ptr, fmt); - this->logva(fmt,arg_ptr); - va_end(arg_ptr); -} - -void rx3270::logva(const char *fmt, va_list args) -{ -#ifdef HAVE_SYSLOG - openlog(PACKAGE_NAME, LOG_NDELAY, LOG_USER); - vsyslog(LOG_INFO,fmt,args); - closelog(); -#else - vfprintf(stderr,fmt,args); -#endif -} - -int rx3270::wait_for_text_at(int row, int col, const char *key, int timeout) -{ - time_t end = time(0)+timeout; - - while(time(0) < end) - { - if(!is_connected()) - return ENOTCONN; - - if(!cmp_text_at(row,col,key)) - return 0; - - iterate(); - } - - return ETIMEDOUT; -} - -void rx3270::set_plugin(rx3270 * (*ptr)(const char *name)) -{ - trace("%s factory=%p",__FUNCTION__,ptr); - - if(ptr) - factory = ptr; - else - factory = factory_default; - -} - -int rx3270::set_copy(const char *text) -{ - return EINVAL; -} - -char * rx3270::get_copy(void) -{ - errno = EINVAL; - return NULL; -} - -char * rx3270::get_clipboard(void) -{ - errno = EINVAL; - return NULL; -} - -int rx3270::set_clipboard(const char *text) -{ - return EINVAL; -} - -extern "C" -{ - static void memfree(void *ptr) - { - free(ptr); - } -} - -void rx3270::free(void *ptr) -{ - memfree(ptr); -} - -int rx3270::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...) -{ - return -1; -} - -char * rx3270::file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename) -{ - return NULL; -} - diff --git a/src/plugins/rx3270/rx3270.cls b/src/plugins/rx3270/rx3270.cls deleted file mode 100644 index 014d26f..0000000 --- a/src/plugins/rx3270/rx3270.cls +++ /dev/null @@ -1,148 +0,0 @@ -/*-- REXX -----------------------------------------------------------------------*/ -/* */ -/* "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 */ -/* (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a */ -/* aplicativos mainframe. Registro no INPI sob o nome G3270. */ -/* */ -/* Copyright (C) <2008> */ -/* */ -/* Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob */ -/* os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela */ -/* Free Software Foundation. */ -/* */ -/* Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER */ -/* GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO */ -/* A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para */ -/* obter mais detalhes. */ -/* */ -/* Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este */ -/* programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple */ -/* Place, Suite 330, Boston, MA, 02111-1307, USA */ -/* */ -/* Contatos: */ -/* */ -/* perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) */ -/* erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) */ -/* licinio@bb.com.br (Licínio Luis Branco) */ -/* */ -/*-------------------------------------------------------------------------------*/ - -::requires "rx3270" LIBRARY - -/*-------------------------------------------------------------------------------*/ -/* 3270 class */ -/*-------------------------------------------------------------------------------*/ - -::class rx3270 public subclass object - -::METHOD INIT EXTERNAL "LIBRARY rx3270 rx3270_method_init" -::METHOD UNINIT EXTERNAL "LIBRARY rx3270 rx3270_method_uninit" - -::METHOD VERSION EXTERNAL "LIBRARY rx3270 rx3270_method_version" -::METHOD REVISION EXTERNAL "LIBRARY rx3270 rx3270_method_revision" - -::METHOD CONNECT EXTERNAL "LIBRARY rx3270 rx3270_method_connect" -::METHOD DISCONNECT EXTERNAL "LIBRARY rx3270 rx3270_method_disconnect" - -::METHOD SLEEP EXTERNAL "LIBRARY rx3270 rx3270_method_sleep" - -::METHOD CONNECTED EXTERNAL "LIBRARY rx3270 rx3270_method_is_connected" -::METHOD READY EXTERNAL "LIBRARY rx3270 rx3270_method_is_ready" - -::METHOD WAITFORREADY EXTERNAL "LIBRARY rx3270 rx3270_method_wait_for_ready" - -::METHOD SETCURSOR EXTERNAL "LIBRARY rx3270 rx3270_method_set_cursor" -::METHOD GETCURSORADDR EXTERNAL "LIBRARY rx3270 rx3270_method_get_cursor_addr" -::METHOD SETCURSORADDR EXTERNAL "LIBRARY rx3270 rx3270_method_set_cursor_addr" - -::METHOD ENTER EXTERNAL "LIBRARY rx3270 rx3270_method_enter" -::METHOD PFKEY EXTERNAL "LIBRARY rx3270 rx3270_method_pfkey" -::METHOD PAKEY EXTERNAL "LIBRARY rx3270 rx3270_method_pakey" - -::METHOD ERASE EXTERNAL "LIBRARY rx3270 rx3270_method_erase" -::METHOD ERASEEOF EXTERNAL "LIBRARY rx3270 rx3270_method_erase_eof" -::METHOD ERASEEOL EXTERNAL "LIBRARY rx3270 rx3270_method_erase_eol" -::METHOD ERASEINPUT EXTERNAL "LIBRARY rx3270 rx3270_method_erase_input" - -::METHOD OPTION EXTERNAL "LIBRARY rx3270 rx3270_method_set_option" -::METHOD EVENTTRACE EXTERNAL "LIBRARY rx3270 rx3270_method_event_trace" -::METHOD SCREENTRACE EXTERNAL "LIBRARY rx3270 rx3270_method_screen_trace" -::METHOD DSTRACE EXTERNAL "LIBRARY rx3270 rx3270_method_ds_trace" - -::METHOD GETTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_get_text_at" -::METHOD SETTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_set_text_at" -::METHOD CMPTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_cmp_text_at" - -::METHOD GET EXTERNAL "LIBRARY rx3270 rx3270_method_get_text" -::METHOD INPUT EXTERNAL "LIBRARY rx3270 rx3270_method_input_text" - -::METHOD WAITFORTEXTAT EXTERNAL "LIBRARY rx3270 rx3270_method_wait_for_text_at" -::METHOD TEST EXTERNAL "LIBRARY rx3270 rx3270_method_test" - -::METHOD GETFIELDSTART EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_start" -::METHOD GETFIELDLEN EXTERNAL "LIBRARY rx3270 rx3270_method_get_field_len" -::METHOD GETNEXTUNPROTECTED EXTERNAL "LIBRARY rx3270 rx3270_method_get_next_unprotected" -::METHOD GETISPROTECTED EXTERNAL "LIBRARY rx3270 rx3270_method_get_is_protected" -::METHOD GETISPROTECTEDAT EXTERNAL "LIBRARY rx3270 rx3270_method_get_is_protected_at" - -::METHOD GETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_get_selection" -::METHOD SETSELECTION EXTERNAL "LIBRARY rx3270 rx3270_method_set_selection" - -::METHOD GETCLIPBOARD EXTERNAL "LIBRARY rx3270 rx3270_method_get_clipboard" -::METHOD SETCLIPBOARD EXTERNAL "LIBRARY rx3270 rx3270_method_set_clipboard" - -::METHOD POPUP EXTERNAL "LIBRARY rx3270 rx3270_method_popup" -::METHOD GETFILENAME EXTERNAL "LIBRARY rx3270 rx3270_method_get_filename" - -::METHOD GETDISPLAYCHARSET EXTERNAL "LIBRARY rx3270 rx3270_method_get_display_charset" -::METHOD SETDISPLAYCHARSET EXTERNAL "LIBRARY rx3270 rx3270_method_set_display_charset" - -::METHOD GETHOSTCHARSET EXTERNAL "LIBRARY rx3270 rx3270_method_get_host_charset" -::METHOD SETHOSTCHARSET EXTERNAL "LIBRARY rx3270 rx3270_method_set_host_charset" - -::METHOD SETUNLOCKDELAY EXTERNAL "LIBRARY rx3270 rx3270_method_set_unlock_delay" - -::method waitForStringAt - use arg row, col, key, timeout - if datatype(timeout) <> "NUM" - then timeout = 60 -return self~WaitForTextAt(row,col,key,timeout) - -::method getScreenContent -return self~get() - -::method queryStringAt - use arg row, col, key -return self~GetTextAt(row,col,length(key)) == key - -::method waitForTerminalReady - use arg timeout -return self~WaitForReady(timeout) - -::method isTerminalReady -return self~ready() - -::method setStringAt - use arg row, col, str -return self~SetTextAt(row,col,str) - -::method getStringAt - use arg row, col, size -return self~GetTextAt(row,col,size) - -::method sendEnterKey -return self~enter() - -::method sendPFKey - use arg key -return self~pfKey(key) - -::method setCursorPosition - use arg row, col -return self~SetCursor(row,col) - -::method getScreenContentAt - use arg row, col, size -return self~GetTextAt(row,col,size) - - diff --git a/src/plugins/rx3270/rx3270.h b/src/plugins/rx3270/rx3270.h deleted file mode 100644 index 5dbee4e..0000000 --- a/src/plugins/rx3270/rx3270.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como pluginmain.c e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - */ - -#ifndef RX3270_H_INCLUDED - - #define RX3270_H_INCLUDED 1 - - #include - #include - - #include - #include - #include - #include - #include - #include - #include - #include - -#ifndef ETIMEDOUT - #define ETIMEDOUT -1 -#endif // !ETIMEOUT - -#ifdef HAVE_ICONV - #include -#endif // HAVE_ICONV - -#ifdef WIN32 - #define REXX_DEFAULT_CHARSET "CP1252" - #define int8_t REXX_INT8_T - #define ssize_t REXX_SSIZE_T -#else - #define REXX_DEFAULT_CHARSET "UTF-8" -#endif // WIN32 - -#include - -/*---[ Rexx entry points ]-----------------------------------------------------------------------------------*/ - - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270version); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270QueryCState); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Disconnect); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Connect); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270isConnected); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270WaitForEvents); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Sleep); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SendENTERKey); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SendPFKey); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SendPAKey); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270WaitForTerminalReady); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270WaitForStringAt); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270GetStringAt); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsTerminalReady); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270queryStringAt); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetStringAt); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270CloseApplication); - REXX_TYPED_ROUTINE_PROTOTYPE(ebc2asc); - REXX_TYPED_ROUTINE_PROTOTYPE(asc2ebc); - - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270Erase); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270EraseEOF); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270EraseEOL); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270EraseInput); - - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsProtected); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsProtectedAt); - REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetUnlockDelay); - - REXX_METHOD_PROTOTYPE(rx3270_method_version); - REXX_METHOD_PROTOTYPE(rx3270_method_revision); - REXX_METHOD_PROTOTYPE(rx3270_method_init); - REXX_METHOD_PROTOTYPE(rx3270_method_uninit); - REXX_METHOD_PROTOTYPE(rx3270_method_connect); - REXX_METHOD_PROTOTYPE(rx3270_method_disconnect); - REXX_METHOD_PROTOTYPE(rx3270_method_sleep); - REXX_METHOD_PROTOTYPE(rx3270_method_is_connected); - REXX_METHOD_PROTOTYPE(rx3270_method_is_ready); - REXX_METHOD_PROTOTYPE(rx3270_method_wait_for_ready); - REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor); - REXX_METHOD_PROTOTYPE(rx3270_method_get_cursor_addr); - REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor_addr); - REXX_METHOD_PROTOTYPE(rx3270_method_enter); - REXX_METHOD_PROTOTYPE(rx3270_method_erase); - REXX_METHOD_PROTOTYPE(rx3270_method_erase_eof); - REXX_METHOD_PROTOTYPE(rx3270_method_erase_eol); - REXX_METHOD_PROTOTYPE(rx3270_method_erase_input); - REXX_METHOD_PROTOTYPE(rx3270_method_pfkey); - REXX_METHOD_PROTOTYPE(rx3270_method_pakey); - REXX_METHOD_PROTOTYPE(rx3270_method_get_text); - REXX_METHOD_PROTOTYPE(rx3270_method_get_text_at); - REXX_METHOD_PROTOTYPE(rx3270_method_set_text_at); - REXX_METHOD_PROTOTYPE(rx3270_method_cmp_text_at); - REXX_METHOD_PROTOTYPE(rx3270_method_event_trace); - REXX_METHOD_PROTOTYPE(rx3270_method_screen_trace); - REXX_METHOD_PROTOTYPE(rx3270_method_ds_trace); - REXX_METHOD_PROTOTYPE(rx3270_method_set_option); - REXX_METHOD_PROTOTYPE(rx3270_method_test); - REXX_METHOD_PROTOTYPE(rx3270_method_wait_for_text_at); - REXX_METHOD_PROTOTYPE(rx3270_method_get_field_len); - REXX_METHOD_PROTOTYPE(rx3270_method_get_field_start); - REXX_METHOD_PROTOTYPE(rx3270_method_get_next_unprotected); - REXX_METHOD_PROTOTYPE(rx3270_method_get_is_protected); - REXX_METHOD_PROTOTYPE(rx3270_method_get_is_protected_at); - REXX_METHOD_PROTOTYPE(rx3270_method_get_selection); - REXX_METHOD_PROTOTYPE(rx3270_method_set_selection); - REXX_METHOD_PROTOTYPE(rx3270_method_get_clipboard); - REXX_METHOD_PROTOTYPE(rx3270_method_set_clipboard); - REXX_METHOD_PROTOTYPE(rx3270_method_popup); - REXX_METHOD_PROTOTYPE(rx3270_method_get_filename); - REXX_METHOD_PROTOTYPE(rx3270_method_get_cursor_addr); - REXX_METHOD_PROTOTYPE(rx3270_method_set_cursor_addr); - REXX_METHOD_PROTOTYPE(rx3270_method_input_text); - REXX_METHOD_PROTOTYPE(rx3270_method_get_display_charset); - REXX_METHOD_PROTOTYPE(rx3270_method_set_display_charset); - REXX_METHOD_PROTOTYPE(rx3270_method_get_host_charset); - REXX_METHOD_PROTOTYPE(rx3270_method_set_host_charset); - REXX_METHOD_PROTOTYPE(rx3270_method_set_unlock_delay); - -/*---[ Globals ]---------------------------------------------------------------------------------------------*/ - -/*--[ 3270 Session ]-----------------------------------------------------------------------------------------*/ - -#ifdef __cplusplus - extern "C" { -#endif - - LIB3270_EXPORT void rx3270_set_package_option(RexxOption *option); - LIB3270_EXPORT void rx3270_set_session(H3270 *hSession); - -#ifdef __cplusplus - } -#endif - -#endif // RX3270_H_INCLUDED diff --git a/src/plugins/rx3270/rxapimain.cc b/src/plugins/rx3270/rxapimain.cc deleted file mode 100644 index 617d6ed..0000000 --- a/src/plugins/rx3270/rxapimain.cc +++ /dev/null @@ -1,208 +0,0 @@ -/* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como rxapimain.c e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - */ - - /* - * - * Reference: - * - * http://www.oorexx.org/docs/rexxpg/x2950.htm - * - */ - - #include "rx3270.h" - #include - #include - -#ifdef HAVE_SYSLOG - #include -#endif // HAVE_SYSLOG - - #include - -/*--[ Globals ]--------------------------------------------------------------------------------------*/ - - static H3270 * default_session = NULL; - -/*--[ Implement ]------------------------------------------------------------------------------------*/ - -static PW3270_NAMESPACE::session * factory(const char *name) -{ - if(!default_session) - return PW3270_NAMESPACE::session::create_local(); - - return PW3270_NAMESPACE::session::create_local(default_session); -} - -void rx3270_set_session(H3270 *session) -{ - default_session = session; - PW3270_NAMESPACE::session::set_plugin(factory); -} - -// now build the actual entry list -RexxRoutineEntry rx3270_functions[] = -{ - REXX_TYPED_ROUTINE(rx3270version, rx3270version), - REXX_TYPED_ROUTINE(rx3270QueryCState, rx3270QueryCState), - REXX_TYPED_ROUTINE(rx3270Disconnect, rx3270Disconnect), - REXX_TYPED_ROUTINE(rx3270Connect, rx3270Connect), - REXX_TYPED_ROUTINE(rx3270isConnected, rx3270isConnected), - REXX_TYPED_ROUTINE(rx3270WaitForEvents, rx3270WaitForEvents), - REXX_TYPED_ROUTINE(rx3270Sleep, rx3270Sleep), - REXX_TYPED_ROUTINE(rx3270SendENTERKey, rx3270SendENTERKey), - REXX_TYPED_ROUTINE(rx3270SendPFKey, rx3270SendPFKey), - REXX_TYPED_ROUTINE(rx3270SendPAKey, rx3270SendPAKey), - REXX_TYPED_ROUTINE(rx3270WaitForTerminalReady, rx3270WaitForTerminalReady), - REXX_TYPED_ROUTINE(rx3270WaitForStringAt, rx3270WaitForStringAt), - REXX_TYPED_ROUTINE(rx3270GetStringAt, rx3270GetStringAt), - REXX_TYPED_ROUTINE(rx3270IsTerminalReady, rx3270IsTerminalReady), - REXX_TYPED_ROUTINE(rx3270queryStringAt, rx3270queryStringAt), - REXX_TYPED_ROUTINE(rx3270SetStringAt, rx3270SetStringAt), - REXX_TYPED_ROUTINE(rx3270CloseApplication, rx3270CloseApplication), - - REXX_TYPED_ROUTINE(rx3270Erase, rx3270Erase), - REXX_TYPED_ROUTINE(rx3270EraseEOF, rx3270EraseEOF), - REXX_TYPED_ROUTINE(rx3270EraseEOL, rx3270EraseEOL), - REXX_TYPED_ROUTINE(rx3270EraseInput, rx3270EraseInput), - - REXX_TYPED_ROUTINE(rx3270IsProtected, rx3270IsProtected), - REXX_TYPED_ROUTINE(rx3270IsProtectedAt, rx3270IsProtectedAt), - REXX_TYPED_ROUTINE(rx3270SetUnlockDelay, rx3270SetUnlockDelay), - - REXX_TYPED_ROUTINE(ebc2asc, ebc2asc), - REXX_TYPED_ROUTINE(asc2ebc, asc2ebc), - - - // rx3270Popup - REXX_LAST_METHOD() -}; - -RexxMethodEntry rx3270_methods[] = -{ - REXX_METHOD(rx3270_method_version, rx3270_method_version ), - REXX_METHOD(rx3270_method_revision, rx3270_method_revision ), - REXX_METHOD(rx3270_method_init, rx3270_method_init ), - REXX_METHOD(rx3270_method_uninit, rx3270_method_uninit ), - REXX_METHOD(rx3270_method_connect, rx3270_method_connect ), - REXX_METHOD(rx3270_method_disconnect, rx3270_method_disconnect ), - REXX_METHOD(rx3270_method_sleep, rx3270_method_sleep ), - REXX_METHOD(rx3270_method_is_connected, rx3270_method_is_connected ), - REXX_METHOD(rx3270_method_is_ready, rx3270_method_is_ready ), - REXX_METHOD(rx3270_method_wait_for_ready, rx3270_method_wait_for_ready ), - REXX_METHOD(rx3270_method_set_cursor, rx3270_method_set_cursor ), - REXX_METHOD(rx3270_method_set_cursor, rx3270_method_get_cursor_addr ), - REXX_METHOD(rx3270_method_set_cursor, rx3270_method_set_cursor_addr ), - REXX_METHOD(rx3270_method_enter, rx3270_method_enter ), - REXX_METHOD(rx3270_method_enter, rx3270_method_erase ), - REXX_METHOD(rx3270_method_enter, rx3270_method_erase_eof ), - REXX_METHOD(rx3270_method_enter, rx3270_method_erase_eol ), - REXX_METHOD(rx3270_method_enter, rx3270_method_erase_input ), - REXX_METHOD(rx3270_method_pfkey, rx3270_method_pfkey ), - REXX_METHOD(rx3270_method_pakey, rx3270_method_pakey ), - REXX_METHOD(rx3270_method_get_text, rx3270_method_get_text ), - REXX_METHOD(rx3270_method_get_text_at, rx3270_method_get_text_at ), - REXX_METHOD(rx3270_method_set_text_at, rx3270_method_set_text_at ), - REXX_METHOD(rx3270_method_cmp_text_at, rx3270_method_cmp_text_at ), - REXX_METHOD(rx3270_method_event_trace, rx3270_method_event_trace ), - REXX_METHOD(rx3270_method_screen_trace, rx3270_method_screen_trace ), - REXX_METHOD(rx3270_method_ds_trace, rx3270_method_ds_trace ), - REXX_METHOD(rx3270_method_set_option, rx3270_method_set_option ), - REXX_METHOD(rx3270_method_test, rx3270_method_test ), - REXX_METHOD(rx3270_method_wait_for_text_at, rx3270_method_wait_for_text_at ), - - REXX_METHOD(rx3270_method_get_field_len, rx3270_method_get_field_len ), - REXX_METHOD(rx3270_method_get_field_start, rx3270_method_get_field_start ), - REXX_METHOD(rx3270_method_get_next_unprotected, rx3270_method_get_next_unprotected ), - - REXX_METHOD(rx3270_method_get_is_protected, rx3270_method_get_is_protected ), - REXX_METHOD(rx3270_method_get_is_protected_at, rx3270_method_get_is_protected_at ), - - REXX_METHOD(rx3270_method_get_selection, rx3270_method_get_selection ), - REXX_METHOD(rx3270_method_set_selection, rx3270_method_set_selection ), - REXX_METHOD(rx3270_method_get_clipboard, rx3270_method_get_clipboard ), - REXX_METHOD(rx3270_method_set_clipboard, rx3270_method_set_clipboard ), - - REXX_METHOD(rx3270_method_erase, rx3270_method_erase ), - REXX_METHOD(rx3270_method_erase_eof, rx3270_method_erase_eof ), - REXX_METHOD(rx3270_method_erase_eol, rx3270_method_erase_eol ), - REXX_METHOD(rx3270_method_erase_input, rx3270_method_erase_input ), - - REXX_METHOD(rx3270_method_popup, rx3270_method_popup ), - REXX_METHOD(rx3270_method_get_filename, rx3270_method_get_filename ), - - REXX_METHOD(rx3270_method_get_cursor_addr, rx3270_method_get_cursor_addr ), - REXX_METHOD(rx3270_method_set_cursor_addr, rx3270_method_set_cursor_addr ), - REXX_METHOD(rx3270_method_input_text, rx3270_method_input_text ), - - REXX_METHOD(rx3270_method_get_display_charset, rx3270_method_get_display_charset ), - REXX_METHOD(rx3270_method_set_display_charset, rx3270_method_set_display_charset ), - - REXX_METHOD(rx3270_method_get_host_charset, rx3270_method_get_host_charset ), - REXX_METHOD(rx3270_method_set_host_charset, rx3270_method_set_host_charset ), - - REXX_METHOD(rx3270_method_set_unlock_delay, rx3270_method_set_unlock_delay ), - - REXX_LAST_METHOD() -}; - -RexxPackageEntry rx3270_package_entry = -{ - STANDARD_PACKAGE_HEADER - REXX_CURRENT_INTERPRETER_VERSION, // anything after 4.0.0 will work - "rx3270", // name of the package - PACKAGE_VERSION, // package information - NULL, // no load/unload functions - NULL, - rx3270_functions, // the exported functions - rx3270_methods // no methods in rx3270. -}; - -// package loading stub. -/* -OOREXX_GET_PACKAGE(rx3270); -*/ - -BEGIN_EXTERN_C() - -LIB3270_EXPORT void rx3270_set_package_option(RexxOption *option) -{ - static const RexxLibraryPackage package = { "rx3270", &rx3270_package_entry }; - - option->optionName = REGISTER_LIBRARY; - option->option = (void *) &package; - -} - -LIB3270_EXPORT RexxPackageEntry * RexxEntry RexxGetPackage(void) -{ - return &rx3270_package_entry; -} -END_EXTERN_C() - - diff --git a/src/plugins/rx3270/sample/asc2ebc.rex b/src/plugins/rx3270/sample/asc2ebc.rex deleted file mode 100644 index a75e797..0000000 --- a/src/plugins/rx3270/sample/asc2ebc.rex +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Sample code for ASC -> EBCDIC conversion - * - */ - - STRING = "ASCII STRING" - - say c2x(asc2ebc(STRING)) - -return 0 - - -::requires "rx3270.cls" diff --git a/src/plugins/rx3270/sample/charset.rex b/src/plugins/rx3270/sample/charset.rex deleted file mode 100644 index 559e905..0000000 --- a/src/plugins/rx3270/sample/charset.rex +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Sample rexx code to get host charset - */ - - host = .rx3270~new("") - - say "Display charset: "||host~getDisplayCharset() - say "Host charset: "||host~getHostCharset() - - return 0 - -::requires "rx3270.cls" diff --git a/src/plugins/rx3270/sample/clipboard.rex b/src/plugins/rx3270/sample/clipboard.rex deleted file mode 100644 index 1a8fdf6..0000000 --- a/src/plugins/rx3270/sample/clipboard.rex +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Sample rexx code to justified paste the clipboard contents. - * - * Autor: Perry Werneck - * - */ - -trace "?R" - - host = .rx3270~new("pw3270:a") - - if host~connected() = 0 then - do - host~popup("error","Can't start script","Disconnected from host") - return 0 - end - - text = strip(host~GetClipboard()) - if text = "" then - do - say "Clipboard is empty" - return 0 - end - - if host~WaitForReady(60) <> 0 then - do - host~popup("error","Failed","Timeout waiting for host response") - return 0 - end - - cursor = host~GetCursorAddr() - next = cursor - - do while text <> "" - addr = host~GetFieldStart(next) - next = host~GetNextUnprotected(addr) - - host~SetCursorAddr(addr) - - field_len = host~GetFieldLen() - - s = strip(left(text,field_len)) - p = lastpos(" ",s) - n = pos(d2c(10),s) - - select - when n <> 0 then - do - s = strip(left(text,n-1)) - text = strip(substr(text,n+1)) - end - - when length(text) < field_len then - do - s = justify(strip(text),field_len) - text = "" - end - - when p = 0 then - do - s = strip(left(text,field_len)) - text = substr(text,field_len+1) - end - - otherwise - s = strip(left(text,p)) - text = strip(substr(text,p+1)) - end - - /* Insert new string */ - host~input(s) - - if next <= cursor then - do - /* Next field is before the original position */ - host~SetClipboard(text) - return 0 - end - - end - -return 0 - -justify: procedure - - use arg text, len - - wlen = words(text) - if wlen < 3 - then return text - - ln = .array~new() - sz = 0 - - do f = 1 to wlen - ln[f] = word(text,f)||" " - sz = sz + length(ln[f]) - end - - do while sz < len - do f = wlen-1 to 1 by -1 - ln[f] = ln[f]||"." - sz = sz+1 - if sz >= len - then leave - end - end - - str = "" - do f = 1 to wlen - str = str||ln[f] - end - -return strip(str) - -::requires "rx3270.cls" - - - diff --git a/src/plugins/rx3270/sample/ebc2asc.rex b/src/plugins/rx3270/sample/ebc2asc.rex deleted file mode 100644 index 581285c..0000000 --- a/src/plugins/rx3270/sample/ebc2asc.rex +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Sample code for EBCDIC -> ASC conversion - * - */ - - STRING = x2c("C1E2C3C9C940E2E3D9C9D5C7") - - say length(string) - say ebc2asc(STRING) - -return 0 - - -::requires "rx3270.cls" diff --git a/src/plugins/rx3270/sample/getversion.rex b/src/plugins/rx3270/sample/getversion.rex deleted file mode 100644 index d8f4174..0000000 --- a/src/plugins/rx3270/sample/getversion.rex +++ /dev/null @@ -1,8 +0,0 @@ - - -say rx3270version() - -return 0 - -::requires "rx3270" library - diff --git a/src/plugins/rx3270/sample/object.rex b/src/plugins/rx3270/sample/object.rex deleted file mode 100644 index 40262c8..0000000 --- a/src/plugins/rx3270/sample/object.rex +++ /dev/null @@ -1,44 +0,0 @@ - -use arg uri - -if arg(1) <> "" then -do - - /* Has a host URI, create a new session and connect to the host */ - - host = .rx3270~new("") - - if host~connect(uri,1) <> 0 then - do - say "Error connecting to "||uri - return -1 - end -end -else -do - /* No host URI, use the first session */ - host = .rx3270~new("pw3270:A") - -end - -if host~WaitForReady(60) <> 0 then -do - say "Timeout waiting for terminal ready" -end - -say "Text(2,2,23)=["||host~GetTextAt(2,2,23)||"]" -say "Text(3,2,27)=["||host~GetTextAt(3,2,27)||"]" - -host~enter() -if host~WaitForReady(60) <> 0 then -do - say "Timeout waiting for terminal ready" -end - -host~disconnect() - -return 0 - - -::requires "rx3270.cls" - diff --git a/src/plugins/rx3270/sample/protected.rex b/src/plugins/rx3270/sample/protected.rex deleted file mode 100644 index ec3a149..0000000 --- a/src/plugins/rx3270/sample/protected.rex +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Sample rexx code to get host charset - */ - - host = .rx3270~new("") - - say "Posição 19,39: "||host~getIsProtectedAt(19,39) - say "Posição 20,39: "||host~getIsProtectedAt(20,39) - - return 0 - -::requires "rx3270.cls" diff --git a/src/plugins/rx3270/sample/remote.rex b/src/plugins/rx3270/sample/remote.rex deleted file mode 100644 index dfbe5f4..0000000 --- a/src/plugins/rx3270/sample/remote.rex +++ /dev/null @@ -1,26 +0,0 @@ - -use arg uri - -trace "?R" - -host = .rx3270~new("pw3270:a") - -say "PW3270 revision is "||host~revision() -say "Connection state is "||host~connected() -say "Ready state is "||host~ready() - -if uri <> "URI" - then say "Connect rc="||host~connect(uri) - -say "Wait for ready is "||host~WaitForReady(60) - -say "Text[3,2,27]="||host~GetTextAt(3,2,27) - -say "ENTER exits with rc="||host~enter() - -say "Wait for ready is "||host~WaitForReady(60) - -return 0 - -::requires "rx3270.cls" - diff --git a/src/plugins/rx3270/typed_routines.cc b/src/plugins/rx3270/typed_routines.cc deleted file mode 100644 index 1089fa8..0000000 --- a/src/plugins/rx3270/typed_routines.cc +++ /dev/null @@ -1,323 +0,0 @@ -/* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como typed_routines.cc e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - */ - - #include "rx3270.h" - #include - #include - #include - #include - - using namespace std; - using namespace PW3270_NAMESPACE; - -/*--[ Implement ]------------------------------------------------------------------------------------*/ - -RexxRoutine0(CSTRING, rx3270version) -{ - try - { - return session::get_default()->get_version().c_str(); - } - catch(std::exception& e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return NULL; -} - -RexxRoutine0(CSTRING, rx3270QueryCState) -{ - #define DECLARE_XLAT_STATE( x ) { x, #x } - - static const struct _xlat_state - { - LIB3270_CSTATE state; - const char * ret; - } xlat_state[] = - { - { LIB3270_NOT_CONNECTED, "NOT_CONNECTED" }, - { LIB3270_RESOLVING, "RESOLVING" }, - { LIB3270_PENDING, "PENDING" }, - { LIB3270_CONNECTED_INITIAL, "CONNECTED_INITIAL" }, - { LIB3270_CONNECTED_ANSI, "CONNECTED_ANSI" }, - { LIB3270_CONNECTED_3270, "CONNECTED_3270" }, - { LIB3270_CONNECTED_INITIAL_E, "CONNECTED_INITIAL_E" }, - { LIB3270_CONNECTED_NVT, "CONNECTED_NVT" }, - { LIB3270_CONNECTED_SSCP, "CONNECTED_SSCP" }, - { LIB3270_CONNECTED_TN3270E, "CONNECTED_TN3270E" }, - }; - - size_t f; - LIB3270_CSTATE state = session::get_default()->get_cstate(); - - for(f=0;f < (sizeof(xlat_state)/sizeof(struct _xlat_state)); f++) - { - if(state == xlat_state[f].state) - return xlat_state[f].ret; - } - - return "UNEXPECTED"; -} - -RexxRoutine0(int, rx3270Disconnect) -{ - return session::get_default()->disconnect(); -} - -RexxRoutine2(int, rx3270Connect, CSTRING, hostname, int, wait) -{ - return session::get_default()->connect(hostname,wait); -} - -RexxRoutine0(int, rx3270isConnected) -{ - return session::get_default()->is_connected(); -} - -RexxRoutine0(int, rx3270WaitForEvents) -{ - return session::get_default()->iterate(); -} - -RexxRoutine1(int, rx3270Sleep, int, seconds) -{ - return session::get_default()->wait(seconds); -} - -RexxRoutine0(int, rx3270SendENTERKey) -{ - return session::get_default()->enter(); -} - -RexxRoutine0(int, rx3270Erase) -{ - return session::get_default()->erase(); -} - -RexxRoutine0(int, rx3270EraseEOF) -{ - return session::get_default()->erase_eof(); -} - -RexxRoutine0(int, rx3270EraseEOL) -{ - return session::get_default()->erase_eol(); -} - -RexxRoutine0(int, rx3270EraseInput) -{ - return session::get_default()->erase_input(); -} - -RexxRoutine1(int, rx3270SendPFKey, int, key) -{ - return session::get_default()->pfkey(key); -} - -RexxRoutine1(int, rx3270SendPAKey, int, key) -{ - return session::get_default()->pakey(key); -} - -RexxRoutine1(int, rx3270WaitForTerminalReady, int, seconds) -{ - return session::get_default()->wait_for_ready(seconds); -} - -RexxRoutine4(int, rx3270WaitForStringAt, int, row, int, col, CSTRING, key, int, timeout) -{ - try - { - return session::get_default()->wait_for_string_at(row,col,key,timeout); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return ETIMEDOUT; - -} - -RexxRoutine3(RexxStringObject, rx3270GetStringAt, int, row, int, col, int, sz) -{ - try - { - string str = session::get_default()->get_string_at(row,col,(int) sz); - return context->String((CSTRING) str.c_str()); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return context->String(""); -} - -RexxRoutine0(int, rx3270IsTerminalReady) -{ - return session::get_default()->is_ready(); -} - -RexxRoutine3(int, rx3270queryStringAt, int, row, int, col, CSTRING, key) -{ - try - { - return session::get_default()->cmp_string_at(row,col,key); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return -1; -} - -RexxRoutine2(int, rx3270SetCursorPosition, int, row, int, col) -{ - try - { - return session::get_default()->set_cursor_position(row,col); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return -1; -} - -RexxRoutine3(int, rx3270SetStringAt, int, row, int, col, CSTRING, text) -{ - try - { - return session::get_default()->set_string_at(row,col,text); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - return -1; -} - -RexxRoutine0(int, rx3270CloseApplication) -{ - return session::get_default()->quit(); -} - - -RexxRoutine2(RexxStringObject, asc2ebc, CSTRING, str, OPTIONAL_int, sz) -{ - try - { - if(sz < 1) - sz = strlen(str); - - if(sz) - { - char buffer[sz+1]; - memcpy(buffer,str,sz); - buffer[sz] = 0; - return context->String((CSTRING) session::get_default()->asc2ebc((unsigned char *)buffer,sz)); - } - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return context->String(""); -} - -RexxRoutine2(RexxStringObject, ebc2asc, CSTRING, str, OPTIONAL_int, sz) -{ - try - { - if(sz < 1) - sz = strlen(str); - - if(sz) - { - char buffer[sz+1]; - memcpy(buffer,str,sz); - buffer[sz] = 0; - return context->String((CSTRING) session::get_default()->ebc2asc((unsigned char *)buffer,sz)); - } - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return context->String(""); -} - -RexxRoutine1(int, rx3270IsProtected, int, baddr) -{ - try - { - return session::get_default()->get_is_protected(baddr); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return -1; -} - -RexxRoutine2(int, rx3270IsProtectedAt, int, row, int, col) -{ - try - { - return session::get_default()->get_is_protected_at(row,col); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return -1; -} - -RexxRoutine1(int, rx3270SetUnlockDelay, int, delay) -{ - try - { - session::get_default()->set_unlock_delay((unsigned short) delay); - } - catch(std::exception &e) - { - context->RaiseException1(Rexx_Error_Application_error,context->NewStringFromAsciiz(e.what())); - } - - return 0; -} - -- libgit2 0.21.2