diff --git a/client/Makefile.in b/client/Makefile.in index d7022a8..bd9aa92 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -102,6 +102,7 @@ CFLAGS= \ -I$(BASEDIR)/common/src/include \ -Isrc/include \ -DBUILD_DATE=`date +%Y%m%d` \ + -DLOCALEDIR=$(localedir) \ @LIB3270_CFLAGS@ \ @DBUS_CFLAGS@ diff --git a/client/ipcclient.cbp b/client/ipcclient.cbp index f867881..ab5385d 100644 --- a/client/ipcclient.cbp +++ b/client/ipcclient.cbp @@ -47,6 +47,7 @@ + diff --git a/client/src/core/linux/dynamic/init.cc b/client/src/core/linux/dynamic/init.cc new file mode 100644 index 0000000..edff6a0 --- /dev/null +++ b/client/src/core/linux/dynamic/init.cc @@ -0,0 +1,73 @@ +/* + * "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., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +/** + * @file + * + * @brief Linux dynamic module initialization. + * + * @author perry.werneck@gmail.com + * + */ + + #include + #include + + extern "C" { + + int ipc3270_loaded(void) __attribute__((constructor)); + int ipc3270_unloaded(void) __attribute__((destructor)); + + } + +/*---[ Implement ]----------------------------------------------------------------------------------*/ + + int ipc3270_loaded(void) { + +#ifdef HAVE_LIBINTL + + static bool initialized = false; + + if(!initialized) { + initialized = true; + bindtextdomain(PACKAGE_NAME, LIB3270_STRINGIZE_VALUE_OF(LOCALEDIR)); + } + +#endif // HAVE_LIBINTL + + return 0; + + } + + int ipc3270_unloaded(void) { + + return 0; + + } + diff --git a/client/src/core/windows/attribute.cc b/client/src/core/windows/attribute.cc index 3754aef..f141386 100644 --- a/client/src/core/windows/attribute.cc +++ b/client/src/core/windows/attribute.cc @@ -42,7 +42,7 @@ /*---[ Implement ]----------------------------------------------------------------------------------*/ - std::vector TN3270::getAttributes() noexcept { + std::vector TN3270::getAttributes() { std::vector attributes; diff --git a/client/src/core/windows/dynamic/init.cc b/client/src/core/windows/dynamic/init.cc index 74d393d..6f4d5ad 100644 --- a/client/src/core/windows/dynamic/init.cc +++ b/client/src/core/windows/dynamic/init.cc @@ -63,10 +63,27 @@ static HANDLE hEventLog = 0; BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwcallpurpose, LPVOID lpvResvd) { + +#ifdef HAVE_LIBINTL + static bool initialized = false; +#endif // HAVE_LIBINTL + switch(dwcallpurpose) { case DLL_PROCESS_ATTACH: hModule = hInstance; hEventLog = RegisterEventSource(NULL, LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME)); + +#ifdef HAVE_LIBINTL + if(!initialized) { + initialized = true; + + std::string localedir = TN3270::getInstallLocation(); + localedir += "\\locale"; + + bindtextdomain(PACKAGE_NAME, localedir.c_str()); + } +#endif // HAVE_LIBINTL + break; case DLL_PROCESS_DETACH: diff --git a/client/src/core/windows/pop.cc b/client/src/core/windows/pop.cc index 194eaf9..c228e0e 100644 --- a/client/src/core/windows/pop.cc +++ b/client/src/core/windows/pop.cc @@ -113,6 +113,38 @@ return *this; } + IPC::Request & IPC::Request::Request::pop(bool &value) { + + DataBlock * block = getNextBlock(); + + switch(block->type) { + case IPC::Request::Boolean: + value = (* ((uint8_t *) (block+1))) != 0; + in.current += sizeof(uint8_t) + sizeof(DataBlock); + break; + + case IPC::Request::Uint16: + value = (* ((uint16_t *) (block+1))) != 0; + in.current += sizeof(uint16_t) + sizeof(DataBlock); + break; + + case IPC::Request::Uint32: + value = (* ((uint32_t *) (block+1))) != 0; + in.current += sizeof(uint32_t) + sizeof(DataBlock); + break; + + case IPC::Request::Uint64: + value = (* ((uint64_t *) (block+1))) != 0; + in.current += sizeof(uint64_t) + sizeof(DataBlock); + break; + + default: + throw std::runtime_error("Invalid format"); + } + + return *this; + } + } diff --git a/client/src/include/ipc-client-internals.h b/client/src/include/ipc-client-internals.h index 78331b5..17feb1d 100644 --- a/client/src/include/ipc-client-internals.h +++ b/client/src/include/ipc-client-internals.h @@ -61,11 +61,11 @@ #ifdef HAVE_LIBINTL #include - #define _( x ) gettext(x) - #define N_( x ) x + #define _( x ) dgettext(PACKAGE_NAME, x) + #define N_( x ) x #else - #define _( x ) x - #define N_( x ) x + #define _( x ) x + #define N_( x ) x #endif // HAVE_LIBINTL #ifdef HAVE_ICONV diff --git a/common/src/include/config.h.in b/common/src/include/config.h.in index 77eb6b9..feef89d 100644 --- a/common/src/include/config.h.in +++ b/common/src/include/config.h.in @@ -36,6 +36,7 @@ #undef PACKAGE_RELEASE #undef PRODUCT_NAME + #undef HAVE_LIBINTL #undef HAVE_ICONV #undef ICONV_CONST diff --git a/configure.ac b/configure.ac index 39e0096..d8fcfcb 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ AC_PREREQ(2.61) dnl Initialise automake with the package name, version and dnl bug-reporting address. -AC_INIT([libipc3270], [5.2], [perry.werneck@gmail.com]) +AC_INIT([ipc3270], [5.2], [perry.werneck@gmail.com]) dnl Place auxilliary scripts here. AC_CONFIG_AUX_DIR([scripts]) @@ -210,6 +210,21 @@ AC_PATH_TOOL([MSGMERGE], [msgmerge], [no]) AC_PATH_TOOL([MSGFMT], [msgfmt], [no]) AC_PATH_TOOL([VALGRIND], [valgrind], [no]) +AC_CHECK_HEADER(libintl.h, [ + AC_DEFINE(HAVE_LIBINTL, 1) + + case "$host" in + *-mingw32|*-pc-msys) + INTL_LIBS="-lintl" + ;; + + *) + INTL_LIBS="" + + esac + +]) + AC_SUBST(INTL_LIBS) dnl --------------------------------------------------------------------------- -- libgit2 0.21.2