From e4c721e638623cc6ac1d2ed4843b0fa94bcb7d53 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Fri, 6 Jul 2012 18:23:42 +0000 Subject: [PATCH] Implementando conversão do buffer de terminal para HTML --- 3270ds.h | 333 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ansi.c | 2 +- ctlr.c | 2 +- ft_cut.c | 2 +- ft_dft.c | 2 +- glue.c | 2 +- html.c | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- kybd.c | 2 +- paste.c | 2 +- proxy.c | 2 +- rpq.c | 2 +- screen.c | 2 +- see.c | 2 +- selection.c | 18 ++++++++++++++++++ session.c | 2 +- sf.c | 2 +- telnet.c | 2 +- toggles.c | 2 ++ trace_ds.c | 2 +- 19 files changed, 196 insertions(+), 406 deletions(-) delete mode 100644 3270ds.h diff --git a/3270ds.h b/3270ds.h deleted file mode 100644 index 655bf32..0000000 --- a/3270ds.h +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Modifications Copyright 1993, 1994, 1995, 1999, 2000, 2002, 2003, 2004, - * 2005 by Paul Mattes. - * RPQNAMES modifications Copyright 2004 by Don Russell. - * Original X11 Port Copyright 1990 by Jeff Sparkes. - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation. - * - * Copyright 1989 by Georgia Tech Research Corporation, Atlanta, GA 30332. - * All Rights Reserved. GTRC hereby grants public use of this software. - * Derivative works based on this software must incorporate this copyright - * notice. - * - * x3270, c3270, s3270, tcl3270 and pr3287 are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * file LICENSE for more details. - */ - -/* - * 3270ds.h - * - * Header file for the 3270 Data Stream Protocol. - */ - -/* 3270 commands */ -#define CMD_W 0x01 /* write */ -#define CMD_RB 0x02 /* read buffer */ -#define CMD_NOP 0x03 /* no-op */ -#define CMD_EW 0x05 /* erase/write */ -#define CMD_RM 0x06 /* read modified */ -#define CMD_EWA 0x0d /* erase/write alternate */ -#define CMD_RMA 0x0e /* read modified all */ -#define CMD_EAU 0x0f /* erase all unprotected */ -#define CMD_WSF 0x11 /* write structured field */ - -/* SNA 3270 commands */ -#define SNA_CMD_RMA 0x6e /* read modified all */ -#define SNA_CMD_EAU 0x6f /* erase all unprotected */ -#define SNA_CMD_EWA 0x7e /* erase/write alternate */ -#define SNA_CMD_W 0xf1 /* write */ -#define SNA_CMD_RB 0xf2 /* read buffer */ -#define SNA_CMD_WSF 0xf3 /* write structured field */ -#define SNA_CMD_EW 0xf5 /* erase/write */ -#define SNA_CMD_RM 0xf6 /* read modified */ - -/* 3270 orders */ -#define ORDER_PT 0x05 /* program tab */ -#define ORDER_GE 0x08 /* graphic escape */ -#define ORDER_SBA 0x11 /* set buffer address */ -#define ORDER_EUA 0x12 /* erase unprotected to address */ -#define ORDER_IC 0x13 /* insert cursor */ -#define ORDER_SF 0x1d /* start field */ -#define ORDER_SA 0x28 /* set attribute */ -#define ORDER_SFE 0x29 /* start field extended */ -#define ORDER_YALE 0x2b /* Yale sub command */ -#define ORDER_MF 0x2c /* modify field */ -#define ORDER_RA 0x3c /* repeat to address */ - -#define FCORDER_NULL 0x00 /* format control: null */ -#define FCORDER_FF 0x0c /* form feed */ -#define FCORDER_CR 0x0d /* carriage return */ -#define FCORDER_SO 0x0e /* shift out (DBCS subfield) */ -#define FCORDER_SI 0x0f /* shift in (DBCS end) */ -#define FCORDER_NL 0x15 /* new line */ -#define FCORDER_EM 0x19 /* end of medium */ -#define FCORDER_DUP 0x1c /* duplicate */ -#define FCORDER_FM 0x1e /* field mark */ -#define FCORDER_SUB 0x3f /* substitute */ -#define FCORDER_EO 0xff /* eight ones */ - -/* SCS control code, some overlap orders */ -#define SCS_BS 0x16 /* Back Space */ -#define SCS_BEL 0x2f /* Bell Function */ -#define SCS_CR 0x0d /* Carriage Return */ -#define SCS_ENP 0x14 /* Enable Presentation */ -#define SCS_FF 0x0c /* Forms Feed */ -#define SCS_GE 0x08 /* Graphic Escape */ -#define SCS_HT 0x05 /* Horizontal Tab */ -#define SCS_INP 0x24 /* Inhibit Presentation */ -#define SCS_IRS 0x1e /* Interchange-Record Separator */ -#define SCS_LF 0x25 /* Line Feed */ -#define SCS_NL 0x15 /* New Line */ -#define SCS_SA 0x28 /* Set Attribute: */ -#define SCS_SA_RESET 0x00 /* Reset all */ -#define SCS_SA_HIGHLIGHT 0x41 /* Highlighting */ -#define SCS_SA_CS 0x42 /* Character set */ -#define SCS_SA_GRID 0xc2 /* Grid */ -#define SCS_SET 0x2b /* Set: */ -#define SCS_SHF 0xc1 /* Horizontal format */ -#define SCS_SLD 0xc6 /* Line Density */ -#define SCS_SVF 0xc2 /* Vertical Format */ -#define SCS_SO 0x0e /* Shift out (DBCS subfield start) */ -#define SCS_SI 0x0f /* Shift in (DBCS subfield end) */ -#define SCS_TRN 0x35 /* Transparent */ -#define SCS_VCS 0x04 /* Vertical Channel Select */ -#define SCS_VT 0x0b /* Vertical Tab */ - -/* Structured fields */ -#define SF_READ_PART 0x01 /* read partition */ -#define SF_RP_QUERY 0x02 /* query */ -#define SF_RP_QLIST 0x03 /* query list */ -#define SF_RPQ_LIST 0x00 /* QCODE list */ -#define SF_RPQ_EQUIV 0x40 /* equivalent+ QCODE list */ -#define SF_RPQ_ALL 0x80 /* all */ -#define SF_ERASE_RESET 0x03 /* erase/reset */ -#define SF_ER_DEFAULT 0x00 /* default */ -#define SF_ER_ALT 0x80 /* alternate */ -#define SF_SET_REPLY_MODE 0x09 /* set reply mode */ -#define SF_SRM_FIELD 0x00 /* field */ -#define SF_SRM_XFIELD 0x01 /* extended field */ -#define SF_SRM_CHAR 0x02 /* character */ -#define SF_CREATE_PART 0x0c /* create partition */ -#define CPFLAG_PROT 0x40 /* protected flag */ -#define CPFLAG_COPY_PS 0x20 /* local copy to presentation space */ -#define CPFLAG_BASE 0x07 /* base character set index */ -#define SF_OUTBOUND_DS 0x40 /* outbound 3270 DS */ -#define SF_TRANSFER_DATA 0xd0 /* file transfer open request */ - -/* Query replies */ -#define QR_SUMMARY 0x80 /* summary */ -#define QR_USABLE_AREA 0x81 /* usable area */ -#define QR_ALPHA_PART 0x84 /* alphanumeric partitions */ -#define QR_CHARSETS 0x85 /* character sets */ -#define QR_COLOR 0x86 /* color */ -#define QR_HIGHLIGHTING 0x87 /* highlighting */ -#define QR_REPLY_MODES 0x88 /* reply modes */ -#define QR_DBCS_ASIA 0x91 /* DBCS-Asia */ -#define QR_PC3270 0x93 /* PC3270 */ -#define QR_DDM 0x95 /* distributed data management */ -#define QR_RPQNAMES 0xa1 /* RPQ names */ -#define QR_IMP_PART 0xa6 /* implicit partition */ -#define QR_NULL 0xff /* null */ - -#define BA_TO_ROW(ba) ((ba) / h3270.cols) -#define BA_TO_COL(ba) ((ba) % h3270.cols) -#define ROWCOL_TO_BA(r,c) (((r) * h3270.cols) + c) -#define INC_BA(ba) { (ba) = ((ba) + 1) % (h3270.cols * h3270.rows); } -#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : ((h3270.cols*h3270.rows) - 1); } - -/* Field attributes. */ -#define FA_PRINTABLE 0xc0 /* these make the character "printable" */ -#define FA_PROTECT 0x20 /* unprotected (0) / protected (1) */ -#define FA_NUMERIC 0x10 /* alphanumeric (0) /numeric (1) */ -#define FA_INTENSITY 0x0c /* display/selector pen detectable: */ -#define FA_INT_NORM_NSEL 0x00 /* 00 normal, non-detect */ -#define FA_INT_NORM_SEL 0x04 /* 01 normal, detectable */ -#define FA_INT_HIGH_SEL 0x08 /* 10 intensified, detectable */ -#define FA_INT_ZERO_NSEL 0x0c /* 11 nondisplay, non-detect */ -#define FA_RESERVED 0x02 /* must be 0 */ -#define FA_MODIFY 0x01 /* modified (1) */ - -/* Bits in the field attribute that are stored. */ -#define FA_MASK (FA_PROTECT | FA_NUMERIC | FA_INTENSITY | FA_MODIFY) - -/* Tests for various attribute properties. */ -#define FA_IS_MODIFIED(c) ((c) & FA_MODIFY) -#define FA_IS_NUMERIC(c) ((c) & FA_NUMERIC) -#define FA_IS_PROTECTED(c) ((c) & FA_PROTECT) -#define FA_IS_SKIP(c) (((c) & FA_PROTECT) && ((c) & FA_NUMERIC)) - -#define FA_IS_ZERO(c) \ - (((c) & FA_INTENSITY) == FA_INT_ZERO_NSEL) -#define FA_IS_HIGH(c) \ - (((c) & FA_INTENSITY) == FA_INT_HIGH_SEL) -#define FA_IS_NORMAL(c) \ - ( \ - ((c) & FA_INTENSITY) == FA_INT_NORM_NSEL \ - || \ - ((c) & FA_INTENSITY) == FA_INT_NORM_SEL \ - ) -#define FA_IS_SELECTABLE(c) \ - ( \ - ((c) & FA_INTENSITY) == FA_INT_NORM_SEL \ - || \ - ((c) & FA_INTENSITY) == FA_INT_HIGH_SEL \ - ) -#define FA_IS_INTENSE(c) \ - ((c & FA_INT_HIGH_SEL) == FA_INT_HIGH_SEL) - -/* Extended attributes */ -#define XA_ALL 0x00 -#define XA_3270 0xc0 -#define XA_VALIDATION 0xc1 -#define XAV_FILL 0x04 -#define XAV_ENTRY 0x02 -#define XAV_TRIGGER 0x01 -#define XA_OUTLINING 0xc2 -#define XAO_UNDERLINE 0x01 -#define XAO_RIGHT 0x02 -#define XAO_OVERLINE 0x04 -#define XAO_LEFT 0x08 -#define XA_HIGHLIGHTING 0x41 -#define XAH_DEFAULT 0x00 -#define XAH_NORMAL 0xf0 -#define XAH_BLINK 0xf1 -#define XAH_REVERSE 0xf2 -#define XAH_UNDERSCORE 0xf4 -#define XAH_INTENSIFY 0xf8 -#define XA_FOREGROUND 0x42 -#define XAC_DEFAULT 0x00 -#define XA_CHARSET 0x43 -#define XA_BACKGROUND 0x45 -#define XA_TRANSPARENCY 0x46 -#define XAT_DEFAULT 0x00 -#define XAT_OR 0xf0 -#define XAT_XOR 0xf1 -#define XAT_OPAQUE 0xff -#define XA_INPUT_CONTROL 0xfe -#define XAI_DISABLED 0x00 -#define XAI_ENABLED 0x01 - -/* WCC definitions */ -#define WCC_RESET(c) ((c) & 0x40) -#define WCC_START_PRINTER(c) ((c) & 0x08) -#define WCC_SOUND_ALARM(c) ((c) & 0x04) -#define WCC_KEYBOARD_RESTORE(c) ((c) & 0x02) -#define WCC_RESET_MDT(c) ((c) & 0x01) - -/* AIDs */ -#define AID_NO 0x60 /* no AID generated */ -#define AID_QREPLY 0x61 -#define AID_ENTER 0x7d -#define AID_PF1 0xf1 -#define AID_PF2 0xf2 -#define AID_PF3 0xf3 -#define AID_PF4 0xf4 -#define AID_PF5 0xf5 -#define AID_PF6 0xf6 -#define AID_PF7 0xf7 -#define AID_PF8 0xf8 -#define AID_PF9 0xf9 -#define AID_PF10 0x7a -#define AID_PF11 0x7b -#define AID_PF12 0x7c -#define AID_PF13 0xc1 -#define AID_PF14 0xc2 -#define AID_PF15 0xc3 -#define AID_PF16 0xc4 -#define AID_PF17 0xc5 -#define AID_PF18 0xc6 -#define AID_PF19 0xc7 -#define AID_PF20 0xc8 -#define AID_PF21 0xc9 -#define AID_PF22 0x4a -#define AID_PF23 0x4b -#define AID_PF24 0x4c -#define AID_OICR 0xe6 -#define AID_MSR_MHS 0xe7 -#define AID_SELECT 0x7e -#define AID_PA1 0x6c -#define AID_PA2 0x6e -#define AID_PA3 0x6b -#define AID_CLEAR 0x6d -#define AID_SYSREQ 0xf0 - -#define AID_SF 0x88 -#define SFID_QREPLY 0x81 - -/* Colors */ -#define COLOR_NEUTRAL_BLACK 0 -#define COLOR_BLUE 1 -#define COLOR_RED 2 -#define COLOR_PINK 3 -#define COLOR_GREEN 4 -#define COLOR_TURQUOISE 5 -#define COLOR_YELLOW 6 -#define COLOR_NEUTRAL_WHITE 7 -#define COLOR_BLACK 8 -#define COLOR_DEEP_BLUE 9 -#define COLOR_ORANGE 10 -#define COLOR_PURPLE 11 -#define COLOR_PALE_GREEN 12 -#define COLOR_PALE_TURQUOISE 13 -#define COLOR_GREY 14 -#define COLOR_WHITE 15 - -/* Data stream manipulation macros. */ -#define MASK32 0xff000000U -#define MASK24 0x00ff0000U -#define MASK16 0x0000ff00U -#define MASK08 0x000000ffU -#define MINUS1 0xffffffffU - -#define SET16(ptr, val) { \ - *((ptr)++) = ((val) & MASK16) >> 8; \ - *((ptr)++) = ((val) & MASK08); \ -} -#define GET16(val, ptr) { \ - (val) = *((ptr)+1); \ - (val) += *(ptr) << 8; \ -} -#define SET32(ptr, val) { \ - *((ptr)++) = ((val) & MASK32) >> 24; \ - *((ptr)++) = ((val) & MASK24) >> 16; \ - *((ptr)++) = ((val) & MASK16) >> 8; \ - *((ptr)++) = ((val) & MASK08); \ -} -#define HIGH8(s) (((s) >> 8) & 0xff) -#define LOW8(s) ((s) & 0xff) - -/* Other EBCDIC control codes. */ -#define EBC_null 0x00 -#define EBC_ff 0x0c -#define EBC_cr 0x0d -#define EBC_so 0x0e -#define EBC_si 0x0f -#define EBC_nl 0x15 -#define EBC_em 0x19 -#define EBC_dup 0x1c -#define EBC_fm 0x1e -#define EBC_space 0x40 -#define EBC_nobreakspace 0x41 -#define EBC_period 0x4b -#define EBC_ampersand 0x50 -#define EBC_underscore 0x6d -#define EBC_greater 0x6e -#define EBC_question 0x6f -#define EBC_Yacute 0xad -#define EBC_diaeresis 0xbd -#define EBC_minus 0xca -#define EBC_0 0xf0 -#define EBC_9 0xf9 -#define EBC_eo 0xff - -/* BIND definitions. */ -#define BIND_RU LIB3270_BIND_RU -#define BIND_OFF_PLU_NAME_LEN LIB3270_BIND_OFF_PLU_NAME_LEN -#define BIND_OFF_PLU_NAME LIB3270_BIND_OFF_PLU_NAME -#define BIND_PLU_NAME_MAX LIB3270_BIND_PLU_NAME_MAX diff --git a/ansi.c b/ansi.c index 680c541..0e8f87a 100644 --- a/ansi.c +++ b/ansi.c @@ -46,7 +46,7 @@ //#include "appres.h" // #include "ctlr.h" #if defined(X3270_DBCS) /*[*/ -#include "3270ds.h" +#include #endif /*]*/ #include "ansic.h" diff --git a/ctlr.c b/ctlr.c index 8268132..41c0541 100644 --- a/ctlr.c +++ b/ctlr.c @@ -40,7 +40,7 @@ #include "globals.h" #include -#include "3270ds.h" +#include //#include "appres.h" // #include "ctlr.h" #include "screen.h" diff --git a/ft_cut.c b/ft_cut.c index aa84585..ae5331f 100644 --- a/ft_cut.c +++ b/ft_cut.c @@ -45,7 +45,7 @@ //#include "appres.h" // #include "ctlr.h" -#include "3270ds.h" +#include #include "actionsc.h" #include "ctlrc.h" diff --git a/ft_dft.c b/ft_dft.c index 0e78ba5..8be86b4 100644 --- a/ft_dft.c +++ b/ft_dft.c @@ -42,7 +42,7 @@ #if defined(X3270_FT) /*[*/ //#include "appres.h" -#include "3270ds.h" +#include #include "ft_dft_ds.h" #include "actionsc.h" diff --git a/glue.c b/glue.c index ff6d7f9..5281daa 100644 --- a/glue.c +++ b/glue.c @@ -52,7 +52,7 @@ #include //#include "appres.h" -#include "3270ds.h" +#include #include "resources.h" #include "actionsc.h" diff --git a/html.c b/html.c index 01c88e9..c79ce49 100644 --- a/html.c +++ b/html.c @@ -27,8 +27,10 @@ */ #include + #include #include #include + #include #include #include "globals.h" @@ -68,29 +70,44 @@ static const char * html_color[] = { - "black", - "deepSkyBlue", - "red", - "pink", - "green", - "turquoise", - "yellow", - "white", - "black", - "blue", - "orange", - "purple", - "paleGreen", - "paleTurquoise", - "grey", - "white" + // Terminal colors + "black", + "deepSkyBlue", + "red", + "pink", + "green", + "turquoise", + "yellow", + "white", + "black", + "blue", + "orange", + "purple", + "paleGreen", + "paleTurquoise", + "grey", + "white", + + // Field colors + "green", // Normal/Unprotected + "red", // Intensified/Unprotected + "cyan", // Normal/Protected + "white", // Intensified/Protected + }; struct html_info { int szText; - unsigned char fa; /**< field attribute, it nonzero */ + enum mode + { + HTML_MODE_TEXT, /**< Non editable */ + HTML_MODE_INPUT_TEXT, /**< Text input */ + HTML_MODE_INPUT_VALUE, /**< Value input */ + HTML_MODE_INPUT_BUTTON, /**< Button input (PFkey) */ + } mode; + char * text; int maxlength; unsigned short fg; @@ -124,9 +141,8 @@ unsigned short bg = ((attr & 0x00F0) >> 4); char * txt; - #warning Fix field colors if(attr & LIB3270_ATTR_FIELD) - fg = (attr & 0x0003); + fg = 16+(attr & 0x0003); else fg = (attr & 0x000F); @@ -162,6 +178,34 @@ } + static void open_input(struct html_info *info, int addr) + { + char name[30]; + + snprintf(name,29,"F%04d",addr); + + append_string(info,"mode = HTML_MODE_INPUT_TEXT; + } + + static void close_input(struct html_info *info) + { + char buffer[80]; + + if(info->mode == HTML_MODE_TEXT) + return; + + snprintf(buffer,80," maxlength=\"%d\" class=\"IW%03d\"",info->maxlength,info->maxlength); + append_string(info,buffer); + + append_string(info,">"); + + info->mode = HTML_MODE_TEXT; + info->maxlength = 0; + } + LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option) { int row, baddr; @@ -172,6 +216,7 @@ info.text = lib3270_malloc(info.szText+1); info.fg = 0xFF; info.bg = 0xFF; + info.mode = HTML_MODE_TEXT; if(option & LIB3270_HTML_OPTION_HEADERS) { @@ -193,69 +238,127 @@ len = col; } - for(col = 0; col <= len;col++) + for(col = 0; col <= len || (col < session->cols && info.mode != HTML_MODE_TEXT);col++) { - if((option && LIB3270_HTML_OPTION_ALL) || (session->text[baddr+col].attr & LIB3270_ATTR_SELECTED)) + if((option & LIB3270_HTML_OPTION_ALL) || (session->text[baddr+col].attr & LIB3270_ATTR_SELECTED)) { cr++; - if(session->text[baddr+col].attr & LIB3270_ATTR_CG) + if((session->text[baddr+col].attr & LIB3270_ATTR_MARKER) && (option & LIB3270_HTML_OPTION_FORM) ) { - static const struct chr_xlat xlat[] = - { - { 0xd3, "+" }, // CG 0xab, plus - { 0xa2, "-" }, // CG 0x92, horizontal line - { 0x85, "|" }, // CG 0x184, vertical line - { 0xd4, "+" }, // CG 0xac, LR corner - { 0xd5, "+" }, // CG 0xad, UR corner - { 0xc5, "+" }, // CG 0xa4, UL corner - { 0xc4, "+" }, // CG 0xa3, LL corner - { 0xc6, "|" }, // CG 0xa5, left tee - { 0xd6, "|" }, // CG 0xae, right tee - { 0xc7, "-" }, // CG 0xa6, bottom tee - { 0xd7, "-" }, // CG 0xaf, top tee - { 0x8c, "≤" }, // CG 0xf7, less or equal "≤" - { 0xae, "≥" }, // CG 0xd9, greater or equal "≥" - { 0xbe, "≠" }, // CG 0x3e, not equal "≠" - { 0xad, "[" }, // "[" - { 0xbd, "]" }, // "]" - - { 0x00, NULL } - }; + int fa = (session->ea_buf[baddr+col].fa & FA_MASK); + int tx = (info.mode == HTML_MODE_TEXT); + + close_input(&info); update_colors(&info,session->text[baddr+col].attr); - append_char(&info, xlat, session->text[baddr+col].chr); + if(!FA_IS_PROTECTED(fa)) + { + // Input field + open_input(&info,baddr+col+1); + } + else if(col < len && session->text[baddr+col+1].chr == 'F') + { + char *text = lib3270_get_field_at(session,baddr+col+1); + + if(text) + { + char *ptr = text; + + while(*ptr && *ptr == ' ') + ptr++; + + if(strlen(ptr)>1) + { + int value = atoi(ptr+1); + if(value > 1 && value < 24) + { + // E uma PF, cria um botao + char name[30]; + + snprintf(name,29,"PF%02d",value); + + append_string(&info,"text[baddr+col].attr); + + if(session->text[baddr+col].attr & LIB3270_ATTR_CG) { - { '"', """ }, - { '&', "&" }, - { '<', "<" }, - { '>', ">" }, - { ' ', " " }, + static const struct chr_xlat xlat[] = + { + { 0xd3, "+" }, // CG 0xab, plus + { 0xa2, "-" }, // CG 0x92, horizontal line + { 0x85, "|" }, // CG 0x184, vertical line + { 0xd4, "+" }, // CG 0xac, LR corner + { 0xd5, "+" }, // CG 0xad, UR corner + { 0xc5, "+" }, // CG 0xa4, UL corner + { 0xc4, "+" }, // CG 0xa3, LL corner + { 0xc6, "|" }, // CG 0xa5, left tee + { 0xd6, "|" }, // CG 0xae, right tee + { 0xc7, "-" }, // CG 0xa6, bottom tee + { 0xd7, "-" }, // CG 0xaf, top tee + { 0x8c, "≤" }, // CG 0xf7, less or equal "≤" + { 0xae, "≥" }, // CG 0xd9, greater or equal "≥" + { 0xbe, "≠" }, // CG 0x3e, not equal "≠" + { 0xad, "[" }, // "[" + { 0xbd, "]" }, // "]" + + { 0x00, NULL } + }; - { 0x00, NULL } - }; + append_char(&info, xlat, session->text[baddr+col].chr); - if((session->text[baddr+col].attr & LIB3270_ATTR_MARKER)) - { - update_colors(&info,session->text[baddr+col].attr); - append_string(&info,"|"); } else { - update_colors(&info,session->text[baddr+col].attr); + static const struct chr_xlat xlat[] = + { + { '"', """ }, + { '&', "&" }, + { '<', "<" }, + { '>', ">" }, + { ' ', " " }, + + { 0x00, NULL } + }; append_char(&info, xlat, session->text[baddr+col].chr); } } + else + { + // Input contents + info.maxlength++; + } } } baddr += session->cols; + if(info.mode != HTML_MODE_TEXT) + { + #warning Incluir o tratamento correto + close_input(&info); + } + if(cr || (option && LIB3270_HTML_OPTION_ALL)) append_element(&info,HTML_ELEMENT_LINE_BREAK); } diff --git a/kybd.c b/kybd.c index 80d7494..745cde5 100644 --- a/kybd.c +++ b/kybd.c @@ -51,7 +51,7 @@ // #include #include -#include "3270ds.h" +#include // #include "appres.h" // #include "ctlr.h" #include "resources.h" diff --git a/paste.c b/paste.c index d666db6..1ad3448 100644 --- a/paste.c +++ b/paste.c @@ -46,7 +46,7 @@ #include -#include "3270ds.h" +#include //#include "appres.h" #include "resources.h" diff --git a/proxy.c b/proxy.c index 895af71..780633d 100644 --- a/proxy.c +++ b/proxy.c @@ -70,7 +70,7 @@ #include "api.h" -#include "3270ds.h" +#include #include "popupsc.h" #include "proxyc.h" #include "resolverc.h" diff --git a/rpq.c b/rpq.c index 71331df..fb4cdea 100644 --- a/rpq.c +++ b/rpq.c @@ -56,7 +56,7 @@ #include #include -#include "3270ds.h" +#include //#include "appres.h" #include "popupsc.h" diff --git a/screen.c b/screen.c index 069cd12..19bf4a1 100644 --- a/screen.c +++ b/screen.c @@ -38,7 +38,7 @@ #include "globals.h" #include //#include "appres.h" -#include "3270ds.h" +#include #include "resources.h" // #include "ctlr.h" diff --git a/see.c b/see.c index f5b0d68..cdabcbf 100644 --- a/see.c +++ b/see.c @@ -44,7 +44,7 @@ #include #include #include -#include "3270ds.h" +#include #include "tablesc.h" #if !defined(PR3287) /*[*/ diff --git a/selection.c b/selection.c index bb3077e..64619ac 100644 --- a/selection.c +++ b/selection.c @@ -497,6 +497,24 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) return buffer; } +/** + * Get field contents + * + * @param session Session handle + * @param baddr Field addr + * + * @return String with the field contents (release it with lib3270_free() + */ +LIB3270_EXPORT char * lib3270_get_field_at(H3270 *session, int baddr) +{ + int first = lib3270_field_addr(session,baddr); + + if(first < 0) + return NULL; + + return lib3270_get_text(session,first,lib3270_field_length(session,first)+1); +} + LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession) { if(!hSession->selected || hSession->select.start == hSession->select.end) diff --git a/session.c b/session.c index 5a5e93a..c71d282 100644 --- a/session.c +++ b/session.c @@ -44,7 +44,7 @@ #include "ctlrc.h" #include "ftc.h" #include "kybdc.h" -#include "3270ds.h" +#include /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ diff --git a/sf.c b/sf.c index 0096579..3e3fbba 100644 --- a/sf.c +++ b/sf.c @@ -42,7 +42,7 @@ #if !defined(_WIN32) /*[*/ #include #endif /*]*/ -#include "3270ds.h" +#include // #include "appres.h" #include "screen.h" // #include "ctlr.h" diff --git a/telnet.c b/telnet.c index 2e1adb6..bc1a086 100644 --- a/telnet.c +++ b/telnet.c @@ -81,7 +81,7 @@ // #include #include "tn3270e.h" -#include "3270ds.h" +#include // #include "appres.h" diff --git a/toggles.c b/toggles.c index c65c9f8..5b3a8f9 100644 --- a/toggles.c +++ b/toggles.c @@ -77,6 +77,8 @@ static const char *toggle_names[LIB3270_TOGGLE_COUNT] = "autoconnect", "kpalternative", /**< Keypad +/- move to next/previous field */ "beep", /**< Beep on errors */ + "fieldattr", /**< View Field attribute */ + }; LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix) diff --git a/trace_ds.c b/trace_ds.c index 562a843..217cdc6 100644 --- a/trace_ds.c +++ b/trace_ds.c @@ -52,7 +52,7 @@ #include #include #include -#include "3270ds.h" +#include //#include "appres.h" #include "objects.h" #include "resources.h" -- libgit2 0.21.2