Commit 178f98865c6a8a5faca30023d46fd7540855372f
1 parent
3d7a468a
Exists in
master
and in
1 other branch
Adding libintl initialization code.
Fixing windows build.
Showing
9 changed files
with
146 additions
and
6 deletions
Show diff stats
client/Makefile.in
client/ipcclient.cbp
| ... | ... | @@ -47,6 +47,7 @@ |
| 47 | 47 | <Unit filename="src/core/constants.cc" /> |
| 48 | 48 | <Unit filename="src/core/events.cc" /> |
| 49 | 49 | <Unit filename="src/core/linux/attribute.cc" /> |
| 50 | + <Unit filename="src/core/linux/dynamic/init.cc" /> | |
| 50 | 51 | <Unit filename="src/core/linux/request.cc" /> |
| 51 | 52 | <Unit filename="src/core/session.cc" /> |
| 52 | 53 | <Unit filename="src/core/windows/attribute.cc" /> | ... | ... |
| ... | ... | @@ -0,0 +1,73 @@ |
| 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 - 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 | |
| 32 | + * | |
| 33 | + * @brief Linux dynamic module initialization. | |
| 34 | + * | |
| 35 | + * @author perry.werneck@gmail.com | |
| 36 | + * | |
| 37 | + */ | |
| 38 | + | |
| 39 | + #include <config.h> | |
| 40 | + #include <ipc-client-internals.h> | |
| 41 | + | |
| 42 | + extern "C" { | |
| 43 | + | |
| 44 | + int ipc3270_loaded(void) __attribute__((constructor)); | |
| 45 | + int ipc3270_unloaded(void) __attribute__((destructor)); | |
| 46 | + | |
| 47 | + } | |
| 48 | + | |
| 49 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | |
| 50 | + | |
| 51 | + int ipc3270_loaded(void) { | |
| 52 | + | |
| 53 | +#ifdef HAVE_LIBINTL | |
| 54 | + | |
| 55 | + static bool initialized = false; | |
| 56 | + | |
| 57 | + if(!initialized) { | |
| 58 | + initialized = true; | |
| 59 | + bindtextdomain(PACKAGE_NAME, LIB3270_STRINGIZE_VALUE_OF(LOCALEDIR)); | |
| 60 | + } | |
| 61 | + | |
| 62 | +#endif // HAVE_LIBINTL | |
| 63 | + | |
| 64 | + return 0; | |
| 65 | + | |
| 66 | + } | |
| 67 | + | |
| 68 | + int ipc3270_unloaded(void) { | |
| 69 | + | |
| 70 | + return 0; | |
| 71 | + | |
| 72 | + } | |
| 73 | + | ... | ... |
client/src/core/windows/attribute.cc
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | |
| 43 | 43 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 44 | 44 | |
| 45 | - std::vector<const LIB3270_PROPERTY *> TN3270::getAttributes() noexcept { | |
| 45 | + std::vector<const LIB3270_PROPERTY *> TN3270::getAttributes() { | |
| 46 | 46 | |
| 47 | 47 | std::vector<const LIB3270_PROPERTY *> attributes; |
| 48 | 48 | ... | ... |
client/src/core/windows/dynamic/init.cc
| ... | ... | @@ -63,10 +63,27 @@ |
| 63 | 63 | static HANDLE hEventLog = 0; |
| 64 | 64 | |
| 65 | 65 | BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwcallpurpose, LPVOID lpvResvd) { |
| 66 | + | |
| 67 | +#ifdef HAVE_LIBINTL | |
| 68 | + static bool initialized = false; | |
| 69 | +#endif // HAVE_LIBINTL | |
| 70 | + | |
| 66 | 71 | switch(dwcallpurpose) { |
| 67 | 72 | case DLL_PROCESS_ATTACH: |
| 68 | 73 | hModule = hInstance; |
| 69 | 74 | hEventLog = RegisterEventSource(NULL, LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME)); |
| 75 | + | |
| 76 | +#ifdef HAVE_LIBINTL | |
| 77 | + if(!initialized) { | |
| 78 | + initialized = true; | |
| 79 | + | |
| 80 | + std::string localedir = TN3270::getInstallLocation(); | |
| 81 | + localedir += "\\locale"; | |
| 82 | + | |
| 83 | + bindtextdomain(PACKAGE_NAME, localedir.c_str()); | |
| 84 | + } | |
| 85 | +#endif // HAVE_LIBINTL | |
| 86 | + | |
| 70 | 87 | break; |
| 71 | 88 | |
| 72 | 89 | case DLL_PROCESS_DETACH: | ... | ... |
client/src/core/windows/pop.cc
| ... | ... | @@ -113,6 +113,38 @@ |
| 113 | 113 | return *this; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | + IPC::Request & IPC::Request::Request::pop(bool &value) { | |
| 117 | + | |
| 118 | + DataBlock * block = getNextBlock(); | |
| 119 | + | |
| 120 | + switch(block->type) { | |
| 121 | + case IPC::Request::Boolean: | |
| 122 | + value = (* ((uint8_t *) (block+1))) != 0; | |
| 123 | + in.current += sizeof(uint8_t) + sizeof(DataBlock); | |
| 124 | + break; | |
| 125 | + | |
| 126 | + case IPC::Request::Uint16: | |
| 127 | + value = (* ((uint16_t *) (block+1))) != 0; | |
| 128 | + in.current += sizeof(uint16_t) + sizeof(DataBlock); | |
| 129 | + break; | |
| 130 | + | |
| 131 | + case IPC::Request::Uint32: | |
| 132 | + value = (* ((uint32_t *) (block+1))) != 0; | |
| 133 | + in.current += sizeof(uint32_t) + sizeof(DataBlock); | |
| 134 | + break; | |
| 135 | + | |
| 136 | + case IPC::Request::Uint64: | |
| 137 | + value = (* ((uint64_t *) (block+1))) != 0; | |
| 138 | + in.current += sizeof(uint64_t) + sizeof(DataBlock); | |
| 139 | + break; | |
| 140 | + | |
| 141 | + default: | |
| 142 | + throw std::runtime_error("Invalid format"); | |
| 143 | + } | |
| 144 | + | |
| 145 | + return *this; | |
| 146 | + } | |
| 147 | + | |
| 116 | 148 | } |
| 117 | 149 | |
| 118 | 150 | ... | ... |
client/src/include/ipc-client-internals.h
| ... | ... | @@ -61,11 +61,11 @@ |
| 61 | 61 | |
| 62 | 62 | #ifdef HAVE_LIBINTL |
| 63 | 63 | #include <libintl.h> |
| 64 | - #define _( x ) gettext(x) | |
| 65 | - #define N_( x ) x | |
| 64 | + #define _( x ) dgettext(PACKAGE_NAME, x) | |
| 65 | + #define N_( x ) x | |
| 66 | 66 | #else |
| 67 | - #define _( x ) x | |
| 68 | - #define N_( x ) x | |
| 67 | + #define _( x ) x | |
| 68 | + #define N_( x ) x | |
| 69 | 69 | #endif // HAVE_LIBINTL |
| 70 | 70 | |
| 71 | 71 | #ifdef HAVE_ICONV | ... | ... |
common/src/include/config.h.in
configure.ac
| ... | ... | @@ -31,7 +31,7 @@ AC_PREREQ(2.61) |
| 31 | 31 | |
| 32 | 32 | dnl Initialise automake with the package name, version and |
| 33 | 33 | dnl bug-reporting address. |
| 34 | -AC_INIT([libipc3270], [5.2], [perry.werneck@gmail.com]) | |
| 34 | +AC_INIT([ipc3270], [5.2], [perry.werneck@gmail.com]) | |
| 35 | 35 | |
| 36 | 36 | dnl Place auxilliary scripts here. |
| 37 | 37 | AC_CONFIG_AUX_DIR([scripts]) |
| ... | ... | @@ -210,6 +210,21 @@ AC_PATH_TOOL([MSGMERGE], [msgmerge], [no]) |
| 210 | 210 | AC_PATH_TOOL([MSGFMT], [msgfmt], [no]) |
| 211 | 211 | AC_PATH_TOOL([VALGRIND], [valgrind], [no]) |
| 212 | 212 | |
| 213 | +AC_CHECK_HEADER(libintl.h, [ | |
| 214 | + AC_DEFINE(HAVE_LIBINTL, 1) | |
| 215 | + | |
| 216 | + case "$host" in | |
| 217 | + *-mingw32|*-pc-msys) | |
| 218 | + INTL_LIBS="-lintl" | |
| 219 | + ;; | |
| 220 | + | |
| 221 | + *) | |
| 222 | + INTL_LIBS="" | |
| 223 | + | |
| 224 | + esac | |
| 225 | + | |
| 226 | +]) | |
| 227 | + | |
| 213 | 228 | AC_SUBST(INTL_LIBS) |
| 214 | 229 | |
| 215 | 230 | dnl --------------------------------------------------------------------------- | ... | ... |