Commit 7078548654065e519532bf2fb0e4f5e874006486
1 parent
afedcc02
Exists in
master
and in
5 other branches
Iniciando implementação da classe ooRexx
Showing
8 changed files
with
173 additions
and
3 deletions
Show diff stats
src/plugins/rx3270/Makefile.in
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | MODULE_NAME=rx3270 |
| 30 | 30 | DEPENDS=*.h ../../include/*.h ../../include/lib3270/*.h Makefile |
| 31 | 31 | PLUGIN_SRC=pluginmain.cc |
| 32 | -EXTAPI_SRC=rxapimain.cc text.cc typed_routines.cc local.cc | |
| 32 | +EXTAPI_SRC=rxapimain.cc text.cc typed_routines.cc local.cc rexx_methods.cc | |
| 33 | 33 | |
| 34 | 34 | #---[ Tools ]------------------------------------------------------------------ |
| 35 | 35 | ... | ... |
src/plugins/rx3270/local.cc
| ... | ... | @@ -139,6 +139,17 @@ rx3270::~rx3270() |
| 139 | 139 | defSession = NULL; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | +rx3270 * rx3270::create(const char *type) | |
| 143 | +{ | |
| 144 | + if(type && *type) | |
| 145 | + { | |
| 146 | + // Create remote session | |
| 147 | + return NULL; | |
| 148 | + } | |
| 149 | + return new dynamic(); | |
| 150 | +} | |
| 151 | + | |
| 152 | + | |
| 142 | 153 | rx3270 * rx3270::get_default(void) |
| 143 | 154 | { |
| 144 | 155 | if(defSession) | ... | ... |
| ... | ... | @@ -0,0 +1,76 @@ |
| 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 | + | |
| 30 | + #include <time.h> | |
| 31 | + #include <string.h> | |
| 32 | + | |
| 33 | + #include "rx3270.h" | |
| 34 | + | |
| 35 | + | |
| 36 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
| 37 | + | |
| 38 | +RexxMethod1(int, rx3270_method_init, CSTRING, type) | |
| 39 | +{ | |
| 40 | + // Set session class in rexx object | |
| 41 | + RexxPointerObject sessionPtr = context->NewPointer(rx3270::create(type)); | |
| 42 | + context->SetObjectVariable("CSELF", sessionPtr); | |
| 43 | + return 0; | |
| 44 | +} | |
| 45 | + | |
| 46 | +RexxMethod1(int, rx3270_method_uninit, CSELF, sessionPtr) | |
| 47 | +{ | |
| 48 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
| 49 | + if(hSession) | |
| 50 | + delete hSession; | |
| 51 | + return 0; | |
| 52 | +} | |
| 53 | + | |
| 54 | +RexxMethod3(int, rx3270_method_connect, CSELF, sessionPtr, CSTRING, uri, OPTIONAL_int, wait) | |
| 55 | +{ | |
| 56 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
| 57 | + if(!hSession) | |
| 58 | + return -1; | |
| 59 | + return hSession->connect(uri,wait != 0); | |
| 60 | +} | |
| 61 | + | |
| 62 | +RexxMethod1(int, rx3270_method_disconnect, CSELF, sessionPtr) | |
| 63 | +{ | |
| 64 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
| 65 | + if(!hSession) | |
| 66 | + return -1; | |
| 67 | + return hSession->disconnect(); | |
| 68 | +} | |
| 69 | + | |
| 70 | +RexxMethod2(int, rx3270_method_sleep, CSELF, sessionPtr, int, seconds) | |
| 71 | +{ | |
| 72 | + rx3270 *hSession = (rx3270 *) sessionPtr; | |
| 73 | + if(!hSession) | |
| 74 | + return -1; | |
| 75 | + return hSession->wait(seconds); | |
| 76 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,44 @@ |
| 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 | +/*-------------------------------------------------------------------------------*/ | |
| 31 | +/* 3270 class */ | |
| 32 | +/*-------------------------------------------------------------------------------*/ | |
| 33 | + | |
| 34 | +::class rx3270 public subclass object | |
| 35 | + | |
| 36 | + | |
| 37 | +::METHOD INIT EXTERNAL "LIBRARY rx3270 rx3270_method_init" | |
| 38 | +::METHOD UNINIT EXTERNAL "LIBRARY rx3270 rx3270_method_uninit" | |
| 39 | + | |
| 40 | +::METHOD CONNECT EXTERNAL "LIBRARY rx3270 rx3270_method_connect" | |
| 41 | +::METHOD DISCONNECT EXTERNAL "LIBRARY rx3270 rx3270_method_disconnect" | |
| 42 | + | |
| 43 | +::METHOD SLEEP EXTERNAL "LIBRARY rx3270 rx3270_method_sleep" | |
| 44 | + | ... | ... |
src/plugins/rx3270/rx3270.h
| ... | ... | @@ -70,6 +70,12 @@ |
| 70 | 70 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270queryStringAt); |
| 71 | 71 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetStringAt); |
| 72 | 72 | |
| 73 | + REXX_METHOD_PROTOTYPE(rx3270_method_init); | |
| 74 | + REXX_METHOD_PROTOTYPE(rx3270_method_uninit); | |
| 75 | + REXX_METHOD_PROTOTYPE(rx3270_method_connect); | |
| 76 | + REXX_METHOD_PROTOTYPE(rx3270_method_disconnect); | |
| 77 | + REXX_METHOD_PROTOTYPE(rx3270_method_sleep); | |
| 78 | + | |
| 73 | 79 | /*---[ Globals ]---------------------------------------------------------------------------------------------*/ |
| 74 | 80 | |
| 75 | 81 | /*--[ 3270 Session ]-----------------------------------------------------------------------------------------*/ |
| ... | ... | @@ -92,6 +98,7 @@ |
| 92 | 98 | rx3270(); |
| 93 | 99 | virtual ~rx3270(); |
| 94 | 100 | |
| 101 | + static rx3270 * create(const char *type = NULL); | |
| 95 | 102 | static rx3270 * get_default(void); |
| 96 | 103 | static void set_plugin(void); |
| 97 | 104 | |
| ... | ... | @@ -121,4 +128,6 @@ |
| 121 | 128 | |
| 122 | 129 | }; |
| 123 | 130 | |
| 131 | + rx3270 * create_lib3270_instance(void); | |
| 132 | + | |
| 124 | 133 | #endif // RX3270_H_INCLUDED | ... | ... |
src/plugins/rx3270/rxapimain.cc
| ... | ... | @@ -109,6 +109,16 @@ RexxRoutineEntry rx3270_functions[] = |
| 109 | 109 | REXX_LAST_METHOD() |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | +RexxMethodEntry rx3270_methods[] = | |
| 113 | +{ | |
| 114 | + REXX_METHOD(rx3270_method_init, rx3270_method_init ), | |
| 115 | + REXX_METHOD(rx3270_method_uninit, rx3270_method_uninit ), | |
| 116 | + REXX_METHOD(rx3270_method_connect, rx3270_method_connect ), | |
| 117 | + REXX_METHOD(rx3270_method_disconnect, rx3270_method_disconnect ), | |
| 118 | + REXX_METHOD(rx3270_method_sleep, rx3270_method_sleep ), | |
| 119 | + REXX_LAST_METHOD() | |
| 120 | +}; | |
| 121 | + | |
| 112 | 122 | RexxPackageEntry rx3270_package_entry = |
| 113 | 123 | { |
| 114 | 124 | STANDARD_PACKAGE_HEADER |
| ... | ... | @@ -118,7 +128,7 @@ RexxPackageEntry rx3270_package_entry = |
| 118 | 128 | NULL, // no load/unload functions |
| 119 | 129 | NULL, |
| 120 | 130 | rx3270_functions, // the exported functions |
| 121 | - NULL // no methods in rx3270. | |
| 131 | + rx3270_methods // no methods in rx3270. | |
| 122 | 132 | }; |
| 123 | 133 | |
| 124 | 134 | // package loading stub. | ... | ... |
src/plugins/rx3270/typed_routines.cc
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple |
| 19 | 19 | * Place, Suite 330, Boston, MA, 02111-1307, USA |
| 20 | 20 | * |
| 21 | - * Este programa está nomeado como text.cc e possui - linhas de código. | |
| 21 | + * Este programa está nomeado como typed_routines.cc e possui - linhas de código. | |
| 22 | 22 | * |
| 23 | 23 | * Contatos: |
| 24 | 24 | * | ... | ... |