Commit 5e9d1f19bba63159a99e8dc333a01c4ecd211c6c

Authored by Perry Werneck
1 parent 062033af

Small adjustments in the library.

src/include/3270ds.h
1 1 /*
2   - * Modifications Copyright 1993, 1994, 1995, 1999, 2000, 2002, 2003, 2004,
3   - * 2005 by Paul Mattes.
4   - * RPQNAMES modifications Copyright 2004 by Don Russell.
5   - * Original X11 Port Copyright 1990 by Jeff Sparkes.
6   - * Permission to use, copy, modify, and distribute this software and its
7   - * documentation for any purpose and without fee is hereby granted,
8   - * provided that the above copyright notice appear in all copies and that
9   - * both that copyright notice and this permission notice appear in
10   - * supporting documentation.
  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.
11 5 *
12   - * Copyright 1989 by Georgia Tech Research Corporation, Atlanta, GA 30332.
13   - * All Rights Reserved. GTRC hereby grants public use of this software.
14   - * Derivative works based on this software must incorporate this copyright
15   - * notice.
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como lib3270.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
16 27 *
17   - * x3270, c3270, s3270, tcl3270 and pr3287 are distributed in the hope that
18   - * they will be useful, but WITHOUT ANY WARRANTY; without even the implied
19   - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20   - * file LICENSE for more details.
21 28 */
22 29  
23 30 /**
... ...
src/include/lib3270.h
... ... @@ -279,18 +279,34 @@
279 279 */
280 280 typedef enum lib3270_cstate
281 281 {
282   - LIB3270_NOT_CONNECTED, /**< @brief no socket, disconnected */
283   - LIB3270_RESOLVING, /**< @brief resolving hostname */
284   - LIB3270_PENDING, /**< @brief connection pending */
285   - LIB3270_CONNECTED_INITIAL, /**< @brief connected, no mode yet */
286   - LIB3270_CONNECTED_ANSI, /**< @brief connected in NVT ANSI mode */
287   - LIB3270_CONNECTED_3270, /**< @brief connected in old-style 3270 mode */
288   - LIB3270_CONNECTED_INITIAL_E, /**< @brief connected in TN3270E mode, unnegotiated */
289   - LIB3270_CONNECTED_NVT, /**< @brief connected in TN3270E mode, NVT mode */
290   - LIB3270_CONNECTED_SSCP, /**< @brief connected in TN3270E mode, SSCP-LU mode */
291   - LIB3270_CONNECTED_TN3270E /**< @brief connected in TN3270E mode, 3270 mode */
  282 + LIB3270_NOT_CONNECTED, ///< @brief no socket, disconnected
  283 + LIB3270_RESOLVING, ///< @brief resolving hostname
  284 + LIB3270_PENDING, ///< @brief connection pending
  285 + LIB3270_CONNECTED_INITIAL, ///< @brief connected, no mode yet
  286 + LIB3270_CONNECTED_ANSI, ///< @brief connected in NVT ANSI mode
  287 + LIB3270_CONNECTED_3270, ///< @brief connected in old-style 3270 mode
  288 + LIB3270_CONNECTED_INITIAL_E, ///< @brief connected in TN3270E mode, unnegotiated
  289 + LIB3270_CONNECTED_NVT, ///< @brief connected in TN3270E mode, NVT mode
  290 + LIB3270_CONNECTED_SSCP, ///< @brief connected in TN3270E mode, SSCP-LU mode
  291 + LIB3270_CONNECTED_TN3270E ///< @brief connected in TN3270E mode, 3270 mode
292 292 } LIB3270_CSTATE;
293 293  
  294 + /**
  295 + * @brief Field attributes.
  296 + */
  297 + typedef enum lib3270_field_attribute
  298 + {
  299 + LIB3270_FIELD_ATTRIBUTE_PRINTABLE = 0xc0, ///< @brief these make the character "printable"
  300 + LIB3270_FIELD_ATTRIBUTE_PROTECT = 0x20, ///< @brief unprotected (0) / protected (1)
  301 + LIB3270_FIELD_ATTRIBUTE_NUMERIC = 0x10, ///< @brief alphanumeric (0) / numeric (1)
  302 + LIB3270_FIELD_ATTRIBUTE_INTENSITY = 0x0c, ///< @brief display/selector pen detectable:
  303 + LIB3270_FIELD_ATTRIBUTE_INT_NORM_NSEL = 0x00, ///< @brief 00 normal, non-detect
  304 + LIB3270_FIELD_ATTRIBUTE_INT_NORM_SEL = 0x04, ///< @brief 01 normal, detectable
  305 + LIB3270_FIELD_ATTRIBUTE_INT_HIGH_SEL = 0x08, ///< @brief 10 intensified, detectable
  306 + LIB3270_FIELD_ATTRIBUTE_INT_ZERO_NSEL = 0x0c, ///< @brief 11 nondisplay, non-detect
  307 + LIB3270_FIELD_ATTRIBUTE_RESERVED = 0x02, ///< @brief must be 0
  308 + LIB3270_FIELD_ATTRIBUTE_MODIFIED = 0x01 ///< @brief modified (1)
  309 + } LIB3270_FIELD_ATTRIBUTE;
294 310  
295 311 /**
296 312 * @brief Host options
... ... @@ -1149,7 +1165,15 @@
1149 1165 */
1150 1166 LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr);
1151 1167  
1152   - LIB3270_EXPORT int lib3270_field_attribute(H3270 *hSession, int baddr);
  1168 + /**
  1169 + * @brief Get field attribute for a given buffer address.
  1170 + *
  1171 + * @param hSession Session handle.
  1172 + * @param addr Buffer address of the field.
  1173 + *
  1174 + * @return field attribute or -1 when failed (sets errno).
  1175 + */
  1176 + LIB3270_EXPORT int lib3270_get_field_attribute(H3270 *hSession, int baddr);
1153 1177  
1154 1178 /**
1155 1179 * @brief Get the length of the field at given buffer address.
... ...
src/include/lib3270/selection.h
... ... @@ -43,9 +43,9 @@
43 43 *
44 44 */
45 45 typedef struct _lib3270_selection_element {
46   - unsigned char chr; ///< @brief Element character
47   - unsigned short flags; ///< @brief Element colors & visual state.
48   - unsigned char attributes; ///< @brief 3270 attributes.
  46 + unsigned char chr; ///< @brief Element character.
  47 + unsigned short flags; ///< @brief Element colors & visual state. @see LIB3270_ATTR
  48 + unsigned char field_attributes; ///< @brief Field attribute. @see LIB3270_FIELD_ATTRIBUTE
49 49 } lib3270_selection_element;
50 50  
51 51 /**
... ...
src/lib3270/ctlr.c
... ... @@ -514,7 +514,7 @@ LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr)
514 514 return -1;
515 515 }
516 516  
517   -LIB3270_EXPORT int lib3270_field_attribute(H3270 *hSession, int baddr)
  517 +LIB3270_EXPORT int lib3270_get_field_attribute(H3270 *hSession, int baddr)
518 518 {
519 519 int sbaddr;
520 520  
... ...
src/lib3270/selection/get.c
... ... @@ -182,9 +182,9 @@ LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cu
182 182 fa = hSession->ea_buf[baddr].fa;
183 183 }
184 184  
185   - selection->contents[dstaddr].chr = (hSession->text[baddr].chr ? hSession->text[baddr].chr : ' ');
186   - selection->contents[dstaddr].flags = hSession->text[baddr].attr;
187   - selection->contents[dstaddr].attributes = fa;
  185 + selection->contents[dstaddr].chr = (hSession->text[baddr].chr ? hSession->text[baddr].chr : ' ');
  186 + selection->contents[dstaddr].flags = hSession->text[baddr].attr;
  187 + selection->contents[dstaddr].field_attributes = fa;
188 188  
189 189 if(cut && !FA_IS_PROTECTED(fa)) {
190 190 clear_chr(hSession,baddr);
... ...