From ec7cd4d8d4fe9dc7882c617d7f5177b8b5534166 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 8 Nov 2018 16:14:10 -0200 Subject: [PATCH] Ajustes para compilação da lib3270 de forma independente. --- gitsync.sh | 20 ++++++++++++++++++++ lib3270.cbp | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/config.h.in | 1 + src/include/lib3270/X11keysym.h | 217 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/action_table.h | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/actions.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/charset.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/filetransfer.h | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/html.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/internals.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/log.h | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/macros.h | 36 ++++++++++++++++++++++++++++++++++++ src/include/lib3270/popup.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/selection.h | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/session.h | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/lib3270/trace.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/private.h | 656 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/lib3270/XtGlue.c | 97 ------------------------------------------------------------------------------------------------- src/lib3270/apl.c | 221 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/lib3270/private.h | 656 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib3270/tables.c | 358 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/lib3270/w3misc.c | 112 ---------------------------------------------------------------------------------------------------------------- src/lib3270/winvers.c | 78 ------------------------------------------------------------------------------ src/lib3270/xio.c | 70 ---------------------------------------------------------------------- 24 files changed, 2172 insertions(+), 1592 deletions(-) create mode 100755 gitsync.sh create mode 100644 lib3270.cbp create mode 100644 src/include/lib3270/X11keysym.h create mode 100644 src/include/lib3270/action_table.h create mode 100644 src/include/lib3270/actions.h create mode 100644 src/include/lib3270/charset.h create mode 100644 src/include/lib3270/filetransfer.h create mode 100644 src/include/lib3270/html.h create mode 100644 src/include/lib3270/internals.h create mode 100644 src/include/lib3270/log.h create mode 100644 src/include/lib3270/macros.h create mode 100644 src/include/lib3270/popup.h create mode 100644 src/include/lib3270/selection.h create mode 100644 src/include/lib3270/session.h create mode 100644 src/include/lib3270/trace.h delete mode 100644 src/include/private.h delete mode 100644 src/lib3270/XtGlue.c delete mode 100644 src/lib3270/apl.c create mode 100644 src/lib3270/private.h delete mode 100644 src/lib3270/tables.c delete mode 100644 src/lib3270/w3misc.c delete mode 100644 src/lib3270/winvers.c delete mode 100644 src/lib3270/xio.c diff --git a/gitsync.sh b/gitsync.sh new file mode 100755 index 0000000..87e8630 --- /dev/null +++ b/gitsync.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# https://help.github.com/articles/syncing-a-fork/ +# +# https://help.github.com/articles/configuring-a-remote-for-a-fork/ +# +# https://www.opentechguides.com/how-to/article/git/177/git-sync-repos.html +# +# Setup: +# +# git remote add github https://github.com/PerryWerneck/lib3270.git +# +# + +git fetch origin +git checkout master +git merge origin/master + +git push github + diff --git a/lib3270.cbp b/lib3270.cbp new file mode 100644 index 0000000..b355e15 --- /dev/null +++ b/lib3270.cbp @@ -0,0 +1,224 @@ + + + + + + diff --git a/src/include/config.h.in b/src/include/config.h.in index 5de8cda..360930f 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -61,6 +61,7 @@ #define X3270_APL #define X3270_TRACE + #define X3270_FT #undef HAVE_PRINTER #undef HAVE_MALLOC_H diff --git a/src/include/lib3270/X11keysym.h b/src/include/lib3270/X11keysym.h new file mode 100644 index 0000000..7c086ef --- /dev/null +++ b/src/include/lib3270/X11keysym.h @@ -0,0 +1,217 @@ +/* + * Copyright 1999 by Paul Mattes. + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation. + * + * c3270, s3270 and tcl3270 are distributed in the hope that they will + * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE + * for more details. + */ + +/* X11 keysyms used by c3270, s3270 and tcl3270 */ + +#if !defined(_x11_keysym_h) /*[*/ +#define _x11_keysym_h 1 + +/* Latin-1 Keysyms */ +#define XK_space 0x020 +#define XK_exclam 0x021 +#define XK_quotedbl 0x022 +#define XK_numbersign 0x023 +#define XK_dollar 0x024 +#define XK_percent 0x025 +#define XK_ampersand 0x026 +#define XK_apostrophe 0x027 +#define XK_quoteright 0x027 +#define XK_parenleft 0x028 +#define XK_parenright 0x029 +#define XK_asterisk 0x02a +#define XK_plus 0x02b +#define XK_comma 0x02c +#define XK_minus 0x02d +#define XK_period 0x02e +#define XK_slash 0x02f +#define XK_0 0x030 +#define XK_1 0x031 +#define XK_2 0x032 +#define XK_3 0x033 +#define XK_4 0x034 +#define XK_5 0x035 +#define XK_6 0x036 +#define XK_7 0x037 +#define XK_8 0x038 +#define XK_9 0x039 +#define XK_colon 0x03a +#define XK_semicolon 0x03b +#define XK_less 0x03c +#define XK_equal 0x03d +#define XK_greater 0x03e +#define XK_question 0x03f +#define XK_at 0x040 +#define XK_A 0x041 +#define XK_B 0x042 +#define XK_C 0x043 +#define XK_D 0x044 +#define XK_E 0x045 +#define XK_F 0x046 +#define XK_G 0x047 +#define XK_H 0x048 +#define XK_I 0x049 +#define XK_J 0x04a +#define XK_K 0x04b +#define XK_L 0x04c +#define XK_M 0x04d +#define XK_N 0x04e +#define XK_O 0x04f +#define XK_P 0x050 +#define XK_Q 0x051 +#define XK_R 0x052 +#define XK_S 0x053 +#define XK_T 0x054 +#define XK_U 0x055 +#define XK_V 0x056 +#define XK_W 0x057 +#define XK_X 0x058 +#define XK_Y 0x059 +#define XK_Z 0x05a +#define XK_bracketleft 0x05b +#define XK_backslash 0x05c +#define XK_bracketright 0x05d +#define XK_asciicircum 0x05e +#define XK_underscore 0x05f +#define XK_grave 0x060 +#define XK_quoteleft 0x060 +#define XK_a 0x061 +#define XK_b 0x062 +#define XK_c 0x063 +#define XK_d 0x064 +#define XK_e 0x065 +#define XK_f 0x066 +#define XK_g 0x067 +#define XK_h 0x068 +#define XK_i 0x069 +#define XK_j 0x06a +#define XK_k 0x06b +#define XK_l 0x06c +#define XK_m 0x06d +#define XK_n 0x06e +#define XK_o 0x06f +#define XK_p 0x070 +#define XK_q 0x071 +#define XK_r 0x072 +#define XK_s 0x073 +#define XK_t 0x074 +#define XK_u 0x075 +#define XK_v 0x076 +#define XK_w 0x077 +#define XK_x 0x078 +#define XK_y 0x079 +#define XK_z 0x07a +#define XK_braceleft 0x07b +#define XK_bar 0x07c +#define XK_braceright 0x07d +#define XK_asciitilde 0x07e +#define XK_nobreakspace 0x0a0 +#define XK_exclamdown 0x0a1 +#define XK_cent 0x0a2 +#define XK_sterling 0x0a3 +#define XK_currency 0x0a4 +#define XK_yen 0x0a5 +#define XK_brokenbar 0x0a6 +#define XK_section 0x0a7 +#define XK_diaeresis 0x0a8 +#define XK_copyright 0x0a9 +#define XK_ordfeminine 0x0aa +#define XK_guillemotleft 0x0ab +#define XK_notsign 0x0ac +#define XK_hyphen 0x0ad +#define XK_registered 0x0ae +#define XK_macron 0x0af +#define XK_degree 0x0b0 +#define XK_plusminus 0x0b1 +#define XK_twosuperior 0x0b2 +#define XK_threesuperior 0x0b3 +#define XK_acute 0x0b4 +#define XK_mu 0x0b5 +#define XK_paragraph 0x0b6 +#define XK_periodcentered 0x0b7 +#define XK_cedilla 0x0b8 +#define XK_onesuperior 0x0b9 +#define XK_masculine 0x0ba +#define XK_guillemotright 0x0bb +#define XK_onequarter 0x0bc +#define XK_onehalf 0x0bd +#define XK_threequarters 0x0be +#define XK_questiondown 0x0bf +#define XK_Agrave 0x0c0 +#define XK_Aacute 0x0c1 +#define XK_Acircumflex 0x0c2 +#define XK_Atilde 0x0c3 +#define XK_Adiaeresis 0x0c4 +#define XK_Aring 0x0c5 +#define XK_AE 0x0c6 +#define XK_Ccedilla 0x0c7 +#define XK_Egrave 0x0c8 +#define XK_Eacute 0x0c9 +#define XK_Ecircumflex 0x0ca +#define XK_Ediaeresis 0x0cb +#define XK_Igrave 0x0cc +#define XK_Iacute 0x0cd +#define XK_Icircumflex 0x0ce +#define XK_Idiaeresis 0x0cf +#define XK_ETH 0x0d0 +#define XK_Eth 0x0d0 +#define XK_Ntilde 0x0d1 +#define XK_Ograve 0x0d2 +#define XK_Oacute 0x0d3 +#define XK_Ocircumflex 0x0d4 +#define XK_Otilde 0x0d5 +#define XK_Odiaeresis 0x0d6 +#define XK_multiply 0x0d7 +#define XK_Ooblique 0x0d8 +#define XK_Ugrave 0x0d9 +#define XK_Uacute 0x0da +#define XK_Ucircumflex 0x0db +#define XK_Udiaeresis 0x0dc +#define XK_Yacute 0x0dd +#define XK_THORN 0x0de +#define XK_Thorn 0x0de +#define XK_ssharp 0x0df +#define XK_agrave 0x0e0 +#define XK_aacute 0x0e1 +#define XK_acircumflex 0x0e2 +#define XK_atilde 0x0e3 +#define XK_adiaeresis 0x0e4 +#define XK_aring 0x0e5 +#define XK_ae 0x0e6 +#define XK_ccedilla 0x0e7 +#define XK_egrave 0x0e8 +#define XK_eacute 0x0e9 +#define XK_ecircumflex 0x0ea +#define XK_ediaeresis 0x0eb +#define XK_igrave 0x0ec +#define XK_iacute 0x0ed +#define XK_icircumflex 0x0ee +#define XK_idiaeresis 0x0ef +#define XK_eth 0x0f0 +#define XK_ntilde 0x0f1 +#define XK_ograve 0x0f2 +#define XK_oacute 0x0f3 +#define XK_ocircumflex 0x0f4 +#define XK_otilde 0x0f5 +#define XK_odiaeresis 0x0f6 +#define XK_division 0x0f7 +#define XK_oslash 0x0f8 +#define XK_ugrave 0x0f9 +#define XK_uacute 0x0fa +#define XK_ucircumflex 0x0fb +#define XK_udiaeresis 0x0fc +#define XK_yacute 0x0fd +#define XK_thorn 0x0fe +#define XK_ydiaeresis 0x0ff + +#endif /*]*/ diff --git a/src/include/lib3270/action_table.h b/src/include/lib3270/action_table.h new file mode 100644 index 0000000..3c0b1f5 --- /dev/null +++ b/src/include/lib3270/action_table.h @@ -0,0 +1,91 @@ +/* + * "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 actions.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) + * licinio@bb.com.br (Licínio Luis Branco) + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) + * + */ + + /* + * Action call table. + * + * Usually this definitions are used to declare lib3270's action table but, + * if you redefine the creation macros it can be used to build a callback + * table for g_object_connect calls. + * + */ + + /* Keyboard actions */ + DECLARE_LIB3270_KEY_ACTION( enter ) + + DECLARE_LIB3270_FKEY_ACTION( pfkey ) + DECLARE_LIB3270_FKEY_ACTION( pakey ) + + /* Cursor movement */ + DECLARE_LIB3270_CURSOR_ACTION( up ) + DECLARE_LIB3270_CURSOR_ACTION( down ) + DECLARE_LIB3270_CURSOR_ACTION( left ) + DECLARE_LIB3270_CURSOR_ACTION( right ) + DECLARE_LIB3270_CURSOR_ACTION( newline ) + + /* Misc actions */ + DECLARE_LIB3270_ACTION( kybdreset ) + DECLARE_LIB3270_ACTION( clear ) + DECLARE_LIB3270_ACTION( eraseinput ) + + DECLARE_LIB3270_ACTION( select_field ) + DECLARE_LIB3270_ACTION( select_all ) + DECLARE_LIB3270_ACTION( unselect ) + DECLARE_LIB3270_ACTION( reselect ) + + DECLARE_LIB3270_ACTION( firstfield ) + DECLARE_LIB3270_ACTION( eraseeof ) + DECLARE_LIB3270_ACTION( eraseeol ) + DECLARE_LIB3270_ACTION( erase ) + DECLARE_LIB3270_ACTION( delete ) + DECLARE_LIB3270_ACTION( dup ) + DECLARE_LIB3270_ACTION( fieldmark ) + + DECLARE_LIB3270_ACTION( backspace ) + DECLARE_LIB3270_ACTION( previousword ) + DECLARE_LIB3270_ACTION( nextword ) + DECLARE_LIB3270_ACTION( fieldend ) + + DECLARE_LIB3270_ACTION( nextfield ) + DECLARE_LIB3270_ACTION( previousfield ) + + DECLARE_LIB3270_ACTION( attn ) + DECLARE_LIB3270_ACTION( break ) + DECLARE_LIB3270_ACTION( pastenext ) + + DECLARE_LIB3270_ACTION( deleteword ) + DECLARE_LIB3270_ACTION( deletefield ) + DECLARE_LIB3270_ACTION( sysreq ) + + DECLARE_LIB3270_ACTION( testpattern ) + DECLARE_LIB3270_ACTION( charsettable ) + + diff --git a/src/include/lib3270/actions.h b/src/include/lib3270/actions.h new file mode 100644 index 0000000..ce16be4 --- /dev/null +++ b/src/include/lib3270/actions.h @@ -0,0 +1,58 @@ +/* + * "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 actions.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) + * licinio@bb.com.br (Licínio Luis Branco) + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) + * + */ + +#ifdef __cplusplus + extern "C" { +#endif + + // Standard actions + #define DECLARE_LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession); + #define LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession) + + // Single key actions + #define DECLARE_LIB3270_KEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession); + #define LIB3270_KEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession) + + // Cursor actions + #define DECLARE_LIB3270_CURSOR_ACTION( name ) LIB3270_EXPORT int lib3270_cursor_ ## name (H3270 *hSession); + #define LIB3270_CURSOR_ACTION( name ) LIB3270_EXPORT int lib3270_cursor_ ## name (H3270 *hSession) + + // PF & PA key actions + #define DECLARE_LIB3270_FKEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession, int key); + #define LIB3270_FKEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession, int key) + + // Load action table entries + #include + +#ifdef __cplusplus + } +#endif diff --git a/src/include/lib3270/charset.h b/src/include/lib3270/charset.h new file mode 100644 index 0000000..d555886 --- /dev/null +++ b/src/include/lib3270/charset.h @@ -0,0 +1,74 @@ +/* + * "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 charset.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * licinio@bb.com.br (Licínio Luis Branco) + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) + * + */ + +#ifndef LIB3270_CHARSET_H_INCLUDED + + #define LIB3270_CHARSET_H_INCLUDED 1 + +#ifdef __cplusplus + extern "C" { +#endif + + struct lib3270_charset + { + char * host; + char * display; + unsigned long cgcsgid; + + // Translation tables + unsigned short ebc2asc[256]; + unsigned short asc2ebc[256]; + + unsigned short asc2uc[256]; + + }; + + typedef enum + { + CS_ONLY, + FT_ONLY, + BOTH + } lib3270_remap_scope; + + LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name); + LIB3270_EXPORT const char * lib3270_get_host_charset(H3270 *hSession); + LIB3270_EXPORT void lib3270_reset_charset(H3270 *hSession, const char * host, const char * display, unsigned long cgcsgid); + + LIB3270_EXPORT void lib3270_remap_char(H3270 *hSession, unsigned short ebc, unsigned short iso, lib3270_remap_scope scope, unsigned char one_way); + LIB3270_EXPORT const char * lib3270_ebc2asc(H3270 *hSession, unsigned char *buffer, int sz); + LIB3270_EXPORT const char * lib3270_asc2ebc(H3270 *hSession, unsigned char *buffer, int sz); + + +#ifdef __cplusplus + } +#endif + +#endif // LIB3270_CHARSET_H_INCLUDED diff --git a/src/include/lib3270/filetransfer.h b/src/include/lib3270/filetransfer.h new file mode 100644 index 0000000..9b0a3ae --- /dev/null +++ b/src/include/lib3270/filetransfer.h @@ -0,0 +1,194 @@ +/* + * "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 filetransfer.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) + * licinio@bb.com.br (Licínio Luis Branco) + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) + * + */ + +#ifndef LIB3270_FILETRANSFER_INCLUDED + + #define LIB3270_FILETRANSFER_INCLUDED 1 + #include + #include + #include + + typedef enum _lib3270_FT_OPTION + { + LIB3270_FT_OPTION_SEND = 0x0000, + + LIB3270_FT_OPTION_RECEIVE = 0x0001, + LIB3270_FT_OPTION_ASCII = 0x0002, ///< @brief Convert to ascii + LIB3270_FT_OPTION_CRLF = 0x0004, ///< @brief Add crlf to each line + LIB3270_FT_OPTION_APPEND = 0x0008, + LIB3270_FT_OPTION_REMAP = 0x0010, ///< @brief Remap ASCII<->EBCDIC + LIB3270_FT_OPTION_UNIX = 0x0020, ///< @brief Unix text file + + LIB3270_FT_RECORD_FORMAT_DEFAULT = 0x0000, + LIB3270_FT_RECORD_FORMAT_FIXED = 0x0100, + LIB3270_FT_RECORD_FORMAT_VARIABLE = 0x0200, + LIB3270_FT_RECORD_FORMAT_UNDEFINED = 0x0300, + + LIB3270_FT_ALLOCATION_UNITS_DEFAULT = 0x0000, + LIB3270_FT_ALLOCATION_UNITS_TRACKS = 0x1000, + LIB3270_FT_ALLOCATION_UNITS_CYLINDERS = 0x2000, + LIB3270_FT_ALLOCATION_UNITS_AVBLOCK = 0x3000 + + } LIB3270_FT_OPTION; + + #define LIB3270_FT_ALLOCATION_UNITS_MASK LIB3270_FT_ALLOCATION_UNITS_AVBLOCK + #define LIB3270_FT_RECORD_FORMAT_MASK LIB3270_FT_RECORD_FORMAT_UNDEFINED + + typedef enum _lib3270_ft_value + { + + LIB3270_FT_VALUE_LRECL, + LIB3270_FT_VALUE_BLKSIZE, + LIB3270_FT_VALUE_PRIMSPACE, + LIB3270_FT_VALUE_SECSPACE, + LIB3270_FT_VALUE_DFT, + + LIB3270_FT_VALUE_COUNT + + } LIB3270_FT_VALUE; + + typedef enum _lib3270_ft_state + { + LIB3270_FT_STATE_NONE, /**< No transfer in progress */ + LIB3270_FT_STATE_AWAIT_ACK, /**< IND$FILE sent, awaiting acknowledgement message */ + LIB3270_FT_STATE_RUNNING, /**< Ack received, data flowing */ + LIB3270_FT_STATE_ABORT_WAIT, /**< Awaiting chance to send an abort */ + LIB3270_FT_STATE_ABORT_SENT /**< Abort sent; awaiting response */ + } LIB3270_FT_STATE; + + #define LIB3270_XLATE_NBUF 4 + + struct lib3270_ft_callbacks + { + void (*complete)(H3270 *hSession, unsigned long length,double kbytes_sec,const char *msg, void *userdata); + void (*failed)(H3270 *hSession, unsigned long length,double kbytes_sec,const char *msg, void *userdata); + void (*message)(H3270 *hSession, const char *msg, void *userdata); + void (*update)(H3270 *hSession, unsigned long current, unsigned long length, double kbytes_sec, void *userdata); + void (*running)(H3270 *hSession, int is_cut, void *userdata); + void (*aborting)(H3270 *hSession, void *userdata); + void (*state_changed)(H3270 *hSession, LIB3270_FT_STATE state, const char *text, void *userdata); + }; + + /** + * @brief File transfer data. + * + */ + struct _h3270ft + { + struct lib3270_ft_callbacks cbk; ///< @brief Callback table - Always the first one. + + int ft_last_cr : 1; ///< @brief CR was last char in local file + int remap_flag : 1; ///< @brief Remap ASCII<->EBCDIC + int cr_flag : 1; ///< @brief Add crlf to each line + int unix_text : 1; ///< @brief Following the convention for UNIX text files. + int message_flag : 1; ///< @brief Open Request for msg received + int ascii_flag : 1; ///< @brief Convert to ascii + int ft_is_cut : 1; ///< @brief File transfer is CUT-style + int dft_eof : 1; + + + H3270 * host; + void * user_data; ///< @brief File transfer dialog handle + FILE * local_file; ///< @brief File descriptor for local file + unsigned long length; ///< @brief File length + + LIB3270_FT_STATE state; + LIB3270_FT_OPTION flags; + + int lrecl; + int blksize; + int primspace; + int secspace; + int dft; + + unsigned long ft_length; ///< Length of transfer + + struct timeval starting_time; ///< Starting time + + const char * local; ///< Local filename + const char * remote; ///< Remote filename + + // ft_dft.c + char * abort_string; + unsigned long recnum; + unsigned char * dft_savebuf; + int dft_savebuf_len; + int dft_savebuf_max; + + // ft_cut.c + int quadrant; + unsigned long expanded_length; + char * saved_errmsg; + int xlate_buffered; ///< buffer count + int xlate_buf_ix; ///< buffer index + unsigned char xlate_buf[LIB3270_XLATE_NBUF]; ///< buffer + + // Charset + struct lib3270_charset charset; + + }; + + + + /** + * Create a new file transfer session. + * + * @param session + * @param flags + * @param local + * @param remote + * @param lrecl + * @param blksize + * @param primspace + * @param secspace + * @param dft + * @param msg Pointer to receive message text. + * + * @return Filetransfer callback table + * + */ + LIB3270_EXPORT H3270FT * lib3270_ft_new(H3270 *hSession, LIB3270_FT_OPTION flags, const char *local, const char *remote, int lrecl, int blksize, int primspace, int secspace, int dft, const char **msg); + + LIB3270_EXPORT int lib3270_ft_start(H3270 *hSession); + LIB3270_EXPORT int lib3270_ft_destroy(H3270 *hSession); + + LIB3270_EXPORT int lib3270_ft_cancel(H3270 *hSession, int force); + + LIB3270_EXPORT void lib3270_ft_set_user_data(H3270 *h, void *ptr); + LIB3270_EXPORT void * lib3270_ft_get_user_data(H3270 *h); + + LIB3270_EXPORT LIB3270_FT_STATE lib3270_get_ft_state(H3270 *session); + + LIB3270_EXPORT struct lib3270_ft_callbacks * lib3270_get_ft_callbacks(H3270 *session, unsigned short sz); + + +#endif // LIB3270_FILETRANSFER_INCLUDED diff --git a/src/include/lib3270/html.h b/src/include/lib3270/html.h new file mode 100644 index 0000000..d4c5072 --- /dev/null +++ b/src/include/lib3270/html.h @@ -0,0 +1,53 @@ +/* + * "Software G3270, 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 html.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * + */ + +#ifndef LIB3270_HTML_H_INCLUDED + + #define LIB3270_HTML_H_INCLUDED 1 + +#ifdef __cplusplus + extern "C" { +#endif + + typedef enum _lib3270_html_option + { + LIB3270_HTML_OPTION_ALL = 0x0001, + LIB3270_HTML_OPTION_HEADERS = 0x0002, + LIB3270_HTML_OPTION_FORM = 0x0004, + + } LIB3270_HTML_OPTION; + + + LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option); + +#ifdef __cplusplus + } +#endif + +#endif // LIB3270_HTML_H_INCLUDED + diff --git a/src/include/lib3270/internals.h b/src/include/lib3270/internals.h new file mode 100644 index 0000000..135c366 --- /dev/null +++ b/src/include/lib3270/internals.h @@ -0,0 +1,48 @@ +/* + * "Software G3270, 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 internals.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * + */ + +#ifndef LIB3270_INTERNALS_H_INCLUDED + + #define LIB3270_INTERNALS_H_INCLUDED 1 + +#ifdef __cplusplus + extern "C" { +#endif + + LIB3270_EXPORT void lib3270_data_recv(H3270 *hSession, size_t nr, const unsigned char *netrbuf); + LIB3270_EXPORT void lib3270_set_disconnected(H3270 *hSession); + LIB3270_EXPORT void lib3270_set_connected(H3270 *hSession); + LIB3270_EXPORT void lib3270_setup_session(H3270 *session); + + +#ifdef __cplusplus + } +#endif + +#endif // LIB3270_HTML_H_INCLUDED + diff --git a/src/include/lib3270/log.h b/src/include/lib3270/log.h new file mode 100644 index 0000000..7a69ea2 --- /dev/null +++ b/src/include/lib3270/log.h @@ -0,0 +1,80 @@ +/* + * "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 log.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + + #ifndef LIB3270_LOG_H_INCLUDED + + #include + + #define LIB3270_LOG_H_INCLUDED 1 + + #ifdef ANDROID + + #include + + #define DEBUG 1 + + #define lib3270_write_log(s,m,f,...) __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", __VA_ARGS__ ) + #define lib3270_write_rc(s,m,r,f,...) __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", __VA_ARGS__ ) + #define lib3270_write_va_log(s,m,f,a) __android_log_vprint(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", a) + + // #define trace( fmt, ... ) __android_log_print(ANDROID_LOG_DEBUG, PACKAGE_NAME, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); + #define trace(x, ...) // __VA_ARGS__ + + #else + + #ifdef __cplusplus + extern "C" { + #endif + + LIB3270_EXPORT void lib3270_set_log_handler(void (*loghandler)(H3270 *, const char *, int, const char *, va_list)); + LIB3270_EXPORT int lib3270_write_log(H3270 *session, const char *module, const char *fmt, ...) LIB3270_GNUC_FORMAT(3,4); + LIB3270_EXPORT int lib3270_write_rc(H3270 *session, const char *module, int rc, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5); + LIB3270_EXPORT void lib3270_write_va_log(H3270 *session, const char *module, const char *fmt, va_list arg); + + #ifdef DEBUG + #include + #undef trace + #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); + #define debug( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); + #else + #undef trace + #define trace(x, ...) // __VA_ARGS__ + #define debug(x, ...) // __VA_ARGS__ + #endif + + #ifdef __cplusplus + } + #endif + + #endif // ANDROID + + + #endif // LIB3270_LOG_H_INCLUDED + + diff --git a/src/include/lib3270/macros.h b/src/include/lib3270/macros.h new file mode 100644 index 0000000..7af7523 --- /dev/null +++ b/src/include/lib3270/macros.h @@ -0,0 +1,36 @@ +/* + * "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 macros.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) + * licinio@bb.com.br (Licínio Luis Branco) + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) + * + */ + + #define LIB3270_MACRO( name ) LIB3270_EXPORT char * lib3270_macro_ ## name (H3270 *hSession, int argc, const char **argv) + + LIB3270_EXPORT char * lib3270_run_macro(H3270 *session, const char **argv); + diff --git a/src/include/lib3270/popup.h b/src/include/lib3270/popup.h new file mode 100644 index 0000000..644dd3f --- /dev/null +++ b/src/include/lib3270/popup.h @@ -0,0 +1,76 @@ +/* + * "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 api.h e possui 444 linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) + * licinio@bb.com.br (Licínio Luis Branco) + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) + * + */ + +#ifndef LIB3270_POPUP_INCLUDED + + #define LIB3270_POPUP_INCLUDED 1 + +#ifdef __cplusplus + extern "C" { +#endif + + /** + * Notification message types. + * + */ + typedef enum _LIB3270_NOTIFY + { + LIB3270_NOTIFY_INFO, /**< Simple information dialog */ + LIB3270_NOTIFY_WARNING, + LIB3270_NOTIFY_ERROR, + LIB3270_NOTIFY_CRITICAL, /**< Critical error, user can abort application */ + + LIB3270_NOTIFY_USER /**< Reserved, always the last one */ + } LIB3270_NOTIFY; + + LIB3270_EXPORT void lib3270_set_popup_handler(int (*popup_handler)(H3270 *, void *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)); + + /** + * Pop up an error dialog, based on an error number. + * + * @param hSession Session handle + * @param errn Error number (errno). + * @param fmt Message format + * @param ... Arguments for message + */ + LIB3270_EXPORT void lib3270_popup_an_errno(H3270 *hSession, int errn, const char *fmt, ...); + + LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); + + LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); + +#ifdef __cplusplus + } +#endif + +#endif // LIB3270_POPUP_INCLUDED + + diff --git a/src/include/lib3270/selection.h b/src/include/lib3270/selection.h new file mode 100644 index 0000000..e90ae34 --- /dev/null +++ b/src/include/lib3270/selection.h @@ -0,0 +1,153 @@ +/* + * "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 selection.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * licinio@bb.com.br (Licínio Luis Branco) + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) + * + */ + + #ifndef LIB3270_SELECTION_H_INCLUDED + + #define LIB3270_SELECTION_H_INCLUDED 1 + + LIB3270_EXPORT int lib3270_unselect(H3270 *session); + LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr); + LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr); + LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr); + LIB3270_EXPORT int lib3270_select_field(H3270 *session); + LIB3270_EXPORT int lib3270_select_all(H3270 *session); + + /** + * "Paste" supplied string. + * + * @param h Session handle. + * @param str String to paste. + * + * @see lib3270_pastenext. + * + * @return Non 0 if there's more to paste with lib3270_pastenext + * + */ + LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str); + + /** + * Paste remaining string. + * + * @param h Session handle. + * + * @see lib3270_paste. + * + * @return Non 0 if there's more to paste. + * + */ + LIB3270_EXPORT int lib3270_pastenext(H3270 *h); + + /** + * Move selected box 1 char in the selected direction. + * + * @param h Session handle. + * @param dir Direction to move + * + * @return 0 if the movement can be done, non zero if failed. + */ + LIB3270_EXPORT int lib3270_move_selection(H3270 *h, LIB3270_DIRECTION dir); + + /** + * Move selected box. + * + * @param h Session handle. + * @param from Address of origin position inside the selected buffer. + * @param to Address of the new origin position. + * + * @return The new origin position. + * + */ + LIB3270_EXPORT int lib3270_move_selected_area(H3270 *h, int from, int to); + + /** + * Drag selected region. + * + * Move or resize selected box according to the selection flags. + * + * @param h Session handle. + * @param flag Selection flag. + * @param origin Reference position (got from mouse button down or other move action). + * @param baddr New position. + * + * @return The new reference position. + * + */ + LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int origin, int baddr); + + /** + * Gets the selected range of characters in the screen + * + * @param h Session handle. + * @param start return location for start of selection, as a character offset. + * @param end return location for end of selection, as a character offset. + * + * @return Non 0 if selection is non-empty + * + */ + LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int *end); + + /** + * Get bitmasked flag for the current selection. + * + * Calculate flags to help drawing of the correct mouse pointer over a selection. + * + * @param h Session handle. + * @param baddr Position. + * + * @return bitmask for mouse pointer. + */ + LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *h, int baddr); + + /** + * Get a string from required region. + * + * @param h Session handle. + * @param start_pos First char to get. + * @param end_pos Last char to get. + * @param all zero to get only selected chars. + * + * @return String with selected region (release it with free() + * + */ + LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, unsigned char all); + + + /** + * Selects a range of characters in the screen. + * + * @param h Session handle. + * @param start_offset Start offset. + * @param end_offset : End offset. + * + */ + LIB3270_EXPORT int lib3270_select_region(H3270 *h, int start, int end); + + #endif // LIB3270_SELECTION_H_INCLUDED diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h new file mode 100644 index 0000000..0fe758e --- /dev/null +++ b/src/include/lib3270/session.h @@ -0,0 +1,96 @@ +/* + * "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 session.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + + #ifndef LIB3270_SESSION_H_INCLUDED + + #define LIB3270_SESSION_H_INCLUDED 1 + + #ifdef WIN32 + #include + #include + #include + #else + #include + #endif // WIN32 + + #include + + struct lib3270_session_callbacks + { + int (*write)(H3270 *hSession, unsigned const char *buf, int len); + void (*disconnect)(H3270 *hSession); + + void (*configure)(H3270 *session, unsigned short rows, unsigned short cols); + void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor); + void (*changed)(H3270 *session, int offset, int len); + void (*display)(H3270 *session); + void (*set_width)(H3270 *session, int width); + + void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); + void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on); + void (*update_toggle)(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name); + void (*update_luname)(H3270 *session, const char *name); + void (*update_status)(H3270 *session, LIB3270_MESSAGE id); + void (*update_connect)(H3270 *session, unsigned char connected); + void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols); + void (*update_selection)(H3270 *session, int start, int end); + void (*update_ssl)(H3270 *session, LIB3270_SSL_STATE state); + + void (*set_timer)(H3270 *session, unsigned char on); + void (*erase)(H3270 *session); + void (*suspend)(H3270 *session); + void (*resume)(H3270 *session); + void (*cursor)(H3270 *session, LIB3270_POINTER id); + void (*set_selection)(H3270 *session, unsigned char on); + void (*ctlr_done)(H3270 *session); + void (*autostart)(H3270 *session); + int (*print)(H3270 *session); + + void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text); + + }; + + /** + * Register application Handlers. + * + * @param cbk Structure with the application I/O handles to set. + * + * @return 0 if ok, error code if not. + * + */ + int LIB3270_EXPORT lib3270_set_session_callbacks(const struct lib3270_callbacks *cbk); + + LIB3270_EXPORT int lib3270_getpeername(H3270 *hSession, struct sockaddr *addr, socklen_t *addrlen); + LIB3270_EXPORT int lib3270_getsockname(H3270 *hSession, struct sockaddr *addr, socklen_t *addrlen); + + LIB3270_EXPORT struct lib3270_session_callbacks * lib3270_get_session_callbacks(H3270 *session, unsigned short sz); + +#endif // LIB3270_SESSION_H_INCLUDED + + diff --git a/src/include/lib3270/trace.h b/src/include/lib3270/trace.h new file mode 100644 index 0000000..576c01a --- /dev/null +++ b/src/include/lib3270/trace.h @@ -0,0 +1,95 @@ +/* + * "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 session.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) + * + */ + +#ifndef LIB3270_TRACE_H_INCLUDED + + #define LIB3270_TRACE_H_INCLUDED 1 + +#ifdef __cplusplus + extern "C" { +#endif + +#ifdef _WIN32 + #define LIB3270_AS_PRINTF(a,b) /* __attribute__((format(printf, a, b))) */ +#else + #define LIB3270_AS_PRINTF(a,b) __attribute__((format(printf, a, b))) +#endif + + typedef void (*LIB3270_TRACE_HANDLER)(H3270 *, const char *, va_list); + + + /** + * Set trace handle callback. + * + * @param handle Callback to write in trace file or show trace window (NULL send all trace to stdout/syslog). + * @param data User data to pass to the trace handler. + * + * @return Current trace handler + */ + LIB3270_EXPORT LIB3270_TRACE_HANDLER lib3270_set_trace_handler( LIB3270_TRACE_HANDLER handler); + + /** + * Write on trace file. + * + * Write text on trace file, if DStrace is enabled. + * + * @param fmt String format. + * @param ... Arguments. + * + */ + LIB3270_EXPORT void lib3270_write_dstrace(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3); + + /** + * Write on trace file. + * + * Write text on trace file, if network trace is enabled. + * + * @param fmt String format. + * @param ... Arguments. + * + */ + LIB3270_EXPORT void lib3270_write_nettrace(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3); + + /** + * Write on trace file. + * + * Write text on trace file, if event is enabled. + * + * @param fmt String format. + * @param ... Arguments. + * + */ + LIB3270_EXPORT void lib3270_trace_event(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3); + +#ifdef __cplusplus + } +#endif + +#endif // LIB3270_TRACE_H_INCLUDED diff --git a/src/include/private.h b/src/include/private.h deleted file mode 100644 index 2b55a47..0000000 --- a/src/include/private.h +++ /dev/null @@ -1,656 +0,0 @@ -/* - * "Software G3270, 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 private.h e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) - * - */ - -#ifdef WIN32 - #include - #include -#endif // WIN32 - -/* Autoconf settings. */ -#include /* autoconf settings */ -#include /* lib3270 API calls and defs */ -#include -#include "api.h" - -#if defined(X3270_TN3270E) && !defined(X3270_ANSI) /*[*/ - #define X3270_ANSI 1 /* RFC2355 requires NVT mode */ -#endif /*]*/ - -#if defined(HAVE_VASPRINTF) && !defined(_GNU_SOURCE) /*[*/ - #define _GNU_SOURCE /* vasprintf isn't POSIX */ -#endif /*]*/ - -/* - * gettext stuff - */ -#ifdef ANDROID - #undef HAVE_LIBINTL - #undef HAVE_LIBSSL -#endif - -#ifdef HAVE_LIBINTL - #include - #define _( x ) gettext(x) - #define N_( x ) x -#else - #define _( x ) x - #define N_( x ) x -#endif // HAVE_LIBINTL - -#define action_name(x) #x - -/* - * OS-specific #defines. Except for the blocking-connect workarounds, these - * should be replaced with autoconf probes as soon as possible. - */ - -/* - * BLOCKING_CONNECT_ONLY - * Use only blocking sockets. - */ -#if defined(sco) /*[*/ - #define BLOCKING_CONNECT_ONLY 1 -#endif /*]*/ - -#if defined(apollo) /*[*/ - #define BLOCKING_CONNECT_ONLY 1 -#endif /*]*/ - -/* - * Compiler-specific #defines. - */ - -/* 'unused' explicitly flags an unused parameter */ -#if defined(__GNUC__) /*[*/ - #define unused __attribute__((__unused__)) - #define printflike(s,f) __attribute__ ((__format__ (__printf__, s, f))) -#else /*][*/ - #define unused /* nothing */ - #define printflike(s, f) /* nothing */ -#endif /*]*/ - - - -/* - * Prerequisite #includes. - */ -#include /* Unix standard I/O library */ -#include /* Unix system calls */ -#include /* Character classes */ -#include /* String manipulations */ -#include /* Basic system data types */ -#include /* System time-related data types */ -#include /* C library time functions */ -#include "localdefs.h" /* {s,tcl,c}3270-specific defines */ - -/* - * Cancel out contradictory parts. - */ -#if !defined(X3270_DISPLAY) /*[*/ - #undef X3270_KEYPAD - #undef X3270_MENUS -#endif /*]*/ - -/* types of internal actions */ -enum iaction { - IA_STRING, IA_PASTE, IA_REDRAW, - IA_KEYPAD, IA_DEFAULT, IA_KEY, - IA_MACRO, IA_SCRIPT, IA_PEEK, - IA_TYPEAHEAD, IA_FT, IA_COMMAND, IA_KEYMAP, - IA_IDLE -}; - -// Version strings -LIB3270_INTERNAL const char * build; -LIB3270_INTERNAL const char * app_defaults_version; -LIB3270_INTERNAL const char * sccsid; -LIB3270_INTERNAL const char * build_rpq_timestamp; -LIB3270_INTERNAL const char * build_rpq_version; -LIB3270_INTERNAL const char * build_rpq_revision; - -#if defined(X3270_DBCS) /*[*/ - LIB3270_INTERNAL Boolean dbcs; -#endif /*]*/ - - -/* toggle names */ -struct toggle_name { - const char *name; - int index; -}; - - -/* input key type */ - -/* Naming convention for private actions. */ -#define PA_PFX "PA-" - -/// @brief Shorthand macros -#define CN ((char *) NULL) -#define PN ((XtPointer) NULL) -#define Replace(var, value) { lib3270_free(var); var = (value); }; - -/// @brief Configuration change masks. -#define NO_CHANGE 0x0000 /// @brief no change -#define MODEL_CHANGE 0x0001 /// @brief screen dimensions changed -#define FONT_CHANGE 0x0002 /// @brief emulator font changed -#define COLOR_CHANGE 0x0004 /// @brief color scheme or 3278/9 mode changed -#define SCROLL_CHANGE 0x0008 /// @brief scrollbar snapped on or off -#define CHARSET_CHANGE 0x0010 /// @brief character set changed -#define ALL_CHANGE 0xffff /// @brief everything changed - -/* Portability macros */ - -/* Equivalent of setlinebuf */ - -#if defined(_IOLBF) /*[*/ - #define SETLINEBUF(s) setvbuf(s, (char *)NULL, _IOLBF, BUFSIZ) -#else /*][*/ - #define SETLINEBUF(s) setlinebuf(s) -#endif /*]*/ - -/* Motorola version of gettimeofday */ - -#if defined(MOTOROLA) - #define gettimeofday(tp,tz) gettimeofday(tp) -#endif - -/* Default DFT file transfer buffer size. */ -#if defined(X3270_FT) && !defined(DFT_BUF) /*[*/ - #define DFT_BUF (4 * 1024) -#endif /*]*/ - -/* DBCS Preedit Types */ -#if defined(X3270_DBCS) /*[*/ - #define PT_ROOT "Root" - #define PT_OVER_THE_SPOT "OverTheSpot" - #define PT_OFF_THE_SPOT "OffTheSpot" - #define PT_ON_THE_SPOT "OnTheSpot" -#endif /*]*/ - -/** input key type */ -enum keytype -{ - KT_STD, - KT_GE -}; - -LIB3270_INTERNAL struct _ansictl -{ - char vintr; - char vquit; - char verase; - char vkill; - char veof; - char vwerase; - char vrprnt; - char vlnext; -} ansictl; - -/** @brief Extended attributes */ -struct lib3270_ea -{ - unsigned char cc; ///< @brief EBCDIC or ASCII character code - unsigned char fa; ///< @brief field attribute, it nonzero - unsigned char fg; ///< @brief foreground color (0x00 or 0xf) - unsigned char bg; ///< @brief background color (0x00 or 0xf) - unsigned char gr; ///< @brief ANSI graphics rendition bits - unsigned char cs; ///< @brief character set (GE flag, or 0..2) - unsigned char ic; ///< @brief input control (DBCS) - unsigned char db; ///< @brief DBCS state -}; - -struct lib3270_text -{ - unsigned char chr; ///< @brief ASCII character code - unsigned short attr; ///< @brief Converted character attribute (color & etc) -}; - -#ifndef HEADER_SSL_H - #define SSL void -#endif // !HEADER_SSL_H - -#ifndef LIB3270_TA - #define LIB3270_TA void -#endif // !LIB3270_TA - -#define LIB3270_MB_MAX 16 -#define LIB3270_DEFAULT_CGEN 0x02b90000 -#define LIB3270_DEFAULT_CSET 0x00000025 - -#define LIB3270_FULL_MODEL_NAME_LENGTH 13 -#define LIB3270_LU_MAX 32 - -#define LIB3270_TELNET_N_OPTS 256 - -/** - * - * @brief Timeout control structure. - * - */ -typedef struct timeout -{ - struct timeout *next; - -#if defined(_WIN32) /*[*/ - unsigned long long ts; -#else /*][*/ - struct timeval tv; -#endif /*]*/ - - void (*proc)(H3270 *session); - - H3270 *session; - - unsigned char in_play; -} timeout_t; - - -/** - * - * @brief I/O events. - * - */ -typedef struct input -{ - struct input * next; - H3270 * session; - int fd; - LIB3270_IO_FLAG flag; - void * userdata; - - void (*call)(H3270 *, int, LIB3270_IO_FLAG, void *); - -} input_t; - - -/** - * - * @brief lib3270 session data - * - */ -struct _h3270 -{ - struct lib3270_session_callbacks cbk; // Callback table - Always the first one. - -// unsigned short sz; /**< Struct size */ - - // Connection info - int sock; /**< Network socket */ - LIB3270_CSTATE cstate; /**< Connection state */ - - // flags - LIB3270_OPTION options; /**< Session options */ - - int bgthread : 1; /**< Running on a background thread ? */ - int selected : 1; /**< Has selected region? */ - int rectsel : 1; /**< Selected region is a rectangle ? */ - int vcontrol : 1; /**< Visible control ? */ - int modified_sel : 1; - int mono : 1; /**< Forces monochrome display */ - int m3279 : 1; - int extended : 1; - int typeahead : 1; - int numeric_lock : 1; - int oerr_lock : 1; - int unlock_delay : 1; - int auto_reconnect_inprogress : 1; - unsigned int colors : 5; - int apl_mode : 1; - int icrnl : 1; - int inlcr : 1; - int onlcr : 1; - int bsd_tm : 1; - int syncing : 1; - int reverse : 1; /**< reverse-input mode */ - int dbcs : 1; - int linemode : 1; - int trace_skipping : 1; - int need_tls_follows : 1; - int cut_xfer_in_progress : 1; -// int auto_keymap : 1; - int formatted : 1; /**< Formatted screen flag */ - int starting : 1; /**< Is starting (no first screen)? */ - - char * oversize; - - LIB3270_SSL_STATE secure; - - struct lib3270_toggle - { - char value; /**< toggle value */ - void (*upcall)(H3270 *, struct lib3270_toggle *, LIB3270_TOGGLE_TYPE); /**< change value */ - } toggle[LIB3270_TOGGLE_COUNT]; - - // Network & Termtype - char * connected_type; - char * connected_lu; - char luname[LIB3270_LUNAME_LENGTH+1]; - - char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1]; - char * model_name; - int model_num; - char * termtype; - - struct - { - char * current; /**< The hostname part, stripped of qualifiers, luname and port number */ - char * full; /**< The entire string, for use in reconnecting */ - char * srvc; /**< The service name */ - char * qualified; - } host; - - char * proxy; /**< Proxy server (type:host[:port]) */ - char * termname; - - struct lib3270_charset charset; - - LIB3270_MESSAGE oia_status; - - unsigned char oia_flag[LIB3270_FLAG_COUNT]; - - unsigned short current_port; - - // Misc - H3270FT * ft; /**< Active file transfer data */ - - // screen info - int ov_rows; - int ov_cols; - int maxROWS; - int maxCOLS; - unsigned short rows; - unsigned short cols; - unsigned short pointer; /**< @brief Current pointer. */ - int cursor_addr; - int buffer_addr; - char flipped; - int screen_alt; /**< alternate screen? */ - int is_altbuffer; - - // Screen contents - void * buffer[2]; /**< Internal buffers */ - struct lib3270_ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */ - struct lib3270_ea * aea_buf; /**< alternate 3270 extended attribute buffer */ - struct lib3270_text * text; /**< Converted 3270 chars */ - - // host.c - char std_ds_host; - char no_login_host; - char non_tn3270e_host; - char passthru_host; - char ssl_host; - char ever_3270; - - // ctlr.c - int sscp_start; - unsigned char default_fg; - unsigned char default_bg; - unsigned char default_gr; - unsigned char default_cs; - unsigned char default_ic; - char reply_mode; - int trace_primed : 1; - int ticking : 1; - int mticking : 1; - int crm_nattr; - unsigned char crm_attr[16]; - unsigned char * zero_buf; /**< empty buffer, for area clears */ - - struct timeval t_start; - void * tick_id; - struct timeval t_want; - - // Telnet.c - unsigned char * ibuf; - int ibuf_size; /**< size of ibuf */ - unsigned char * obuf; /**< 3270 output buffer */ - unsigned char * obptr; - time_t ns_time; - int ns_brcvd; - int ns_rrcvd; - int ns_bsent; - int ns_rsent; - struct timeval ds_ts; - unsigned long e_funcs; /**< negotiated TN3270E functions */ - unsigned short e_xmit_seq; /**< transmit sequence number */ - int response_required; - int tn3270e_bound; - int tn3270e_negotiated; - int ansi_data; - int lnext; - int backslashed; - char plu_name[LIB3270_BIND_PLU_NAME_MAX+1]; - char **lus; - char **curr_lu; - char * try_lu; - int proxy_type; - char * proxy_host; - char * proxy_portname; - unsigned short proxy_port; - char reported_lu[LIB3270_LU_MAX+1]; - char reported_type[LIB3270_LU_MAX+1]; - - enum - { - E_NONE, - E_3270, - E_NVT, - E_SSCP - } tn3270e_submode; - - unsigned char * lbuf; /**< line-mode input buffer */ - unsigned char * lbptr; - - - // 3270 input buffer - unsigned char * ibptr; - unsigned char * obuf_base; - int obuf_size; -// unsigned char * netrbuf; - - // network input buffer - unsigned char * sbbuf; - - // telnet sub-option buffer - unsigned char * sbptr; - unsigned char telnet_state; -// char ttype_tmpval[13]; - - unsigned char myopts[LIB3270_TELNET_N_OPTS]; - unsigned char hisopts[LIB3270_TELNET_N_OPTS]; - - // kybd.c - unsigned int kybdlock; ///< @brief keyboard lock state - unsigned char aid; ///< @brief current attention ID - void * unlock_id; - time_t unlock_delay_time; - unsigned long unlock_delay_ms; ///< @brief Delay before actually unlocking the keyboard after the host permits it. - LIB3270_TA * ta_head; - LIB3270_TA * ta_tail; - - // ft_dft.c - int dft_buffersize; ///< @brief Buffer size (LIMIN, LIMOUT) - - // rpq.c - int rpq_complained : 1; -#if !defined(_WIN32) - int omit_due_space_limit : 1; -#endif - - char * rpq_warnbuf; - int rpq_wbcnt; - - // User data (Usually points to session's widget) - void * user_data; - - // selection - char * paste_buffer; - struct - { - int start; - int end; - } select; - - // ansi.c - int scroll_top; - int scroll_bottom; - int once_cset; - int saved_cursor; - - int held_wrap : 1; - - int insert_mode : 1; - int auto_newline_mode : 1; - - int appl_cursor : 1; - int saved_appl_cursor : 1; - - int wraparound_mode : 1; - int saved_wraparound_mode : 1; - - int rev_wraparound_mode : 1; - int saved_rev_wraparound_mode : 1; - - int allow_wide_mode : 1; - int saved_allow_wide_mode : 1; - - int wide_mode : 1; - int saved_wide_mode : 1; - - int saved_altbuffer : 1; - int ansi_reset : 1; /**< Non zero if the ansi_reset() was called in this session */ - - int ansi_ch; - int cs_to_change; - - /** ANSI Character sets. */ - enum lib3270_ansi_cs - { - LIB3270_ANSI_CS_G0 = 0, - LIB3270_ANSI_CS_G1 = 1, - LIB3270_ANSI_CS_G2 = 2, - LIB3270_ANSI_CS_G3 = 3 - } cset; - enum lib3270_ansi_cs saved_cset; - - /** Character set designations. */ - enum lib3270_ansi_csd - { - LIB3270_ANSI_CSD_LD = 0, - LIB3270_ANSI_CSD_UK = 1, - LIB3270_ANSI_CSD_US = 2 - } csd[4]; - enum lib3270_ansi_csd saved_csd[4]; - - enum lib3270_ansi_state - { - LIB3270_ANSI_STATE_DATA = 0, - LIB3270_ANSI_STATE_ESC = 1, - LIB3270_ANSI_STATE_CSDES = 2, - LIB3270_ANSI_STATE_N1 = 3, - LIB3270_ANSI_STATE_DECP = 4, - LIB3270_ANSI_STATE_TEXT = 5, - LIB3270_ANSI_STATE_TEXT2 = 6, - LIB3270_ANSI_STATE_MBPEND = 7 - } state; - - unsigned char * tabs; - - int pmi; - char pending_mbs[LIB3270_MB_MAX]; - - unsigned char gr; - unsigned char saved_gr; - - unsigned char fg; - unsigned char saved_fg; - - unsigned char bg; - unsigned char saved_bg; - - // xio - void * ns_read_id; - void * ns_write_id; - void * ns_exception_id; - - // SSL Data (Always defined to mantain the same structure size) - unsigned long ssl_error; - SSL * ssl_con; - - timeout_t * timeouts; - input_t * inputs; - int inputs_changed : 1; - - // Callbacks. - struct lib3270_state_callback * st_callbacks[LIB3270_STATE_USER]; - struct lib3270_state_callback * st_last[LIB3270_STATE_USER]; - -}; - -/* Library internal calls */ -LIB3270_INTERNAL void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped); -LIB3270_INTERNAL void lib3270_initialize(void); -LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); - -LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); -LIB3270_INTERNAL void remove_input_calls(H3270 *session); - -LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf, int len); -LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession); - -LIB3270_INTERNAL int lib3270_default_event_dispatcher(H3270 *hSession, int block); - -#if defined(DEBUG) - #define CHECK_SESSION_HANDLE(x) check_session_handle(&x,__FUNCTION__); - LIB3270_INTERNAL void check_session_handle(H3270 **hSession, const char *fname); -#else - #define CHECK_SESSION_HANDLE(x) check_session_handle(&x); - LIB3270_INTERNAL void check_session_handle(H3270 **hSession); -#endif // DEBUG - -LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); - -#if defined(HAVE_LIBSSL) /*[*/ - - LIB3270_INTERNAL int ssl_init(H3270 *session); - LIB3270_INTERNAL int ssl_negotiate(H3270 *hSession); - LIB3270_INTERNAL void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state); - - - #if OPENSSL_VERSION_NUMBER >= 0x00907000L /*[*/ - #define INFO_CONST const - #else /*][*/ - #define INFO_CONST - #endif /*]*/ - - LIB3270_INTERNAL void ssl_info_callback(INFO_CONST SSL *s, int where, int ret); - -#endif /*]*/ - diff --git a/src/lib3270/XtGlue.c b/src/lib3270/XtGlue.c deleted file mode 100644 index 3c44587..0000000 --- a/src/lib3270/XtGlue.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * "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., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como XtGlue.c e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * licinio@bb.com.br (Licínio Luis Branco) - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) - * - */ - -#error Deprecated - -/* glue for missing Xt code */ -#if defined(_WIN32) - #include - #include -#endif // WIN32 - -#include "globals.h" -#include "api.h" -// #include - -#if defined(_WIN32) -// #include "appres.h" - #include "trace_dsc.h" - #include "xioc.h" -#endif - -#include "utilc.h" - -#include -// #include -#include -#include -#include "X11keysym.h" - -#include -#include -#include - -#include - -#if defined(_WIN32) /*[*/ - - #include - #include - #include - -#else /*][*/ - - #include - #include - #include - - #if defined(SEPARATE_SELECT_H) /*[*/ - #include - #endif /*]*/ -#endif /*]*/ - -#include "resolverc.h" - -/*---[ Implement external calls ]---------------------------------------------------------------------------*/ - -/* -const char * KeysymToString(KeySym k) -{ - int i; - - for (i = 0; latin1[i].name != (char *)NULL; i++) { - if (latin1[i].keysym == k) - return latin1[i].name; - } - return (char *)NULL; -} -*/ diff --git a/src/lib3270/apl.c b/src/lib3270/apl.c deleted file mode 100644 index b2985a2..0000000 --- a/src/lib3270/apl.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * "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., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como apl.c e possui 219 linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * licinio@bb.com.br (Licínio Luis Branco) - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) - * - */ - -/* - * apl.c - * This module handles APL-specific actions. - */ - -#include "globals.h" - -#if defined(X3270_APL) /*[*/ - -// #include - -#include "aplc.h" - - -/* - * APL keysym translation. - * - * This code looks a little odd because of how an APL font is implemented. - * An APL font has APL graphics in place of the various accented letters and - * special symbols in a regular font. APL keysym translation consists of - * taking the keysym name for an APL symbol (these names are meaningful only to - * x3270) and translating it into the keysym for the regular symbol that the - * desired APL symbol _replaces_. - * - * For example, an APL font has the APL "jot" symbol where a regular font has - * the "registered" symbol. So we take the keysym name "jot" and translate it - * into the keysym XK_registered. When the XK_registered symbol is displayed - * with an APL font, it appears as a "jot". - * - * The specification of which APL symbols replace which regular symbols is in - * IBM GA27-3831, 3174 Establishment Controller Character Set Reference. - * - * In addition, several standard characters have different names for APL, - * for example, "period" becomes "dot". These are included in the table as - * well. - */ - /* - -static struct { - const char *name; - KeySym keysym; - int is_ge; -} axl[] = { - { "Aunderbar", XK_nobreakspace, 1 }, - { "Bunderbar", XK_acircumflex, 1 }, - { "Cunderbar", XK_adiaeresis, 1 }, - { "Dunderbar", XK_agrave, 1 }, - { "Eunderbar", XK_aacute, 1 }, - { "Funderbar", XK_atilde, 1 }, - { "Gunderbar", XK_aring, 1 }, - { "Hunderbar", XK_ccedilla, 1 }, - { "Iunderbar", XK_ntilde, 1 }, - { "Junderbar", XK_eacute, 1 }, - { "Kunderbar", XK_ecircumflex, 1 }, - { "Lunderbar", XK_ediaeresis, 1 }, - { "Munderbar", XK_egrave, 1 }, - { "Nunderbar", XK_iacute, 1 }, - { "Ounderbar", XK_icircumflex, 1 }, - { "Punderbar", XK_idiaeresis, 1 }, - { "Qunderbar", XK_igrave, 1 }, - { "Runderbar", XK_ssharp, 1 }, - { "Sunderbar", XK_Acircumflex, 1 }, - { "Tunderbar", XK_Adiaeresis, 1 }, - { "Uunderbar", XK_Agrave, 1 }, - { "Vunderbar", XK_Aacute, 1 }, - { "Wunderbar", XK_Atilde, 1 }, - { "Xunderbar", XK_Aring, 1 }, - { "Yunderbar", XK_Ccedilla, 1 }, - { "Zunderbar", XK_Ntilde, 1 }, - { "alpha", XK_asciicircum, 1 }, - { "bar", XK_minus, 0 }, - { "braceleft", XK_braceleft, 1 }, - { "braceright", XK_braceright, 1 }, - { "bracketleft", XK_Yacute, 1 }, - { "bracketright", XK_diaeresis, 1 }, - { "circle", XK_cedilla, 1 }, - { "circlebar", XK_Ograve, 1 }, - { "circleslope", XK_otilde, 1 }, - { "circlestar", XK_Ugrave, 1 }, - { "circlestile", XK_ograve, 1 }, - { "colon", XK_colon, 0 }, - { "comma", XK_comma, 0 }, - { "commabar", XK_W, 1 }, // soliton - { "del", XK_bracketleft, 1 }, - { "delstile", XK_udiaeresis, 1 }, - { "delta", XK_bracketright, 1 }, - { "deltastile", XK_ugrave, 1 }, - { "deltaunderbar", XK_Udiaeresis, 1 }, - { "deltilde", XK_Ucircumflex, 1 }, - { "diaeresis", XK_Ecircumflex, 1 }, - { "diaeresiscircle", XK_V, 1 }, // soliton - { "diaeresisdot", XK_Odiaeresis, 1 }, - { "diaeresisjot", XK_U, 1 }, // soliton - { "diamond", XK_oslash, 1 }, - { "dieresis", XK_Ecircumflex, 1 }, - { "dieresisdot", XK_Odiaeresis, 1 }, - { "divide", XK_onehalf, 1 }, - { "dot", XK_period, 0 }, - { "downarrow", XK_guillemotright, 1 }, - { "downcaret", XK_Igrave, 1 }, - { "downcarettilde", XK_ocircumflex, 1 }, - { "downshoe", XK_questiondown, 1 }, - { "downstile", XK_thorn, 1 }, - { "downtack", XK_ETH, 1 }, - { "downtackjot", XK_Uacute, 1 }, - { "downtackup", XK_onesuperior, 1 }, - { "downtackuptack", XK_onesuperior, 1 }, - { "epsilon", XK_sterling, 1 }, - { "epsilonunderbar", XK_Iacute, 1 }, - { "equal", XK_equal, 0 }, - { "equalunderbar", XK_backslash, 1 }, - { "euro", XK_X, 1 }, // soliton - { "greater", XK_greater, 0 }, - { "iota", XK_yen, 1 }, - { "iotaunderbar", XK_Egrave, 1 }, - { "jot", XK_registered, 1 }, - { "leftarrow", XK_currency, 1 }, - { "leftbracket", XK_Yacute, 1 }, - { "leftparen", XK_parenleft, 0 }, - { "leftshoe", XK_masculine, 1 }, - { "lefttack", XK_Icircumflex, 1 }, - { "less", XK_less, 0 }, - { "multiply", XK_paragraph, 1 }, - { "notequal", XK_acute, 1 }, - { "notgreater", XK_eth, 1 }, - { "notless", XK_THORN, 1 }, - { "omega", XK_copyright, 1 }, - { "overbar", XK_mu, 1 }, - { "plus", XK_plus, 0 }, - { "plusminus", XK_AE, 1 }, - { "quad", XK_degree, 1 }, - { "quaddivide", XK_Oacute, 1 }, - { "quadjot", XK_Ediaeresis, 1 }, - { "quadquote", XK_uacute, 1 }, - { "quadslope", XK_oacute, 1 }, - { "query", XK_question, 0 }, - { "quote", XK_apostrophe, 0 }, - { "quotedot", XK_ucircumflex, 1 }, - { "rho", XK_periodcentered, 1 }, - { "rightarrow", XK_plusminus, 1 }, - { "rightbracket", XK_diaeresis, 1 }, - { "rightparen", XK_parenright, 0 }, - { "rightshoe", XK_ordfeminine, 1 }, - { "righttack", XK_Idiaeresis, 1 }, - { "semicolon", XK_semicolon, 0 }, - { "slash", XK_slash, 0 }, - { "slashbar", XK_twosuperior, 1 }, - { "slope", XK_onequarter, 1 }, - { "slopebar", XK_Ocircumflex, 1 }, - { "slopequad", XK_oacute, 1 }, - { "splat", XK_ae, 1 }, - { "squad", XK_odiaeresis, 1 }, - { "star", XK_asterisk, 0 }, - { "stile", XK_multiply, 1 }, - { "tilde", XK_Ooblique, 1 }, - { "times", XK_paragraph, 1 }, - { "underbar", XK_underscore, 0 }, - { "uparrow", XK_guillemotleft, 1 }, - { "upcaret", XK_Eacute, 1 }, - { "upcarettilde", XK_hyphen, 1 }, - { "upshoe", XK_exclamdown, 1 }, - { "upshoejot", XK_ydiaeresis, 1 }, - { "upstile", XK_yacute, 1 }, - { "uptack", XK_macron, 1 }, - { "uptackjot", XK_Otilde, 1 }, - { 0, 0 } -}; - -// -// Translation from APL ksysym names to indirect APL keysyms. -// -KeySym -APLStringToKeysym(char *s, int *is_gep) -{ - register int i; - - if (strncmp(s, "apl_", 4)) - return NoSymbol; - s += 4; - for (i = 0; axl[i].name; i++) - if (!strcmp(axl[i].name, s)) { - *is_gep = axl[i].is_ge; - return axl[i].keysym; - } - return NoSymbol; -} -*/ - -#endif /*]*/ diff --git a/src/lib3270/private.h b/src/lib3270/private.h new file mode 100644 index 0000000..2b55a47 --- /dev/null +++ b/src/lib3270/private.h @@ -0,0 +1,656 @@ +/* + * "Software G3270, 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 private.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) + * + */ + +#ifdef WIN32 + #include + #include +#endif // WIN32 + +/* Autoconf settings. */ +#include /* autoconf settings */ +#include /* lib3270 API calls and defs */ +#include +#include "api.h" + +#if defined(X3270_TN3270E) && !defined(X3270_ANSI) /*[*/ + #define X3270_ANSI 1 /* RFC2355 requires NVT mode */ +#endif /*]*/ + +#if defined(HAVE_VASPRINTF) && !defined(_GNU_SOURCE) /*[*/ + #define _GNU_SOURCE /* vasprintf isn't POSIX */ +#endif /*]*/ + +/* + * gettext stuff + */ +#ifdef ANDROID + #undef HAVE_LIBINTL + #undef HAVE_LIBSSL +#endif + +#ifdef HAVE_LIBINTL + #include + #define _( x ) gettext(x) + #define N_( x ) x +#else + #define _( x ) x + #define N_( x ) x +#endif // HAVE_LIBINTL + +#define action_name(x) #x + +/* + * OS-specific #defines. Except for the blocking-connect workarounds, these + * should be replaced with autoconf probes as soon as possible. + */ + +/* + * BLOCKING_CONNECT_ONLY + * Use only blocking sockets. + */ +#if defined(sco) /*[*/ + #define BLOCKING_CONNECT_ONLY 1 +#endif /*]*/ + +#if defined(apollo) /*[*/ + #define BLOCKING_CONNECT_ONLY 1 +#endif /*]*/ + +/* + * Compiler-specific #defines. + */ + +/* 'unused' explicitly flags an unused parameter */ +#if defined(__GNUC__) /*[*/ + #define unused __attribute__((__unused__)) + #define printflike(s,f) __attribute__ ((__format__ (__printf__, s, f))) +#else /*][*/ + #define unused /* nothing */ + #define printflike(s, f) /* nothing */ +#endif /*]*/ + + + +/* + * Prerequisite #includes. + */ +#include /* Unix standard I/O library */ +#include /* Unix system calls */ +#include /* Character classes */ +#include /* String manipulations */ +#include /* Basic system data types */ +#include /* System time-related data types */ +#include /* C library time functions */ +#include "localdefs.h" /* {s,tcl,c}3270-specific defines */ + +/* + * Cancel out contradictory parts. + */ +#if !defined(X3270_DISPLAY) /*[*/ + #undef X3270_KEYPAD + #undef X3270_MENUS +#endif /*]*/ + +/* types of internal actions */ +enum iaction { + IA_STRING, IA_PASTE, IA_REDRAW, + IA_KEYPAD, IA_DEFAULT, IA_KEY, + IA_MACRO, IA_SCRIPT, IA_PEEK, + IA_TYPEAHEAD, IA_FT, IA_COMMAND, IA_KEYMAP, + IA_IDLE +}; + +// Version strings +LIB3270_INTERNAL const char * build; +LIB3270_INTERNAL const char * app_defaults_version; +LIB3270_INTERNAL const char * sccsid; +LIB3270_INTERNAL const char * build_rpq_timestamp; +LIB3270_INTERNAL const char * build_rpq_version; +LIB3270_INTERNAL const char * build_rpq_revision; + +#if defined(X3270_DBCS) /*[*/ + LIB3270_INTERNAL Boolean dbcs; +#endif /*]*/ + + +/* toggle names */ +struct toggle_name { + const char *name; + int index; +}; + + +/* input key type */ + +/* Naming convention for private actions. */ +#define PA_PFX "PA-" + +/// @brief Shorthand macros +#define CN ((char *) NULL) +#define PN ((XtPointer) NULL) +#define Replace(var, value) { lib3270_free(var); var = (value); }; + +/// @brief Configuration change masks. +#define NO_CHANGE 0x0000 /// @brief no change +#define MODEL_CHANGE 0x0001 /// @brief screen dimensions changed +#define FONT_CHANGE 0x0002 /// @brief emulator font changed +#define COLOR_CHANGE 0x0004 /// @brief color scheme or 3278/9 mode changed +#define SCROLL_CHANGE 0x0008 /// @brief scrollbar snapped on or off +#define CHARSET_CHANGE 0x0010 /// @brief character set changed +#define ALL_CHANGE 0xffff /// @brief everything changed + +/* Portability macros */ + +/* Equivalent of setlinebuf */ + +#if defined(_IOLBF) /*[*/ + #define SETLINEBUF(s) setvbuf(s, (char *)NULL, _IOLBF, BUFSIZ) +#else /*][*/ + #define SETLINEBUF(s) setlinebuf(s) +#endif /*]*/ + +/* Motorola version of gettimeofday */ + +#if defined(MOTOROLA) + #define gettimeofday(tp,tz) gettimeofday(tp) +#endif + +/* Default DFT file transfer buffer size. */ +#if defined(X3270_FT) && !defined(DFT_BUF) /*[*/ + #define DFT_BUF (4 * 1024) +#endif /*]*/ + +/* DBCS Preedit Types */ +#if defined(X3270_DBCS) /*[*/ + #define PT_ROOT "Root" + #define PT_OVER_THE_SPOT "OverTheSpot" + #define PT_OFF_THE_SPOT "OffTheSpot" + #define PT_ON_THE_SPOT "OnTheSpot" +#endif /*]*/ + +/** input key type */ +enum keytype +{ + KT_STD, + KT_GE +}; + +LIB3270_INTERNAL struct _ansictl +{ + char vintr; + char vquit; + char verase; + char vkill; + char veof; + char vwerase; + char vrprnt; + char vlnext; +} ansictl; + +/** @brief Extended attributes */ +struct lib3270_ea +{ + unsigned char cc; ///< @brief EBCDIC or ASCII character code + unsigned char fa; ///< @brief field attribute, it nonzero + unsigned char fg; ///< @brief foreground color (0x00 or 0xf) + unsigned char bg; ///< @brief background color (0x00 or 0xf) + unsigned char gr; ///< @brief ANSI graphics rendition bits + unsigned char cs; ///< @brief character set (GE flag, or 0..2) + unsigned char ic; ///< @brief input control (DBCS) + unsigned char db; ///< @brief DBCS state +}; + +struct lib3270_text +{ + unsigned char chr; ///< @brief ASCII character code + unsigned short attr; ///< @brief Converted character attribute (color & etc) +}; + +#ifndef HEADER_SSL_H + #define SSL void +#endif // !HEADER_SSL_H + +#ifndef LIB3270_TA + #define LIB3270_TA void +#endif // !LIB3270_TA + +#define LIB3270_MB_MAX 16 +#define LIB3270_DEFAULT_CGEN 0x02b90000 +#define LIB3270_DEFAULT_CSET 0x00000025 + +#define LIB3270_FULL_MODEL_NAME_LENGTH 13 +#define LIB3270_LU_MAX 32 + +#define LIB3270_TELNET_N_OPTS 256 + +/** + * + * @brief Timeout control structure. + * + */ +typedef struct timeout +{ + struct timeout *next; + +#if defined(_WIN32) /*[*/ + unsigned long long ts; +#else /*][*/ + struct timeval tv; +#endif /*]*/ + + void (*proc)(H3270 *session); + + H3270 *session; + + unsigned char in_play; +} timeout_t; + + +/** + * + * @brief I/O events. + * + */ +typedef struct input +{ + struct input * next; + H3270 * session; + int fd; + LIB3270_IO_FLAG flag; + void * userdata; + + void (*call)(H3270 *, int, LIB3270_IO_FLAG, void *); + +} input_t; + + +/** + * + * @brief lib3270 session data + * + */ +struct _h3270 +{ + struct lib3270_session_callbacks cbk; // Callback table - Always the first one. + +// unsigned short sz; /**< Struct size */ + + // Connection info + int sock; /**< Network socket */ + LIB3270_CSTATE cstate; /**< Connection state */ + + // flags + LIB3270_OPTION options; /**< Session options */ + + int bgthread : 1; /**< Running on a background thread ? */ + int selected : 1; /**< Has selected region? */ + int rectsel : 1; /**< Selected region is a rectangle ? */ + int vcontrol : 1; /**< Visible control ? */ + int modified_sel : 1; + int mono : 1; /**< Forces monochrome display */ + int m3279 : 1; + int extended : 1; + int typeahead : 1; + int numeric_lock : 1; + int oerr_lock : 1; + int unlock_delay : 1; + int auto_reconnect_inprogress : 1; + unsigned int colors : 5; + int apl_mode : 1; + int icrnl : 1; + int inlcr : 1; + int onlcr : 1; + int bsd_tm : 1; + int syncing : 1; + int reverse : 1; /**< reverse-input mode */ + int dbcs : 1; + int linemode : 1; + int trace_skipping : 1; + int need_tls_follows : 1; + int cut_xfer_in_progress : 1; +// int auto_keymap : 1; + int formatted : 1; /**< Formatted screen flag */ + int starting : 1; /**< Is starting (no first screen)? */ + + char * oversize; + + LIB3270_SSL_STATE secure; + + struct lib3270_toggle + { + char value; /**< toggle value */ + void (*upcall)(H3270 *, struct lib3270_toggle *, LIB3270_TOGGLE_TYPE); /**< change value */ + } toggle[LIB3270_TOGGLE_COUNT]; + + // Network & Termtype + char * connected_type; + char * connected_lu; + char luname[LIB3270_LUNAME_LENGTH+1]; + + char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1]; + char * model_name; + int model_num; + char * termtype; + + struct + { + char * current; /**< The hostname part, stripped of qualifiers, luname and port number */ + char * full; /**< The entire string, for use in reconnecting */ + char * srvc; /**< The service name */ + char * qualified; + } host; + + char * proxy; /**< Proxy server (type:host[:port]) */ + char * termname; + + struct lib3270_charset charset; + + LIB3270_MESSAGE oia_status; + + unsigned char oia_flag[LIB3270_FLAG_COUNT]; + + unsigned short current_port; + + // Misc + H3270FT * ft; /**< Active file transfer data */ + + // screen info + int ov_rows; + int ov_cols; + int maxROWS; + int maxCOLS; + unsigned short rows; + unsigned short cols; + unsigned short pointer; /**< @brief Current pointer. */ + int cursor_addr; + int buffer_addr; + char flipped; + int screen_alt; /**< alternate screen? */ + int is_altbuffer; + + // Screen contents + void * buffer[2]; /**< Internal buffers */ + struct lib3270_ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */ + struct lib3270_ea * aea_buf; /**< alternate 3270 extended attribute buffer */ + struct lib3270_text * text; /**< Converted 3270 chars */ + + // host.c + char std_ds_host; + char no_login_host; + char non_tn3270e_host; + char passthru_host; + char ssl_host; + char ever_3270; + + // ctlr.c + int sscp_start; + unsigned char default_fg; + unsigned char default_bg; + unsigned char default_gr; + unsigned char default_cs; + unsigned char default_ic; + char reply_mode; + int trace_primed : 1; + int ticking : 1; + int mticking : 1; + int crm_nattr; + unsigned char crm_attr[16]; + unsigned char * zero_buf; /**< empty buffer, for area clears */ + + struct timeval t_start; + void * tick_id; + struct timeval t_want; + + // Telnet.c + unsigned char * ibuf; + int ibuf_size; /**< size of ibuf */ + unsigned char * obuf; /**< 3270 output buffer */ + unsigned char * obptr; + time_t ns_time; + int ns_brcvd; + int ns_rrcvd; + int ns_bsent; + int ns_rsent; + struct timeval ds_ts; + unsigned long e_funcs; /**< negotiated TN3270E functions */ + unsigned short e_xmit_seq; /**< transmit sequence number */ + int response_required; + int tn3270e_bound; + int tn3270e_negotiated; + int ansi_data; + int lnext; + int backslashed; + char plu_name[LIB3270_BIND_PLU_NAME_MAX+1]; + char **lus; + char **curr_lu; + char * try_lu; + int proxy_type; + char * proxy_host; + char * proxy_portname; + unsigned short proxy_port; + char reported_lu[LIB3270_LU_MAX+1]; + char reported_type[LIB3270_LU_MAX+1]; + + enum + { + E_NONE, + E_3270, + E_NVT, + E_SSCP + } tn3270e_submode; + + unsigned char * lbuf; /**< line-mode input buffer */ + unsigned char * lbptr; + + + // 3270 input buffer + unsigned char * ibptr; + unsigned char * obuf_base; + int obuf_size; +// unsigned char * netrbuf; + + // network input buffer + unsigned char * sbbuf; + + // telnet sub-option buffer + unsigned char * sbptr; + unsigned char telnet_state; +// char ttype_tmpval[13]; + + unsigned char myopts[LIB3270_TELNET_N_OPTS]; + unsigned char hisopts[LIB3270_TELNET_N_OPTS]; + + // kybd.c + unsigned int kybdlock; ///< @brief keyboard lock state + unsigned char aid; ///< @brief current attention ID + void * unlock_id; + time_t unlock_delay_time; + unsigned long unlock_delay_ms; ///< @brief Delay before actually unlocking the keyboard after the host permits it. + LIB3270_TA * ta_head; + LIB3270_TA * ta_tail; + + // ft_dft.c + int dft_buffersize; ///< @brief Buffer size (LIMIN, LIMOUT) + + // rpq.c + int rpq_complained : 1; +#if !defined(_WIN32) + int omit_due_space_limit : 1; +#endif + + char * rpq_warnbuf; + int rpq_wbcnt; + + // User data (Usually points to session's widget) + void * user_data; + + // selection + char * paste_buffer; + struct + { + int start; + int end; + } select; + + // ansi.c + int scroll_top; + int scroll_bottom; + int once_cset; + int saved_cursor; + + int held_wrap : 1; + + int insert_mode : 1; + int auto_newline_mode : 1; + + int appl_cursor : 1; + int saved_appl_cursor : 1; + + int wraparound_mode : 1; + int saved_wraparound_mode : 1; + + int rev_wraparound_mode : 1; + int saved_rev_wraparound_mode : 1; + + int allow_wide_mode : 1; + int saved_allow_wide_mode : 1; + + int wide_mode : 1; + int saved_wide_mode : 1; + + int saved_altbuffer : 1; + int ansi_reset : 1; /**< Non zero if the ansi_reset() was called in this session */ + + int ansi_ch; + int cs_to_change; + + /** ANSI Character sets. */ + enum lib3270_ansi_cs + { + LIB3270_ANSI_CS_G0 = 0, + LIB3270_ANSI_CS_G1 = 1, + LIB3270_ANSI_CS_G2 = 2, + LIB3270_ANSI_CS_G3 = 3 + } cset; + enum lib3270_ansi_cs saved_cset; + + /** Character set designations. */ + enum lib3270_ansi_csd + { + LIB3270_ANSI_CSD_LD = 0, + LIB3270_ANSI_CSD_UK = 1, + LIB3270_ANSI_CSD_US = 2 + } csd[4]; + enum lib3270_ansi_csd saved_csd[4]; + + enum lib3270_ansi_state + { + LIB3270_ANSI_STATE_DATA = 0, + LIB3270_ANSI_STATE_ESC = 1, + LIB3270_ANSI_STATE_CSDES = 2, + LIB3270_ANSI_STATE_N1 = 3, + LIB3270_ANSI_STATE_DECP = 4, + LIB3270_ANSI_STATE_TEXT = 5, + LIB3270_ANSI_STATE_TEXT2 = 6, + LIB3270_ANSI_STATE_MBPEND = 7 + } state; + + unsigned char * tabs; + + int pmi; + char pending_mbs[LIB3270_MB_MAX]; + + unsigned char gr; + unsigned char saved_gr; + + unsigned char fg; + unsigned char saved_fg; + + unsigned char bg; + unsigned char saved_bg; + + // xio + void * ns_read_id; + void * ns_write_id; + void * ns_exception_id; + + // SSL Data (Always defined to mantain the same structure size) + unsigned long ssl_error; + SSL * ssl_con; + + timeout_t * timeouts; + input_t * inputs; + int inputs_changed : 1; + + // Callbacks. + struct lib3270_state_callback * st_callbacks[LIB3270_STATE_USER]; + struct lib3270_state_callback * st_last[LIB3270_STATE_USER]; + +}; + +/* Library internal calls */ +LIB3270_INTERNAL void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped); +LIB3270_INTERNAL void lib3270_initialize(void); +LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); + +LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); +LIB3270_INTERNAL void remove_input_calls(H3270 *session); + +LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf, int len); +LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession); + +LIB3270_INTERNAL int lib3270_default_event_dispatcher(H3270 *hSession, int block); + +#if defined(DEBUG) + #define CHECK_SESSION_HANDLE(x) check_session_handle(&x,__FUNCTION__); + LIB3270_INTERNAL void check_session_handle(H3270 **hSession, const char *fname); +#else + #define CHECK_SESSION_HANDLE(x) check_session_handle(&x); + LIB3270_INTERNAL void check_session_handle(H3270 **hSession); +#endif // DEBUG + +LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); + +#if defined(HAVE_LIBSSL) /*[*/ + + LIB3270_INTERNAL int ssl_init(H3270 *session); + LIB3270_INTERNAL int ssl_negotiate(H3270 *hSession); + LIB3270_INTERNAL void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state); + + + #if OPENSSL_VERSION_NUMBER >= 0x00907000L /*[*/ + #define INFO_CONST const + #else /*][*/ + #define INFO_CONST + #endif /*]*/ + + LIB3270_INTERNAL void ssl_info_callback(INFO_CONST SSL *s, int where, int ret); + +#endif /*]*/ + diff --git a/src/lib3270/tables.c b/src/lib3270/tables.c deleted file mode 100644 index bce259b..0000000 --- a/src/lib3270/tables.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * "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. 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 tables.c e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * licinio@bb.com.br (Licínio Luis Branco) - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) - * - */ - - -/* - * tables.c - * Translation tables between the three character sets: - * EBCDIC - * ASCII (ISO Latin-1) - * Character Generator ("3270" font) - */ - -#include "globals.h" -#include "tablesc.h" -#include "kybdc.h" - -static const unsigned short asc2cg[256] = { -/*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*18*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*20*/ 0x10, 0x19, 0x13, 0x2c, 0x1a, 0x2e, 0x30, 0x12, -/*28*/ 0x0d, 0x0c, 0xbf, 0x35, 0x33, 0x31, 0x32, 0x14, -/*30*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, -/*38*/ 0x28, 0x29, 0x34, 0xbe, 0x09, 0x11, 0x08, 0x18, -/*40*/ 0x2d, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, -/*48*/ 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, -/*50*/ 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, -/*58*/ 0xb7, 0xb8, 0xb9, 0x0a, 0x15, 0x0b, 0x3a, 0x2f, -/*60*/ 0x3d, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, -/*68*/ 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, -/*70*/ 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, -/*78*/ 0x97, 0x98, 0x99, 0x0f, 0x16, 0x0e, 0x3b, 0x00, -/*80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*88*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*98*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*a0*/ 0x01, 0x6e, 0x1b, 0x1c, 0x1f, 0x1d, 0x17, 0x2b, -/*a8*/ 0x3c, 0xd0, 0x6a, 0x6c, 0x36, 0x07, 0xd1, 0x37, -/*b0*/ 0x38, 0xd6, 0x68, 0x69, 0x3e, 0x54, 0x1e, 0x39, -/*b8*/ 0x3f, 0x67, 0x6b, 0x6d, 0x4b, 0x4c, 0x4d, 0x6f, -/*c0*/ 0x60, 0x7a, 0x75, 0x65, 0x70, 0xbc, 0xba, 0xbd, -/*c8*/ 0x61, 0x7b, 0x76, 0x71, 0x62, 0x7c, 0x77, 0x72, -/*d0*/ 0xd7, 0x7f, 0x63, 0x7d, 0x78, 0x66, 0x73, 0x5b, -/*d8*/ 0xbb, 0x64, 0x7e, 0x79, 0x74, 0x48, 0xd9, 0x2a, -/*e0*/ 0x40, 0x5a, 0x55, 0x45, 0x50, 0x9c, 0x9a, 0x4f, -/*e8*/ 0x41, 0x4a, 0x56, 0x51, 0x42, 0x5c, 0x57, 0x52, -/*f0*/ 0xf7, 0x5f, 0x43, 0x5d, 0x58, 0x46, 0x53, 0x9d, -/*f8*/ 0x9b, 0x44, 0x5e, 0x59, 0x4e, 0x49, 0xf9, 0x47 -}; - -static const unsigned short cg2asc[256] = { -/*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xad, -/*08*/ 0x3e, 0x3c, 0x5b, 0x5d, 0x29, 0x28, 0x7d, 0x7b, -/*10*/ 0x20, 0x3d, 0x27, 0x22, 0x2f, 0x5c, 0x7c, 0xa6, -/*18*/ 0x3f, 0x21, 0x24, 0xa2, 0xa3, 0xa5, 0xb6, 0xa4, -/*20*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, -/*28*/ 0x38, 0x39, 0xdf, 0xa7, 0x23, 0x40, 0x25, 0x5f, -/*30*/ 0x26, 0x2d, 0x2e, 0x2c, 0x3a, 0x2b, 0xac, 0xaf, -/*38*/ 0xb0, 0xb7, 0x5e, 0x7e, 0xa8, 0x60, 0xb4, 0xb8, -/*40*/ 0xe0, 0xe8, 0xec, 0xf2, 0xf9, 0xe3, 0xf5, 0xff, -/*48*/ 0xdd, 0xfd, 0xe9, 0xbc, 0xbd, 0xbe, 0xfc, 0xe7, -/*50*/ 0xe4, 0xeb, 0xef, 0xf6, 0xb5, 0xe2, 0xea, 0xee, -/*58*/ 0xf4, 0xfb, 0xe1, 0xd7, 0xed, 0xf3, 0xfa, 0xf1, -/*60*/ 0xc0, 0xc8, 0xcc, 0xd2, 0xd9, 0xc3, 0xd5, 0xb9, -/*68*/ 0xb2, 0xb3, 0xaa, 0xba, 0xab, 0xbb, 0xa1, 0xbf, -/*70*/ 0xc4, 0xcb, 0xcf, 0xd6, 0xdc, 0xc2, 0xca, 0xce, -/*78*/ 0xd4, 0xdb, 0xc1, 0xc9, 0xcd, 0xd3, 0xda, 0xd1, -/*80*/ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, -/*88*/ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, -/*90*/ 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, -/*98*/ 0x79, 0x7a, 0xe6, 0xf8, 0xe5, 0xf7, 0x3b, 0x2a, -/*a0*/ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, -/*a8*/ 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, -/*b0*/ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, -/*b8*/ 0x59, 0x5a, 0xc6, 0xd8, 0xc5, 0xc7, 0x3b, 0x2a, -/*c0*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*c8*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*d0*/ 0xa9, 0xae, 0x20, 0x20, 0x20, 0x20, 0xb1, 0xd0, -/*d8*/ 0x20, 0xde, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*e0*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*e8*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*f0*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf0, -/*f8*/ 0x20, 0xfe, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 -}; - -static const unsigned short ebc2cg0[256] = { -/*00*/ 0x00, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, -/*08*/ 0xdf, 0xdf, 0xdf, 0xdf, 0x02, 0x03, 0x00, 0x00, -/*10*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0x04, 0xdf, 0xdf, -/*18*/ 0xdf, 0x05, 0xdf, 0xdf, 0x9f, 0xdf, 0x9e, 0xdf, -/*20*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, -/*28*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, -/*30*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, -/*38*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, -/*40*/ 0x10, 0x01, 0x55, 0x50, 0x40, 0x5a, 0x45, 0x9c, -/*48*/ 0x4f, 0x5f, 0x1b, 0x32, 0x09, 0x0d, 0x35, 0x16, -/*50*/ 0x30, 0x4a, 0x56, 0x51, 0x41, 0x5c, 0x57, 0x52, -/*58*/ 0x42, 0x2a, 0x19, 0x1a, 0xbf, 0x0c, 0xbe, 0x36, -/*60*/ 0x31, 0x14, 0x75, 0x70, 0x60, 0x7a, 0x65, 0xbc, -/*68*/ 0xbd, 0x7f, 0x17, 0x33, 0x2e, 0x2f, 0x08, 0x18, -/*70*/ 0x9b, 0x7b, 0x76, 0x71, 0x61, 0x7c, 0x77, 0x72, -/*78*/ 0x62, 0x3d, 0x34, 0x2c, 0x2d, 0x12, 0x11, 0x13, -/*80*/ 0xbb, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, -/*88*/ 0x87, 0x88, 0x6c, 0x6d, 0xf7, 0x49, 0xf9, 0xd6, -/*90*/ 0x38, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, -/*98*/ 0x90, 0x91, 0x6a, 0x6b, 0x9a, 0x3f, 0xba, 0x1f, -/*a0*/ 0x54, 0x3b, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, -/*a8*/ 0x98, 0x99, 0x6e, 0x6f, 0xd7, 0x48, 0xd9, 0xd1, -/*b0*/ 0x3a, 0x1c, 0x1d, 0x39, 0xd0, 0x2b, 0x1e, 0x4b, -/*b8*/ 0x4c, 0x4d, 0x0a, 0x0b, 0x37, 0x3c, 0x3e, 0x5b, -/*c0*/ 0x0f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, -/*c8*/ 0xa7, 0xa8, 0x07, 0x58, 0x53, 0x43, 0x5d, 0x46, -/*d0*/ 0x0e, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, -/*d8*/ 0xb0, 0xb1, 0x67, 0x59, 0x4e, 0x44, 0x5e, 0x47, -/*e0*/ 0x15, 0x9d, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, -/*e8*/ 0xb8, 0xb9, 0x68, 0x78, 0x73, 0x63, 0x7d, 0x66, -/*f0*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, -/*f8*/ 0x28, 0x29, 0x69, 0x79, 0x74, 0x64, 0x7e, 0x06 -}; - -static const unsigned short cg2ebc0[256] = { -/*00*/ 0x00, 0x41, 0x0c, 0x0d, 0x15, 0x19, 0xff, 0xca, -/*08*/ 0x6e, 0x4c, 0xba, 0xbb, 0x5d, 0x4d, 0xd0, 0xc0, -/*10*/ 0x40, 0x7e, 0x7d, 0x7f, 0x61, 0xe0, 0x4f, 0x6a, -/*18*/ 0x6f, 0x5a, 0x5b, 0x4a, 0xb1, 0xb2, 0xb6, 0x9f, -/*20*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, -/*28*/ 0xf8, 0xf9, 0x59, 0xb5, 0x7b, 0x7c, 0x6c, 0x6d, -/*30*/ 0x50, 0x60, 0x4b, 0x6b, 0x7a, 0x4e, 0x5f, 0xbc, -/*38*/ 0x90, 0xb3, 0xb0, 0xa1, 0xbd, 0x79, 0xbe, 0x9d, -/*40*/ 0x44, 0x54, 0x58, 0xcd, 0xdd, 0x46, 0xcf, 0xdf, -/*48*/ 0xad, 0x8d, 0x51, 0xb7, 0xb8, 0xb9, 0xdc, 0x48, -/*50*/ 0x43, 0x53, 0x57, 0xcc, 0xa0, 0x42, 0x52, 0x56, -/*58*/ 0xcb, 0xdb, 0x45, 0xbf, 0x55, 0xce, 0xde, 0x49, -/*60*/ 0x64, 0x74, 0x78, 0xed, 0xfd, 0x66, 0xef, 0xda, -/*68*/ 0xea, 0xfa, 0x9a, 0x9b, 0x8a, 0x8b, 0xaa, 0xab, -/*70*/ 0x63, 0x73, 0x77, 0xec, 0xfc, 0x62, 0x72, 0x76, -/*78*/ 0xeb, 0xfb, 0x65, 0x71, 0x75, 0xee, 0xfe, 0x69, -/*80*/ 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, -/*88*/ 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, -/*90*/ 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, -/*98*/ 0xa8, 0xa9, 0x9c, 0x70, 0x47, 0xe1, 0x1e, 0x1c, -/*a0*/ 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, -/*a8*/ 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, -/*b0*/ 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, -/*b8*/ 0xe8, 0xe9, 0x9e, 0x80, 0x67, 0x68, 0x5e, 0x5c, -/*c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*c8*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*d0*/ 0xb4, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x8f, 0xac, -/*d8*/ 0x00, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*e8*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, -/*f8*/ 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -#ifdef EXTENDED_TABLES -static const unsigned short ebc2asc70[256] = { -/*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*10*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*18*/ 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x3b, 0x20, -/*20*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*28*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*30*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*38*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, -/*40*/ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*48*/ 0x00, 0x00, 0x00, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, -/*50*/ 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*58*/ 0x00, 0x00, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x00, -/*60*/ 0x2d, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*68*/ 0x00, 0x00, 0x00, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, -/*70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*78*/ 0x00, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, -/*80*/ 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, -/*88*/ 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*90*/ 0x00, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, -/*98*/ 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*a0*/ 0x00, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, -/*a8*/ 0x79, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*b0*/ 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*b8*/ 0x00, 0x00, 0x5b, 0x5d, 0x00, 0x00, 0x00, 0x00, -/*c0*/ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, -/*c8*/ 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*d0*/ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, -/*d8*/ 0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*e0*/ 0x5c, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, -/*e8*/ 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, -/*f8*/ 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 -}; -#endif // EXTENDED_TABLES - -static const unsigned short asc2ebc0[256] = { -/*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*18*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, -/*28*/ 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, -/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, -/*38*/ 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, -/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, -/*48*/ 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, -/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, -/*58*/ 0xe7, 0xe8, 0xe9, 0xba, 0xe0, 0xbb, 0xb0, 0x6d, -/*60*/ 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, -/*68*/ 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, -/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, -/*78*/ 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x00, -/*80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*88*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*98*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/*a0*/ 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, -/*a8*/ 0xbd, 0xb4, 0x9a, 0x8a, 0x5f, 0xca, 0xaf, 0xbc, -/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, -/*b8*/ 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, -/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, -/*c8*/ 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, -/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, -/*d8*/ 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xad, 0xae, 0x59, -/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, -/*e8*/ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, -/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, -/*f8*/ 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf -}; - -#ifdef EXTENDED_TABLES -static const unsigned short ge2asc[256] = { -/*00*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*08*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*10*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*18*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*20*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*28*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*30*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*38*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*40*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*48*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*50*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*58*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*60*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*68*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*70*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*78*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*80*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x19, 0x02, 0x02, -/*88*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*90*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*98*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*a0*/ 0x02, 0x02, 0x12, 0x02, 0x02, 0x02, 0x02, 0x02, -/*a8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x5b, 0x02, 0x02, -/*b0*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*b8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x5d, 0x02, 0x19, -/*c0*/ 0x02, 0x02, 0x02, 0x02, 0x0e, 0x0d, 0x15, 0x17, -/*c8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*d0*/ 0x02, 0x02, 0x02, 0x0f, 0x0b, 0x0c, 0x16, 0x18, -/*d8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*e0*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*e8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*f0*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, -/*f8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 -}; -#endif // EXTENDED_TABLES - -static const unsigned short ebc2uc[256] = { -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, -/*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, -/*18*/ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, -/*20*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, -/*28*/ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, -/*30*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, -/*38*/ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, -/*40*/ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, -/*48*/ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, -/*50*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, -/*58*/ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, -/*60*/ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, -/*68*/ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, -/*70*/ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, -/*78*/ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, -/*80*/ 0x80, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, -/*88*/ 0xc8, 0xc9, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, -/*90*/ 0x90, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, -/*98*/ 0xd8, 0xd9, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, -/*a0*/ 0xa0, 0xa1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, -/*a8*/ 0xe8, 0xe9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, -/*b0*/ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, -/*b8*/ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, -/*c0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, -/*c8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, -/*d0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, -/*d8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, -/*e0*/ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, -/*e8*/ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, -/*f0*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, -/*f8*/ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff -}; -#if defined(X3270_FT) /*[*/ - -#endif /*]*/ - -//unsigned short ebc2cg[256]; -//unsigned short cg2ebc[256]; -// unsigned short ebc2asc[256]; -// unsigned short asc2ebc[256]; -// unsigned short asc2ft[256]; -// unsigned short ft2asc[256]; - -#ifdef EXTENDED_TABLES -unsigned short ebc2asc7[256]; -#endif //EXTENDED_TABLES - - -/* -void charset_defaults(H3270 *hSession) -{ - // Go to defaults first. - (void) memcpy((char *) hSession->charset.ebc2cg, (const char *)ebc2cg0, 256); - (void) memcpy((char *) hSession->charset.cg2ebc, (const char *)cg2ebc0, 256); - (void) memcpy((char *) hSession->charset.ebc2asc, (const char *)ebc2asc0, 256); - (void) memcpy((char *) hSession->charset.asc2ebc, (const char *)asc2ebc0, 256); -#if defined(X3270_FT) - (void) memcpy((char *)hSession->charset.ft2asc, (const char *)ft2asc0, 256); - (void) memcpy((char *)hSession->charset.asc2ft, (const char *)asc2ft0, 256); -#endif - // clear_xks(); -} -*/ diff --git a/src/lib3270/w3misc.c b/src/lib3270/w3misc.c deleted file mode 100644 index b4598e6..0000000 --- a/src/lib3270/w3misc.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * "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. 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., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como w3misc.c e possui 110 linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * licinio@bb.com.br (Licínio Luis Branco) - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) - * - */ - -#error Deprecated - -/* - * w3misc.c - * Miscellaneous Win32 functions. - */ - -/* -#include "globals.h" - -#if !defined(_WIN32) -#error This module is only for Win32. -#endif - -#include -#include -#include -#include - -#include "w3miscc.h" - -// Convert a network address to a string. -const char * inet_ntop(int af, const void *src, char *dst, socklen_t cnt) -{ - union { - struct sockaddr sa; - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - } sa; - DWORD ssz; - DWORD sz = cnt; - - memset(&sa, '\0', sizeof(sa)); - - switch (af) { - case AF_INET: - sa.sin = *(struct sockaddr_in *)src; // struct copy - ssz = sizeof(struct sockaddr_in); - break; - case AF_INET6: - sa.sin6 = *(struct sockaddr_in6 *)src; // struct copy - ssz = sizeof(struct sockaddr_in6); - break; - default: - if (cnt > 0) - dst[0] = '\0'; - return NULL; - } - - sa.sa.sa_family = af; - - if (WSAAddressToString(&sa.sa, ssz, NULL, dst, &sz) != 0) { - if (cnt > 0) - dst[0] = '\0'; - return NULL; - } - - return dst; -} - -// Decode a Win32 error number. -const char * win32_strerror(int e) -{ - static char buffer[4096]; - - if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - e, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - buffer, - sizeof(buffer), - NULL) == 0) { - - sprintf(buffer, "Windows error %d", e); - } - - return buffer; -} - -*/ diff --git a/src/lib3270/winvers.c b/src/lib3270/winvers.c deleted file mode 100644 index 9d557d6..0000000 --- a/src/lib3270/winvers.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * "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. 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., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como winvers.c e possui 73 linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * licinio@bb.com.br (Licínio Luis Branco) - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) - * - */ - -#error Deprecated - -/* - * winvers.c - * A Windows console-based 3270 Terminal Emulator - * OS version query - */ - -/* -#include -#include - -#include "globals.h" -#include "winversc.h" - -int is_nt = 1; -int has_ipv6 = 1; - -int -get_version_info(void) -{ - OSVERSIONINFO info; - - // Figure out what version of Windows this is. - memset(&info, '\0', sizeof(info)); - info.dwOSVersionInfoSize = sizeof(info); - if (GetVersionEx(&info) == 0) { - fprintf(stderr, "Can't get Windows version\n"); - return -1; - } - - // Yes, people still run Win98. - if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - is_nt = 0; - - // Win2K and earlier is IPv4-only. WinXP and later can have IPv6. - if (!is_nt || - info.dwMajorVersion < 5 || - (info.dwMajorVersion == 5 && info.dwMinorVersion < 1)) { - has_ipv6 = 0; - } - - return 0; -} - -*/ diff --git a/src/lib3270/xio.c b/src/lib3270/xio.c deleted file mode 100644 index 21d60c3..0000000 --- a/src/lib3270/xio.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * "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. 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., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como xio.c e possui 143 linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * licinio@bb.com.br (Licínio Luis Branco) - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) - * - */ - -/* - * xio.c - * Low-level I/O setup functions and exit code. - */ - -#include "globals.h" - -#include "actionsc.h" -#include "hostc.h" -#include "telnetc.h" -#include "toggle.h" -#include "utilc.h" -#include "xioc.h" - -#error xio.c is deprecated, use iocalls.c - -void x_except_on(H3270 *h) -{ - if(h->excepting) - return; - - if(h->reading) - RemoveInput(h->ns_read_id); - -#ifdef WIN32 - h->ns_exception_id = AddExcept((int) h->sockEvent, h, net_exception); - h->excepting = 1; - - if(h->reading) - h->ns_read_id = AddInput( (int) h->sockEvent, h, net_input); -#else - h->ns_exception_id = AddExcept(h->sock, h, net_exception); - h->excepting = 1; - - if(h->reading) - h->ns_read_id = AddInput(h->sock, h, net_input); -#endif // WIN32 -} -- libgit2 0.21.2