From e8cf13fc8285d59db34842393ae4ae38df3e852e Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 23 Aug 2017 16:09:06 -0300 Subject: [PATCH] Incluindo teste de conexão ativa nas chamadas hllapi. --- Makefile.in | 7 +++++++ locale/pt_BR.po | 48 ++++++++++++++++++------------------------------ locale/pw3270.pot | 47 +++++++---------------------------------------- src/include/pw3270/hllapi.h | 1 - src/libpw3270cpp/Makefile.in | 6 +++--- src/plugins/hllapi/calls.cc | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 6 files changed, 88 insertions(+), 78 deletions(-) diff --git a/Makefile.in b/Makefile.in index 3fe9744..68b9767 100644 --- a/Makefile.in +++ b/Makefile.in @@ -265,8 +265,15 @@ install-branding: Debug: \ $(BINDBG)/lib3270@DLLEXT@ \ $(BINDBG)/$(PACKAGE_TARNAME)@EXEEXT@ \ + $(BINDBG)/libpw3270cpp.a \ $(foreach PLG, $(PLUGINS), $(BINDBG)/plugins/$(PLG)@DLLEXT@) +$(BINDBG)/libpw3270cpp.a: \ + src/libpw3270cpp/* + + @$(MAKE) -C src/libpw3270cpp Debug + + run: \ $(BINDBG)/lib3270@DLLEXT@ \ $(BINDBG)/$(PACKAGE_TARNAME)@EXEEXT@ \ diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b397668..7f8b1f3 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: pw3270 5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-21 09:51-0300\n" +"POT-Creation-Date: 2017-08-21 10:15-0300\n" "PO-Revision-Date: 2017-02-15 17:08-0200\n" "Last-Translator: Perry Werneck \n" "Language-Team: Português \n" @@ -119,7 +119,7 @@ msgstr "Alerta 3270" msgid "3270 screen" msgstr "Tela 3270" -#: dialog.c:531 +#: dialog.c:550 #, c-format msgid "3270 terminal emulator for GTK %d.%d" msgstr "Emulador 3270 para GTK+ %d.%d" @@ -363,7 +363,7 @@ msgstr "Azul" msgid "Bold" msgstr "Negrito" -#: dialog.c:538 +#: dialog.c:557 msgid "Brazilian Public Software Portal" msgstr "Portal do Software Público Brasileiro" @@ -419,11 +419,6 @@ msgstr "Não foi possível conectar a %s" msgid "Can't connect to %s:%s" msgstr "Não foi possível conectar a %s:%s" -#: main.c:70 -#, fuzzy -msgid "Can't connect to DBUS server" -msgstr "Não foi possível conectar a %s" - #: selection.c:425 #, c-format msgid "Can't convert line %d from %s to %s" @@ -438,10 +433,6 @@ msgstr "Recortar não permitido em seleção retangular" msgid "Can't determine value for environment variable \"%s\" " msgstr "Não consigo determinar o valor da variável de ambiente \"%s\" " -#: main.c:115 -msgid "Can't get DBUS object name" -msgstr "" - #: ft.c:413 msgid "Can't get file size" msgstr "Não foi possível obter o tamanho do arquivo" @@ -663,11 +654,6 @@ msgstr "Configurar host" msgid "Connect on startup" msgstr "Conectar ao iniciar" -#: gobject.c:205 -#, fuzzy -msgid "Connecting to host" -msgstr "Não foi possível conectar ao servidor" - #: connect.c:215 connect.c:311 connect.c:320 connect.c:382 connect.c:397 #: connect.c:413 connect.c:427 connect.c:447 connect.c:461 connect.c:477 #: connect.c:573 @@ -1923,11 +1909,6 @@ msgstr "Iniciar transferência de arquivo" msgid "Starting" msgstr "Iniciando" -#: gobject.c:193 -#, c-format -msgid "State %04d can't accept requests" -msgstr "" - #: security.c:237 msgid "Subject issuer mismatch" msgstr "Divergência na identidade do emissor" @@ -2190,7 +2171,7 @@ msgstr "Não encontrei configuração para a tabela de caracteres \"%s\"" msgid "This is a host program error." msgstr "Este é um erro no programa do host." -#: dialog.c:480 +#: dialog.c:499 msgid "" "This program is free software; you can redistribute it and/or modify it " "under the terms of the GNU General Public License as published by the Free " @@ -2413,11 +2394,6 @@ msgstr "Valor de cor inválido ou inesperado: \"%s\"" msgid "Unexpected or unknown security status" msgstr "Estado de segurança inesperado ou desconhecido." -#: gobject.c:208 -#, fuzzy, c-format -msgid "Unexpected state %04d" -msgstr "Alvo inesperado \"%s\"" - #: actions.c:391 #, c-format msgid "Unexpected target \"%s\"" @@ -2480,7 +2456,7 @@ msgstr "Use the keys +/- from keypad to select editable fields" msgid "Variable" msgstr "Variável" -#: dialog.c:521 dialog.c:523 +#: dialog.c:540 dialog.c:542 #, c-format msgid "Version %s-%s" msgstr "Versão %s-%s" @@ -2762,7 +2738,7 @@ msgstr "ioctlsocket(FIONBIO) failed." msgid "setsockopt(SO_OOBINLINE) has failed" msgstr "setsockopt(SO_OOBINLINE) has failed" -#: dialog.c:541 +#: dialog.c:560 msgid "translator-credits" msgstr "translator-credits" @@ -2822,6 +2798,10 @@ msgstr "translator-credits" #~ "32768. Valores maiores trazem maior performance, porem, nem todos os " #~ "hosts podem suportá-los." +#, fuzzy +#~ msgid "Can't connect to DBUS server" +#~ msgstr "Não foi possível conectar a %s" + #~ msgid "Can't start download." #~ msgstr "Não foi possível iniciar o download." @@ -2858,6 +2838,10 @@ msgstr "translator-credits" #~ msgid "Complete" #~ msgstr "Completo" +#, fuzzy +#~ msgid "Connecting to host" +#~ msgstr "Não foi possível conectar ao servidor" + #~ msgid "Copiar tudo" #~ msgstr "Copiar tudo" @@ -3223,6 +3207,10 @@ msgstr "translator-credits" #~ msgid "Unexpected element <%s>" #~ msgstr "Elemento <%s> inesperado" +#, fuzzy +#~ msgid "Unexpected state %04d" +#~ msgstr "Alvo inesperado \"%s\"" + #~ msgid "" #~ "Unknown host:\n" #~ "%s" diff --git a/locale/pw3270.pot b/locale/pw3270.pot index b5237cb..5ce2e53 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-08-21 09:51-0300\n" +"POT-Creation-Date: 2017-08-21 10:23-0300\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-08-21 09:51-0300\n" +"POT-Creation-Date: 2017-08-21 10:23-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -39,17 +39,6 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -"#-#-#-#-# dbus3270.pot (PACKAGE VERSION) #-#-#-#-#\n" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-21 09:51-0300\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" #: window.c:329 #, c-format @@ -151,7 +140,7 @@ msgstr "" msgid "3270 screen" msgstr "" -#: dialog.c:531 +#: dialog.c:550 #, c-format msgid "3270 terminal emulator for GTK %d.%d" msgstr "" @@ -379,7 +368,7 @@ msgstr "" msgid "Bold" msgstr "" -#: dialog.c:538 +#: dialog.c:557 msgid "Brazilian Public Software Portal" msgstr "" @@ -435,10 +424,6 @@ msgstr "" msgid "Can't connect to %s:%s" msgstr "" -#: main.c:70 -msgid "Can't connect to DBUS server" -msgstr "" - #: selection.c:425 #, c-format msgid "Can't convert line %d from %s to %s" @@ -453,10 +438,6 @@ msgstr "" msgid "Can't determine value for environment variable \"%s\" " msgstr "" -#: main.c:115 -msgid "Can't get DBUS object name" -msgstr "" - #: ft.c:413 msgid "Can't get file size" msgstr "" @@ -666,10 +647,6 @@ msgstr "" msgid "Connect on startup" msgstr "" -#: gobject.c:205 -msgid "Connecting to host" -msgstr "" - #: connect.c:215 connect.c:311 connect.c:320 connect.c:382 connect.c:397 #: connect.c:413 connect.c:427 connect.c:447 connect.c:461 connect.c:477 #: connect.c:573 @@ -1880,11 +1857,6 @@ msgstr "" msgid "Starting" msgstr "" -#: gobject.c:193 -#, c-format -msgid "State %04d can't accept requests" -msgstr "" - #: security.c:237 msgid "Subject issuer mismatch" msgstr "" @@ -2106,7 +2078,7 @@ msgstr "" msgid "This is a host program error." msgstr "" -#: dialog.c:480 +#: dialog.c:499 msgid "" "This program is free software; you can redistribute it and/or modify it " "under the terms of the GNU General Public License as published by the Free " @@ -2316,11 +2288,6 @@ msgstr "" msgid "Unexpected or unknown security status" msgstr "" -#: gobject.c:208 -#, c-format -msgid "Unexpected state %04d" -msgstr "" - #: actions.c:391 #, c-format msgid "Unexpected target \"%s\"" @@ -2383,7 +2350,7 @@ msgstr "" msgid "Variable" msgstr "" -#: dialog.c:521 dialog.c:523 +#: dialog.c:540 dialog.c:542 #, c-format msgid "Version %s-%s" msgstr "" @@ -2647,6 +2614,6 @@ msgstr "" msgid "setsockopt(SO_OOBINLINE) has failed" msgstr "" -#: dialog.c:541 +#: dialog.c:560 msgid "translator-credits" msgstr "" diff --git a/src/include/pw3270/hllapi.h b/src/include/pw3270/hllapi.h index 926d12c..27b820e 100644 --- a/src/include/pw3270/hllapi.h +++ b/src/include/pw3270/hllapi.h @@ -196,7 +196,6 @@ extern "C" { HLLAPI_API_CALL hllapi_get_message_id(void); HLLAPI_API_CALL hllapi_is_connected(void); HLLAPI_API_CALL hllapi_get_state(void); - HLLAPI_API_CALL hllapi_get_screen_at(WORD row, WORD col, LPSTR buffer); HLLAPI_API_CALL hllapi_get_screen(WORD pos, LPSTR buffer, WORD len); HLLAPI_API_CALL hllapi_enter(void); HLLAPI_API_CALL hllapi_set_text_at(WORD row, WORD col, LPSTR text); diff --git a/src/libpw3270cpp/Makefile.in b/src/libpw3270cpp/Makefile.in index 87acadd..c5be126 100644 --- a/src/libpw3270cpp/Makefile.in +++ b/src/libpw3270cpp/Makefile.in @@ -148,9 +148,9 @@ $(SRCDIR): \ #---[ Debug Targets ]-------------------------------------------------------------------- Debug: \ - .bin/Debug/$(MODULE_NAME)@EXEEXT@ + $(BASEDIR)/.bin/Debug/$(MODULE_NAME).a -$(BASEDIR)/.obj/Debug/$(MODULE_NAME).a: \ +$(BASEDIR)/.bin/Debug/$(MODULE_NAME).a: \ $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o) @echo $@ ... @@ -159,7 +159,7 @@ $(BASEDIR)/.obj/Debug/$(MODULE_NAME).a: \ .bin/Debug/$(MODULE_NAME)@EXEEXT@: \ $(OBJDBG)/testprogram.o \ - $(BASEDIR)/.obj/Debug/$(MODULE_NAME).a + $(BASEDIR)/.bin/Debug/$(MODULE_NAME).a @$(MKDIR) `dirname $@` @$(LD) $(APP_LDFLAGS) -o $@ $^ $(LIBS) diff --git a/src/plugins/hllapi/calls.cc b/src/plugins/hllapi/calls.cc index d06158c..f06337d 100644 --- a/src/plugins/hllapi/calls.cc +++ b/src/plugins/hllapi/calls.cc @@ -129,11 +129,11 @@ { switch(hllapi_get_message_id()) { - case LIB3270_MESSAGE_NONE: // 0 - No message - return HLLAPI_STATUS_SUCCESS; // keyboard was unlocked and ready for input. + case LIB3270_MESSAGE_NONE: // 0 - No message + return HLLAPI_STATUS_SUCCESS; // keyboard was unlocked and ready for input. - case LIB3270_MESSAGE_DISCONNECTED: // 4 - Disconnected from host - return HLLAPI_STATUS_DISCONNECTED; // Your application program was not connected to a valid session. + case LIB3270_MESSAGE_DISCONNECTED: // 4 - Disconnected from host + return HLLAPI_STATUS_DISCONNECTED; // Your application program was not connected to a valid session. case LIB3270_MESSAGE_MINUS: case LIB3270_MESSAGE_PROTECTED: @@ -163,23 +163,37 @@ HLLAPI_API_CALL hllapi_wait_for_ready(WORD seconds) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + session::get_default()->wait_for_ready(seconds); + return hllapi_get_state(); } HLLAPI_API_CALL hllapi_wait(WORD seconds) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + session::get_default()->wait(seconds); + return hllapi_get_state(); } HLLAPI_API_CALL hllapi_get_message_id(void) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + return session::get_default()->get_program_message(); } HLLAPI_API_CALL hllapi_get_screen_at(WORD row, WORD col, LPSTR buffer) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + if(!(buffer && *buffer)) return HLLAPI_STATUS_SYSTEM_ERROR; @@ -199,11 +213,17 @@ HLLAPI_API_CALL hllapi_enter(void) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + return session::get_default()->enter(); } HLLAPI_API_CALL hllapi_set_text_at(WORD row, WORD col, LPSTR text) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + try { session::get_default()->set_string_at(row,col,text); @@ -218,7 +238,12 @@ HLLAPI_API_CALL hllapi_cmp_text_at(WORD row, WORD col, LPSTR text) { + + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + int rc = HLLAPI_STATUS_SYSTEM_ERROR; + try { rc = session::get_default()->cmp_string_at(row,col,text); @@ -233,6 +258,9 @@ HLLAPI_API_CALL hllapi_find_text(LPSTR text) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + return (int) session::get_default()->find_string((const char *) text, false); } @@ -260,11 +288,17 @@ HLLAPI_API_CALL hllapi_pfkey(WORD key) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + return session::get_default()->pfkey(key); } HLLAPI_API_CALL hllapi_pakey(WORD key) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + return session::get_default()->pakey(key); } @@ -322,6 +356,9 @@ HLLAPI_API_CALL hllapi_get_screen(WORD offset, LPSTR buffer, WORD len) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + int rc = HLLAPI_STATUS_SYSTEM_ERROR; if(offset < 1) @@ -369,6 +406,9 @@ HLLAPI_API_CALL hllapi_emulate_input(const LPSTR buffer, WORD len, WORD pasting) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + try { session::get_default()->input_string(buffer); @@ -396,6 +436,9 @@ HLLAPI_API_CALL hllapi_erase_eof(void) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + try { session::get_default()->erase_eof(); @@ -409,6 +452,9 @@ HLLAPI_API_CALL hllapi_erase_eol(void) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + try { session::get_default()->erase_eol(); @@ -422,6 +468,9 @@ HLLAPI_API_CALL hllapi_erase_input(void) { + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; + try { session::get_default()->erase_input(); -- libgit2 0.21.2