Commit 4b376e26abe74c5cffd6a66c02179d06dff08429

Authored by Perry Werneck
1 parent 1aa06f8c

Cretating include dir and files based on operating system.

Makefile.in
... ... @@ -107,12 +107,14 @@ DEPENDS= \
107 107 Makefile \
108 108 src/include/*.h \
109 109 src/include/lib3270/*.h \
  110 + src/include/@OSNAME@/lib3270/*.h \
110 111 $(BASEDIR)/src/include/lib3270/actions.h
111 112  
112 113 CFLAGS= \
113 114 @CFLAGS@ \
114 115 -g \
115 116 -I$(BASEDIR)/src/include \
  117 + -I$(BASEDIR)/src/include/@OSNAME@ \
116 118 @LIBSSL_CFLAGS@ \
117 119 @LDAP_CFLAGS@ \
118 120 @LIBCURL_CFLAGS@
... ... @@ -323,7 +325,7 @@ install-dev: \
323 325 @mkdir -p $(DESTDIR)$(includedir)/lib3270
324 326  
325 327 @$(INSTALL_DATA) \
326   - src/include/lib3270/*.h \
  328 + src/include/@OSNAME@/lib3270/*.h \
327 329 $(DESTDIR)$(includedir)/lib3270
328 330  
329 331 @$(INSTALL_DATA) \
... ...
lib3270.cbp
... ... @@ -254,6 +254,8 @@
254 254 <Option compilerVar="CC" />
255 255 </Unit>
256 256 <Unit filename="src/include/3270ds.h" />
  257 + <Unit filename="src/include/X11keysym.h" />
  258 + <Unit filename="src/include/action_table.h" />
257 259 <Unit filename="src/include/ansic.h" />
258 260 <Unit filename="src/include/arpa_telnet.h" />
259 261 <Unit filename="src/include/array.h" />
... ... @@ -269,6 +271,7 @@
269 271 <Unit filename="src/include/hostc.h" />
270 272 <Unit filename="src/include/internals.h" />
271 273 <Unit filename="src/include/kybdc.h" />
  274 + <Unit filename="src/include/lib3270++.h" />
272 275 <Unit filename="src/include/lib3270.h" />
273 276 <Unit filename="src/include/lib3270/actions.h" />
274 277 <Unit filename="src/include/lib3270/charset.h" />
... ... @@ -284,7 +287,9 @@
284 287 <Unit filename="src/include/lib3270/toggle.h" />
285 288 <Unit filename="src/include/lib3270/trace.h" />
286 289 <Unit filename="src/include/linkedlist.h" />
  290 + <Unit filename="src/include/linux/lib3270/os.h" />
287 291 <Unit filename="src/include/localdefs.h" />
  292 + <Unit filename="src/include/macos/lib3270/os.h" />
288 293 <Unit filename="src/include/networking.h" />
289 294 <Unit filename="src/include/popupsc.h" />
290 295 <Unit filename="src/include/proxyc.h" />
... ... @@ -305,6 +310,8 @@
305 310 <Unit filename="src/include/utilc.h" />
306 311 <Unit filename="src/include/w3miscc.h" />
307 312 <Unit filename="src/include/widec.h" />
  313 + <Unit filename="src/include/windows/lib3270/os.h" />
  314 + <Unit filename="src/include/windows/lib3270/win32.h" />
308 315 <Unit filename="src/include/winversc.h" />
309 316 <Unit filename="src/include/xioc.h" />
310 317 <Unit filename="src/include/xl.h" />
... ...
src/core/iocalls.c
... ... @@ -36,6 +36,7 @@
36 36 #include "telnetc.h"
37 37 #include "utilc.h"
38 38 #include "kybdc.h"
  39 +#include <lib3270/os.h>
39 40  
40 41 #if defined(_WIN32)
41 42 #include <ws2tcpip.h>
... ... @@ -45,7 +46,6 @@
45 46 #include <sys/ioctl.h>
46 47 #include <netinet/in.h>
47 48 #include <netdb.h>
48   - #include <unistd.h>
49 49 #include <fcntl.h>
50 50 #endif
51 51  
... ...
src/core/linux/connect.c
... ... @@ -39,7 +39,6 @@
39 39 #include <sys/ioctl.h>
40 40 #include <netinet/in.h>
41 41 #include <netdb.h>
42   -#include <unistd.h>
43 42 #include <fcntl.h>
44 43  
45 44 #include <stdlib.h>
... ... @@ -53,6 +52,7 @@
53 52 #include <lib3270/internals.h>
54 53 #include <lib3270/log.h>
55 54 #include <lib3270/trace.h>
  55 +#include <lib3270/os.h>
56 56 #include <networking.h>
57 57 //#include <fcntl.h>
58 58 #include <poll.h>
... ...
src/core/linux/util.c
... ... @@ -36,7 +36,7 @@
36 36 #include <config.h>
37 37 #include <stdarg.h>
38 38 #include <internals.h>
39   -#include <unistd.h>
  39 +#include <lib3270/os.h>
40 40  
41 41 static char * concat(char *path, const char *name, size_t *length)
42 42 {
... ...
src/core/telnet.c
... ... @@ -73,7 +73,9 @@
73 73 #include <errno.h>
74 74 #include <fcntl.h>
75 75  
76   -#if !defined(_WIN32)
  76 +#if defined(_WIN32)
  77 + #include <lib3270/win32.h>
  78 +#else
77 79 #include <netdb.h>
78 80 #endif
79 81  
... ...
src/core/windows/connect.c
... ... @@ -32,6 +32,7 @@
32 32 #include <winsock2.h>
33 33 #include <windows.h>
34 34 #include <ws2tcpip.h>
  35 +#include <lib3270/win32.h>
35 36  
36 37 #include <internals.h>
37 38 #include <lib3270/log.h>
... ...
src/core/windows/event_dispatcher.c
... ... @@ -36,6 +36,7 @@
36 36 #include <sys/time.h>
37 37 #include <sys/types.h>
38 38 #include <lib3270/log.h>
  39 +#include <lib3270/win32.h>
39 40  
40 41 #define TN (timeout_t *)NULL
41 42  
... ...
src/core/windows/http.c
... ... @@ -42,6 +42,7 @@
42 42 #include <lib3270/trace.h>
43 43 #include <winhttp.h>
44 44 #include <utilc.h>
  45 +#include <lib3270/win32.h>
45 46  
46 47 /*--[ Implement ]------------------------------------------------------------------------------------*/
47 48  
... ...
src/core/windows/util.c
... ... @@ -49,6 +49,7 @@
49 49 #endif // HAVE_ICONV
50 50  
51 51 #include <lib3270/log.h>
  52 +#include <lib3270/win32.h>
52 53  
53 54 #define my_isspace(c) isspace((unsigned char)c)
54 55  
... ...
src/include/internals.h
... ... @@ -40,6 +40,7 @@
40 40 #include <lib3270/actions.h>
41 41 #include <lib3270/popup.h>
42 42 #include <networking.h>
  43 +#include <lib3270/os.h>
43 44  
44 45 #if defined(HAVE_LIBSSL)
45 46 #include <openssl/ssl.h>
... ... @@ -100,7 +101,6 @@
100 101  
101 102 #else
102 103  
103   - #include <unistd.h> /* Unix system calls */
104 104 #include <sys/time.h> /* System time-related data types */
105 105  
106 106 #endif // _WIN32
... ...
src/include/lib3270.h
... ... @@ -1573,32 +1573,6 @@
1573 1573  
1574 1574 LIB3270_EXPORT int lib3270_set_as400(H3270 *hSession, int on);
1575 1575  
1576   -#ifdef _WIN32
1577   - LIB3270_EXPORT const char * lib3270_win32_strerror(int e);
1578   - LIB3270_EXPORT const char * lib3270_win32_local_charset(void);
1579   - LIB3270_EXPORT LSTATUS lib3270_win32_create_regkey(LPCSTR lpSubKey, REGSAM samDesired, PHKEY phkResult);
1580   - LIB3270_EXPORT DWORD lib3270_win32_get_dword(HKEY hKey, const char *name, DWORD def);
1581   -
1582   - /**
1583   - * @brief Translate windows error code.
1584   - *
1585   - * @param lasterror Windows error code (from GetLastError()).
1586   - *
1587   - * @return String with translated message (release it with lib3270_free).
1588   - *
1589   - */
1590   - LIB3270_EXPORT char * lib3270_win32_translate_error_code(int lasterror);
1591   -
1592   - /**
1593   - * @brief Get lib3270's installation path.
1594   - *
1595   - * @return Full path for the lib3270 installation path (release it with lib3270_free)
1596   - *
1597   - */
1598   - LIB3270_EXPORT char * lib3270_get_installation_path();
1599   -
1600   -#endif // WIn32
1601   -
1602 1576 /**
1603 1577 * @brief Build filename on application data dir.
1604 1578 *
... ...
src/include/lib3270/internals.h
... ... @@ -44,5 +44,5 @@
44 44 }
45 45 #endif
46 46  
47   -#endif // LIB3270_HTML_H_INCLUDED
  47 +#endif // LIB3270_INTERNALS_H_INCLUDED
48 48  
... ...
src/include/linux/lib3270/os.h 0 → 100644
... ... @@ -0,0 +1,43 @@
  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 + * @brief TN3270 API linux definitions.
  32 + *
  33 + * @author perry.werneck@gmail.com
  34 + *
  35 + */
  36 +
  37 +#ifndef LIB3270_OS_H_INCLUDED
  38 +
  39 + #define LIB3270_OS_H_INCLUDED 1
  40 +
  41 + #include <unistd.h>
  42 +
  43 +#endif // LIB3270_OS_H_INCLUDED
... ...
src/include/macos/lib3270/os.h 0 → 100644
... ... @@ -0,0 +1,43 @@
  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 + * @brief TN3270 API MAC definitions.
  32 + *
  33 + * @author perry.werneck@gmail.com
  34 + *
  35 + */
  36 +
  37 +#ifndef LIB3270_OS_H_INCLUDED
  38 +
  39 + #define LIB3270_OS_H_INCLUDED 1
  40 +
  41 + #include <unistd.h>
  42 +
  43 +#endif // LIB3270_OS_H_INCLUDED
... ...
src/include/windows/lib3270/os.h 0 → 100644
... ... @@ -0,0 +1,44 @@
  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 + * @brief TN3270 API windows definitions.
  32 + *
  33 + * @author perry.werneck@gmail.com
  34 + *
  35 + */
  36 +
  37 +#ifndef LIB3270_OS_H_INCLUDED
  38 +
  39 + #define LIB3270_OS_H_INCLUDED 1
  40 +
  41 + #include <winsock2.h>
  42 + #include <windows.h>
  43 +
  44 +#endif // LIB3270_OS_H_INCLUDED
... ...
src/include/windows/lib3270/win32.h 0 → 100644
... ... @@ -0,0 +1,78 @@
  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 + * @brief TN3270 API windows definitions.
  32 + *
  33 + * @author perry.werneck@gmail.com
  34 + *
  35 + */
  36 +
  37 +#ifndef LIB3270_WIN32_H_INCLUDED
  38 +
  39 + #define LIB3270_WIN32_H_INCLUDED 1
  40 +
  41 + #include <winsock2.h>
  42 + #include <windows.h>
  43 + #include <lib3270.h>
  44 +
  45 +#ifdef __cplusplus
  46 + extern "C" {
  47 +#endif
  48 +
  49 + LIB3270_EXPORT const char * lib3270_win32_strerror(int e);
  50 + LIB3270_EXPORT const char * lib3270_win32_local_charset(void);
  51 + LIB3270_EXPORT LSTATUS lib3270_win32_create_regkey(LPCSTR lpSubKey, REGSAM samDesired, PHKEY phkResult);
  52 + LIB3270_EXPORT DWORD lib3270_win32_get_dword(HKEY hKey, const char *name, DWORD def);
  53 +
  54 + /**
  55 + * @brief Translate windows error code.
  56 + *
  57 + * @param lasterror Windows error code (from GetLastError()).
  58 + *
  59 + * @return String with translated message (release it with lib3270_free).
  60 + *
  61 + */
  62 + LIB3270_EXPORT char * lib3270_win32_translate_error_code(int lasterror);
  63 +
  64 + /**
  65 + * @brief Get lib3270's installation path.
  66 + *
  67 + * @return Full path for the lib3270 installation path (release it with lib3270_free)
  68 + *
  69 + */
  70 + LIB3270_EXPORT char * lib3270_get_installation_path();
  71 +
  72 +
  73 +
  74 +#ifdef __cplusplus
  75 + }
  76 +#endif
  77 +
  78 +#endif // LIB3270_WIN32_H_INCLUDED
... ...
src/network_modules/openssl/context.c
... ... @@ -39,6 +39,10 @@
39 39  
40 40 #include "private.h"
41 41  
  42 +#ifdef _WIN32
  43 + #include <lib3270/win32.h>
  44 +#endif // _WIN32
  45 +
42 46 #include <openssl/err.h>
43 47 #include <openssl/x509_vfy.h>
44 48  
... ...
src/network_modules/openssl/private.h
... ... @@ -37,13 +37,13 @@
37 37 #include <winsock2.h>
38 38 #include <windows.h>
39 39 #else
40   - #include <unistd.h>
41 40 #include <fcntl.h>
42 41 #endif // _WIN32
43 42  
44 43 #include <lib3270.h>
45 44 #include <lib3270/log.h>
46 45 #include <lib3270/popup.h>
  46 + #include <lib3270/os.h>
47 47 #include <array.h>
48 48 #include <internals.h>
49 49 #include <networking.h>
... ...
src/network_modules/tools.c
... ... @@ -38,6 +38,9 @@
38 38 #include <internals.h>
39 39 #include <networking.h>
40 40 #include <fcntl.h>
  41 + #ifdef _WIN32
  42 + #include <lib3270/win32.h>
  43 + #endif // _WIN32
41 44  
42 45 /*--[ Implement ]------------------------------------------------------------------------------------*/
43 46  
... ...
src/ssl/notify.c
... ... @@ -37,6 +37,7 @@
37 37 #include <internals.h>
38 38 #include <lib3270/log.h>
39 39 #include <lib3270/popup.h>
  40 +#include <lib3270/win32.h>
40 41  
41 42 /*--[ Implement ]------------------------------------------------------------------------------------*/
42 43  
... ...
src/testprogram/testprogram.c
... ... @@ -42,6 +42,10 @@
42 42 #include <lib3270/properties.h>
43 43 #include <lib3270/charset.h>
44 44  
  45 +#ifdef _WIN32
  46 + #include <lib3270/win32.h>
  47 +#endif // _WIN32
  48 +
45 49 #define MAX_ARGS 10
46 50  
47 51 const char *trace_file = "test.trace";
... ...