Commit db07d95eabd016dce0123b018e30a7b5aa9e1cb6

Authored by Perry Werneck
1 parent eb028695
Exists in master and in 1 other branch develop

Working in new lib3270 API.

@@ -41,11 +41,13 @@ @@ -41,11 +41,13 @@
41 </Linker> 41 </Linker>
42 <Unit filename="../include/lib3270++.h" /> 42 <Unit filename="../include/lib3270++.h" />
43 <Unit filename="../include/lib3270.h" /> 43 <Unit filename="../include/lib3270.h" />
  44 + <Unit filename="../include/lib3270/session.h" />
44 <Unit filename="abstract.cc" /> 45 <Unit filename="abstract.cc" />
45 <Unit filename="host.cc" /> 46 <Unit filename="host.cc" />
46 <Unit filename="local.cc" /> 47 <Unit filename="local.cc" />
47 <Unit filename="private.h" /> 48 <Unit filename="private.h" />
48 <Unit filename="session.cc" /> 49 <Unit filename="session.cc" />
  50 + <Unit filename="testprogram/testprogram.cc" />
49 <Extensions> 51 <Extensions>
50 <code_completion /> 52 <code_completion />
51 <envvars /> 53 <envvars />
@@ -64,7 +64,12 @@ @@ -64,7 +64,12 @@
64 64
65 void LocalSession::connect(const char *url) { 65 void LocalSession::connect(const char *url) {
66 std::lock_guard<std::mutex> lock(sync); 66 std::lock_guard<std::mutex> lock(sync);
67 - lib3270_connect_url(hSession,url,0); 67 + int rc = lib3270_connect_url(hSession,url,0);
  68 +
  69 + if(!rc) {
  70 + throw std::system_error(rc, std::system_category());
  71 + }
  72 +
68 } 73 }
69 74
70 void LocalSession::disconnect() { 75 void LocalSession::disconnect() {
@@ -43,6 +43,18 @@ @@ -43,6 +43,18 @@
43 43
44 namespace TN3270 { 44 namespace TN3270 {
45 45
  46 + /// @brief Create a tn3270 session.
  47 + Session * Session::create(const char *id) {
  48 +
  49 + if(!id) {
  50 + return new LocalSession();
  51 + }
  52 +
  53 + throw std::system_error(EINVAL, std::system_category());
  54 +
  55 + }
  56 +
  57 +
46 Session::Session() { 58 Session::Session() {
47 59
48 } 60 }
testprogram/testprogram.cc 0 → 100644
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como lib3270++.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +/**
  31 + * @file src/lib3270++/testprogram/testprogram.cc
  32 + *
  33 + * @brief
  34 + *
  35 + * @author perry.werneck@gmail.com
  36 + *
  37 + */
  38 +
  39 + #include <lib3270++.h>
  40 +
  41 +/*---[ Implement ]----------------------------------------------------------------------------------*/
  42 +
  43 + int main(int argc, const char *argv[]) {
  44 +
  45 + TN3270::Host host;
  46 +
  47 + host.connect(nullptr);
  48 +
  49 + return 0;
  50 + }
  51 +
  52 +