Commit ec7cd4d8d4fe9dc7882c617d7f5177b8b5534166

Authored by Perry Werneck
1 parent 1ae6cf2c

Ajustes para compilação da lib3270 de forma independente.

gitsync.sh 0 → 100755
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +#!/bin/bash
  2 +#
  3 +# https://help.github.com/articles/syncing-a-fork/
  4 +#
  5 +# https://help.github.com/articles/configuring-a-remote-for-a-fork/
  6 +#
  7 +# https://www.opentechguides.com/how-to/article/git/177/git-sync-repos.html
  8 +#
  9 +# Setup:
  10 +#
  11 +# git remote add github https://github.com/PerryWerneck/lib3270.git
  12 +#
  13 +#
  14 +
  15 +git fetch origin
  16 +git checkout master
  17 +git merge origin/master
  18 +
  19 +git push github
  20 +
lib3270.cbp 0 → 100644
@@ -0,0 +1,224 @@ @@ -0,0 +1,224 @@
  1 +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
  2 +<CodeBlocks_project_file>
  3 + <FileVersion major="1" minor="6" />
  4 + <Project>
  5 + <Option title="3270 C Access Library" />
  6 + <Option pch_mode="2" />
  7 + <Option compiler="gcc" />
  8 + <Build>
  9 + <Target title="Debug">
  10 + <Option output=".bin/Debug/3270 C Access Library" prefix_auto="1" extension_auto="1" />
  11 + <Option object_output=".obj/Debug/" />
  12 + <Option type="1" />
  13 + <Option compiler="gcc" />
  14 + <Compiler>
  15 + <Add option="-g" />
  16 + </Compiler>
  17 + </Target>
  18 + <Target title="Release">
  19 + <Option output=".bin/Release/3270 C Access Library" prefix_auto="1" extension_auto="1" />
  20 + <Option object_output=".obj/Release/" />
  21 + <Option type="1" />
  22 + <Option compiler="gcc" />
  23 + <Compiler>
  24 + <Add option="-O2" />
  25 + </Compiler>
  26 + <Linker>
  27 + <Add option="-s" />
  28 + </Linker>
  29 + </Target>
  30 + </Build>
  31 + <Compiler>
  32 + <Add option="-Wall" />
  33 + <Add directory="src/include" />
  34 + </Compiler>
  35 + <Unit filename="AUTHORS" />
  36 + <Unit filename="LICENCA" />
  37 + <Unit filename="LICENSE" />
  38 + <Unit filename="README.md" />
  39 + <Unit filename="X3270.xad" />
  40 + <Unit filename="config.status" />
  41 + <Unit filename="configure" />
  42 + <Unit filename="configure.ac" />
  43 + <Unit filename="gitsync.sh" />
  44 + <Unit filename="src/include/3270ds.h" />
  45 + <Unit filename="src/include/actionsc.h" />
  46 + <Unit filename="src/include/ansic.h" />
  47 + <Unit filename="src/include/api.h" />
  48 + <Unit filename="src/include/aplc.h" />
  49 + <Unit filename="src/include/appres.h" />
  50 + <Unit filename="src/include/arpa_telnet.h" />
  51 + <Unit filename="src/include/cg.h" />
  52 + <Unit filename="src/include/childc.h" />
  53 + <Unit filename="src/include/config.h" />
  54 + <Unit filename="src/include/config.h.in" />
  55 + <Unit filename="src/include/ctlrc.h" />
  56 + <Unit filename="src/include/ft_cut_ds.h" />
  57 + <Unit filename="src/include/ft_cutc.h" />
  58 + <Unit filename="src/include/ft_dft_ds.h" />
  59 + <Unit filename="src/include/ft_dftc.h" />
  60 + <Unit filename="src/include/ftc.h" />
  61 + <Unit filename="src/include/gluec.h" />
  62 + <Unit filename="src/include/hostc.h" />
  63 + <Unit filename="src/include/icmdc.h" />
  64 + <Unit filename="src/include/keypadc.h" />
  65 + <Unit filename="src/include/kybdc.h" />
  66 + <Unit filename="src/include/lib3270/X11keysym.h" />
  67 + <Unit filename="src/include/lib3270/action_table.h" />
  68 + <Unit filename="src/include/lib3270/actions.h" />
  69 + <Unit filename="src/include/lib3270/charset.h" />
  70 + <Unit filename="src/include/lib3270/filetransfer.h" />
  71 + <Unit filename="src/include/lib3270/html.h" />
  72 + <Unit filename="src/include/lib3270/internals.h" />
  73 + <Unit filename="src/include/lib3270/log.h" />
  74 + <Unit filename="src/include/lib3270/macros.h" />
  75 + <Unit filename="src/include/lib3270/popup.h" />
  76 + <Unit filename="src/include/lib3270/selection.h" />
  77 + <Unit filename="src/include/lib3270/session.h" />
  78 + <Unit filename="src/include/lib3270/trace.h" />
  79 + <Unit filename="src/include/localdefs.h" />
  80 + <Unit filename="src/include/objects.h" />
  81 + <Unit filename="src/include/popupsc.h" />
  82 + <Unit filename="src/include/printc.h" />
  83 + <Unit filename="src/include/printerc.h" />
  84 + <Unit filename="src/include/private.h" />
  85 + <Unit filename="src/include/proxyc.h" />
  86 + <Unit filename="src/include/resolverc.h" />
  87 + <Unit filename="src/include/resources.h" />
  88 + <Unit filename="src/include/savec.h" />
  89 + <Unit filename="src/include/screen.h" />
  90 + <Unit filename="src/include/screenc.h" />
  91 + <Unit filename="src/include/scrollc.h" />
  92 + <Unit filename="src/include/seec.h" />
  93 + <Unit filename="src/include/sf.h" />
  94 + <Unit filename="src/include/shlobj_missing.h" />
  95 + <Unit filename="src/include/stamp-h1" />
  96 + <Unit filename="src/include/statusc.h" />
  97 + <Unit filename="src/include/telnetc.h" />
  98 + <Unit filename="src/include/tn3270e.h" />
  99 + <Unit filename="src/include/toggle.h" />
  100 + <Unit filename="src/include/togglesc.h" />
  101 + <Unit filename="src/include/trace_dsc.h" />
  102 + <Unit filename="src/include/utf8c.h" />
  103 + <Unit filename="src/include/utilc.h" />
  104 + <Unit filename="src/include/w3miscc.h" />
  105 + <Unit filename="src/include/widec.h" />
  106 + <Unit filename="src/include/winversc.h" />
  107 + <Unit filename="src/include/xioc.h" />
  108 + <Unit filename="src/include/xl.h" />
  109 + <Unit filename="src/lib3270/actions.c">
  110 + <Option compilerVar="CC" />
  111 + </Unit>
  112 + <Unit filename="src/lib3270/ansi.c">
  113 + <Option compilerVar="CC" />
  114 + </Unit>
  115 + <Unit filename="src/lib3270/bounds.c">
  116 + <Option compilerVar="CC" />
  117 + </Unit>
  118 + <Unit filename="src/lib3270/charset.c">
  119 + <Option compilerVar="CC" />
  120 + </Unit>
  121 + <Unit filename="src/lib3270/connect.c">
  122 + <Option compilerVar="CC" />
  123 + </Unit>
  124 + <Unit filename="src/lib3270/ctlr.c">
  125 + <Option compilerVar="CC" />
  126 + </Unit>
  127 + <Unit filename="src/lib3270/ft.c">
  128 + <Option compilerVar="CC" />
  129 + </Unit>
  130 + <Unit filename="src/lib3270/ft_cut.c">
  131 + <Option compilerVar="CC" />
  132 + </Unit>
  133 + <Unit filename="src/lib3270/ft_dft.c">
  134 + <Option compilerVar="CC" />
  135 + </Unit>
  136 + <Unit filename="src/lib3270/glue.c">
  137 + <Option compilerVar="CC" />
  138 + </Unit>
  139 + <Unit filename="src/lib3270/host.c">
  140 + <Option compilerVar="CC" />
  141 + </Unit>
  142 + <Unit filename="src/lib3270/html.c">
  143 + <Option compilerVar="CC" />
  144 + </Unit>
  145 + <Unit filename="src/lib3270/iocalls.c">
  146 + <Option compilerVar="CC" />
  147 + </Unit>
  148 + <Unit filename="src/lib3270/kybd.c">
  149 + <Option compilerVar="CC" />
  150 + </Unit>
  151 + <Unit filename="src/lib3270/log.c">
  152 + <Option compilerVar="CC" />
  153 + </Unit>
  154 + <Unit filename="src/lib3270/macros.c">
  155 + <Option compilerVar="CC" />
  156 + </Unit>
  157 + <Unit filename="src/lib3270/mkfb.c">
  158 + <Option compilerVar="CC" />
  159 + </Unit>
  160 + <Unit filename="src/lib3270/options.c">
  161 + <Option compilerVar="CC" />
  162 + </Unit>
  163 + <Unit filename="src/lib3270/paste.c">
  164 + <Option compilerVar="CC" />
  165 + </Unit>
  166 + <Unit filename="src/lib3270/print.c">
  167 + <Option compilerVar="CC" />
  168 + </Unit>
  169 + <Unit filename="src/lib3270/printer.c">
  170 + <Option compilerVar="CC" />
  171 + </Unit>
  172 + <Unit filename="src/lib3270/resolver.c">
  173 + <Option compilerVar="CC" />
  174 + </Unit>
  175 + <Unit filename="src/lib3270/resources.c">
  176 + <Option compilerVar="CC" />
  177 + </Unit>
  178 + <Unit filename="src/lib3270/rpq.c">
  179 + <Option compilerVar="CC" />
  180 + </Unit>
  181 + <Unit filename="src/lib3270/screen.c">
  182 + <Option compilerVar="CC" />
  183 + </Unit>
  184 + <Unit filename="src/lib3270/see.c">
  185 + <Option compilerVar="CC" />
  186 + </Unit>
  187 + <Unit filename="src/lib3270/selection.c">
  188 + <Option compilerVar="CC" />
  189 + </Unit>
  190 + <Unit filename="src/lib3270/session.c">
  191 + <Option compilerVar="CC" />
  192 + </Unit>
  193 + <Unit filename="src/lib3270/sf.c">
  194 + <Option compilerVar="CC" />
  195 + </Unit>
  196 + <Unit filename="src/lib3270/ssl.c">
  197 + <Option compilerVar="CC" />
  198 + </Unit>
  199 + <Unit filename="src/lib3270/state.c">
  200 + <Option compilerVar="CC" />
  201 + </Unit>
  202 + <Unit filename="src/lib3270/telnet.c">
  203 + <Option compilerVar="CC" />
  204 + </Unit>
  205 + <Unit filename="src/lib3270/toggles.c">
  206 + <Option compilerVar="CC" />
  207 + </Unit>
  208 + <Unit filename="src/lib3270/trace_ds.c">
  209 + <Option compilerVar="CC" />
  210 + </Unit>
  211 + <Unit filename="src/lib3270/utf8.c">
  212 + <Option compilerVar="CC" />
  213 + </Unit>
  214 + <Unit filename="src/lib3270/util.c">
  215 + <Option compilerVar="CC" />
  216 + </Unit>
  217 + <Unit filename="src/lib3270/windows/resources.rc.in" />
  218 + <Extensions>
  219 + <code_completion />
  220 + <envvars />
  221 + <debugger />
  222 + </Extensions>
  223 + </Project>
  224 +</CodeBlocks_project_file>
src/include/config.h.in
@@ -61,6 +61,7 @@ @@ -61,6 +61,7 @@
61 #define X3270_APL 61 #define X3270_APL
62 62
63 #define X3270_TRACE 63 #define X3270_TRACE
  64 + #define X3270_FT
64 65
65 #undef HAVE_PRINTER 66 #undef HAVE_PRINTER
66 #undef HAVE_MALLOC_H 67 #undef HAVE_MALLOC_H
src/include/lib3270/X11keysym.h 0 → 100644
@@ -0,0 +1,217 @@ @@ -0,0 +1,217 @@
  1 +/*
  2 + * Copyright 1999 by Paul Mattes.
  3 + * Permission to use, copy, modify, and distribute this software and its
  4 + * documentation for any purpose and without fee is hereby granted,
  5 + * provided that the above copyright notice appear in all copies and that
  6 + * both that copyright notice and this permission notice appear in
  7 + * supporting documentation.
  8 + *
  9 + * c3270, s3270 and tcl3270 are distributed in the hope that they will
  10 + * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE
  12 + * for more details.
  13 + */
  14 +
  15 +/* X11 keysyms used by c3270, s3270 and tcl3270 */
  16 +
  17 +#if !defined(_x11_keysym_h) /*[*/
  18 +#define _x11_keysym_h 1
  19 +
  20 +/* Latin-1 Keysyms */
  21 +#define XK_space 0x020
  22 +#define XK_exclam 0x021
  23 +#define XK_quotedbl 0x022
  24 +#define XK_numbersign 0x023
  25 +#define XK_dollar 0x024
  26 +#define XK_percent 0x025
  27 +#define XK_ampersand 0x026
  28 +#define XK_apostrophe 0x027
  29 +#define XK_quoteright 0x027
  30 +#define XK_parenleft 0x028
  31 +#define XK_parenright 0x029
  32 +#define XK_asterisk 0x02a
  33 +#define XK_plus 0x02b
  34 +#define XK_comma 0x02c
  35 +#define XK_minus 0x02d
  36 +#define XK_period 0x02e
  37 +#define XK_slash 0x02f
  38 +#define XK_0 0x030
  39 +#define XK_1 0x031
  40 +#define XK_2 0x032
  41 +#define XK_3 0x033
  42 +#define XK_4 0x034
  43 +#define XK_5 0x035
  44 +#define XK_6 0x036
  45 +#define XK_7 0x037
  46 +#define XK_8 0x038
  47 +#define XK_9 0x039
  48 +#define XK_colon 0x03a
  49 +#define XK_semicolon 0x03b
  50 +#define XK_less 0x03c
  51 +#define XK_equal 0x03d
  52 +#define XK_greater 0x03e
  53 +#define XK_question 0x03f
  54 +#define XK_at 0x040
  55 +#define XK_A 0x041
  56 +#define XK_B 0x042
  57 +#define XK_C 0x043
  58 +#define XK_D 0x044
  59 +#define XK_E 0x045
  60 +#define XK_F 0x046
  61 +#define XK_G 0x047
  62 +#define XK_H 0x048
  63 +#define XK_I 0x049
  64 +#define XK_J 0x04a
  65 +#define XK_K 0x04b
  66 +#define XK_L 0x04c
  67 +#define XK_M 0x04d
  68 +#define XK_N 0x04e
  69 +#define XK_O 0x04f
  70 +#define XK_P 0x050
  71 +#define XK_Q 0x051
  72 +#define XK_R 0x052
  73 +#define XK_S 0x053
  74 +#define XK_T 0x054
  75 +#define XK_U 0x055
  76 +#define XK_V 0x056
  77 +#define XK_W 0x057
  78 +#define XK_X 0x058
  79 +#define XK_Y 0x059
  80 +#define XK_Z 0x05a
  81 +#define XK_bracketleft 0x05b
  82 +#define XK_backslash 0x05c
  83 +#define XK_bracketright 0x05d
  84 +#define XK_asciicircum 0x05e
  85 +#define XK_underscore 0x05f
  86 +#define XK_grave 0x060
  87 +#define XK_quoteleft 0x060
  88 +#define XK_a 0x061
  89 +#define XK_b 0x062
  90 +#define XK_c 0x063
  91 +#define XK_d 0x064
  92 +#define XK_e 0x065
  93 +#define XK_f 0x066
  94 +#define XK_g 0x067
  95 +#define XK_h 0x068
  96 +#define XK_i 0x069
  97 +#define XK_j 0x06a
  98 +#define XK_k 0x06b
  99 +#define XK_l 0x06c
  100 +#define XK_m 0x06d
  101 +#define XK_n 0x06e
  102 +#define XK_o 0x06f
  103 +#define XK_p 0x070
  104 +#define XK_q 0x071
  105 +#define XK_r 0x072
  106 +#define XK_s 0x073
  107 +#define XK_t 0x074
  108 +#define XK_u 0x075
  109 +#define XK_v 0x076
  110 +#define XK_w 0x077
  111 +#define XK_x 0x078
  112 +#define XK_y 0x079
  113 +#define XK_z 0x07a
  114 +#define XK_braceleft 0x07b
  115 +#define XK_bar 0x07c
  116 +#define XK_braceright 0x07d
  117 +#define XK_asciitilde 0x07e
  118 +#define XK_nobreakspace 0x0a0
  119 +#define XK_exclamdown 0x0a1
  120 +#define XK_cent 0x0a2
  121 +#define XK_sterling 0x0a3
  122 +#define XK_currency 0x0a4
  123 +#define XK_yen 0x0a5
  124 +#define XK_brokenbar 0x0a6
  125 +#define XK_section 0x0a7
  126 +#define XK_diaeresis 0x0a8
  127 +#define XK_copyright 0x0a9
  128 +#define XK_ordfeminine 0x0aa
  129 +#define XK_guillemotleft 0x0ab
  130 +#define XK_notsign 0x0ac
  131 +#define XK_hyphen 0x0ad
  132 +#define XK_registered 0x0ae
  133 +#define XK_macron 0x0af
  134 +#define XK_degree 0x0b0
  135 +#define XK_plusminus 0x0b1
  136 +#define XK_twosuperior 0x0b2
  137 +#define XK_threesuperior 0x0b3
  138 +#define XK_acute 0x0b4
  139 +#define XK_mu 0x0b5
  140 +#define XK_paragraph 0x0b6
  141 +#define XK_periodcentered 0x0b7
  142 +#define XK_cedilla 0x0b8
  143 +#define XK_onesuperior 0x0b9
  144 +#define XK_masculine 0x0ba
  145 +#define XK_guillemotright 0x0bb
  146 +#define XK_onequarter 0x0bc
  147 +#define XK_onehalf 0x0bd
  148 +#define XK_threequarters 0x0be
  149 +#define XK_questiondown 0x0bf
  150 +#define XK_Agrave 0x0c0
  151 +#define XK_Aacute 0x0c1
  152 +#define XK_Acircumflex 0x0c2
  153 +#define XK_Atilde 0x0c3
  154 +#define XK_Adiaeresis 0x0c4
  155 +#define XK_Aring 0x0c5
  156 +#define XK_AE 0x0c6
  157 +#define XK_Ccedilla 0x0c7
  158 +#define XK_Egrave 0x0c8
  159 +#define XK_Eacute 0x0c9
  160 +#define XK_Ecircumflex 0x0ca
  161 +#define XK_Ediaeresis 0x0cb
  162 +#define XK_Igrave 0x0cc
  163 +#define XK_Iacute 0x0cd
  164 +#define XK_Icircumflex 0x0ce
  165 +#define XK_Idiaeresis 0x0cf
  166 +#define XK_ETH 0x0d0
  167 +#define XK_Eth 0x0d0
  168 +#define XK_Ntilde 0x0d1
  169 +#define XK_Ograve 0x0d2
  170 +#define XK_Oacute 0x0d3
  171 +#define XK_Ocircumflex 0x0d4
  172 +#define XK_Otilde 0x0d5
  173 +#define XK_Odiaeresis 0x0d6
  174 +#define XK_multiply 0x0d7
  175 +#define XK_Ooblique 0x0d8
  176 +#define XK_Ugrave 0x0d9
  177 +#define XK_Uacute 0x0da
  178 +#define XK_Ucircumflex 0x0db
  179 +#define XK_Udiaeresis 0x0dc
  180 +#define XK_Yacute 0x0dd
  181 +#define XK_THORN 0x0de
  182 +#define XK_Thorn 0x0de
  183 +#define XK_ssharp 0x0df
  184 +#define XK_agrave 0x0e0
  185 +#define XK_aacute 0x0e1
  186 +#define XK_acircumflex 0x0e2
  187 +#define XK_atilde 0x0e3
  188 +#define XK_adiaeresis 0x0e4
  189 +#define XK_aring 0x0e5
  190 +#define XK_ae 0x0e6
  191 +#define XK_ccedilla 0x0e7
  192 +#define XK_egrave 0x0e8
  193 +#define XK_eacute 0x0e9
  194 +#define XK_ecircumflex 0x0ea
  195 +#define XK_ediaeresis 0x0eb
  196 +#define XK_igrave 0x0ec
  197 +#define XK_iacute 0x0ed
  198 +#define XK_icircumflex 0x0ee
  199 +#define XK_idiaeresis 0x0ef
  200 +#define XK_eth 0x0f0
  201 +#define XK_ntilde 0x0f1
  202 +#define XK_ograve 0x0f2
  203 +#define XK_oacute 0x0f3
  204 +#define XK_ocircumflex 0x0f4
  205 +#define XK_otilde 0x0f5
  206 +#define XK_odiaeresis 0x0f6
  207 +#define XK_division 0x0f7
  208 +#define XK_oslash 0x0f8
  209 +#define XK_ugrave 0x0f9
  210 +#define XK_uacute 0x0fa
  211 +#define XK_ucircumflex 0x0fb
  212 +#define XK_udiaeresis 0x0fc
  213 +#define XK_yacute 0x0fd
  214 +#define XK_thorn 0x0fe
  215 +#define XK_ydiaeresis 0x0ff
  216 +
  217 +#endif /*]*/
src/include/lib3270/action_table.h 0 → 100644
@@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
  1 +/*
  2 + * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como actions.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + *
  30 + */
  31 +
  32 + /*
  33 + * Action call table.
  34 + *
  35 + * Usually this definitions are used to declare lib3270's action table but,
  36 + * if you redefine the creation macros it can be used to build a callback
  37 + * table for g_object_connect calls.
  38 + *
  39 + */
  40 +
  41 + /* Keyboard actions */
  42 + DECLARE_LIB3270_KEY_ACTION( enter )
  43 +
  44 + DECLARE_LIB3270_FKEY_ACTION( pfkey )
  45 + DECLARE_LIB3270_FKEY_ACTION( pakey )
  46 +
  47 + /* Cursor movement */
  48 + DECLARE_LIB3270_CURSOR_ACTION( up )
  49 + DECLARE_LIB3270_CURSOR_ACTION( down )
  50 + DECLARE_LIB3270_CURSOR_ACTION( left )
  51 + DECLARE_LIB3270_CURSOR_ACTION( right )
  52 + DECLARE_LIB3270_CURSOR_ACTION( newline )
  53 +
  54 + /* Misc actions */
  55 + DECLARE_LIB3270_ACTION( kybdreset )
  56 + DECLARE_LIB3270_ACTION( clear )
  57 + DECLARE_LIB3270_ACTION( eraseinput )
  58 +
  59 + DECLARE_LIB3270_ACTION( select_field )
  60 + DECLARE_LIB3270_ACTION( select_all )
  61 + DECLARE_LIB3270_ACTION( unselect )
  62 + DECLARE_LIB3270_ACTION( reselect )
  63 +
  64 + DECLARE_LIB3270_ACTION( firstfield )
  65 + DECLARE_LIB3270_ACTION( eraseeof )
  66 + DECLARE_LIB3270_ACTION( eraseeol )
  67 + DECLARE_LIB3270_ACTION( erase )
  68 + DECLARE_LIB3270_ACTION( delete )
  69 + DECLARE_LIB3270_ACTION( dup )
  70 + DECLARE_LIB3270_ACTION( fieldmark )
  71 +
  72 + DECLARE_LIB3270_ACTION( backspace )
  73 + DECLARE_LIB3270_ACTION( previousword )
  74 + DECLARE_LIB3270_ACTION( nextword )
  75 + DECLARE_LIB3270_ACTION( fieldend )
  76 +
  77 + DECLARE_LIB3270_ACTION( nextfield )
  78 + DECLARE_LIB3270_ACTION( previousfield )
  79 +
  80 + DECLARE_LIB3270_ACTION( attn )
  81 + DECLARE_LIB3270_ACTION( break )
  82 + DECLARE_LIB3270_ACTION( pastenext )
  83 +
  84 + DECLARE_LIB3270_ACTION( deleteword )
  85 + DECLARE_LIB3270_ACTION( deletefield )
  86 + DECLARE_LIB3270_ACTION( sysreq )
  87 +
  88 + DECLARE_LIB3270_ACTION( testpattern )
  89 + DECLARE_LIB3270_ACTION( charsettable )
  90 +
  91 +
src/include/lib3270/actions.h 0 → 100644
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
  1 +/*
  2 + * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como actions.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)
  30 + *
  31 + */
  32 +
  33 +#ifdef __cplusplus
  34 + extern "C" {
  35 +#endif
  36 +
  37 + // Standard actions
  38 + #define DECLARE_LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession);
  39 + #define LIB3270_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession)
  40 +
  41 + // Single key actions
  42 + #define DECLARE_LIB3270_KEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession);
  43 + #define LIB3270_KEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession)
  44 +
  45 + // Cursor actions
  46 + #define DECLARE_LIB3270_CURSOR_ACTION( name ) LIB3270_EXPORT int lib3270_cursor_ ## name (H3270 *hSession);
  47 + #define LIB3270_CURSOR_ACTION( name ) LIB3270_EXPORT int lib3270_cursor_ ## name (H3270 *hSession)
  48 +
  49 + // PF & PA key actions
  50 + #define DECLARE_LIB3270_FKEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession, int key);
  51 + #define LIB3270_FKEY_ACTION( name ) LIB3270_EXPORT int lib3270_ ## name (H3270 *hSession, int key)
  52 +
  53 + // Load action table entries
  54 + #include <lib3270/action_table.h>
  55 +
  56 +#ifdef __cplusplus
  57 + }
  58 +#endif
src/include/lib3270/charset.h 0 → 100644
@@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como charset.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + *
  30 + */
  31 +
  32 +#ifndef LIB3270_CHARSET_H_INCLUDED
  33 +
  34 + #define LIB3270_CHARSET_H_INCLUDED 1
  35 +
  36 +#ifdef __cplusplus
  37 + extern "C" {
  38 +#endif
  39 +
  40 + struct lib3270_charset
  41 + {
  42 + char * host;
  43 + char * display;
  44 + unsigned long cgcsgid;
  45 +
  46 + // Translation tables
  47 + unsigned short ebc2asc[256];
  48 + unsigned short asc2ebc[256];
  49 +
  50 + unsigned short asc2uc[256];
  51 +
  52 + };
  53 +
  54 + typedef enum
  55 + {
  56 + CS_ONLY,
  57 + FT_ONLY,
  58 + BOTH
  59 + } lib3270_remap_scope;
  60 +
  61 + LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name);
  62 + LIB3270_EXPORT const char * lib3270_get_host_charset(H3270 *hSession);
  63 + LIB3270_EXPORT void lib3270_reset_charset(H3270 *hSession, const char * host, const char * display, unsigned long cgcsgid);
  64 +
  65 + LIB3270_EXPORT void lib3270_remap_char(H3270 *hSession, unsigned short ebc, unsigned short iso, lib3270_remap_scope scope, unsigned char one_way);
  66 + LIB3270_EXPORT const char * lib3270_ebc2asc(H3270 *hSession, unsigned char *buffer, int sz);
  67 + LIB3270_EXPORT const char * lib3270_asc2ebc(H3270 *hSession, unsigned char *buffer, int sz);
  68 +
  69 +
  70 +#ifdef __cplusplus
  71 + }
  72 +#endif
  73 +
  74 +#endif // LIB3270_CHARSET_H_INCLUDED
src/include/lib3270/filetransfer.h 0 → 100644
@@ -0,0 +1,194 @@ @@ -0,0 +1,194 @@
  1 +/*
  2 + * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como filetransfer.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)
  30 + *
  31 + */
  32 +
  33 +#ifndef LIB3270_FILETRANSFER_INCLUDED
  34 +
  35 + #define LIB3270_FILETRANSFER_INCLUDED 1
  36 + #include <stdio.h>
  37 + #include <sys/time.h>
  38 + #include <lib3270/charset.h>
  39 +
  40 + typedef enum _lib3270_FT_OPTION
  41 + {
  42 + LIB3270_FT_OPTION_SEND = 0x0000,
  43 +
  44 + LIB3270_FT_OPTION_RECEIVE = 0x0001,
  45 + LIB3270_FT_OPTION_ASCII = 0x0002, ///< @brief Convert to ascii
  46 + LIB3270_FT_OPTION_CRLF = 0x0004, ///< @brief Add crlf to each line
  47 + LIB3270_FT_OPTION_APPEND = 0x0008,
  48 + LIB3270_FT_OPTION_REMAP = 0x0010, ///< @brief Remap ASCII<->EBCDIC
  49 + LIB3270_FT_OPTION_UNIX = 0x0020, ///< @brief Unix text file
  50 +
  51 + LIB3270_FT_RECORD_FORMAT_DEFAULT = 0x0000,
  52 + LIB3270_FT_RECORD_FORMAT_FIXED = 0x0100,
  53 + LIB3270_FT_RECORD_FORMAT_VARIABLE = 0x0200,
  54 + LIB3270_FT_RECORD_FORMAT_UNDEFINED = 0x0300,
  55 +
  56 + LIB3270_FT_ALLOCATION_UNITS_DEFAULT = 0x0000,
  57 + LIB3270_FT_ALLOCATION_UNITS_TRACKS = 0x1000,
  58 + LIB3270_FT_ALLOCATION_UNITS_CYLINDERS = 0x2000,
  59 + LIB3270_FT_ALLOCATION_UNITS_AVBLOCK = 0x3000
  60 +
  61 + } LIB3270_FT_OPTION;
  62 +
  63 + #define LIB3270_FT_ALLOCATION_UNITS_MASK LIB3270_FT_ALLOCATION_UNITS_AVBLOCK
  64 + #define LIB3270_FT_RECORD_FORMAT_MASK LIB3270_FT_RECORD_FORMAT_UNDEFINED
  65 +
  66 + typedef enum _lib3270_ft_value
  67 + {
  68 +
  69 + LIB3270_FT_VALUE_LRECL,
  70 + LIB3270_FT_VALUE_BLKSIZE,
  71 + LIB3270_FT_VALUE_PRIMSPACE,
  72 + LIB3270_FT_VALUE_SECSPACE,
  73 + LIB3270_FT_VALUE_DFT,
  74 +
  75 + LIB3270_FT_VALUE_COUNT
  76 +
  77 + } LIB3270_FT_VALUE;
  78 +
  79 + typedef enum _lib3270_ft_state
  80 + {
  81 + LIB3270_FT_STATE_NONE, /**< No transfer in progress */
  82 + LIB3270_FT_STATE_AWAIT_ACK, /**< IND$FILE sent, awaiting acknowledgement message */
  83 + LIB3270_FT_STATE_RUNNING, /**< Ack received, data flowing */
  84 + LIB3270_FT_STATE_ABORT_WAIT, /**< Awaiting chance to send an abort */
  85 + LIB3270_FT_STATE_ABORT_SENT /**< Abort sent; awaiting response */
  86 + } LIB3270_FT_STATE;
  87 +
  88 + #define LIB3270_XLATE_NBUF 4
  89 +
  90 + struct lib3270_ft_callbacks
  91 + {
  92 + void (*complete)(H3270 *hSession, unsigned long length,double kbytes_sec,const char *msg, void *userdata);
  93 + void (*failed)(H3270 *hSession, unsigned long length,double kbytes_sec,const char *msg, void *userdata);
  94 + void (*message)(H3270 *hSession, const char *msg, void *userdata);
  95 + void (*update)(H3270 *hSession, unsigned long current, unsigned long length, double kbytes_sec, void *userdata);
  96 + void (*running)(H3270 *hSession, int is_cut, void *userdata);
  97 + void (*aborting)(H3270 *hSession, void *userdata);
  98 + void (*state_changed)(H3270 *hSession, LIB3270_FT_STATE state, const char *text, void *userdata);
  99 + };
  100 +
  101 + /**
  102 + * @brief File transfer data.
  103 + *
  104 + */
  105 + struct _h3270ft
  106 + {
  107 + struct lib3270_ft_callbacks cbk; ///< @brief Callback table - Always the first one.
  108 +
  109 + int ft_last_cr : 1; ///< @brief CR was last char in local file
  110 + int remap_flag : 1; ///< @brief Remap ASCII<->EBCDIC
  111 + int cr_flag : 1; ///< @brief Add crlf to each line
  112 + int unix_text : 1; ///< @brief Following the convention for UNIX text files.
  113 + int message_flag : 1; ///< @brief Open Request for msg received
  114 + int ascii_flag : 1; ///< @brief Convert to ascii
  115 + int ft_is_cut : 1; ///< @brief File transfer is CUT-style
  116 + int dft_eof : 1;
  117 +
  118 +
  119 + H3270 * host;
  120 + void * user_data; ///< @brief File transfer dialog handle
  121 + FILE * local_file; ///< @brief File descriptor for local file
  122 + unsigned long length; ///< @brief File length
  123 +
  124 + LIB3270_FT_STATE state;
  125 + LIB3270_FT_OPTION flags;
  126 +
  127 + int lrecl;
  128 + int blksize;
  129 + int primspace;
  130 + int secspace;
  131 + int dft;
  132 +
  133 + unsigned long ft_length; ///< Length of transfer
  134 +
  135 + struct timeval starting_time; ///< Starting time
  136 +
  137 + const char * local; ///< Local filename
  138 + const char * remote; ///< Remote filename
  139 +
  140 + // ft_dft.c
  141 + char * abort_string;
  142 + unsigned long recnum;
  143 + unsigned char * dft_savebuf;
  144 + int dft_savebuf_len;
  145 + int dft_savebuf_max;
  146 +
  147 + // ft_cut.c
  148 + int quadrant;
  149 + unsigned long expanded_length;
  150 + char * saved_errmsg;
  151 + int xlate_buffered; ///< buffer count
  152 + int xlate_buf_ix; ///< buffer index
  153 + unsigned char xlate_buf[LIB3270_XLATE_NBUF]; ///< buffer
  154 +
  155 + // Charset
  156 + struct lib3270_charset charset;
  157 +
  158 + };
  159 +
  160 +
  161 +
  162 + /**
  163 + * Create a new file transfer session.
  164 + *
  165 + * @param session
  166 + * @param flags
  167 + * @param local
  168 + * @param remote
  169 + * @param lrecl
  170 + * @param blksize
  171 + * @param primspace
  172 + * @param secspace
  173 + * @param dft
  174 + * @param msg Pointer to receive message text.
  175 + *
  176 + * @return Filetransfer callback table
  177 + *
  178 + */
  179 + 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);
  180 +
  181 + LIB3270_EXPORT int lib3270_ft_start(H3270 *hSession);
  182 + LIB3270_EXPORT int lib3270_ft_destroy(H3270 *hSession);
  183 +
  184 + LIB3270_EXPORT int lib3270_ft_cancel(H3270 *hSession, int force);
  185 +
  186 + LIB3270_EXPORT void lib3270_ft_set_user_data(H3270 *h, void *ptr);
  187 + LIB3270_EXPORT void * lib3270_ft_get_user_data(H3270 *h);
  188 +
  189 + LIB3270_EXPORT LIB3270_FT_STATE lib3270_get_ft_state(H3270 *session);
  190 +
  191 + LIB3270_EXPORT struct lib3270_ft_callbacks * lib3270_get_ft_callbacks(H3270 *session, unsigned short sz);
  192 +
  193 +
  194 +#endif // LIB3270_FILETRANSFER_INCLUDED
src/include/lib3270/html.h 0 → 100644
@@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
  1 +/*
  2 + * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como html.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + *
  27 + */
  28 +
  29 +#ifndef LIB3270_HTML_H_INCLUDED
  30 +
  31 + #define LIB3270_HTML_H_INCLUDED 1
  32 +
  33 +#ifdef __cplusplus
  34 + extern "C" {
  35 +#endif
  36 +
  37 + typedef enum _lib3270_html_option
  38 + {
  39 + LIB3270_HTML_OPTION_ALL = 0x0001,
  40 + LIB3270_HTML_OPTION_HEADERS = 0x0002,
  41 + LIB3270_HTML_OPTION_FORM = 0x0004,
  42 +
  43 + } LIB3270_HTML_OPTION;
  44 +
  45 +
  46 + LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option);
  47 +
  48 +#ifdef __cplusplus
  49 + }
  50 +#endif
  51 +
  52 +#endif // LIB3270_HTML_H_INCLUDED
  53 +
src/include/lib3270/internals.h 0 → 100644
@@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
  1 +/*
  2 + * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como internals.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + *
  27 + */
  28 +
  29 +#ifndef LIB3270_INTERNALS_H_INCLUDED
  30 +
  31 + #define LIB3270_INTERNALS_H_INCLUDED 1
  32 +
  33 +#ifdef __cplusplus
  34 + extern "C" {
  35 +#endif
  36 +
  37 + LIB3270_EXPORT void lib3270_data_recv(H3270 *hSession, size_t nr, const unsigned char *netrbuf);
  38 + LIB3270_EXPORT void lib3270_set_disconnected(H3270 *hSession);
  39 + LIB3270_EXPORT void lib3270_set_connected(H3270 *hSession);
  40 + LIB3270_EXPORT void lib3270_setup_session(H3270 *session);
  41 +
  42 +
  43 +#ifdef __cplusplus
  44 + }
  45 +#endif
  46 +
  47 +#endif // LIB3270_HTML_H_INCLUDED
  48 +
src/include/lib3270/log.h 0 → 100644
@@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como log.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 + #ifndef LIB3270_LOG_H_INCLUDED
  31 +
  32 + #include <stdarg.h>
  33 +
  34 + #define LIB3270_LOG_H_INCLUDED 1
  35 +
  36 + #ifdef ANDROID
  37 +
  38 + #include <android/log.h>
  39 +
  40 + #define DEBUG 1
  41 +
  42 + #define lib3270_write_log(s,m,f,...) __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", __VA_ARGS__ )
  43 + #define lib3270_write_rc(s,m,r,f,...) __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", __VA_ARGS__ )
  44 + #define lib3270_write_va_log(s,m,f,a) __android_log_vprint(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", a)
  45 +
  46 + // #define trace( fmt, ... ) __android_log_print(ANDROID_LOG_DEBUG, PACKAGE_NAME, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ );
  47 + #define trace(x, ...) // __VA_ARGS__
  48 +
  49 + #else
  50 +
  51 + #ifdef __cplusplus
  52 + extern "C" {
  53 + #endif
  54 +
  55 + LIB3270_EXPORT void lib3270_set_log_handler(void (*loghandler)(H3270 *, const char *, int, const char *, va_list));
  56 + LIB3270_EXPORT int lib3270_write_log(H3270 *session, const char *module, const char *fmt, ...) LIB3270_GNUC_FORMAT(3,4);
  57 + LIB3270_EXPORT int lib3270_write_rc(H3270 *session, const char *module, int rc, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5);
  58 + LIB3270_EXPORT void lib3270_write_va_log(H3270 *session, const char *module, const char *fmt, va_list arg);
  59 +
  60 + #ifdef DEBUG
  61 + #include <stdio.h>
  62 + #undef trace
  63 + #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr);
  64 + #define debug( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr);
  65 + #else
  66 + #undef trace
  67 + #define trace(x, ...) // __VA_ARGS__
  68 + #define debug(x, ...) // __VA_ARGS__
  69 + #endif
  70 +
  71 + #ifdef __cplusplus
  72 + }
  73 + #endif
  74 +
  75 + #endif // ANDROID
  76 +
  77 +
  78 + #endif // LIB3270_LOG_H_INCLUDED
  79 +
  80 +
src/include/lib3270/macros.h 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +/*
  2 + * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como macros.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)
  30 + *
  31 + */
  32 +
  33 + #define LIB3270_MACRO( name ) LIB3270_EXPORT char * lib3270_macro_ ## name (H3270 *hSession, int argc, const char **argv)
  34 +
  35 + LIB3270_EXPORT char * lib3270_run_macro(H3270 *session, const char **argv);
  36 +
src/include/lib3270/popup.h 0 → 100644
@@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
  1 +/*
  2 + * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como api.h e possui 444 linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + *
  30 + */
  31 +
  32 +#ifndef LIB3270_POPUP_INCLUDED
  33 +
  34 + #define LIB3270_POPUP_INCLUDED 1
  35 +
  36 +#ifdef __cplusplus
  37 + extern "C" {
  38 +#endif
  39 +
  40 + /**
  41 + * Notification message types.
  42 + *
  43 + */
  44 + typedef enum _LIB3270_NOTIFY
  45 + {
  46 + LIB3270_NOTIFY_INFO, /**< Simple information dialog */
  47 + LIB3270_NOTIFY_WARNING,
  48 + LIB3270_NOTIFY_ERROR,
  49 + LIB3270_NOTIFY_CRITICAL, /**< Critical error, user can abort application */
  50 +
  51 + LIB3270_NOTIFY_USER /**< Reserved, always the last one */
  52 + } LIB3270_NOTIFY;
  53 +
  54 + LIB3270_EXPORT void lib3270_set_popup_handler(int (*popup_handler)(H3270 *, void *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list));
  55 +
  56 + /**
  57 + * Pop up an error dialog, based on an error number.
  58 + *
  59 + * @param hSession Session handle
  60 + * @param errn Error number (errno).
  61 + * @param fmt Message format
  62 + * @param ... Arguments for message
  63 + */
  64 + LIB3270_EXPORT void lib3270_popup_an_errno(H3270 *hSession, int errn, const char *fmt, ...);
  65 +
  66 + LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...);
  67 +
  68 + LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list);
  69 +
  70 +#ifdef __cplusplus
  71 + }
  72 +#endif
  73 +
  74 +#endif // LIB3270_POPUP_INCLUDED
  75 +
  76 +
src/include/lib3270/selection.h 0 → 100644
@@ -0,0 +1,153 @@ @@ -0,0 +1,153 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como selection.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + *
  30 + */
  31 +
  32 + #ifndef LIB3270_SELECTION_H_INCLUDED
  33 +
  34 + #define LIB3270_SELECTION_H_INCLUDED 1
  35 +
  36 + LIB3270_EXPORT int lib3270_unselect(H3270 *session);
  37 + LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr);
  38 + LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr);
  39 + LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr);
  40 + LIB3270_EXPORT int lib3270_select_field(H3270 *session);
  41 + LIB3270_EXPORT int lib3270_select_all(H3270 *session);
  42 +
  43 + /**
  44 + * "Paste" supplied string.
  45 + *
  46 + * @param h Session handle.
  47 + * @param str String to paste.
  48 + *
  49 + * @see lib3270_pastenext.
  50 + *
  51 + * @return Non 0 if there's more to paste with lib3270_pastenext
  52 + *
  53 + */
  54 + LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str);
  55 +
  56 + /**
  57 + * Paste remaining string.
  58 + *
  59 + * @param h Session handle.
  60 + *
  61 + * @see lib3270_paste.
  62 + *
  63 + * @return Non 0 if there's more to paste.
  64 + *
  65 + */
  66 + LIB3270_EXPORT int lib3270_pastenext(H3270 *h);
  67 +
  68 + /**
  69 + * Move selected box 1 char in the selected direction.
  70 + *
  71 + * @param h Session handle.
  72 + * @param dir Direction to move
  73 + *
  74 + * @return 0 if the movement can be done, non zero if failed.
  75 + */
  76 + LIB3270_EXPORT int lib3270_move_selection(H3270 *h, LIB3270_DIRECTION dir);
  77 +
  78 + /**
  79 + * Move selected box.
  80 + *
  81 + * @param h Session handle.
  82 + * @param from Address of origin position inside the selected buffer.
  83 + * @param to Address of the new origin position.
  84 + *
  85 + * @return The new origin position.
  86 + *
  87 + */
  88 + LIB3270_EXPORT int lib3270_move_selected_area(H3270 *h, int from, int to);
  89 +
  90 + /**
  91 + * Drag selected region.
  92 + *
  93 + * Move or resize selected box according to the selection flags.
  94 + *
  95 + * @param h Session handle.
  96 + * @param flag Selection flag.
  97 + * @param origin Reference position (got from mouse button down or other move action).
  98 + * @param baddr New position.
  99 + *
  100 + * @return The new reference position.
  101 + *
  102 + */
  103 + LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int origin, int baddr);
  104 +
  105 + /**
  106 + * Gets the selected range of characters in the screen
  107 + *
  108 + * @param h Session handle.
  109 + * @param start return location for start of selection, as a character offset.
  110 + * @param end return location for end of selection, as a character offset.
  111 + *
  112 + * @return Non 0 if selection is non-empty
  113 + *
  114 + */
  115 + LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int *end);
  116 +
  117 + /**
  118 + * Get bitmasked flag for the current selection.
  119 + *
  120 + * Calculate flags to help drawing of the correct mouse pointer over a selection.
  121 + *
  122 + * @param h Session handle.
  123 + * @param baddr Position.
  124 + *
  125 + * @return bitmask for mouse pointer.
  126 + */
  127 + LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *h, int baddr);
  128 +
  129 + /**
  130 + * Get a string from required region.
  131 + *
  132 + * @param h Session handle.
  133 + * @param start_pos First char to get.
  134 + * @param end_pos Last char to get.
  135 + * @param all zero to get only selected chars.
  136 + *
  137 + * @return String with selected region (release it with free()
  138 + *
  139 + */
  140 + LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, unsigned char all);
  141 +
  142 +
  143 + /**
  144 + * Selects a range of characters in the screen.
  145 + *
  146 + * @param h Session handle.
  147 + * @param start_offset Start offset.
  148 + * @param end_offset : End offset.
  149 + *
  150 + */
  151 + LIB3270_EXPORT int lib3270_select_region(H3270 *h, int start, int end);
  152 +
  153 + #endif // LIB3270_SELECTION_H_INCLUDED
src/include/lib3270/session.h 0 → 100644
@@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como session.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 + #ifndef LIB3270_SESSION_H_INCLUDED
  31 +
  32 + #define LIB3270_SESSION_H_INCLUDED 1
  33 +
  34 + #ifdef WIN32
  35 + #include <winsock2.h>
  36 + #include <windows.h>
  37 + #include <ws2tcpip.h>
  38 + #else
  39 + #include <sys/socket.h>
  40 + #endif // WIN32
  41 +
  42 + #include <lib3270/popup.h>
  43 +
  44 + struct lib3270_session_callbacks
  45 + {
  46 + int (*write)(H3270 *hSession, unsigned const char *buf, int len);
  47 + void (*disconnect)(H3270 *hSession);
  48 +
  49 + void (*configure)(H3270 *session, unsigned short rows, unsigned short cols);
  50 + void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor);
  51 + void (*changed)(H3270 *session, int offset, int len);
  52 + void (*display)(H3270 *session);
  53 + void (*set_width)(H3270 *session, int width);
  54 +
  55 + void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);
  56 + void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on);
  57 + void (*update_toggle)(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name);
  58 + void (*update_luname)(H3270 *session, const char *name);
  59 + void (*update_status)(H3270 *session, LIB3270_MESSAGE id);
  60 + void (*update_connect)(H3270 *session, unsigned char connected);
  61 + void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols);
  62 + void (*update_selection)(H3270 *session, int start, int end);
  63 + void (*update_ssl)(H3270 *session, LIB3270_SSL_STATE state);
  64 +
  65 + void (*set_timer)(H3270 *session, unsigned char on);
  66 + void (*erase)(H3270 *session);
  67 + void (*suspend)(H3270 *session);
  68 + void (*resume)(H3270 *session);
  69 + void (*cursor)(H3270 *session, LIB3270_POINTER id);
  70 + void (*set_selection)(H3270 *session, unsigned char on);
  71 + void (*ctlr_done)(H3270 *session);
  72 + void (*autostart)(H3270 *session);
  73 + int (*print)(H3270 *session);
  74 +
  75 + void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text);
  76 +
  77 + };
  78 +
  79 + /**
  80 + * Register application Handlers.
  81 + *
  82 + * @param cbk Structure with the application I/O handles to set.
  83 + *
  84 + * @return 0 if ok, error code if not.
  85 + *
  86 + */
  87 + int LIB3270_EXPORT lib3270_set_session_callbacks(const struct lib3270_callbacks *cbk);
  88 +
  89 + LIB3270_EXPORT int lib3270_getpeername(H3270 *hSession, struct sockaddr *addr, socklen_t *addrlen);
  90 + LIB3270_EXPORT int lib3270_getsockname(H3270 *hSession, struct sockaddr *addr, socklen_t *addrlen);
  91 +
  92 + LIB3270_EXPORT struct lib3270_session_callbacks * lib3270_get_session_callbacks(H3270 *session, unsigned short sz);
  93 +
  94 +#endif // LIB3270_SESSION_H_INCLUDED
  95 +
  96 +
src/include/lib3270/trace.h 0 → 100644
@@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como session.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  28 + *
  29 + */
  30 +
  31 +#ifndef LIB3270_TRACE_H_INCLUDED
  32 +
  33 + #define LIB3270_TRACE_H_INCLUDED 1
  34 +
  35 +#ifdef __cplusplus
  36 + extern "C" {
  37 +#endif
  38 +
  39 +#ifdef _WIN32
  40 + #define LIB3270_AS_PRINTF(a,b) /* __attribute__((format(printf, a, b))) */
  41 +#else
  42 + #define LIB3270_AS_PRINTF(a,b) __attribute__((format(printf, a, b)))
  43 +#endif
  44 +
  45 + typedef void (*LIB3270_TRACE_HANDLER)(H3270 *, const char *, va_list);
  46 +
  47 +
  48 + /**
  49 + * Set trace handle callback.
  50 + *
  51 + * @param handle Callback to write in trace file or show trace window (NULL send all trace to stdout/syslog).
  52 + * @param data User data to pass to the trace handler.
  53 + *
  54 + * @return Current trace handler
  55 + */
  56 + LIB3270_EXPORT LIB3270_TRACE_HANDLER lib3270_set_trace_handler( LIB3270_TRACE_HANDLER handler);
  57 +
  58 + /**
  59 + * Write on trace file.
  60 + *
  61 + * Write text on trace file, if DStrace is enabled.
  62 + *
  63 + * @param fmt String format.
  64 + * @param ... Arguments.
  65 + *
  66 + */
  67 + LIB3270_EXPORT void lib3270_write_dstrace(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3);
  68 +
  69 + /**
  70 + * Write on trace file.
  71 + *
  72 + * Write text on trace file, if network trace is enabled.
  73 + *
  74 + * @param fmt String format.
  75 + * @param ... Arguments.
  76 + *
  77 + */
  78 + LIB3270_EXPORT void lib3270_write_nettrace(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3);
  79 +
  80 + /**
  81 + * Write on trace file.
  82 + *
  83 + * Write text on trace file, if event is enabled.
  84 + *
  85 + * @param fmt String format.
  86 + * @param ... Arguments.
  87 + *
  88 + */
  89 + LIB3270_EXPORT void lib3270_trace_event(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3);
  90 +
  91 +#ifdef __cplusplus
  92 + }
  93 +#endif
  94 +
  95 +#endif // LIB3270_TRACE_H_INCLUDED
src/include/private.h
@@ -1,656 +0,0 @@ @@ -1,656 +0,0 @@
1 -/*  
2 - * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270  
3 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a  
4 - * aplicativos mainframe. Registro no INPI sob o nome G3270.  
5 - *  
6 - * Copyright (C) <2008> <Banco do Brasil S.A.>  
7 - *  
8 - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob  
9 - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela  
10 - * Free Software Foundation.  
11 - *  
12 - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER  
13 - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO  
14 - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para  
15 - * obter mais detalhes.  
16 - *  
17 - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este  
18 - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin  
19 - * St, Fifth Floor, Boston, MA 02110-1301 USA  
20 - *  
21 - * Este programa está nomeado como private.h e possui - linhas de código.  
22 - *  
23 - * Contatos:  
24 - *  
25 - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)  
26 - * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)  
27 - *  
28 - */  
29 -  
30 -#ifdef WIN32  
31 - #include <winsock2.h>  
32 - #include <windows.h>  
33 -#endif // WIN32  
34 -  
35 -/* Autoconf settings. */  
36 -#include <config.h> /* autoconf settings */  
37 -#include <lib3270.h> /* lib3270 API calls and defs */  
38 -#include <lib3270/charset.h>  
39 -#include "api.h"  
40 -  
41 -#if defined(X3270_TN3270E) && !defined(X3270_ANSI) /*[*/  
42 - #define X3270_ANSI 1 /* RFC2355 requires NVT mode */  
43 -#endif /*]*/  
44 -  
45 -#if defined(HAVE_VASPRINTF) && !defined(_GNU_SOURCE) /*[*/  
46 - #define _GNU_SOURCE /* vasprintf isn't POSIX */  
47 -#endif /*]*/  
48 -  
49 -/*  
50 - * gettext stuff  
51 - */  
52 -#ifdef ANDROID  
53 - #undef HAVE_LIBINTL  
54 - #undef HAVE_LIBSSL  
55 -#endif  
56 -  
57 -#ifdef HAVE_LIBINTL  
58 - #include <libintl.h>  
59 - #define _( x ) gettext(x)  
60 - #define N_( x ) x  
61 -#else  
62 - #define _( x ) x  
63 - #define N_( x ) x  
64 -#endif // HAVE_LIBINTL  
65 -  
66 -#define action_name(x) #x  
67 -  
68 -/*  
69 - * OS-specific #defines. Except for the blocking-connect workarounds, these  
70 - * should be replaced with autoconf probes as soon as possible.  
71 - */  
72 -  
73 -/*  
74 - * BLOCKING_CONNECT_ONLY  
75 - * Use only blocking sockets.  
76 - */  
77 -#if defined(sco) /*[*/  
78 - #define BLOCKING_CONNECT_ONLY 1  
79 -#endif /*]*/  
80 -  
81 -#if defined(apollo) /*[*/  
82 - #define BLOCKING_CONNECT_ONLY 1  
83 -#endif /*]*/  
84 -  
85 -/*  
86 - * Compiler-specific #defines.  
87 - */  
88 -  
89 -/* 'unused' explicitly flags an unused parameter */  
90 -#if defined(__GNUC__) /*[*/  
91 - #define unused __attribute__((__unused__))  
92 - #define printflike(s,f) __attribute__ ((__format__ (__printf__, s, f)))  
93 -#else /*][*/  
94 - #define unused /* nothing */  
95 - #define printflike(s, f) /* nothing */  
96 -#endif /*]*/  
97 -  
98 -  
99 -  
100 -/*  
101 - * Prerequisite #includes.  
102 - */  
103 -#include <stdio.h> /* Unix standard I/O library */  
104 -#include <unistd.h> /* Unix system calls */  
105 -#include <ctype.h> /* Character classes */  
106 -#include <string.h> /* String manipulations */  
107 -#include <sys/types.h> /* Basic system data types */  
108 -#include <sys/time.h> /* System time-related data types */  
109 -#include <time.h> /* C library time functions */  
110 -#include "localdefs.h" /* {s,tcl,c}3270-specific defines */  
111 -  
112 -/*  
113 - * Cancel out contradictory parts.  
114 - */  
115 -#if !defined(X3270_DISPLAY) /*[*/  
116 - #undef X3270_KEYPAD  
117 - #undef X3270_MENUS  
118 -#endif /*]*/  
119 -  
120 -/* types of internal actions */  
121 -enum iaction {  
122 - IA_STRING, IA_PASTE, IA_REDRAW,  
123 - IA_KEYPAD, IA_DEFAULT, IA_KEY,  
124 - IA_MACRO, IA_SCRIPT, IA_PEEK,  
125 - IA_TYPEAHEAD, IA_FT, IA_COMMAND, IA_KEYMAP,  
126 - IA_IDLE  
127 -};  
128 -  
129 -// Version strings  
130 -LIB3270_INTERNAL const char * build;  
131 -LIB3270_INTERNAL const char * app_defaults_version;  
132 -LIB3270_INTERNAL const char * sccsid;  
133 -LIB3270_INTERNAL const char * build_rpq_timestamp;  
134 -LIB3270_INTERNAL const char * build_rpq_version;  
135 -LIB3270_INTERNAL const char * build_rpq_revision;  
136 -  
137 -#if defined(X3270_DBCS) /*[*/  
138 - LIB3270_INTERNAL Boolean dbcs;  
139 -#endif /*]*/  
140 -  
141 -  
142 -/* toggle names */  
143 -struct toggle_name {  
144 - const char *name;  
145 - int index;  
146 -};  
147 -  
148 -  
149 -/* input key type */  
150 -  
151 -/* Naming convention for private actions. */  
152 -#define PA_PFX "PA-"  
153 -  
154 -/// @brief Shorthand macros  
155 -#define CN ((char *) NULL)  
156 -#define PN ((XtPointer) NULL)  
157 -#define Replace(var, value) { lib3270_free(var); var = (value); };  
158 -  
159 -/// @brief Configuration change masks.  
160 -#define NO_CHANGE 0x0000 /// @brief no change  
161 -#define MODEL_CHANGE 0x0001 /// @brief screen dimensions changed  
162 -#define FONT_CHANGE 0x0002 /// @brief emulator font changed  
163 -#define COLOR_CHANGE 0x0004 /// @brief color scheme or 3278/9 mode changed  
164 -#define SCROLL_CHANGE 0x0008 /// @brief scrollbar snapped on or off  
165 -#define CHARSET_CHANGE 0x0010 /// @brief character set changed  
166 -#define ALL_CHANGE 0xffff /// @brief everything changed  
167 -  
168 -/* Portability macros */  
169 -  
170 -/* Equivalent of setlinebuf */  
171 -  
172 -#if defined(_IOLBF) /*[*/  
173 - #define SETLINEBUF(s) setvbuf(s, (char *)NULL, _IOLBF, BUFSIZ)  
174 -#else /*][*/  
175 - #define SETLINEBUF(s) setlinebuf(s)  
176 -#endif /*]*/  
177 -  
178 -/* Motorola version of gettimeofday */  
179 -  
180 -#if defined(MOTOROLA)  
181 - #define gettimeofday(tp,tz) gettimeofday(tp)  
182 -#endif  
183 -  
184 -/* Default DFT file transfer buffer size. */  
185 -#if defined(X3270_FT) && !defined(DFT_BUF) /*[*/  
186 - #define DFT_BUF (4 * 1024)  
187 -#endif /*]*/  
188 -  
189 -/* DBCS Preedit Types */  
190 -#if defined(X3270_DBCS) /*[*/  
191 - #define PT_ROOT "Root"  
192 - #define PT_OVER_THE_SPOT "OverTheSpot"  
193 - #define PT_OFF_THE_SPOT "OffTheSpot"  
194 - #define PT_ON_THE_SPOT "OnTheSpot"  
195 -#endif /*]*/  
196 -  
197 -/** input key type */  
198 -enum keytype  
199 -{  
200 - KT_STD,  
201 - KT_GE  
202 -};  
203 -  
204 -LIB3270_INTERNAL struct _ansictl  
205 -{  
206 - char vintr;  
207 - char vquit;  
208 - char verase;  
209 - char vkill;  
210 - char veof;  
211 - char vwerase;  
212 - char vrprnt;  
213 - char vlnext;  
214 -} ansictl;  
215 -  
216 -/** @brief Extended attributes */  
217 -struct lib3270_ea  
218 -{  
219 - unsigned char cc; ///< @brief EBCDIC or ASCII character code  
220 - unsigned char fa; ///< @brief field attribute, it nonzero  
221 - unsigned char fg; ///< @brief foreground color (0x00 or 0xf<n>)  
222 - unsigned char bg; ///< @brief background color (0x00 or 0xf<n>)  
223 - unsigned char gr; ///< @brief ANSI graphics rendition bits  
224 - unsigned char cs; ///< @brief character set (GE flag, or 0..2)  
225 - unsigned char ic; ///< @brief input control (DBCS)  
226 - unsigned char db; ///< @brief DBCS state  
227 -};  
228 -  
229 -struct lib3270_text  
230 -{  
231 - unsigned char chr; ///< @brief ASCII character code  
232 - unsigned short attr; ///< @brief Converted character attribute (color & etc)  
233 -};  
234 -  
235 -#ifndef HEADER_SSL_H  
236 - #define SSL void  
237 -#endif // !HEADER_SSL_H  
238 -  
239 -#ifndef LIB3270_TA  
240 - #define LIB3270_TA void  
241 -#endif // !LIB3270_TA  
242 -  
243 -#define LIB3270_MB_MAX 16  
244 -#define LIB3270_DEFAULT_CGEN 0x02b90000  
245 -#define LIB3270_DEFAULT_CSET 0x00000025  
246 -  
247 -#define LIB3270_FULL_MODEL_NAME_LENGTH 13  
248 -#define LIB3270_LU_MAX 32  
249 -  
250 -#define LIB3270_TELNET_N_OPTS 256  
251 -  
252 -/**  
253 - *  
254 - * @brief Timeout control structure.  
255 - *  
256 - */  
257 -typedef struct timeout  
258 -{  
259 - struct timeout *next;  
260 -  
261 -#if defined(_WIN32) /*[*/  
262 - unsigned long long ts;  
263 -#else /*][*/  
264 - struct timeval tv;  
265 -#endif /*]*/  
266 -  
267 - void (*proc)(H3270 *session);  
268 -  
269 - H3270 *session;  
270 -  
271 - unsigned char in_play;  
272 -} timeout_t;  
273 -  
274 -  
275 -/**  
276 - *  
277 - * @brief I/O events.  
278 - *  
279 - */  
280 -typedef struct input  
281 -{  
282 - struct input * next;  
283 - H3270 * session;  
284 - int fd;  
285 - LIB3270_IO_FLAG flag;  
286 - void * userdata;  
287 -  
288 - void (*call)(H3270 *, int, LIB3270_IO_FLAG, void *);  
289 -  
290 -} input_t;  
291 -  
292 -  
293 -/**  
294 - *  
295 - * @brief lib3270 session data  
296 - *  
297 - */  
298 -struct _h3270  
299 -{  
300 - struct lib3270_session_callbacks cbk; // Callback table - Always the first one.  
301 -  
302 -// unsigned short sz; /**< Struct size */  
303 -  
304 - // Connection info  
305 - int sock; /**< Network socket */  
306 - LIB3270_CSTATE cstate; /**< Connection state */  
307 -  
308 - // flags  
309 - LIB3270_OPTION options; /**< Session options */  
310 -  
311 - int bgthread : 1; /**< Running on a background thread ? */  
312 - int selected : 1; /**< Has selected region? */  
313 - int rectsel : 1; /**< Selected region is a rectangle ? */  
314 - int vcontrol : 1; /**< Visible control ? */  
315 - int modified_sel : 1;  
316 - int mono : 1; /**< Forces monochrome display */  
317 - int m3279 : 1;  
318 - int extended : 1;  
319 - int typeahead : 1;  
320 - int numeric_lock : 1;  
321 - int oerr_lock : 1;  
322 - int unlock_delay : 1;  
323 - int auto_reconnect_inprogress : 1;  
324 - unsigned int colors : 5;  
325 - int apl_mode : 1;  
326 - int icrnl : 1;  
327 - int inlcr : 1;  
328 - int onlcr : 1;  
329 - int bsd_tm : 1;  
330 - int syncing : 1;  
331 - int reverse : 1; /**< reverse-input mode */  
332 - int dbcs : 1;  
333 - int linemode : 1;  
334 - int trace_skipping : 1;  
335 - int need_tls_follows : 1;  
336 - int cut_xfer_in_progress : 1;  
337 -// int auto_keymap : 1;  
338 - int formatted : 1; /**< Formatted screen flag */  
339 - int starting : 1; /**< Is starting (no first screen)? */  
340 -  
341 - char * oversize;  
342 -  
343 - LIB3270_SSL_STATE secure;  
344 -  
345 - struct lib3270_toggle  
346 - {  
347 - char value; /**< toggle value */  
348 - void (*upcall)(H3270 *, struct lib3270_toggle *, LIB3270_TOGGLE_TYPE); /**< change value */  
349 - } toggle[LIB3270_TOGGLE_COUNT];  
350 -  
351 - // Network & Termtype  
352 - char * connected_type;  
353 - char * connected_lu;  
354 - char luname[LIB3270_LUNAME_LENGTH+1];  
355 -  
356 - char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1];  
357 - char * model_name;  
358 - int model_num;  
359 - char * termtype;  
360 -  
361 - struct  
362 - {  
363 - char * current; /**< The hostname part, stripped of qualifiers, luname and port number */  
364 - char * full; /**< The entire string, for use in reconnecting */  
365 - char * srvc; /**< The service name */  
366 - char * qualified;  
367 - } host;  
368 -  
369 - char * proxy; /**< Proxy server (type:host[:port]) */  
370 - char * termname;  
371 -  
372 - struct lib3270_charset charset;  
373 -  
374 - LIB3270_MESSAGE oia_status;  
375 -  
376 - unsigned char oia_flag[LIB3270_FLAG_COUNT];  
377 -  
378 - unsigned short current_port;  
379 -  
380 - // Misc  
381 - H3270FT * ft; /**< Active file transfer data */  
382 -  
383 - // screen info  
384 - int ov_rows;  
385 - int ov_cols;  
386 - int maxROWS;  
387 - int maxCOLS;  
388 - unsigned short rows;  
389 - unsigned short cols;  
390 - unsigned short pointer; /**< @brief Current pointer. */  
391 - int cursor_addr;  
392 - int buffer_addr;  
393 - char flipped;  
394 - int screen_alt; /**< alternate screen? */  
395 - int is_altbuffer;  
396 -  
397 - // Screen contents  
398 - void * buffer[2]; /**< Internal buffers */  
399 - struct lib3270_ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */  
400 - struct lib3270_ea * aea_buf; /**< alternate 3270 extended attribute buffer */  
401 - struct lib3270_text * text; /**< Converted 3270 chars */  
402 -  
403 - // host.c  
404 - char std_ds_host;  
405 - char no_login_host;  
406 - char non_tn3270e_host;  
407 - char passthru_host;  
408 - char ssl_host;  
409 - char ever_3270;  
410 -  
411 - // ctlr.c  
412 - int sscp_start;  
413 - unsigned char default_fg;  
414 - unsigned char default_bg;  
415 - unsigned char default_gr;  
416 - unsigned char default_cs;  
417 - unsigned char default_ic;  
418 - char reply_mode;  
419 - int trace_primed : 1;  
420 - int ticking : 1;  
421 - int mticking : 1;  
422 - int crm_nattr;  
423 - unsigned char crm_attr[16];  
424 - unsigned char * zero_buf; /**< empty buffer, for area clears */  
425 -  
426 - struct timeval t_start;  
427 - void * tick_id;  
428 - struct timeval t_want;  
429 -  
430 - // Telnet.c  
431 - unsigned char * ibuf;  
432 - int ibuf_size; /**< size of ibuf */  
433 - unsigned char * obuf; /**< 3270 output buffer */  
434 - unsigned char * obptr;  
435 - time_t ns_time;  
436 - int ns_brcvd;  
437 - int ns_rrcvd;  
438 - int ns_bsent;  
439 - int ns_rsent;  
440 - struct timeval ds_ts;  
441 - unsigned long e_funcs; /**< negotiated TN3270E functions */  
442 - unsigned short e_xmit_seq; /**< transmit sequence number */  
443 - int response_required;  
444 - int tn3270e_bound;  
445 - int tn3270e_negotiated;  
446 - int ansi_data;  
447 - int lnext;  
448 - int backslashed;  
449 - char plu_name[LIB3270_BIND_PLU_NAME_MAX+1];  
450 - char **lus;  
451 - char **curr_lu;  
452 - char * try_lu;  
453 - int proxy_type;  
454 - char * proxy_host;  
455 - char * proxy_portname;  
456 - unsigned short proxy_port;  
457 - char reported_lu[LIB3270_LU_MAX+1];  
458 - char reported_type[LIB3270_LU_MAX+1];  
459 -  
460 - enum  
461 - {  
462 - E_NONE,  
463 - E_3270,  
464 - E_NVT,  
465 - E_SSCP  
466 - } tn3270e_submode;  
467 -  
468 - unsigned char * lbuf; /**< line-mode input buffer */  
469 - unsigned char * lbptr;  
470 -  
471 -  
472 - // 3270 input buffer  
473 - unsigned char * ibptr;  
474 - unsigned char * obuf_base;  
475 - int obuf_size;  
476 -// unsigned char * netrbuf;  
477 -  
478 - // network input buffer  
479 - unsigned char * sbbuf;  
480 -  
481 - // telnet sub-option buffer  
482 - unsigned char * sbptr;  
483 - unsigned char telnet_state;  
484 -// char ttype_tmpval[13];  
485 -  
486 - unsigned char myopts[LIB3270_TELNET_N_OPTS];  
487 - unsigned char hisopts[LIB3270_TELNET_N_OPTS];  
488 -  
489 - // kybd.c  
490 - unsigned int kybdlock; ///< @brief keyboard lock state  
491 - unsigned char aid; ///< @brief current attention ID  
492 - void * unlock_id;  
493 - time_t unlock_delay_time;  
494 - unsigned long unlock_delay_ms; ///< @brief Delay before actually unlocking the keyboard after the host permits it.  
495 - LIB3270_TA * ta_head;  
496 - LIB3270_TA * ta_tail;  
497 -  
498 - // ft_dft.c  
499 - int dft_buffersize; ///< @brief Buffer size (LIMIN, LIMOUT)  
500 -  
501 - // rpq.c  
502 - int rpq_complained : 1;  
503 -#if !defined(_WIN32)  
504 - int omit_due_space_limit : 1;  
505 -#endif  
506 -  
507 - char * rpq_warnbuf;  
508 - int rpq_wbcnt;  
509 -  
510 - // User data (Usually points to session's widget)  
511 - void * user_data;  
512 -  
513 - // selection  
514 - char * paste_buffer;  
515 - struct  
516 - {  
517 - int start;  
518 - int end;  
519 - } select;  
520 -  
521 - // ansi.c  
522 - int scroll_top;  
523 - int scroll_bottom;  
524 - int once_cset;  
525 - int saved_cursor;  
526 -  
527 - int held_wrap : 1;  
528 -  
529 - int insert_mode : 1;  
530 - int auto_newline_mode : 1;  
531 -  
532 - int appl_cursor : 1;  
533 - int saved_appl_cursor : 1;  
534 -  
535 - int wraparound_mode : 1;  
536 - int saved_wraparound_mode : 1;  
537 -  
538 - int rev_wraparound_mode : 1;  
539 - int saved_rev_wraparound_mode : 1;  
540 -  
541 - int allow_wide_mode : 1;  
542 - int saved_allow_wide_mode : 1;  
543 -  
544 - int wide_mode : 1;  
545 - int saved_wide_mode : 1;  
546 -  
547 - int saved_altbuffer : 1;  
548 - int ansi_reset : 1; /**< Non zero if the ansi_reset() was called in this session */  
549 -  
550 - int ansi_ch;  
551 - int cs_to_change;  
552 -  
553 - /** ANSI Character sets. */  
554 - enum lib3270_ansi_cs  
555 - {  
556 - LIB3270_ANSI_CS_G0 = 0,  
557 - LIB3270_ANSI_CS_G1 = 1,  
558 - LIB3270_ANSI_CS_G2 = 2,  
559 - LIB3270_ANSI_CS_G3 = 3  
560 - } cset;  
561 - enum lib3270_ansi_cs saved_cset;  
562 -  
563 - /** Character set designations. */  
564 - enum lib3270_ansi_csd  
565 - {  
566 - LIB3270_ANSI_CSD_LD = 0,  
567 - LIB3270_ANSI_CSD_UK = 1,  
568 - LIB3270_ANSI_CSD_US = 2  
569 - } csd[4];  
570 - enum lib3270_ansi_csd saved_csd[4];  
571 -  
572 - enum lib3270_ansi_state  
573 - {  
574 - LIB3270_ANSI_STATE_DATA = 0,  
575 - LIB3270_ANSI_STATE_ESC = 1,  
576 - LIB3270_ANSI_STATE_CSDES = 2,  
577 - LIB3270_ANSI_STATE_N1 = 3,  
578 - LIB3270_ANSI_STATE_DECP = 4,  
579 - LIB3270_ANSI_STATE_TEXT = 5,  
580 - LIB3270_ANSI_STATE_TEXT2 = 6,  
581 - LIB3270_ANSI_STATE_MBPEND = 7  
582 - } state;  
583 -  
584 - unsigned char * tabs;  
585 -  
586 - int pmi;  
587 - char pending_mbs[LIB3270_MB_MAX];  
588 -  
589 - unsigned char gr;  
590 - unsigned char saved_gr;  
591 -  
592 - unsigned char fg;  
593 - unsigned char saved_fg;  
594 -  
595 - unsigned char bg;  
596 - unsigned char saved_bg;  
597 -  
598 - // xio  
599 - void * ns_read_id;  
600 - void * ns_write_id;  
601 - void * ns_exception_id;  
602 -  
603 - // SSL Data (Always defined to mantain the same structure size)  
604 - unsigned long ssl_error;  
605 - SSL * ssl_con;  
606 -  
607 - timeout_t * timeouts;  
608 - input_t * inputs;  
609 - int inputs_changed : 1;  
610 -  
611 - // Callbacks.  
612 - struct lib3270_state_callback * st_callbacks[LIB3270_STATE_USER];  
613 - struct lib3270_state_callback * st_last[LIB3270_STATE_USER];  
614 -  
615 -};  
616 -  
617 -/* Library internal calls */  
618 -LIB3270_INTERNAL void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped);  
619 -LIB3270_INTERNAL void lib3270_initialize(void);  
620 -LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr);  
621 -  
622 -LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);  
623 -LIB3270_INTERNAL void remove_input_calls(H3270 *session);  
624 -  
625 -LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf, int len);  
626 -LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession);  
627 -  
628 -LIB3270_INTERNAL int lib3270_default_event_dispatcher(H3270 *hSession, int block);  
629 -  
630 -#if defined(DEBUG)  
631 - #define CHECK_SESSION_HANDLE(x) check_session_handle(&x,__FUNCTION__);  
632 - LIB3270_INTERNAL void check_session_handle(H3270 **hSession, const char *fname);  
633 -#else  
634 - #define CHECK_SESSION_HANDLE(x) check_session_handle(&x);  
635 - LIB3270_INTERNAL void check_session_handle(H3270 **hSession);  
636 -#endif // DEBUG  
637 -  
638 -LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on);  
639 -  
640 -#if defined(HAVE_LIBSSL) /*[*/  
641 -  
642 - LIB3270_INTERNAL int ssl_init(H3270 *session);  
643 - LIB3270_INTERNAL int ssl_negotiate(H3270 *hSession);  
644 - LIB3270_INTERNAL void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state);  
645 -  
646 -  
647 - #if OPENSSL_VERSION_NUMBER >= 0x00907000L /*[*/  
648 - #define INFO_CONST const  
649 - #else /*][*/  
650 - #define INFO_CONST  
651 - #endif /*]*/  
652 -  
653 - LIB3270_INTERNAL void ssl_info_callback(INFO_CONST SSL *s, int where, int ret);  
654 -  
655 -#endif /*]*/  
656 -  
src/lib3270/XtGlue.c
@@ -1,97 +0,0 @@ @@ -1,97 +0,0 @@
1 -/*  
2 - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270  
3 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a  
4 - * aplicativos mainframe. Registro no INPI sob o nome G3270.  
5 - *  
6 - * Copyright (C) <2008> <Banco do Brasil S.A.>  
7 - *  
8 - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob  
9 - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela  
10 - * Free Software Foundation.  
11 - *  
12 - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER  
13 - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO  
14 - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para  
15 - * obter mais detalhes.  
16 - *  
17 - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este  
18 - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple  
19 - * Place, Suite 330, Boston, MA, 02111-1307, USA  
20 - *  
21 - * Este programa está nomeado como XtGlue.c e possui - linhas de código.  
22 - *  
23 - * Contatos:  
24 - *  
25 - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)  
26 - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)  
27 - * licinio@bb.com.br (Licínio Luis Branco)  
28 - * kraucer@bb.com.br (Kraucer Fernandes Mazuco)  
29 - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)  
30 - *  
31 - */  
32 -  
33 -#error Deprecated  
34 -  
35 -/* glue for missing Xt code */  
36 -#if defined(_WIN32)  
37 - #include <winsock2.h>  
38 - #include <windows.h>  
39 -#endif // WIN32  
40 -  
41 -#include "globals.h"  
42 -#include "api.h"  
43 -// #include <malloc.h>  
44 -  
45 -#if defined(_WIN32)  
46 -// #include "appres.h"  
47 - #include "trace_dsc.h"  
48 - #include "xioc.h"  
49 -#endif  
50 -  
51 -#include "utilc.h"  
52 -  
53 -#include <stdio.h>  
54 -// #include <stdlib.h>  
55 -#include <string.h>  
56 -#include <errno.h>  
57 -#include "X11keysym.h"  
58 -  
59 -#include <sys/time.h>  
60 -#include <sys/types.h>  
61 -#include <errno.h>  
62 -  
63 -#include <lib3270.h>  
64 -  
65 -#if defined(_WIN32) /*[*/  
66 -  
67 - #include <winsock2.h>  
68 - #include <windows.h>  
69 - #include <ws2tcpip.h>  
70 -  
71 -#else /*][*/  
72 -  
73 - #include <sys/socket.h>  
74 - #include <netinet/in.h>  
75 - #include <netdb.h>  
76 -  
77 - #if defined(SEPARATE_SELECT_H) /*[*/  
78 - #include <sys/select.h>  
79 - #endif /*]*/  
80 -#endif /*]*/  
81 -  
82 -#include "resolverc.h"  
83 -  
84 -/*---[ Implement external calls ]---------------------------------------------------------------------------*/  
85 -  
86 -/*  
87 -const char * KeysymToString(KeySym k)  
88 -{  
89 - int i;  
90 -  
91 - for (i = 0; latin1[i].name != (char *)NULL; i++) {  
92 - if (latin1[i].keysym == k)  
93 - return latin1[i].name;  
94 - }  
95 - return (char *)NULL;  
96 -}  
97 -*/  
src/lib3270/apl.c
@@ -1,221 +0,0 @@ @@ -1,221 +0,0 @@
1 -/*  
2 - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270  
3 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a  
4 - * aplicativos mainframe. Registro no INPI sob o nome G3270.  
5 - *  
6 - * Copyright (C) <2008> <Banco do Brasil S.A.>  
7 - *  
8 - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob  
9 - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela  
10 - * Free Software Foundation.  
11 - *  
12 - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER  
13 - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO  
14 - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para  
15 - * obter mais detalhes.  
16 - *  
17 - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este  
18 - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple  
19 - * Place, Suite 330, Boston, MA, 02111-1307, USA  
20 - *  
21 - * Este programa está nomeado como apl.c e possui 219 linhas de código.  
22 - *  
23 - * Contatos:  
24 - *  
25 - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)  
26 - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)  
27 - * licinio@bb.com.br (Licínio Luis Branco)  
28 - * kraucer@bb.com.br (Kraucer Fernandes Mazuco)  
29 - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)  
30 - *  
31 - */  
32 -  
33 -/*  
34 - * apl.c  
35 - * This module handles APL-specific actions.  
36 - */  
37 -  
38 -#include "globals.h"  
39 -  
40 -#if defined(X3270_APL) /*[*/  
41 -  
42 -// #include <X11/keysym.h>  
43 -  
44 -#include "aplc.h"  
45 -  
46 -  
47 -/*  
48 - * APL keysym translation.  
49 - *  
50 - * This code looks a little odd because of how an APL font is implemented.  
51 - * An APL font has APL graphics in place of the various accented letters and  
52 - * special symbols in a regular font. APL keysym translation consists of  
53 - * taking the keysym name for an APL symbol (these names are meaningful only to  
54 - * x3270) and translating it into the keysym for the regular symbol that the  
55 - * desired APL symbol _replaces_.  
56 - *  
57 - * For example, an APL font has the APL "jot" symbol where a regular font has  
58 - * the "registered" symbol. So we take the keysym name "jot" and translate it  
59 - * into the keysym XK_registered. When the XK_registered symbol is displayed  
60 - * with an APL font, it appears as a "jot".  
61 - *  
62 - * The specification of which APL symbols replace which regular symbols is in  
63 - * IBM GA27-3831, 3174 Establishment Controller Character Set Reference.  
64 - *  
65 - * In addition, several standard characters have different names for APL,  
66 - * for example, "period" becomes "dot". These are included in the table as  
67 - * well.  
68 - */  
69 - /*  
70 -  
71 -static struct {  
72 - const char *name;  
73 - KeySym keysym;  
74 - int is_ge;  
75 -} axl[] = {  
76 - { "Aunderbar", XK_nobreakspace, 1 },  
77 - { "Bunderbar", XK_acircumflex, 1 },  
78 - { "Cunderbar", XK_adiaeresis, 1 },  
79 - { "Dunderbar", XK_agrave, 1 },  
80 - { "Eunderbar", XK_aacute, 1 },  
81 - { "Funderbar", XK_atilde, 1 },  
82 - { "Gunderbar", XK_aring, 1 },  
83 - { "Hunderbar", XK_ccedilla, 1 },  
84 - { "Iunderbar", XK_ntilde, 1 },  
85 - { "Junderbar", XK_eacute, 1 },  
86 - { "Kunderbar", XK_ecircumflex, 1 },  
87 - { "Lunderbar", XK_ediaeresis, 1 },  
88 - { "Munderbar", XK_egrave, 1 },  
89 - { "Nunderbar", XK_iacute, 1 },  
90 - { "Ounderbar", XK_icircumflex, 1 },  
91 - { "Punderbar", XK_idiaeresis, 1 },  
92 - { "Qunderbar", XK_igrave, 1 },  
93 - { "Runderbar", XK_ssharp, 1 },  
94 - { "Sunderbar", XK_Acircumflex, 1 },  
95 - { "Tunderbar", XK_Adiaeresis, 1 },  
96 - { "Uunderbar", XK_Agrave, 1 },  
97 - { "Vunderbar", XK_Aacute, 1 },  
98 - { "Wunderbar", XK_Atilde, 1 },  
99 - { "Xunderbar", XK_Aring, 1 },  
100 - { "Yunderbar", XK_Ccedilla, 1 },  
101 - { "Zunderbar", XK_Ntilde, 1 },  
102 - { "alpha", XK_asciicircum, 1 },  
103 - { "bar", XK_minus, 0 },  
104 - { "braceleft", XK_braceleft, 1 },  
105 - { "braceright", XK_braceright, 1 },  
106 - { "bracketleft", XK_Yacute, 1 },  
107 - { "bracketright", XK_diaeresis, 1 },  
108 - { "circle", XK_cedilla, 1 },  
109 - { "circlebar", XK_Ograve, 1 },  
110 - { "circleslope", XK_otilde, 1 },  
111 - { "circlestar", XK_Ugrave, 1 },  
112 - { "circlestile", XK_ograve, 1 },  
113 - { "colon", XK_colon, 0 },  
114 - { "comma", XK_comma, 0 },  
115 - { "commabar", XK_W, 1 }, // soliton  
116 - { "del", XK_bracketleft, 1 },  
117 - { "delstile", XK_udiaeresis, 1 },  
118 - { "delta", XK_bracketright, 1 },  
119 - { "deltastile", XK_ugrave, 1 },  
120 - { "deltaunderbar", XK_Udiaeresis, 1 },  
121 - { "deltilde", XK_Ucircumflex, 1 },  
122 - { "diaeresis", XK_Ecircumflex, 1 },  
123 - { "diaeresiscircle", XK_V, 1 }, // soliton  
124 - { "diaeresisdot", XK_Odiaeresis, 1 },  
125 - { "diaeresisjot", XK_U, 1 }, // soliton  
126 - { "diamond", XK_oslash, 1 },  
127 - { "dieresis", XK_Ecircumflex, 1 },  
128 - { "dieresisdot", XK_Odiaeresis, 1 },  
129 - { "divide", XK_onehalf, 1 },  
130 - { "dot", XK_period, 0 },  
131 - { "downarrow", XK_guillemotright, 1 },  
132 - { "downcaret", XK_Igrave, 1 },  
133 - { "downcarettilde", XK_ocircumflex, 1 },  
134 - { "downshoe", XK_questiondown, 1 },  
135 - { "downstile", XK_thorn, 1 },  
136 - { "downtack", XK_ETH, 1 },  
137 - { "downtackjot", XK_Uacute, 1 },  
138 - { "downtackup", XK_onesuperior, 1 },  
139 - { "downtackuptack", XK_onesuperior, 1 },  
140 - { "epsilon", XK_sterling, 1 },  
141 - { "epsilonunderbar", XK_Iacute, 1 },  
142 - { "equal", XK_equal, 0 },  
143 - { "equalunderbar", XK_backslash, 1 },  
144 - { "euro", XK_X, 1 }, // soliton  
145 - { "greater", XK_greater, 0 },  
146 - { "iota", XK_yen, 1 },  
147 - { "iotaunderbar", XK_Egrave, 1 },  
148 - { "jot", XK_registered, 1 },  
149 - { "leftarrow", XK_currency, 1 },  
150 - { "leftbracket", XK_Yacute, 1 },  
151 - { "leftparen", XK_parenleft, 0 },  
152 - { "leftshoe", XK_masculine, 1 },  
153 - { "lefttack", XK_Icircumflex, 1 },  
154 - { "less", XK_less, 0 },  
155 - { "multiply", XK_paragraph, 1 },  
156 - { "notequal", XK_acute, 1 },  
157 - { "notgreater", XK_eth, 1 },  
158 - { "notless", XK_THORN, 1 },  
159 - { "omega", XK_copyright, 1 },  
160 - { "overbar", XK_mu, 1 },  
161 - { "plus", XK_plus, 0 },  
162 - { "plusminus", XK_AE, 1 },  
163 - { "quad", XK_degree, 1 },  
164 - { "quaddivide", XK_Oacute, 1 },  
165 - { "quadjot", XK_Ediaeresis, 1 },  
166 - { "quadquote", XK_uacute, 1 },  
167 - { "quadslope", XK_oacute, 1 },  
168 - { "query", XK_question, 0 },  
169 - { "quote", XK_apostrophe, 0 },  
170 - { "quotedot", XK_ucircumflex, 1 },  
171 - { "rho", XK_periodcentered, 1 },  
172 - { "rightarrow", XK_plusminus, 1 },  
173 - { "rightbracket", XK_diaeresis, 1 },  
174 - { "rightparen", XK_parenright, 0 },  
175 - { "rightshoe", XK_ordfeminine, 1 },  
176 - { "righttack", XK_Idiaeresis, 1 },  
177 - { "semicolon", XK_semicolon, 0 },  
178 - { "slash", XK_slash, 0 },  
179 - { "slashbar", XK_twosuperior, 1 },  
180 - { "slope", XK_onequarter, 1 },  
181 - { "slopebar", XK_Ocircumflex, 1 },  
182 - { "slopequad", XK_oacute, 1 },  
183 - { "splat", XK_ae, 1 },  
184 - { "squad", XK_odiaeresis, 1 },  
185 - { "star", XK_asterisk, 0 },  
186 - { "stile", XK_multiply, 1 },  
187 - { "tilde", XK_Ooblique, 1 },  
188 - { "times", XK_paragraph, 1 },  
189 - { "underbar", XK_underscore, 0 },  
190 - { "uparrow", XK_guillemotleft, 1 },  
191 - { "upcaret", XK_Eacute, 1 },  
192 - { "upcarettilde", XK_hyphen, 1 },  
193 - { "upshoe", XK_exclamdown, 1 },  
194 - { "upshoejot", XK_ydiaeresis, 1 },  
195 - { "upstile", XK_yacute, 1 },  
196 - { "uptack", XK_macron, 1 },  
197 - { "uptackjot", XK_Otilde, 1 },  
198 - { 0, 0 }  
199 -};  
200 -  
201 -//  
202 -// Translation from APL ksysym names to indirect APL keysyms.  
203 -//  
204 -KeySym  
205 -APLStringToKeysym(char *s, int *is_gep)  
206 -{  
207 - register int i;  
208 -  
209 - if (strncmp(s, "apl_", 4))  
210 - return NoSymbol;  
211 - s += 4;  
212 - for (i = 0; axl[i].name; i++)  
213 - if (!strcmp(axl[i].name, s)) {  
214 - *is_gep = axl[i].is_ge;  
215 - return axl[i].keysym;  
216 - }  
217 - return NoSymbol;  
218 -}  
219 -*/  
220 -  
221 -#endif /*]*/  
src/lib3270/private.h 0 → 100644
@@ -0,0 +1,656 @@ @@ -0,0 +1,656 @@
  1 +/*
  2 + * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como private.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  27 + *
  28 + */
  29 +
  30 +#ifdef WIN32
  31 + #include <winsock2.h>
  32 + #include <windows.h>
  33 +#endif // WIN32
  34 +
  35 +/* Autoconf settings. */
  36 +#include <config.h> /* autoconf settings */
  37 +#include <lib3270.h> /* lib3270 API calls and defs */
  38 +#include <lib3270/charset.h>
  39 +#include "api.h"
  40 +
  41 +#if defined(X3270_TN3270E) && !defined(X3270_ANSI) /*[*/
  42 + #define X3270_ANSI 1 /* RFC2355 requires NVT mode */
  43 +#endif /*]*/
  44 +
  45 +#if defined(HAVE_VASPRINTF) && !defined(_GNU_SOURCE) /*[*/
  46 + #define _GNU_SOURCE /* vasprintf isn't POSIX */
  47 +#endif /*]*/
  48 +
  49 +/*
  50 + * gettext stuff
  51 + */
  52 +#ifdef ANDROID
  53 + #undef HAVE_LIBINTL
  54 + #undef HAVE_LIBSSL
  55 +#endif
  56 +
  57 +#ifdef HAVE_LIBINTL
  58 + #include <libintl.h>
  59 + #define _( x ) gettext(x)
  60 + #define N_( x ) x
  61 +#else
  62 + #define _( x ) x
  63 + #define N_( x ) x
  64 +#endif // HAVE_LIBINTL
  65 +
  66 +#define action_name(x) #x
  67 +
  68 +/*
  69 + * OS-specific #defines. Except for the blocking-connect workarounds, these
  70 + * should be replaced with autoconf probes as soon as possible.
  71 + */
  72 +
  73 +/*
  74 + * BLOCKING_CONNECT_ONLY
  75 + * Use only blocking sockets.
  76 + */
  77 +#if defined(sco) /*[*/
  78 + #define BLOCKING_CONNECT_ONLY 1
  79 +#endif /*]*/
  80 +
  81 +#if defined(apollo) /*[*/
  82 + #define BLOCKING_CONNECT_ONLY 1
  83 +#endif /*]*/
  84 +
  85 +/*
  86 + * Compiler-specific #defines.
  87 + */
  88 +
  89 +/* 'unused' explicitly flags an unused parameter */
  90 +#if defined(__GNUC__) /*[*/
  91 + #define unused __attribute__((__unused__))
  92 + #define printflike(s,f) __attribute__ ((__format__ (__printf__, s, f)))
  93 +#else /*][*/
  94 + #define unused /* nothing */
  95 + #define printflike(s, f) /* nothing */
  96 +#endif /*]*/
  97 +
  98 +
  99 +
  100 +/*
  101 + * Prerequisite #includes.
  102 + */
  103 +#include <stdio.h> /* Unix standard I/O library */
  104 +#include <unistd.h> /* Unix system calls */
  105 +#include <ctype.h> /* Character classes */
  106 +#include <string.h> /* String manipulations */
  107 +#include <sys/types.h> /* Basic system data types */
  108 +#include <sys/time.h> /* System time-related data types */
  109 +#include <time.h> /* C library time functions */
  110 +#include "localdefs.h" /* {s,tcl,c}3270-specific defines */
  111 +
  112 +/*
  113 + * Cancel out contradictory parts.
  114 + */
  115 +#if !defined(X3270_DISPLAY) /*[*/
  116 + #undef X3270_KEYPAD
  117 + #undef X3270_MENUS
  118 +#endif /*]*/
  119 +
  120 +/* types of internal actions */
  121 +enum iaction {
  122 + IA_STRING, IA_PASTE, IA_REDRAW,
  123 + IA_KEYPAD, IA_DEFAULT, IA_KEY,
  124 + IA_MACRO, IA_SCRIPT, IA_PEEK,
  125 + IA_TYPEAHEAD, IA_FT, IA_COMMAND, IA_KEYMAP,
  126 + IA_IDLE
  127 +};
  128 +
  129 +// Version strings
  130 +LIB3270_INTERNAL const char * build;
  131 +LIB3270_INTERNAL const char * app_defaults_version;
  132 +LIB3270_INTERNAL const char * sccsid;
  133 +LIB3270_INTERNAL const char * build_rpq_timestamp;
  134 +LIB3270_INTERNAL const char * build_rpq_version;
  135 +LIB3270_INTERNAL const char * build_rpq_revision;
  136 +
  137 +#if defined(X3270_DBCS) /*[*/
  138 + LIB3270_INTERNAL Boolean dbcs;
  139 +#endif /*]*/
  140 +
  141 +
  142 +/* toggle names */
  143 +struct toggle_name {
  144 + const char *name;
  145 + int index;
  146 +};
  147 +
  148 +
  149 +/* input key type */
  150 +
  151 +/* Naming convention for private actions. */
  152 +#define PA_PFX "PA-"
  153 +
  154 +/// @brief Shorthand macros
  155 +#define CN ((char *) NULL)
  156 +#define PN ((XtPointer) NULL)
  157 +#define Replace(var, value) { lib3270_free(var); var = (value); };
  158 +
  159 +/// @brief Configuration change masks.
  160 +#define NO_CHANGE 0x0000 /// @brief no change
  161 +#define MODEL_CHANGE 0x0001 /// @brief screen dimensions changed
  162 +#define FONT_CHANGE 0x0002 /// @brief emulator font changed
  163 +#define COLOR_CHANGE 0x0004 /// @brief color scheme or 3278/9 mode changed
  164 +#define SCROLL_CHANGE 0x0008 /// @brief scrollbar snapped on or off
  165 +#define CHARSET_CHANGE 0x0010 /// @brief character set changed
  166 +#define ALL_CHANGE 0xffff /// @brief everything changed
  167 +
  168 +/* Portability macros */
  169 +
  170 +/* Equivalent of setlinebuf */
  171 +
  172 +#if defined(_IOLBF) /*[*/
  173 + #define SETLINEBUF(s) setvbuf(s, (char *)NULL, _IOLBF, BUFSIZ)
  174 +#else /*][*/
  175 + #define SETLINEBUF(s) setlinebuf(s)
  176 +#endif /*]*/
  177 +
  178 +/* Motorola version of gettimeofday */
  179 +
  180 +#if defined(MOTOROLA)
  181 + #define gettimeofday(tp,tz) gettimeofday(tp)
  182 +#endif
  183 +
  184 +/* Default DFT file transfer buffer size. */
  185 +#if defined(X3270_FT) && !defined(DFT_BUF) /*[*/
  186 + #define DFT_BUF (4 * 1024)
  187 +#endif /*]*/
  188 +
  189 +/* DBCS Preedit Types */
  190 +#if defined(X3270_DBCS) /*[*/
  191 + #define PT_ROOT "Root"
  192 + #define PT_OVER_THE_SPOT "OverTheSpot"
  193 + #define PT_OFF_THE_SPOT "OffTheSpot"
  194 + #define PT_ON_THE_SPOT "OnTheSpot"
  195 +#endif /*]*/
  196 +
  197 +/** input key type */
  198 +enum keytype
  199 +{
  200 + KT_STD,
  201 + KT_GE
  202 +};
  203 +
  204 +LIB3270_INTERNAL struct _ansictl
  205 +{
  206 + char vintr;
  207 + char vquit;
  208 + char verase;
  209 + char vkill;
  210 + char veof;
  211 + char vwerase;
  212 + char vrprnt;
  213 + char vlnext;
  214 +} ansictl;
  215 +
  216 +/** @brief Extended attributes */
  217 +struct lib3270_ea
  218 +{
  219 + unsigned char cc; ///< @brief EBCDIC or ASCII character code
  220 + unsigned char fa; ///< @brief field attribute, it nonzero
  221 + unsigned char fg; ///< @brief foreground color (0x00 or 0xf<n>)
  222 + unsigned char bg; ///< @brief background color (0x00 or 0xf<n>)
  223 + unsigned char gr; ///< @brief ANSI graphics rendition bits
  224 + unsigned char cs; ///< @brief character set (GE flag, or 0..2)
  225 + unsigned char ic; ///< @brief input control (DBCS)
  226 + unsigned char db; ///< @brief DBCS state
  227 +};
  228 +
  229 +struct lib3270_text
  230 +{
  231 + unsigned char chr; ///< @brief ASCII character code
  232 + unsigned short attr; ///< @brief Converted character attribute (color & etc)
  233 +};
  234 +
  235 +#ifndef HEADER_SSL_H
  236 + #define SSL void
  237 +#endif // !HEADER_SSL_H
  238 +
  239 +#ifndef LIB3270_TA
  240 + #define LIB3270_TA void
  241 +#endif // !LIB3270_TA
  242 +
  243 +#define LIB3270_MB_MAX 16
  244 +#define LIB3270_DEFAULT_CGEN 0x02b90000
  245 +#define LIB3270_DEFAULT_CSET 0x00000025
  246 +
  247 +#define LIB3270_FULL_MODEL_NAME_LENGTH 13
  248 +#define LIB3270_LU_MAX 32
  249 +
  250 +#define LIB3270_TELNET_N_OPTS 256
  251 +
  252 +/**
  253 + *
  254 + * @brief Timeout control structure.
  255 + *
  256 + */
  257 +typedef struct timeout
  258 +{
  259 + struct timeout *next;
  260 +
  261 +#if defined(_WIN32) /*[*/
  262 + unsigned long long ts;
  263 +#else /*][*/
  264 + struct timeval tv;
  265 +#endif /*]*/
  266 +
  267 + void (*proc)(H3270 *session);
  268 +
  269 + H3270 *session;
  270 +
  271 + unsigned char in_play;
  272 +} timeout_t;
  273 +
  274 +
  275 +/**
  276 + *
  277 + * @brief I/O events.
  278 + *
  279 + */
  280 +typedef struct input
  281 +{
  282 + struct input * next;
  283 + H3270 * session;
  284 + int fd;
  285 + LIB3270_IO_FLAG flag;
  286 + void * userdata;
  287 +
  288 + void (*call)(H3270 *, int, LIB3270_IO_FLAG, void *);
  289 +
  290 +} input_t;
  291 +
  292 +
  293 +/**
  294 + *
  295 + * @brief lib3270 session data
  296 + *
  297 + */
  298 +struct _h3270
  299 +{
  300 + struct lib3270_session_callbacks cbk; // Callback table - Always the first one.
  301 +
  302 +// unsigned short sz; /**< Struct size */
  303 +
  304 + // Connection info
  305 + int sock; /**< Network socket */
  306 + LIB3270_CSTATE cstate; /**< Connection state */
  307 +
  308 + // flags
  309 + LIB3270_OPTION options; /**< Session options */
  310 +
  311 + int bgthread : 1; /**< Running on a background thread ? */
  312 + int selected : 1; /**< Has selected region? */
  313 + int rectsel : 1; /**< Selected region is a rectangle ? */
  314 + int vcontrol : 1; /**< Visible control ? */
  315 + int modified_sel : 1;
  316 + int mono : 1; /**< Forces monochrome display */
  317 + int m3279 : 1;
  318 + int extended : 1;
  319 + int typeahead : 1;
  320 + int numeric_lock : 1;
  321 + int oerr_lock : 1;
  322 + int unlock_delay : 1;
  323 + int auto_reconnect_inprogress : 1;
  324 + unsigned int colors : 5;
  325 + int apl_mode : 1;
  326 + int icrnl : 1;
  327 + int inlcr : 1;
  328 + int onlcr : 1;
  329 + int bsd_tm : 1;
  330 + int syncing : 1;
  331 + int reverse : 1; /**< reverse-input mode */
  332 + int dbcs : 1;
  333 + int linemode : 1;
  334 + int trace_skipping : 1;
  335 + int need_tls_follows : 1;
  336 + int cut_xfer_in_progress : 1;
  337 +// int auto_keymap : 1;
  338 + int formatted : 1; /**< Formatted screen flag */
  339 + int starting : 1; /**< Is starting (no first screen)? */
  340 +
  341 + char * oversize;
  342 +
  343 + LIB3270_SSL_STATE secure;
  344 +
  345 + struct lib3270_toggle
  346 + {
  347 + char value; /**< toggle value */
  348 + void (*upcall)(H3270 *, struct lib3270_toggle *, LIB3270_TOGGLE_TYPE); /**< change value */
  349 + } toggle[LIB3270_TOGGLE_COUNT];
  350 +
  351 + // Network & Termtype
  352 + char * connected_type;
  353 + char * connected_lu;
  354 + char luname[LIB3270_LUNAME_LENGTH+1];
  355 +
  356 + char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1];
  357 + char * model_name;
  358 + int model_num;
  359 + char * termtype;
  360 +
  361 + struct
  362 + {
  363 + char * current; /**< The hostname part, stripped of qualifiers, luname and port number */
  364 + char * full; /**< The entire string, for use in reconnecting */
  365 + char * srvc; /**< The service name */
  366 + char * qualified;
  367 + } host;
  368 +
  369 + char * proxy; /**< Proxy server (type:host[:port]) */
  370 + char * termname;
  371 +
  372 + struct lib3270_charset charset;
  373 +
  374 + LIB3270_MESSAGE oia_status;
  375 +
  376 + unsigned char oia_flag[LIB3270_FLAG_COUNT];
  377 +
  378 + unsigned short current_port;
  379 +
  380 + // Misc
  381 + H3270FT * ft; /**< Active file transfer data */
  382 +
  383 + // screen info
  384 + int ov_rows;
  385 + int ov_cols;
  386 + int maxROWS;
  387 + int maxCOLS;
  388 + unsigned short rows;
  389 + unsigned short cols;
  390 + unsigned short pointer; /**< @brief Current pointer. */
  391 + int cursor_addr;
  392 + int buffer_addr;
  393 + char flipped;
  394 + int screen_alt; /**< alternate screen? */
  395 + int is_altbuffer;
  396 +
  397 + // Screen contents
  398 + void * buffer[2]; /**< Internal buffers */
  399 + struct lib3270_ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */
  400 + struct lib3270_ea * aea_buf; /**< alternate 3270 extended attribute buffer */
  401 + struct lib3270_text * text; /**< Converted 3270 chars */
  402 +
  403 + // host.c
  404 + char std_ds_host;
  405 + char no_login_host;
  406 + char non_tn3270e_host;
  407 + char passthru_host;
  408 + char ssl_host;
  409 + char ever_3270;
  410 +
  411 + // ctlr.c
  412 + int sscp_start;
  413 + unsigned char default_fg;
  414 + unsigned char default_bg;
  415 + unsigned char default_gr;
  416 + unsigned char default_cs;
  417 + unsigned char default_ic;
  418 + char reply_mode;
  419 + int trace_primed : 1;
  420 + int ticking : 1;
  421 + int mticking : 1;
  422 + int crm_nattr;
  423 + unsigned char crm_attr[16];
  424 + unsigned char * zero_buf; /**< empty buffer, for area clears */
  425 +
  426 + struct timeval t_start;
  427 + void * tick_id;
  428 + struct timeval t_want;
  429 +
  430 + // Telnet.c
  431 + unsigned char * ibuf;
  432 + int ibuf_size; /**< size of ibuf */
  433 + unsigned char * obuf; /**< 3270 output buffer */
  434 + unsigned char * obptr;
  435 + time_t ns_time;
  436 + int ns_brcvd;
  437 + int ns_rrcvd;
  438 + int ns_bsent;
  439 + int ns_rsent;
  440 + struct timeval ds_ts;
  441 + unsigned long e_funcs; /**< negotiated TN3270E functions */
  442 + unsigned short e_xmit_seq; /**< transmit sequence number */
  443 + int response_required;
  444 + int tn3270e_bound;
  445 + int tn3270e_negotiated;
  446 + int ansi_data;
  447 + int lnext;
  448 + int backslashed;
  449 + char plu_name[LIB3270_BIND_PLU_NAME_MAX+1];
  450 + char **lus;
  451 + char **curr_lu;
  452 + char * try_lu;
  453 + int proxy_type;
  454 + char * proxy_host;
  455 + char * proxy_portname;
  456 + unsigned short proxy_port;
  457 + char reported_lu[LIB3270_LU_MAX+1];
  458 + char reported_type[LIB3270_LU_MAX+1];
  459 +
  460 + enum
  461 + {
  462 + E_NONE,
  463 + E_3270,
  464 + E_NVT,
  465 + E_SSCP
  466 + } tn3270e_submode;
  467 +
  468 + unsigned char * lbuf; /**< line-mode input buffer */
  469 + unsigned char * lbptr;
  470 +
  471 +
  472 + // 3270 input buffer
  473 + unsigned char * ibptr;
  474 + unsigned char * obuf_base;
  475 + int obuf_size;
  476 +// unsigned char * netrbuf;
  477 +
  478 + // network input buffer
  479 + unsigned char * sbbuf;
  480 +
  481 + // telnet sub-option buffer
  482 + unsigned char * sbptr;
  483 + unsigned char telnet_state;
  484 +// char ttype_tmpval[13];
  485 +
  486 + unsigned char myopts[LIB3270_TELNET_N_OPTS];
  487 + unsigned char hisopts[LIB3270_TELNET_N_OPTS];
  488 +
  489 + // kybd.c
  490 + unsigned int kybdlock; ///< @brief keyboard lock state
  491 + unsigned char aid; ///< @brief current attention ID
  492 + void * unlock_id;
  493 + time_t unlock_delay_time;
  494 + unsigned long unlock_delay_ms; ///< @brief Delay before actually unlocking the keyboard after the host permits it.
  495 + LIB3270_TA * ta_head;
  496 + LIB3270_TA * ta_tail;
  497 +
  498 + // ft_dft.c
  499 + int dft_buffersize; ///< @brief Buffer size (LIMIN, LIMOUT)
  500 +
  501 + // rpq.c
  502 + int rpq_complained : 1;
  503 +#if !defined(_WIN32)
  504 + int omit_due_space_limit : 1;
  505 +#endif
  506 +
  507 + char * rpq_warnbuf;
  508 + int rpq_wbcnt;
  509 +
  510 + // User data (Usually points to session's widget)
  511 + void * user_data;
  512 +
  513 + // selection
  514 + char * paste_buffer;
  515 + struct
  516 + {
  517 + int start;
  518 + int end;
  519 + } select;
  520 +
  521 + // ansi.c
  522 + int scroll_top;
  523 + int scroll_bottom;
  524 + int once_cset;
  525 + int saved_cursor;
  526 +
  527 + int held_wrap : 1;
  528 +
  529 + int insert_mode : 1;
  530 + int auto_newline_mode : 1;
  531 +
  532 + int appl_cursor : 1;
  533 + int saved_appl_cursor : 1;
  534 +
  535 + int wraparound_mode : 1;
  536 + int saved_wraparound_mode : 1;
  537 +
  538 + int rev_wraparound_mode : 1;
  539 + int saved_rev_wraparound_mode : 1;
  540 +
  541 + int allow_wide_mode : 1;
  542 + int saved_allow_wide_mode : 1;
  543 +
  544 + int wide_mode : 1;
  545 + int saved_wide_mode : 1;
  546 +
  547 + int saved_altbuffer : 1;
  548 + int ansi_reset : 1; /**< Non zero if the ansi_reset() was called in this session */
  549 +
  550 + int ansi_ch;
  551 + int cs_to_change;
  552 +
  553 + /** ANSI Character sets. */
  554 + enum lib3270_ansi_cs
  555 + {
  556 + LIB3270_ANSI_CS_G0 = 0,
  557 + LIB3270_ANSI_CS_G1 = 1,
  558 + LIB3270_ANSI_CS_G2 = 2,
  559 + LIB3270_ANSI_CS_G3 = 3
  560 + } cset;
  561 + enum lib3270_ansi_cs saved_cset;
  562 +
  563 + /** Character set designations. */
  564 + enum lib3270_ansi_csd
  565 + {
  566 + LIB3270_ANSI_CSD_LD = 0,
  567 + LIB3270_ANSI_CSD_UK = 1,
  568 + LIB3270_ANSI_CSD_US = 2
  569 + } csd[4];
  570 + enum lib3270_ansi_csd saved_csd[4];
  571 +
  572 + enum lib3270_ansi_state
  573 + {
  574 + LIB3270_ANSI_STATE_DATA = 0,
  575 + LIB3270_ANSI_STATE_ESC = 1,
  576 + LIB3270_ANSI_STATE_CSDES = 2,
  577 + LIB3270_ANSI_STATE_N1 = 3,
  578 + LIB3270_ANSI_STATE_DECP = 4,
  579 + LIB3270_ANSI_STATE_TEXT = 5,
  580 + LIB3270_ANSI_STATE_TEXT2 = 6,
  581 + LIB3270_ANSI_STATE_MBPEND = 7
  582 + } state;
  583 +
  584 + unsigned char * tabs;
  585 +
  586 + int pmi;
  587 + char pending_mbs[LIB3270_MB_MAX];
  588 +
  589 + unsigned char gr;
  590 + unsigned char saved_gr;
  591 +
  592 + unsigned char fg;
  593 + unsigned char saved_fg;
  594 +
  595 + unsigned char bg;
  596 + unsigned char saved_bg;
  597 +
  598 + // xio
  599 + void * ns_read_id;
  600 + void * ns_write_id;
  601 + void * ns_exception_id;
  602 +
  603 + // SSL Data (Always defined to mantain the same structure size)
  604 + unsigned long ssl_error;
  605 + SSL * ssl_con;
  606 +
  607 + timeout_t * timeouts;
  608 + input_t * inputs;
  609 + int inputs_changed : 1;
  610 +
  611 + // Callbacks.
  612 + struct lib3270_state_callback * st_callbacks[LIB3270_STATE_USER];
  613 + struct lib3270_state_callback * st_last[LIB3270_STATE_USER];
  614 +
  615 +};
  616 +
  617 +/* Library internal calls */
  618 +LIB3270_INTERNAL void key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped);
  619 +LIB3270_INTERNAL void lib3270_initialize(void);
  620 +LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr);
  621 +
  622 +LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);
  623 +LIB3270_INTERNAL void remove_input_calls(H3270 *session);
  624 +
  625 +LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf, int len);
  626 +LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession);
  627 +
  628 +LIB3270_INTERNAL int lib3270_default_event_dispatcher(H3270 *hSession, int block);
  629 +
  630 +#if defined(DEBUG)
  631 + #define CHECK_SESSION_HANDLE(x) check_session_handle(&x,__FUNCTION__);
  632 + LIB3270_INTERNAL void check_session_handle(H3270 **hSession, const char *fname);
  633 +#else
  634 + #define CHECK_SESSION_HANDLE(x) check_session_handle(&x);
  635 + LIB3270_INTERNAL void check_session_handle(H3270 **hSession);
  636 +#endif // DEBUG
  637 +
  638 +LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on);
  639 +
  640 +#if defined(HAVE_LIBSSL) /*[*/
  641 +
  642 + LIB3270_INTERNAL int ssl_init(H3270 *session);
  643 + LIB3270_INTERNAL int ssl_negotiate(H3270 *hSession);
  644 + LIB3270_INTERNAL void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state);
  645 +
  646 +
  647 + #if OPENSSL_VERSION_NUMBER >= 0x00907000L /*[*/
  648 + #define INFO_CONST const
  649 + #else /*][*/
  650 + #define INFO_CONST
  651 + #endif /*]*/
  652 +
  653 + LIB3270_INTERNAL void ssl_info_callback(INFO_CONST SSL *s, int where, int ret);
  654 +
  655 +#endif /*]*/
  656 +
src/lib3270/tables.c
@@ -1,358 +0,0 @@ @@ -1,358 +0,0 @@
1 -/*  
2 - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270  
3 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a  
4 - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.  
5 - *  
6 - * Copyright (C) <2008> <Banco do Brasil S.A.>  
7 - *  
8 - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob  
9 - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela  
10 - * Free Software Foundation.  
11 - *  
12 - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER  
13 - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO  
14 - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para  
15 - * obter mais detalhes.  
16 - *  
17 - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este  
18 - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin  
19 - * St, Fifth Floor, Boston, MA 02110-1301 USA  
20 - *  
21 - * Este programa está nomeado como tables.c e possui - linhas de código.  
22 - *  
23 - * Contatos:  
24 - *  
25 - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)  
26 - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)  
27 - * licinio@bb.com.br (Licínio Luis Branco)  
28 - * kraucer@bb.com.br (Kraucer Fernandes Mazuco)  
29 - *  
30 - */  
31 -  
32 -  
33 -/*  
34 - * tables.c  
35 - * Translation tables between the three character sets:  
36 - * EBCDIC  
37 - * ASCII (ISO Latin-1)  
38 - * Character Generator ("3270" font)  
39 - */  
40 -  
41 -#include "globals.h"  
42 -#include "tablesc.h"  
43 -#include "kybdc.h"  
44 -  
45 -static const unsigned short asc2cg[256] = {  
46 -/*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
47 -/*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
48 -/*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
49 -/*18*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
50 -/*20*/ 0x10, 0x19, 0x13, 0x2c, 0x1a, 0x2e, 0x30, 0x12,  
51 -/*28*/ 0x0d, 0x0c, 0xbf, 0x35, 0x33, 0x31, 0x32, 0x14,  
52 -/*30*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,  
53 -/*38*/ 0x28, 0x29, 0x34, 0xbe, 0x09, 0x11, 0x08, 0x18,  
54 -/*40*/ 0x2d, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,  
55 -/*48*/ 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae,  
56 -/*50*/ 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,  
57 -/*58*/ 0xb7, 0xb8, 0xb9, 0x0a, 0x15, 0x0b, 0x3a, 0x2f,  
58 -/*60*/ 0x3d, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86,  
59 -/*68*/ 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e,  
60 -/*70*/ 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,  
61 -/*78*/ 0x97, 0x98, 0x99, 0x0f, 0x16, 0x0e, 0x3b, 0x00,  
62 -/*80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
63 -/*88*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
64 -/*90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
65 -/*98*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
66 -/*a0*/ 0x01, 0x6e, 0x1b, 0x1c, 0x1f, 0x1d, 0x17, 0x2b,  
67 -/*a8*/ 0x3c, 0xd0, 0x6a, 0x6c, 0x36, 0x07, 0xd1, 0x37,  
68 -/*b0*/ 0x38, 0xd6, 0x68, 0x69, 0x3e, 0x54, 0x1e, 0x39,  
69 -/*b8*/ 0x3f, 0x67, 0x6b, 0x6d, 0x4b, 0x4c, 0x4d, 0x6f,  
70 -/*c0*/ 0x60, 0x7a, 0x75, 0x65, 0x70, 0xbc, 0xba, 0xbd,  
71 -/*c8*/ 0x61, 0x7b, 0x76, 0x71, 0x62, 0x7c, 0x77, 0x72,  
72 -/*d0*/ 0xd7, 0x7f, 0x63, 0x7d, 0x78, 0x66, 0x73, 0x5b,  
73 -/*d8*/ 0xbb, 0x64, 0x7e, 0x79, 0x74, 0x48, 0xd9, 0x2a,  
74 -/*e0*/ 0x40, 0x5a, 0x55, 0x45, 0x50, 0x9c, 0x9a, 0x4f,  
75 -/*e8*/ 0x41, 0x4a, 0x56, 0x51, 0x42, 0x5c, 0x57, 0x52,  
76 -/*f0*/ 0xf7, 0x5f, 0x43, 0x5d, 0x58, 0x46, 0x53, 0x9d,  
77 -/*f8*/ 0x9b, 0x44, 0x5e, 0x59, 0x4e, 0x49, 0xf9, 0x47  
78 -};  
79 -  
80 -static const unsigned short cg2asc[256] = {  
81 -/*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xad,  
82 -/*08*/ 0x3e, 0x3c, 0x5b, 0x5d, 0x29, 0x28, 0x7d, 0x7b,  
83 -/*10*/ 0x20, 0x3d, 0x27, 0x22, 0x2f, 0x5c, 0x7c, 0xa6,  
84 -/*18*/ 0x3f, 0x21, 0x24, 0xa2, 0xa3, 0xa5, 0xb6, 0xa4,  
85 -/*20*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,  
86 -/*28*/ 0x38, 0x39, 0xdf, 0xa7, 0x23, 0x40, 0x25, 0x5f,  
87 -/*30*/ 0x26, 0x2d, 0x2e, 0x2c, 0x3a, 0x2b, 0xac, 0xaf,  
88 -/*38*/ 0xb0, 0xb7, 0x5e, 0x7e, 0xa8, 0x60, 0xb4, 0xb8,  
89 -/*40*/ 0xe0, 0xe8, 0xec, 0xf2, 0xf9, 0xe3, 0xf5, 0xff,  
90 -/*48*/ 0xdd, 0xfd, 0xe9, 0xbc, 0xbd, 0xbe, 0xfc, 0xe7,  
91 -/*50*/ 0xe4, 0xeb, 0xef, 0xf6, 0xb5, 0xe2, 0xea, 0xee,  
92 -/*58*/ 0xf4, 0xfb, 0xe1, 0xd7, 0xed, 0xf3, 0xfa, 0xf1,  
93 -/*60*/ 0xc0, 0xc8, 0xcc, 0xd2, 0xd9, 0xc3, 0xd5, 0xb9,  
94 -/*68*/ 0xb2, 0xb3, 0xaa, 0xba, 0xab, 0xbb, 0xa1, 0xbf,  
95 -/*70*/ 0xc4, 0xcb, 0xcf, 0xd6, 0xdc, 0xc2, 0xca, 0xce,  
96 -/*78*/ 0xd4, 0xdb, 0xc1, 0xc9, 0xcd, 0xd3, 0xda, 0xd1,  
97 -/*80*/ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,  
98 -/*88*/ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,  
99 -/*90*/ 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,  
100 -/*98*/ 0x79, 0x7a, 0xe6, 0xf8, 0xe5, 0xf7, 0x3b, 0x2a,  
101 -/*a0*/ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,  
102 -/*a8*/ 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,  
103 -/*b0*/ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,  
104 -/*b8*/ 0x59, 0x5a, 0xc6, 0xd8, 0xc5, 0xc7, 0x3b, 0x2a,  
105 -/*c0*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
106 -/*c8*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
107 -/*d0*/ 0xa9, 0xae, 0x20, 0x20, 0x20, 0x20, 0xb1, 0xd0,  
108 -/*d8*/ 0x20, 0xde, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
109 -/*e0*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
110 -/*e8*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
111 -/*f0*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf0,  
112 -/*f8*/ 0x20, 0xfe, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20  
113 -};  
114 -  
115 -static const unsigned short ebc2cg0[256] = {  
116 -/*00*/ 0x00, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf,  
117 -/*08*/ 0xdf, 0xdf, 0xdf, 0xdf, 0x02, 0x03, 0x00, 0x00,  
118 -/*10*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0x04, 0xdf, 0xdf,  
119 -/*18*/ 0xdf, 0x05, 0xdf, 0xdf, 0x9f, 0xdf, 0x9e, 0xdf,  
120 -/*20*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf,  
121 -/*28*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf,  
122 -/*30*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf,  
123 -/*38*/ 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf,  
124 -/*40*/ 0x10, 0x01, 0x55, 0x50, 0x40, 0x5a, 0x45, 0x9c,  
125 -/*48*/ 0x4f, 0x5f, 0x1b, 0x32, 0x09, 0x0d, 0x35, 0x16,  
126 -/*50*/ 0x30, 0x4a, 0x56, 0x51, 0x41, 0x5c, 0x57, 0x52,  
127 -/*58*/ 0x42, 0x2a, 0x19, 0x1a, 0xbf, 0x0c, 0xbe, 0x36,  
128 -/*60*/ 0x31, 0x14, 0x75, 0x70, 0x60, 0x7a, 0x65, 0xbc,  
129 -/*68*/ 0xbd, 0x7f, 0x17, 0x33, 0x2e, 0x2f, 0x08, 0x18,  
130 -/*70*/ 0x9b, 0x7b, 0x76, 0x71, 0x61, 0x7c, 0x77, 0x72,  
131 -/*78*/ 0x62, 0x3d, 0x34, 0x2c, 0x2d, 0x12, 0x11, 0x13,  
132 -/*80*/ 0xbb, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86,  
133 -/*88*/ 0x87, 0x88, 0x6c, 0x6d, 0xf7, 0x49, 0xf9, 0xd6,  
134 -/*90*/ 0x38, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,  
135 -/*98*/ 0x90, 0x91, 0x6a, 0x6b, 0x9a, 0x3f, 0xba, 0x1f,  
136 -/*a0*/ 0x54, 0x3b, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,  
137 -/*a8*/ 0x98, 0x99, 0x6e, 0x6f, 0xd7, 0x48, 0xd9, 0xd1,  
138 -/*b0*/ 0x3a, 0x1c, 0x1d, 0x39, 0xd0, 0x2b, 0x1e, 0x4b,  
139 -/*b8*/ 0x4c, 0x4d, 0x0a, 0x0b, 0x37, 0x3c, 0x3e, 0x5b,  
140 -/*c0*/ 0x0f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,  
141 -/*c8*/ 0xa7, 0xa8, 0x07, 0x58, 0x53, 0x43, 0x5d, 0x46,  
142 -/*d0*/ 0x0e, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,  
143 -/*d8*/ 0xb0, 0xb1, 0x67, 0x59, 0x4e, 0x44, 0x5e, 0x47,  
144 -/*e0*/ 0x15, 0x9d, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,  
145 -/*e8*/ 0xb8, 0xb9, 0x68, 0x78, 0x73, 0x63, 0x7d, 0x66,  
146 -/*f0*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,  
147 -/*f8*/ 0x28, 0x29, 0x69, 0x79, 0x74, 0x64, 0x7e, 0x06  
148 -};  
149 -  
150 -static const unsigned short cg2ebc0[256] = {  
151 -/*00*/ 0x00, 0x41, 0x0c, 0x0d, 0x15, 0x19, 0xff, 0xca,  
152 -/*08*/ 0x6e, 0x4c, 0xba, 0xbb, 0x5d, 0x4d, 0xd0, 0xc0,  
153 -/*10*/ 0x40, 0x7e, 0x7d, 0x7f, 0x61, 0xe0, 0x4f, 0x6a,  
154 -/*18*/ 0x6f, 0x5a, 0x5b, 0x4a, 0xb1, 0xb2, 0xb6, 0x9f,  
155 -/*20*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,  
156 -/*28*/ 0xf8, 0xf9, 0x59, 0xb5, 0x7b, 0x7c, 0x6c, 0x6d,  
157 -/*30*/ 0x50, 0x60, 0x4b, 0x6b, 0x7a, 0x4e, 0x5f, 0xbc,  
158 -/*38*/ 0x90, 0xb3, 0xb0, 0xa1, 0xbd, 0x79, 0xbe, 0x9d,  
159 -/*40*/ 0x44, 0x54, 0x58, 0xcd, 0xdd, 0x46, 0xcf, 0xdf,  
160 -/*48*/ 0xad, 0x8d, 0x51, 0xb7, 0xb8, 0xb9, 0xdc, 0x48,  
161 -/*50*/ 0x43, 0x53, 0x57, 0xcc, 0xa0, 0x42, 0x52, 0x56,  
162 -/*58*/ 0xcb, 0xdb, 0x45, 0xbf, 0x55, 0xce, 0xde, 0x49,  
163 -/*60*/ 0x64, 0x74, 0x78, 0xed, 0xfd, 0x66, 0xef, 0xda,  
164 -/*68*/ 0xea, 0xfa, 0x9a, 0x9b, 0x8a, 0x8b, 0xaa, 0xab,  
165 -/*70*/ 0x63, 0x73, 0x77, 0xec, 0xfc, 0x62, 0x72, 0x76,  
166 -/*78*/ 0xeb, 0xfb, 0x65, 0x71, 0x75, 0xee, 0xfe, 0x69,  
167 -/*80*/ 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,  
168 -/*88*/ 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,  
169 -/*90*/ 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,  
170 -/*98*/ 0xa8, 0xa9, 0x9c, 0x70, 0x47, 0xe1, 0x1e, 0x1c,  
171 -/*a0*/ 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,  
172 -/*a8*/ 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,  
173 -/*b0*/ 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,  
174 -/*b8*/ 0xe8, 0xe9, 0x9e, 0x80, 0x67, 0x68, 0x5e, 0x5c,  
175 -/*c0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
176 -/*c8*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
177 -/*d0*/ 0xb4, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x8f, 0xac,  
178 -/*d8*/ 0x00, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
179 -/*e0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
180 -/*e8*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
181 -/*f0*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c,  
182 -/*f8*/ 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  
183 -};  
184 -  
185 -#ifdef EXTENDED_TABLES  
186 -static const unsigned short ebc2asc70[256] = {  
187 -/*00*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
188 -/*08*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
189 -/*10*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
190 -/*18*/ 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x3b, 0x20,  
191 -/*20*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
192 -/*28*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
193 -/*30*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
194 -/*38*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,  
195 -/*40*/ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
196 -/*48*/ 0x00, 0x00, 0x00, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,  
197 -/*50*/ 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
198 -/*58*/ 0x00, 0x00, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x00,  
199 -/*60*/ 0x2d, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
200 -/*68*/ 0x00, 0x00, 0x00, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,  
201 -/*70*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
202 -/*78*/ 0x00, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,  
203 -/*80*/ 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,  
204 -/*88*/ 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
205 -/*90*/ 0x00, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,  
206 -/*98*/ 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
207 -/*a0*/ 0x00, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,  
208 -/*a8*/ 0x79, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
209 -/*b0*/ 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
210 -/*b8*/ 0x00, 0x00, 0x5b, 0x5d, 0x00, 0x00, 0x00, 0x00,  
211 -/*c0*/ 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,  
212 -/*c8*/ 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
213 -/*d0*/ 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,  
214 -/*d8*/ 0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
215 -/*e0*/ 0x5c, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,  
216 -/*e8*/ 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
217 -/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,  
218 -/*f8*/ 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20  
219 -};  
220 -#endif // EXTENDED_TABLES  
221 -  
222 -static const unsigned short asc2ebc0[256] = {  
223 -/*00*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
224 -/*08*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
225 -/*10*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
226 -/*18*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
227 -/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,  
228 -/*28*/ 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,  
229 -/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,  
230 -/*38*/ 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,  
231 -/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,  
232 -/*48*/ 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,  
233 -/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,  
234 -/*58*/ 0xe7, 0xe8, 0xe9, 0xba, 0xe0, 0xbb, 0xb0, 0x6d,  
235 -/*60*/ 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,  
236 -/*68*/ 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,  
237 -/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,  
238 -/*78*/ 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x00,  
239 -/*80*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
240 -/*88*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
241 -/*90*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
242 -/*98*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
243 -/*a0*/ 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5,  
244 -/*a8*/ 0xbd, 0xb4, 0x9a, 0x8a, 0x5f, 0xca, 0xaf, 0xbc,  
245 -/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,  
246 -/*b8*/ 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,  
247 -/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,  
248 -/*c8*/ 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,  
249 -/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,  
250 -/*d8*/ 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xad, 0xae, 0x59,  
251 -/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,  
252 -/*e8*/ 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,  
253 -/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,  
254 -/*f8*/ 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf  
255 -};  
256 -  
257 -#ifdef EXTENDED_TABLES  
258 -static const unsigned short ge2asc[256] = {  
259 -/*00*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
260 -/*08*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
261 -/*10*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
262 -/*18*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
263 -/*20*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
264 -/*28*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
265 -/*30*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
266 -/*38*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
267 -/*40*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
268 -/*48*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
269 -/*50*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
270 -/*58*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
271 -/*60*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
272 -/*68*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
273 -/*70*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
274 -/*78*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
275 -/*80*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x19, 0x02, 0x02,  
276 -/*88*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
277 -/*90*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
278 -/*98*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
279 -/*a0*/ 0x02, 0x02, 0x12, 0x02, 0x02, 0x02, 0x02, 0x02,  
280 -/*a8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x5b, 0x02, 0x02,  
281 -/*b0*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
282 -/*b8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x5d, 0x02, 0x19,  
283 -/*c0*/ 0x02, 0x02, 0x02, 0x02, 0x0e, 0x0d, 0x15, 0x17,  
284 -/*c8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
285 -/*d0*/ 0x02, 0x02, 0x02, 0x0f, 0x0b, 0x0c, 0x16, 0x18,  
286 -/*d8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
287 -/*e0*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
288 -/*e8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
289 -/*f0*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  
290 -/*f8*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02  
291 -};  
292 -#endif // EXTENDED_TABLES  
293 -  
294 -static const unsigned short ebc2uc[256] = {  
295 -/*00*/ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,  
296 -/*08*/ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,  
297 -/*10*/ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,  
298 -/*18*/ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,  
299 -/*20*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,  
300 -/*28*/ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,  
301 -/*30*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,  
302 -/*38*/ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,  
303 -/*40*/ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,  
304 -/*48*/ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,  
305 -/*50*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,  
306 -/*58*/ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,  
307 -/*60*/ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,  
308 -/*68*/ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,  
309 -/*70*/ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,  
310 -/*78*/ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,  
311 -/*80*/ 0x80, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,  
312 -/*88*/ 0xc8, 0xc9, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,  
313 -/*90*/ 0x90, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,  
314 -/*98*/ 0xd8, 0xd9, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,  
315 -/*a0*/ 0xa0, 0xa1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,  
316 -/*a8*/ 0xe8, 0xe9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,  
317 -/*b0*/ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,  
318 -/*b8*/ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,  
319 -/*c0*/ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,  
320 -/*c8*/ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,  
321 -/*d0*/ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,  
322 -/*d8*/ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,  
323 -/*e0*/ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,  
324 -/*e8*/ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,  
325 -/*f0*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,  
326 -/*f8*/ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff  
327 -};  
328 -#if defined(X3270_FT) /*[*/  
329 -  
330 -#endif /*]*/  
331 -  
332 -//unsigned short ebc2cg[256];  
333 -//unsigned short cg2ebc[256];  
334 -// unsigned short ebc2asc[256];  
335 -// unsigned short asc2ebc[256];  
336 -// unsigned short asc2ft[256];  
337 -// unsigned short ft2asc[256];  
338 -  
339 -#ifdef EXTENDED_TABLES  
340 -unsigned short ebc2asc7[256];  
341 -#endif //EXTENDED_TABLES  
342 -  
343 -  
344 -/*  
345 -void charset_defaults(H3270 *hSession)  
346 -{  
347 - // Go to defaults first.  
348 - (void) memcpy((char *) hSession->charset.ebc2cg, (const char *)ebc2cg0, 256);  
349 - (void) memcpy((char *) hSession->charset.cg2ebc, (const char *)cg2ebc0, 256);  
350 - (void) memcpy((char *) hSession->charset.ebc2asc, (const char *)ebc2asc0, 256);  
351 - (void) memcpy((char *) hSession->charset.asc2ebc, (const char *)asc2ebc0, 256);  
352 -#if defined(X3270_FT)  
353 - (void) memcpy((char *)hSession->charset.ft2asc, (const char *)ft2asc0, 256);  
354 - (void) memcpy((char *)hSession->charset.asc2ft, (const char *)asc2ft0, 256);  
355 -#endif  
356 - // clear_xks();  
357 -}  
358 -*/  
src/lib3270/w3misc.c
@@ -1,112 +0,0 @@ @@ -1,112 +0,0 @@
1 -/*  
2 - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270  
3 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a  
4 - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.  
5 - *  
6 - * Copyright (C) <2008> <Banco do Brasil S.A.>  
7 - *  
8 - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob  
9 - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela  
10 - * Free Software Foundation.  
11 - *  
12 - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER  
13 - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO  
14 - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para  
15 - * obter mais detalhes.  
16 - *  
17 - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este  
18 - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple  
19 - * Place, Suite 330, Boston, MA, 02111-1307, USA  
20 - *  
21 - * Este programa está nomeado como w3misc.c e possui 110 linhas de código.  
22 - *  
23 - * Contatos:  
24 - *  
25 - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)  
26 - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)  
27 - * licinio@bb.com.br (Licínio Luis Branco)  
28 - * kraucer@bb.com.br (Kraucer Fernandes Mazuco)  
29 - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)  
30 - *  
31 - */  
32 -  
33 -#error Deprecated  
34 -  
35 -/*  
36 - * w3misc.c  
37 - * Miscellaneous Win32 functions.  
38 - */  
39 -  
40 -/*  
41 -#include "globals.h"  
42 -  
43 -#if !defined(_WIN32)  
44 -#error This module is only for Win32.  
45 -#endif  
46 -  
47 -#include <winsock2.h>  
48 -#include <ws2tcpip.h>  
49 -#include <stdio.h>  
50 -#include <errno.h>  
51 -  
52 -#include "w3miscc.h"  
53 -  
54 -// Convert a network address to a string.  
55 -const char * inet_ntop(int af, const void *src, char *dst, socklen_t cnt)  
56 -{  
57 - union {  
58 - struct sockaddr sa;  
59 - struct sockaddr_in sin;  
60 - struct sockaddr_in6 sin6;  
61 - } sa;  
62 - DWORD ssz;  
63 - DWORD sz = cnt;  
64 -  
65 - memset(&sa, '\0', sizeof(sa));  
66 -  
67 - switch (af) {  
68 - case AF_INET:  
69 - sa.sin = *(struct sockaddr_in *)src; // struct copy  
70 - ssz = sizeof(struct sockaddr_in);  
71 - break;  
72 - case AF_INET6:  
73 - sa.sin6 = *(struct sockaddr_in6 *)src; // struct copy  
74 - ssz = sizeof(struct sockaddr_in6);  
75 - break;  
76 - default:  
77 - if (cnt > 0)  
78 - dst[0] = '\0';  
79 - return NULL;  
80 - }  
81 -  
82 - sa.sa.sa_family = af;  
83 -  
84 - if (WSAAddressToString(&sa.sa, ssz, NULL, dst, &sz) != 0) {  
85 - if (cnt > 0)  
86 - dst[0] = '\0';  
87 - return NULL;  
88 - }  
89 -  
90 - return dst;  
91 -}  
92 -  
93 -// Decode a Win32 error number.  
94 -const char * win32_strerror(int e)  
95 -{  
96 - static char buffer[4096];  
97 -  
98 - if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,  
99 - NULL,  
100 - e,  
101 - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),  
102 - buffer,  
103 - sizeof(buffer),  
104 - NULL) == 0) {  
105 -  
106 - sprintf(buffer, "Windows error %d", e);  
107 - }  
108 -  
109 - return buffer;  
110 -}  
111 -  
112 -*/  
src/lib3270/winvers.c
@@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
1 -/*  
2 - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270  
3 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a  
4 - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.  
5 - *  
6 - * Copyright (C) <2008> <Banco do Brasil S.A.>  
7 - *  
8 - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob  
9 - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela  
10 - * Free Software Foundation.  
11 - *  
12 - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER  
13 - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO  
14 - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para  
15 - * obter mais detalhes.  
16 - *  
17 - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este  
18 - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple  
19 - * Place, Suite 330, Boston, MA, 02111-1307, USA  
20 - *  
21 - * Este programa está nomeado como winvers.c e possui 73 linhas de código.  
22 - *  
23 - * Contatos:  
24 - *  
25 - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)  
26 - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)  
27 - * licinio@bb.com.br (Licínio Luis Branco)  
28 - * kraucer@bb.com.br (Kraucer Fernandes Mazuco)  
29 - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)  
30 - *  
31 - */  
32 -  
33 -#error Deprecated  
34 -  
35 -/*  
36 - * winvers.c  
37 - * A Windows console-based 3270 Terminal Emulator  
38 - * OS version query  
39 - */  
40 -  
41 -/*  
42 -#include <windows.h>  
43 -#include <stdio.h>  
44 -  
45 -#include "globals.h"  
46 -#include "winversc.h"  
47 -  
48 -int is_nt = 1;  
49 -int has_ipv6 = 1;  
50 -  
51 -int  
52 -get_version_info(void)  
53 -{  
54 - OSVERSIONINFO info;  
55 -  
56 - // Figure out what version of Windows this is.  
57 - memset(&info, '\0', sizeof(info));  
58 - info.dwOSVersionInfoSize = sizeof(info);  
59 - if (GetVersionEx(&info) == 0) {  
60 - fprintf(stderr, "Can't get Windows version\n");  
61 - return -1;  
62 - }  
63 -  
64 - // Yes, people still run Win98.  
65 - if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)  
66 - is_nt = 0;  
67 -  
68 - // Win2K and earlier is IPv4-only. WinXP and later can have IPv6.  
69 - if (!is_nt ||  
70 - info.dwMajorVersion < 5 ||  
71 - (info.dwMajorVersion == 5 && info.dwMinorVersion < 1)) {  
72 - has_ipv6 = 0;  
73 - }  
74 -  
75 - return 0;  
76 -}  
77 -  
78 -*/  
src/lib3270/xio.c
@@ -1,70 +0,0 @@ @@ -1,70 +0,0 @@
1 -/*  
2 - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270  
3 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a  
4 - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.  
5 - *  
6 - * Copyright (C) <2008> <Banco do Brasil S.A.>  
7 - *  
8 - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob  
9 - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela  
10 - * Free Software Foundation.  
11 - *  
12 - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER  
13 - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO  
14 - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para  
15 - * obter mais detalhes.  
16 - *  
17 - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este  
18 - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple  
19 - * Place, Suite 330, Boston, MA, 02111-1307, USA  
20 - *  
21 - * Este programa está nomeado como xio.c e possui 143 linhas de código.  
22 - *  
23 - * Contatos:  
24 - *  
25 - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)  
26 - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)  
27 - * licinio@bb.com.br (Licínio Luis Branco)  
28 - * kraucer@bb.com.br (Kraucer Fernandes Mazuco)  
29 - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)  
30 - *  
31 - */  
32 -  
33 -/*  
34 - * xio.c  
35 - * Low-level I/O setup functions and exit code.  
36 - */  
37 -  
38 -#include "globals.h"  
39 -  
40 -#include "actionsc.h"  
41 -#include "hostc.h"  
42 -#include "telnetc.h"  
43 -#include "toggle.h"  
44 -#include "utilc.h"  
45 -#include "xioc.h"  
46 -  
47 -#error xio.c is deprecated, use iocalls.c  
48 -  
49 -void x_except_on(H3270 *h)  
50 -{  
51 - if(h->excepting)  
52 - return;  
53 -  
54 - if(h->reading)  
55 - RemoveInput(h->ns_read_id);  
56 -  
57 -#ifdef WIN32  
58 - h->ns_exception_id = AddExcept((int) h->sockEvent, h, net_exception);  
59 - h->excepting = 1;  
60 -  
61 - if(h->reading)  
62 - h->ns_read_id = AddInput( (int) h->sockEvent, h, net_input);  
63 -#else  
64 - h->ns_exception_id = AddExcept(h->sock, h, net_exception);  
65 - h->excepting = 1;  
66 -  
67 - if(h->reading)  
68 - h->ns_read_id = AddInput(h->sock, h, net_input);  
69 -#endif // WIN32  
70 -}