Commit bfa31c773b95d64b00bd0ba970bd438b237363a2
1 parent
e6624bf6
Exists in
master
and in
5 other branches
Implementando conversão do buffer de terminal para HTML
Showing
23 changed files
with
555 additions
and
411 deletions
Show diff stats
src/include/lib3270.h
@@ -103,11 +103,11 @@ | @@ -103,11 +103,11 @@ | ||
103 | LIB3270_TOGGLE_CONNECT_ON_STARTUP, | 103 | LIB3270_TOGGLE_CONNECT_ON_STARTUP, |
104 | LIB3270_TOGGLE_KP_ALTERNATIVE, /**< Keypad +/- move to next/previous field */ | 104 | LIB3270_TOGGLE_KP_ALTERNATIVE, /**< Keypad +/- move to next/previous field */ |
105 | LIB3270_TOGGLE_BEEP, /**< Beep on errors */ | 105 | LIB3270_TOGGLE_BEEP, /**< Beep on errors */ |
106 | + LIB3270_TOGGLE_VIEW_FIELD, /**< View Field attribute */ | ||
106 | 107 | ||
107 | // LIB3270_TOGGLE_ALT_CURSOR, | 108 | // LIB3270_TOGGLE_ALT_CURSOR, |
108 | // LIB3270_TOGGLE_AID_WAIT, | 109 | // LIB3270_TOGGLE_AID_WAIT, |
109 | // LIB3270_TOGGLE_SCROLL_BAR, | 110 | // LIB3270_TOGGLE_SCROLL_BAR, |
110 | -// LIB3270_TOGGLE_VISIBLE_CONTROL, | ||
111 | // LIB3270_TOGGLE_KEYPAD, | 111 | // LIB3270_TOGGLE_KEYPAD, |
112 | 112 | ||
113 | LIB3270_TOGGLE_COUNT | 113 | LIB3270_TOGGLE_COUNT |
@@ -716,11 +716,13 @@ | @@ -716,11 +716,13 @@ | ||
716 | * @param offset Start position. | 716 | * @param offset Start position. |
717 | * @param len Text length or -1 to all text. | 717 | * @param len Text length or -1 to all text. |
718 | * | 718 | * |
719 | - * @return Contents at position if available, or NULL. Release it with free() | 719 | + * @return Contents at position if available, or NULL. Release it with lib3270_free() |
720 | * | 720 | * |
721 | */ | 721 | */ |
722 | LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len); | 722 | LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len); |
723 | 723 | ||
724 | + LIB3270_EXPORT char * lib3270_get_field_at(H3270 *session, int baddr); | ||
725 | + | ||
724 | /** | 726 | /** |
725 | * Get a terminal character and attribute. | 727 | * Get a terminal character and attribute. |
726 | * | 728 | * |
@@ -0,0 +1,333 @@ | @@ -0,0 +1,333 @@ | ||
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. | ||
11 | + * | ||
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. | ||
16 | + * | ||
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 | + */ | ||
22 | + | ||
23 | +/* | ||
24 | + * 3270ds.h | ||
25 | + * | ||
26 | + * Header file for the 3270 Data Stream Protocol. | ||
27 | + */ | ||
28 | + | ||
29 | +/* 3270 commands */ | ||
30 | +#define CMD_W 0x01 /* write */ | ||
31 | +#define CMD_RB 0x02 /* read buffer */ | ||
32 | +#define CMD_NOP 0x03 /* no-op */ | ||
33 | +#define CMD_EW 0x05 /* erase/write */ | ||
34 | +#define CMD_RM 0x06 /* read modified */ | ||
35 | +#define CMD_EWA 0x0d /* erase/write alternate */ | ||
36 | +#define CMD_RMA 0x0e /* read modified all */ | ||
37 | +#define CMD_EAU 0x0f /* erase all unprotected */ | ||
38 | +#define CMD_WSF 0x11 /* write structured field */ | ||
39 | + | ||
40 | +/* SNA 3270 commands */ | ||
41 | +#define SNA_CMD_RMA 0x6e /* read modified all */ | ||
42 | +#define SNA_CMD_EAU 0x6f /* erase all unprotected */ | ||
43 | +#define SNA_CMD_EWA 0x7e /* erase/write alternate */ | ||
44 | +#define SNA_CMD_W 0xf1 /* write */ | ||
45 | +#define SNA_CMD_RB 0xf2 /* read buffer */ | ||
46 | +#define SNA_CMD_WSF 0xf3 /* write structured field */ | ||
47 | +#define SNA_CMD_EW 0xf5 /* erase/write */ | ||
48 | +#define SNA_CMD_RM 0xf6 /* read modified */ | ||
49 | + | ||
50 | +/* 3270 orders */ | ||
51 | +#define ORDER_PT 0x05 /* program tab */ | ||
52 | +#define ORDER_GE 0x08 /* graphic escape */ | ||
53 | +#define ORDER_SBA 0x11 /* set buffer address */ | ||
54 | +#define ORDER_EUA 0x12 /* erase unprotected to address */ | ||
55 | +#define ORDER_IC 0x13 /* insert cursor */ | ||
56 | +#define ORDER_SF 0x1d /* start field */ | ||
57 | +#define ORDER_SA 0x28 /* set attribute */ | ||
58 | +#define ORDER_SFE 0x29 /* start field extended */ | ||
59 | +#define ORDER_YALE 0x2b /* Yale sub command */ | ||
60 | +#define ORDER_MF 0x2c /* modify field */ | ||
61 | +#define ORDER_RA 0x3c /* repeat to address */ | ||
62 | + | ||
63 | +#define FCORDER_NULL 0x00 /* format control: null */ | ||
64 | +#define FCORDER_FF 0x0c /* form feed */ | ||
65 | +#define FCORDER_CR 0x0d /* carriage return */ | ||
66 | +#define FCORDER_SO 0x0e /* shift out (DBCS subfield) */ | ||
67 | +#define FCORDER_SI 0x0f /* shift in (DBCS end) */ | ||
68 | +#define FCORDER_NL 0x15 /* new line */ | ||
69 | +#define FCORDER_EM 0x19 /* end of medium */ | ||
70 | +#define FCORDER_DUP 0x1c /* duplicate */ | ||
71 | +#define FCORDER_FM 0x1e /* field mark */ | ||
72 | +#define FCORDER_SUB 0x3f /* substitute */ | ||
73 | +#define FCORDER_EO 0xff /* eight ones */ | ||
74 | + | ||
75 | +/* SCS control code, some overlap orders */ | ||
76 | +#define SCS_BS 0x16 /* Back Space */ | ||
77 | +#define SCS_BEL 0x2f /* Bell Function */ | ||
78 | +#define SCS_CR 0x0d /* Carriage Return */ | ||
79 | +#define SCS_ENP 0x14 /* Enable Presentation */ | ||
80 | +#define SCS_FF 0x0c /* Forms Feed */ | ||
81 | +#define SCS_GE 0x08 /* Graphic Escape */ | ||
82 | +#define SCS_HT 0x05 /* Horizontal Tab */ | ||
83 | +#define SCS_INP 0x24 /* Inhibit Presentation */ | ||
84 | +#define SCS_IRS 0x1e /* Interchange-Record Separator */ | ||
85 | +#define SCS_LF 0x25 /* Line Feed */ | ||
86 | +#define SCS_NL 0x15 /* New Line */ | ||
87 | +#define SCS_SA 0x28 /* Set Attribute: */ | ||
88 | +#define SCS_SA_RESET 0x00 /* Reset all */ | ||
89 | +#define SCS_SA_HIGHLIGHT 0x41 /* Highlighting */ | ||
90 | +#define SCS_SA_CS 0x42 /* Character set */ | ||
91 | +#define SCS_SA_GRID 0xc2 /* Grid */ | ||
92 | +#define SCS_SET 0x2b /* Set: */ | ||
93 | +#define SCS_SHF 0xc1 /* Horizontal format */ | ||
94 | +#define SCS_SLD 0xc6 /* Line Density */ | ||
95 | +#define SCS_SVF 0xc2 /* Vertical Format */ | ||
96 | +#define SCS_SO 0x0e /* Shift out (DBCS subfield start) */ | ||
97 | +#define SCS_SI 0x0f /* Shift in (DBCS subfield end) */ | ||
98 | +#define SCS_TRN 0x35 /* Transparent */ | ||
99 | +#define SCS_VCS 0x04 /* Vertical Channel Select */ | ||
100 | +#define SCS_VT 0x0b /* Vertical Tab */ | ||
101 | + | ||
102 | +/* Structured fields */ | ||
103 | +#define SF_READ_PART 0x01 /* read partition */ | ||
104 | +#define SF_RP_QUERY 0x02 /* query */ | ||
105 | +#define SF_RP_QLIST 0x03 /* query list */ | ||
106 | +#define SF_RPQ_LIST 0x00 /* QCODE list */ | ||
107 | +#define SF_RPQ_EQUIV 0x40 /* equivalent+ QCODE list */ | ||
108 | +#define SF_RPQ_ALL 0x80 /* all */ | ||
109 | +#define SF_ERASE_RESET 0x03 /* erase/reset */ | ||
110 | +#define SF_ER_DEFAULT 0x00 /* default */ | ||
111 | +#define SF_ER_ALT 0x80 /* alternate */ | ||
112 | +#define SF_SET_REPLY_MODE 0x09 /* set reply mode */ | ||
113 | +#define SF_SRM_FIELD 0x00 /* field */ | ||
114 | +#define SF_SRM_XFIELD 0x01 /* extended field */ | ||
115 | +#define SF_SRM_CHAR 0x02 /* character */ | ||
116 | +#define SF_CREATE_PART 0x0c /* create partition */ | ||
117 | +#define CPFLAG_PROT 0x40 /* protected flag */ | ||
118 | +#define CPFLAG_COPY_PS 0x20 /* local copy to presentation space */ | ||
119 | +#define CPFLAG_BASE 0x07 /* base character set index */ | ||
120 | +#define SF_OUTBOUND_DS 0x40 /* outbound 3270 DS */ | ||
121 | +#define SF_TRANSFER_DATA 0xd0 /* file transfer open request */ | ||
122 | + | ||
123 | +/* Query replies */ | ||
124 | +#define QR_SUMMARY 0x80 /* summary */ | ||
125 | +#define QR_USABLE_AREA 0x81 /* usable area */ | ||
126 | +#define QR_ALPHA_PART 0x84 /* alphanumeric partitions */ | ||
127 | +#define QR_CHARSETS 0x85 /* character sets */ | ||
128 | +#define QR_COLOR 0x86 /* color */ | ||
129 | +#define QR_HIGHLIGHTING 0x87 /* highlighting */ | ||
130 | +#define QR_REPLY_MODES 0x88 /* reply modes */ | ||
131 | +#define QR_DBCS_ASIA 0x91 /* DBCS-Asia */ | ||
132 | +#define QR_PC3270 0x93 /* PC3270 */ | ||
133 | +#define QR_DDM 0x95 /* distributed data management */ | ||
134 | +#define QR_RPQNAMES 0xa1 /* RPQ names */ | ||
135 | +#define QR_IMP_PART 0xa6 /* implicit partition */ | ||
136 | +#define QR_NULL 0xff /* null */ | ||
137 | + | ||
138 | +#define BA_TO_ROW(ba) ((ba) / h3270.cols) | ||
139 | +#define BA_TO_COL(ba) ((ba) % h3270.cols) | ||
140 | +#define ROWCOL_TO_BA(r,c) (((r) * h3270.cols) + c) | ||
141 | +#define INC_BA(ba) { (ba) = ((ba) + 1) % (h3270.cols * h3270.rows); } | ||
142 | +#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : ((h3270.cols*h3270.rows) - 1); } | ||
143 | + | ||
144 | +/** Field attributes. */ | ||
145 | +#define FA_PRINTABLE 0xc0 /**< these make the character "printable" */ | ||
146 | +#define FA_PROTECT 0x20 /**< unprotected (0) / protected (1) */ | ||
147 | +#define FA_NUMERIC 0x10 /**< alphanumeric (0) /numeric (1) */ | ||
148 | +#define FA_INTENSITY 0x0c /**< display/selector pen detectable: */ | ||
149 | +#define FA_INT_NORM_NSEL 0x00 /**< 00 normal, non-detect */ | ||
150 | +#define FA_INT_NORM_SEL 0x04 /**< 01 normal, detectable */ | ||
151 | +#define FA_INT_HIGH_SEL 0x08 /**< 10 intensified, detectable */ | ||
152 | +#define FA_INT_ZERO_NSEL 0x0c /**< 11 nondisplay, non-detect */ | ||
153 | +#define FA_RESERVED 0x02 /**< must be 0 */ | ||
154 | +#define FA_MODIFY 0x01 /**< modified (1) */ | ||
155 | + | ||
156 | +/* Bits in the field attribute that are stored. */ | ||
157 | +#define FA_MASK (FA_PROTECT | FA_NUMERIC | FA_INTENSITY | FA_MODIFY) | ||
158 | + | ||
159 | +/* Tests for various attribute properties. */ | ||
160 | +#define FA_IS_MODIFIED(c) ((c) & FA_MODIFY) | ||
161 | +#define FA_IS_NUMERIC(c) ((c) & FA_NUMERIC) | ||
162 | +#define FA_IS_PROTECTED(c) ((c) & FA_PROTECT) | ||
163 | +#define FA_IS_SKIP(c) (((c) & FA_PROTECT) && ((c) & FA_NUMERIC)) | ||
164 | + | ||
165 | +#define FA_IS_ZERO(c) \ | ||
166 | + (((c) & FA_INTENSITY) == FA_INT_ZERO_NSEL) | ||
167 | +#define FA_IS_HIGH(c) \ | ||
168 | + (((c) & FA_INTENSITY) == FA_INT_HIGH_SEL) | ||
169 | +#define FA_IS_NORMAL(c) \ | ||
170 | + ( \ | ||
171 | + ((c) & FA_INTENSITY) == FA_INT_NORM_NSEL \ | ||
172 | + || \ | ||
173 | + ((c) & FA_INTENSITY) == FA_INT_NORM_SEL \ | ||
174 | + ) | ||
175 | +#define FA_IS_SELECTABLE(c) \ | ||
176 | + ( \ | ||
177 | + ((c) & FA_INTENSITY) == FA_INT_NORM_SEL \ | ||
178 | + || \ | ||
179 | + ((c) & FA_INTENSITY) == FA_INT_HIGH_SEL \ | ||
180 | + ) | ||
181 | +#define FA_IS_INTENSE(c) \ | ||
182 | + ((c & FA_INT_HIGH_SEL) == FA_INT_HIGH_SEL) | ||
183 | + | ||
184 | +/* Extended attributes */ | ||
185 | +#define XA_ALL 0x00 | ||
186 | +#define XA_3270 0xc0 | ||
187 | +#define XA_VALIDATION 0xc1 | ||
188 | +#define XAV_FILL 0x04 | ||
189 | +#define XAV_ENTRY 0x02 | ||
190 | +#define XAV_TRIGGER 0x01 | ||
191 | +#define XA_OUTLINING 0xc2 | ||
192 | +#define XAO_UNDERLINE 0x01 | ||
193 | +#define XAO_RIGHT 0x02 | ||
194 | +#define XAO_OVERLINE 0x04 | ||
195 | +#define XAO_LEFT 0x08 | ||
196 | +#define XA_HIGHLIGHTING 0x41 | ||
197 | +#define XAH_DEFAULT 0x00 | ||
198 | +#define XAH_NORMAL 0xf0 | ||
199 | +#define XAH_BLINK 0xf1 | ||
200 | +#define XAH_REVERSE 0xf2 | ||
201 | +#define XAH_UNDERSCORE 0xf4 | ||
202 | +#define XAH_INTENSIFY 0xf8 | ||
203 | +#define XA_FOREGROUND 0x42 | ||
204 | +#define XAC_DEFAULT 0x00 | ||
205 | +#define XA_CHARSET 0x43 | ||
206 | +#define XA_BACKGROUND 0x45 | ||
207 | +#define XA_TRANSPARENCY 0x46 | ||
208 | +#define XAT_DEFAULT 0x00 | ||
209 | +#define XAT_OR 0xf0 | ||
210 | +#define XAT_XOR 0xf1 | ||
211 | +#define XAT_OPAQUE 0xff | ||
212 | +#define XA_INPUT_CONTROL 0xfe | ||
213 | +#define XAI_DISABLED 0x00 | ||
214 | +#define XAI_ENABLED 0x01 | ||
215 | + | ||
216 | +/* WCC definitions */ | ||
217 | +#define WCC_RESET(c) ((c) & 0x40) | ||
218 | +#define WCC_START_PRINTER(c) ((c) & 0x08) | ||
219 | +#define WCC_SOUND_ALARM(c) ((c) & 0x04) | ||
220 | +#define WCC_KEYBOARD_RESTORE(c) ((c) & 0x02) | ||
221 | +#define WCC_RESET_MDT(c) ((c) & 0x01) | ||
222 | + | ||
223 | +/* AIDs */ | ||
224 | +#define AID_NO 0x60 /* no AID generated */ | ||
225 | +#define AID_QREPLY 0x61 | ||
226 | +#define AID_ENTER 0x7d | ||
227 | +#define AID_PF1 0xf1 | ||
228 | +#define AID_PF2 0xf2 | ||
229 | +#define AID_PF3 0xf3 | ||
230 | +#define AID_PF4 0xf4 | ||
231 | +#define AID_PF5 0xf5 | ||
232 | +#define AID_PF6 0xf6 | ||
233 | +#define AID_PF7 0xf7 | ||
234 | +#define AID_PF8 0xf8 | ||
235 | +#define AID_PF9 0xf9 | ||
236 | +#define AID_PF10 0x7a | ||
237 | +#define AID_PF11 0x7b | ||
238 | +#define AID_PF12 0x7c | ||
239 | +#define AID_PF13 0xc1 | ||
240 | +#define AID_PF14 0xc2 | ||
241 | +#define AID_PF15 0xc3 | ||
242 | +#define AID_PF16 0xc4 | ||
243 | +#define AID_PF17 0xc5 | ||
244 | +#define AID_PF18 0xc6 | ||
245 | +#define AID_PF19 0xc7 | ||
246 | +#define AID_PF20 0xc8 | ||
247 | +#define AID_PF21 0xc9 | ||
248 | +#define AID_PF22 0x4a | ||
249 | +#define AID_PF23 0x4b | ||
250 | +#define AID_PF24 0x4c | ||
251 | +#define AID_OICR 0xe6 | ||
252 | +#define AID_MSR_MHS 0xe7 | ||
253 | +#define AID_SELECT 0x7e | ||
254 | +#define AID_PA1 0x6c | ||
255 | +#define AID_PA2 0x6e | ||
256 | +#define AID_PA3 0x6b | ||
257 | +#define AID_CLEAR 0x6d | ||
258 | +#define AID_SYSREQ 0xf0 | ||
259 | + | ||
260 | +#define AID_SF 0x88 | ||
261 | +#define SFID_QREPLY 0x81 | ||
262 | + | ||
263 | +/* Colors */ | ||
264 | +#define COLOR_NEUTRAL_BLACK 0 | ||
265 | +#define COLOR_BLUE 1 | ||
266 | +#define COLOR_RED 2 | ||
267 | +#define COLOR_PINK 3 | ||
268 | +#define COLOR_GREEN 4 | ||
269 | +#define COLOR_TURQUOISE 5 | ||
270 | +#define COLOR_YELLOW 6 | ||
271 | +#define COLOR_NEUTRAL_WHITE 7 | ||
272 | +#define COLOR_BLACK 8 | ||
273 | +#define COLOR_DEEP_BLUE 9 | ||
274 | +#define COLOR_ORANGE 10 | ||
275 | +#define COLOR_PURPLE 11 | ||
276 | +#define COLOR_PALE_GREEN 12 | ||
277 | +#define COLOR_PALE_TURQUOISE 13 | ||
278 | +#define COLOR_GREY 14 | ||
279 | +#define COLOR_WHITE 15 | ||
280 | + | ||
281 | +/* Data stream manipulation macros. */ | ||
282 | +#define MASK32 0xff000000U | ||
283 | +#define MASK24 0x00ff0000U | ||
284 | +#define MASK16 0x0000ff00U | ||
285 | +#define MASK08 0x000000ffU | ||
286 | +#define MINUS1 0xffffffffU | ||
287 | + | ||
288 | +#define SET16(ptr, val) { \ | ||
289 | + *((ptr)++) = ((val) & MASK16) >> 8; \ | ||
290 | + *((ptr)++) = ((val) & MASK08); \ | ||
291 | +} | ||
292 | +#define GET16(val, ptr) { \ | ||
293 | + (val) = *((ptr)+1); \ | ||
294 | + (val) += *(ptr) << 8; \ | ||
295 | +} | ||
296 | +#define SET32(ptr, val) { \ | ||
297 | + *((ptr)++) = ((val) & MASK32) >> 24; \ | ||
298 | + *((ptr)++) = ((val) & MASK24) >> 16; \ | ||
299 | + *((ptr)++) = ((val) & MASK16) >> 8; \ | ||
300 | + *((ptr)++) = ((val) & MASK08); \ | ||
301 | +} | ||
302 | +#define HIGH8(s) (((s) >> 8) & 0xff) | ||
303 | +#define LOW8(s) ((s) & 0xff) | ||
304 | + | ||
305 | +/* Other EBCDIC control codes. */ | ||
306 | +#define EBC_null 0x00 | ||
307 | +#define EBC_ff 0x0c | ||
308 | +#define EBC_cr 0x0d | ||
309 | +#define EBC_so 0x0e | ||
310 | +#define EBC_si 0x0f | ||
311 | +#define EBC_nl 0x15 | ||
312 | +#define EBC_em 0x19 | ||
313 | +#define EBC_dup 0x1c | ||
314 | +#define EBC_fm 0x1e | ||
315 | +#define EBC_space 0x40 | ||
316 | +#define EBC_nobreakspace 0x41 | ||
317 | +#define EBC_period 0x4b | ||
318 | +#define EBC_ampersand 0x50 | ||
319 | +#define EBC_underscore 0x6d | ||
320 | +#define EBC_greater 0x6e | ||
321 | +#define EBC_question 0x6f | ||
322 | +#define EBC_Yacute 0xad | ||
323 | +#define EBC_diaeresis 0xbd | ||
324 | +#define EBC_minus 0xca | ||
325 | +#define EBC_0 0xf0 | ||
326 | +#define EBC_9 0xf9 | ||
327 | +#define EBC_eo 0xff | ||
328 | + | ||
329 | +/* BIND definitions. */ | ||
330 | +#define BIND_RU LIB3270_BIND_RU | ||
331 | +#define BIND_OFF_PLU_NAME_LEN LIB3270_BIND_OFF_PLU_NAME_LEN | ||
332 | +#define BIND_OFF_PLU_NAME LIB3270_BIND_OFF_PLU_NAME | ||
333 | +#define BIND_PLU_NAME_MAX LIB3270_BIND_PLU_NAME_MAX |
src/lib3270/3270ds.h
@@ -1,333 +0,0 @@ | @@ -1,333 +0,0 @@ | ||
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. | ||
11 | - * | ||
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. | ||
16 | - * | ||
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 | - */ | ||
22 | - | ||
23 | -/* | ||
24 | - * 3270ds.h | ||
25 | - * | ||
26 | - * Header file for the 3270 Data Stream Protocol. | ||
27 | - */ | ||
28 | - | ||
29 | -/* 3270 commands */ | ||
30 | -#define CMD_W 0x01 /* write */ | ||
31 | -#define CMD_RB 0x02 /* read buffer */ | ||
32 | -#define CMD_NOP 0x03 /* no-op */ | ||
33 | -#define CMD_EW 0x05 /* erase/write */ | ||
34 | -#define CMD_RM 0x06 /* read modified */ | ||
35 | -#define CMD_EWA 0x0d /* erase/write alternate */ | ||
36 | -#define CMD_RMA 0x0e /* read modified all */ | ||
37 | -#define CMD_EAU 0x0f /* erase all unprotected */ | ||
38 | -#define CMD_WSF 0x11 /* write structured field */ | ||
39 | - | ||
40 | -/* SNA 3270 commands */ | ||
41 | -#define SNA_CMD_RMA 0x6e /* read modified all */ | ||
42 | -#define SNA_CMD_EAU 0x6f /* erase all unprotected */ | ||
43 | -#define SNA_CMD_EWA 0x7e /* erase/write alternate */ | ||
44 | -#define SNA_CMD_W 0xf1 /* write */ | ||
45 | -#define SNA_CMD_RB 0xf2 /* read buffer */ | ||
46 | -#define SNA_CMD_WSF 0xf3 /* write structured field */ | ||
47 | -#define SNA_CMD_EW 0xf5 /* erase/write */ | ||
48 | -#define SNA_CMD_RM 0xf6 /* read modified */ | ||
49 | - | ||
50 | -/* 3270 orders */ | ||
51 | -#define ORDER_PT 0x05 /* program tab */ | ||
52 | -#define ORDER_GE 0x08 /* graphic escape */ | ||
53 | -#define ORDER_SBA 0x11 /* set buffer address */ | ||
54 | -#define ORDER_EUA 0x12 /* erase unprotected to address */ | ||
55 | -#define ORDER_IC 0x13 /* insert cursor */ | ||
56 | -#define ORDER_SF 0x1d /* start field */ | ||
57 | -#define ORDER_SA 0x28 /* set attribute */ | ||
58 | -#define ORDER_SFE 0x29 /* start field extended */ | ||
59 | -#define ORDER_YALE 0x2b /* Yale sub command */ | ||
60 | -#define ORDER_MF 0x2c /* modify field */ | ||
61 | -#define ORDER_RA 0x3c /* repeat to address */ | ||
62 | - | ||
63 | -#define FCORDER_NULL 0x00 /* format control: null */ | ||
64 | -#define FCORDER_FF 0x0c /* form feed */ | ||
65 | -#define FCORDER_CR 0x0d /* carriage return */ | ||
66 | -#define FCORDER_SO 0x0e /* shift out (DBCS subfield) */ | ||
67 | -#define FCORDER_SI 0x0f /* shift in (DBCS end) */ | ||
68 | -#define FCORDER_NL 0x15 /* new line */ | ||
69 | -#define FCORDER_EM 0x19 /* end of medium */ | ||
70 | -#define FCORDER_DUP 0x1c /* duplicate */ | ||
71 | -#define FCORDER_FM 0x1e /* field mark */ | ||
72 | -#define FCORDER_SUB 0x3f /* substitute */ | ||
73 | -#define FCORDER_EO 0xff /* eight ones */ | ||
74 | - | ||
75 | -/* SCS control code, some overlap orders */ | ||
76 | -#define SCS_BS 0x16 /* Back Space */ | ||
77 | -#define SCS_BEL 0x2f /* Bell Function */ | ||
78 | -#define SCS_CR 0x0d /* Carriage Return */ | ||
79 | -#define SCS_ENP 0x14 /* Enable Presentation */ | ||
80 | -#define SCS_FF 0x0c /* Forms Feed */ | ||
81 | -#define SCS_GE 0x08 /* Graphic Escape */ | ||
82 | -#define SCS_HT 0x05 /* Horizontal Tab */ | ||
83 | -#define SCS_INP 0x24 /* Inhibit Presentation */ | ||
84 | -#define SCS_IRS 0x1e /* Interchange-Record Separator */ | ||
85 | -#define SCS_LF 0x25 /* Line Feed */ | ||
86 | -#define SCS_NL 0x15 /* New Line */ | ||
87 | -#define SCS_SA 0x28 /* Set Attribute: */ | ||
88 | -#define SCS_SA_RESET 0x00 /* Reset all */ | ||
89 | -#define SCS_SA_HIGHLIGHT 0x41 /* Highlighting */ | ||
90 | -#define SCS_SA_CS 0x42 /* Character set */ | ||
91 | -#define SCS_SA_GRID 0xc2 /* Grid */ | ||
92 | -#define SCS_SET 0x2b /* Set: */ | ||
93 | -#define SCS_SHF 0xc1 /* Horizontal format */ | ||
94 | -#define SCS_SLD 0xc6 /* Line Density */ | ||
95 | -#define SCS_SVF 0xc2 /* Vertical Format */ | ||
96 | -#define SCS_SO 0x0e /* Shift out (DBCS subfield start) */ | ||
97 | -#define SCS_SI 0x0f /* Shift in (DBCS subfield end) */ | ||
98 | -#define SCS_TRN 0x35 /* Transparent */ | ||
99 | -#define SCS_VCS 0x04 /* Vertical Channel Select */ | ||
100 | -#define SCS_VT 0x0b /* Vertical Tab */ | ||
101 | - | ||
102 | -/* Structured fields */ | ||
103 | -#define SF_READ_PART 0x01 /* read partition */ | ||
104 | -#define SF_RP_QUERY 0x02 /* query */ | ||
105 | -#define SF_RP_QLIST 0x03 /* query list */ | ||
106 | -#define SF_RPQ_LIST 0x00 /* QCODE list */ | ||
107 | -#define SF_RPQ_EQUIV 0x40 /* equivalent+ QCODE list */ | ||
108 | -#define SF_RPQ_ALL 0x80 /* all */ | ||
109 | -#define SF_ERASE_RESET 0x03 /* erase/reset */ | ||
110 | -#define SF_ER_DEFAULT 0x00 /* default */ | ||
111 | -#define SF_ER_ALT 0x80 /* alternate */ | ||
112 | -#define SF_SET_REPLY_MODE 0x09 /* set reply mode */ | ||
113 | -#define SF_SRM_FIELD 0x00 /* field */ | ||
114 | -#define SF_SRM_XFIELD 0x01 /* extended field */ | ||
115 | -#define SF_SRM_CHAR 0x02 /* character */ | ||
116 | -#define SF_CREATE_PART 0x0c /* create partition */ | ||
117 | -#define CPFLAG_PROT 0x40 /* protected flag */ | ||
118 | -#define CPFLAG_COPY_PS 0x20 /* local copy to presentation space */ | ||
119 | -#define CPFLAG_BASE 0x07 /* base character set index */ | ||
120 | -#define SF_OUTBOUND_DS 0x40 /* outbound 3270 DS */ | ||
121 | -#define SF_TRANSFER_DATA 0xd0 /* file transfer open request */ | ||
122 | - | ||
123 | -/* Query replies */ | ||
124 | -#define QR_SUMMARY 0x80 /* summary */ | ||
125 | -#define QR_USABLE_AREA 0x81 /* usable area */ | ||
126 | -#define QR_ALPHA_PART 0x84 /* alphanumeric partitions */ | ||
127 | -#define QR_CHARSETS 0x85 /* character sets */ | ||
128 | -#define QR_COLOR 0x86 /* color */ | ||
129 | -#define QR_HIGHLIGHTING 0x87 /* highlighting */ | ||
130 | -#define QR_REPLY_MODES 0x88 /* reply modes */ | ||
131 | -#define QR_DBCS_ASIA 0x91 /* DBCS-Asia */ | ||
132 | -#define QR_PC3270 0x93 /* PC3270 */ | ||
133 | -#define QR_DDM 0x95 /* distributed data management */ | ||
134 | -#define QR_RPQNAMES 0xa1 /* RPQ names */ | ||
135 | -#define QR_IMP_PART 0xa6 /* implicit partition */ | ||
136 | -#define QR_NULL 0xff /* null */ | ||
137 | - | ||
138 | -#define BA_TO_ROW(ba) ((ba) / h3270.cols) | ||
139 | -#define BA_TO_COL(ba) ((ba) % h3270.cols) | ||
140 | -#define ROWCOL_TO_BA(r,c) (((r) * h3270.cols) + c) | ||
141 | -#define INC_BA(ba) { (ba) = ((ba) + 1) % (h3270.cols * h3270.rows); } | ||
142 | -#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : ((h3270.cols*h3270.rows) - 1); } | ||
143 | - | ||
144 | -/* Field attributes. */ | ||
145 | -#define FA_PRINTABLE 0xc0 /* these make the character "printable" */ | ||
146 | -#define FA_PROTECT 0x20 /* unprotected (0) / protected (1) */ | ||
147 | -#define FA_NUMERIC 0x10 /* alphanumeric (0) /numeric (1) */ | ||
148 | -#define FA_INTENSITY 0x0c /* display/selector pen detectable: */ | ||
149 | -#define FA_INT_NORM_NSEL 0x00 /* 00 normal, non-detect */ | ||
150 | -#define FA_INT_NORM_SEL 0x04 /* 01 normal, detectable */ | ||
151 | -#define FA_INT_HIGH_SEL 0x08 /* 10 intensified, detectable */ | ||
152 | -#define FA_INT_ZERO_NSEL 0x0c /* 11 nondisplay, non-detect */ | ||
153 | -#define FA_RESERVED 0x02 /* must be 0 */ | ||
154 | -#define FA_MODIFY 0x01 /* modified (1) */ | ||
155 | - | ||
156 | -/* Bits in the field attribute that are stored. */ | ||
157 | -#define FA_MASK (FA_PROTECT | FA_NUMERIC | FA_INTENSITY | FA_MODIFY) | ||
158 | - | ||
159 | -/* Tests for various attribute properties. */ | ||
160 | -#define FA_IS_MODIFIED(c) ((c) & FA_MODIFY) | ||
161 | -#define FA_IS_NUMERIC(c) ((c) & FA_NUMERIC) | ||
162 | -#define FA_IS_PROTECTED(c) ((c) & FA_PROTECT) | ||
163 | -#define FA_IS_SKIP(c) (((c) & FA_PROTECT) && ((c) & FA_NUMERIC)) | ||
164 | - | ||
165 | -#define FA_IS_ZERO(c) \ | ||
166 | - (((c) & FA_INTENSITY) == FA_INT_ZERO_NSEL) | ||
167 | -#define FA_IS_HIGH(c) \ | ||
168 | - (((c) & FA_INTENSITY) == FA_INT_HIGH_SEL) | ||
169 | -#define FA_IS_NORMAL(c) \ | ||
170 | - ( \ | ||
171 | - ((c) & FA_INTENSITY) == FA_INT_NORM_NSEL \ | ||
172 | - || \ | ||
173 | - ((c) & FA_INTENSITY) == FA_INT_NORM_SEL \ | ||
174 | - ) | ||
175 | -#define FA_IS_SELECTABLE(c) \ | ||
176 | - ( \ | ||
177 | - ((c) & FA_INTENSITY) == FA_INT_NORM_SEL \ | ||
178 | - || \ | ||
179 | - ((c) & FA_INTENSITY) == FA_INT_HIGH_SEL \ | ||
180 | - ) | ||
181 | -#define FA_IS_INTENSE(c) \ | ||
182 | - ((c & FA_INT_HIGH_SEL) == FA_INT_HIGH_SEL) | ||
183 | - | ||
184 | -/* Extended attributes */ | ||
185 | -#define XA_ALL 0x00 | ||
186 | -#define XA_3270 0xc0 | ||
187 | -#define XA_VALIDATION 0xc1 | ||
188 | -#define XAV_FILL 0x04 | ||
189 | -#define XAV_ENTRY 0x02 | ||
190 | -#define XAV_TRIGGER 0x01 | ||
191 | -#define XA_OUTLINING 0xc2 | ||
192 | -#define XAO_UNDERLINE 0x01 | ||
193 | -#define XAO_RIGHT 0x02 | ||
194 | -#define XAO_OVERLINE 0x04 | ||
195 | -#define XAO_LEFT 0x08 | ||
196 | -#define XA_HIGHLIGHTING 0x41 | ||
197 | -#define XAH_DEFAULT 0x00 | ||
198 | -#define XAH_NORMAL 0xf0 | ||
199 | -#define XAH_BLINK 0xf1 | ||
200 | -#define XAH_REVERSE 0xf2 | ||
201 | -#define XAH_UNDERSCORE 0xf4 | ||
202 | -#define XAH_INTENSIFY 0xf8 | ||
203 | -#define XA_FOREGROUND 0x42 | ||
204 | -#define XAC_DEFAULT 0x00 | ||
205 | -#define XA_CHARSET 0x43 | ||
206 | -#define XA_BACKGROUND 0x45 | ||
207 | -#define XA_TRANSPARENCY 0x46 | ||
208 | -#define XAT_DEFAULT 0x00 | ||
209 | -#define XAT_OR 0xf0 | ||
210 | -#define XAT_XOR 0xf1 | ||
211 | -#define XAT_OPAQUE 0xff | ||
212 | -#define XA_INPUT_CONTROL 0xfe | ||
213 | -#define XAI_DISABLED 0x00 | ||
214 | -#define XAI_ENABLED 0x01 | ||
215 | - | ||
216 | -/* WCC definitions */ | ||
217 | -#define WCC_RESET(c) ((c) & 0x40) | ||
218 | -#define WCC_START_PRINTER(c) ((c) & 0x08) | ||
219 | -#define WCC_SOUND_ALARM(c) ((c) & 0x04) | ||
220 | -#define WCC_KEYBOARD_RESTORE(c) ((c) & 0x02) | ||
221 | -#define WCC_RESET_MDT(c) ((c) & 0x01) | ||
222 | - | ||
223 | -/* AIDs */ | ||
224 | -#define AID_NO 0x60 /* no AID generated */ | ||
225 | -#define AID_QREPLY 0x61 | ||
226 | -#define AID_ENTER 0x7d | ||
227 | -#define AID_PF1 0xf1 | ||
228 | -#define AID_PF2 0xf2 | ||
229 | -#define AID_PF3 0xf3 | ||
230 | -#define AID_PF4 0xf4 | ||
231 | -#define AID_PF5 0xf5 | ||
232 | -#define AID_PF6 0xf6 | ||
233 | -#define AID_PF7 0xf7 | ||
234 | -#define AID_PF8 0xf8 | ||
235 | -#define AID_PF9 0xf9 | ||
236 | -#define AID_PF10 0x7a | ||
237 | -#define AID_PF11 0x7b | ||
238 | -#define AID_PF12 0x7c | ||
239 | -#define AID_PF13 0xc1 | ||
240 | -#define AID_PF14 0xc2 | ||
241 | -#define AID_PF15 0xc3 | ||
242 | -#define AID_PF16 0xc4 | ||
243 | -#define AID_PF17 0xc5 | ||
244 | -#define AID_PF18 0xc6 | ||
245 | -#define AID_PF19 0xc7 | ||
246 | -#define AID_PF20 0xc8 | ||
247 | -#define AID_PF21 0xc9 | ||
248 | -#define AID_PF22 0x4a | ||
249 | -#define AID_PF23 0x4b | ||
250 | -#define AID_PF24 0x4c | ||
251 | -#define AID_OICR 0xe6 | ||
252 | -#define AID_MSR_MHS 0xe7 | ||
253 | -#define AID_SELECT 0x7e | ||
254 | -#define AID_PA1 0x6c | ||
255 | -#define AID_PA2 0x6e | ||
256 | -#define AID_PA3 0x6b | ||
257 | -#define AID_CLEAR 0x6d | ||
258 | -#define AID_SYSREQ 0xf0 | ||
259 | - | ||
260 | -#define AID_SF 0x88 | ||
261 | -#define SFID_QREPLY 0x81 | ||
262 | - | ||
263 | -/* Colors */ | ||
264 | -#define COLOR_NEUTRAL_BLACK 0 | ||
265 | -#define COLOR_BLUE 1 | ||
266 | -#define COLOR_RED 2 | ||
267 | -#define COLOR_PINK 3 | ||
268 | -#define COLOR_GREEN 4 | ||
269 | -#define COLOR_TURQUOISE 5 | ||
270 | -#define COLOR_YELLOW 6 | ||
271 | -#define COLOR_NEUTRAL_WHITE 7 | ||
272 | -#define COLOR_BLACK 8 | ||
273 | -#define COLOR_DEEP_BLUE 9 | ||
274 | -#define COLOR_ORANGE 10 | ||
275 | -#define COLOR_PURPLE 11 | ||
276 | -#define COLOR_PALE_GREEN 12 | ||
277 | -#define COLOR_PALE_TURQUOISE 13 | ||
278 | -#define COLOR_GREY 14 | ||
279 | -#define COLOR_WHITE 15 | ||
280 | - | ||
281 | -/* Data stream manipulation macros. */ | ||
282 | -#define MASK32 0xff000000U | ||
283 | -#define MASK24 0x00ff0000U | ||
284 | -#define MASK16 0x0000ff00U | ||
285 | -#define MASK08 0x000000ffU | ||
286 | -#define MINUS1 0xffffffffU | ||
287 | - | ||
288 | -#define SET16(ptr, val) { \ | ||
289 | - *((ptr)++) = ((val) & MASK16) >> 8; \ | ||
290 | - *((ptr)++) = ((val) & MASK08); \ | ||
291 | -} | ||
292 | -#define GET16(val, ptr) { \ | ||
293 | - (val) = *((ptr)+1); \ | ||
294 | - (val) += *(ptr) << 8; \ | ||
295 | -} | ||
296 | -#define SET32(ptr, val) { \ | ||
297 | - *((ptr)++) = ((val) & MASK32) >> 24; \ | ||
298 | - *((ptr)++) = ((val) & MASK24) >> 16; \ | ||
299 | - *((ptr)++) = ((val) & MASK16) >> 8; \ | ||
300 | - *((ptr)++) = ((val) & MASK08); \ | ||
301 | -} | ||
302 | -#define HIGH8(s) (((s) >> 8) & 0xff) | ||
303 | -#define LOW8(s) ((s) & 0xff) | ||
304 | - | ||
305 | -/* Other EBCDIC control codes. */ | ||
306 | -#define EBC_null 0x00 | ||
307 | -#define EBC_ff 0x0c | ||
308 | -#define EBC_cr 0x0d | ||
309 | -#define EBC_so 0x0e | ||
310 | -#define EBC_si 0x0f | ||
311 | -#define EBC_nl 0x15 | ||
312 | -#define EBC_em 0x19 | ||
313 | -#define EBC_dup 0x1c | ||
314 | -#define EBC_fm 0x1e | ||
315 | -#define EBC_space 0x40 | ||
316 | -#define EBC_nobreakspace 0x41 | ||
317 | -#define EBC_period 0x4b | ||
318 | -#define EBC_ampersand 0x50 | ||
319 | -#define EBC_underscore 0x6d | ||
320 | -#define EBC_greater 0x6e | ||
321 | -#define EBC_question 0x6f | ||
322 | -#define EBC_Yacute 0xad | ||
323 | -#define EBC_diaeresis 0xbd | ||
324 | -#define EBC_minus 0xca | ||
325 | -#define EBC_0 0xf0 | ||
326 | -#define EBC_9 0xf9 | ||
327 | -#define EBC_eo 0xff | ||
328 | - | ||
329 | -/* BIND definitions. */ | ||
330 | -#define BIND_RU LIB3270_BIND_RU | ||
331 | -#define BIND_OFF_PLU_NAME_LEN LIB3270_BIND_OFF_PLU_NAME_LEN | ||
332 | -#define BIND_OFF_PLU_NAME LIB3270_BIND_OFF_PLU_NAME | ||
333 | -#define BIND_PLU_NAME_MAX LIB3270_BIND_PLU_NAME_MAX |
src/lib3270/ansi.c
@@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
46 | //#include "appres.h" | 46 | //#include "appres.h" |
47 | // #include "ctlr.h" | 47 | // #include "ctlr.h" |
48 | #if defined(X3270_DBCS) /*[*/ | 48 | #if defined(X3270_DBCS) /*[*/ |
49 | -#include "3270ds.h" | 49 | +#include <lib3270/3270ds.h> |
50 | #endif /*]*/ | 50 | #endif /*]*/ |
51 | 51 | ||
52 | #include "ansic.h" | 52 | #include "ansic.h" |
src/lib3270/ctlr.c
@@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
40 | 40 | ||
41 | #include "globals.h" | 41 | #include "globals.h" |
42 | #include <errno.h> | 42 | #include <errno.h> |
43 | -#include "3270ds.h" | 43 | +#include <lib3270/3270ds.h> |
44 | //#include "appres.h" | 44 | //#include "appres.h" |
45 | // #include "ctlr.h" | 45 | // #include "ctlr.h" |
46 | #include "screen.h" | 46 | #include "screen.h" |
src/lib3270/ft_cut.c
src/lib3270/ft_dft.c
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | #if defined(X3270_FT) /*[*/ | 42 | #if defined(X3270_FT) /*[*/ |
43 | 43 | ||
44 | //#include "appres.h" | 44 | //#include "appres.h" |
45 | -#include "3270ds.h" | 45 | +#include <lib3270/3270ds.h> |
46 | #include "ft_dft_ds.h" | 46 | #include "ft_dft_ds.h" |
47 | 47 | ||
48 | #include "actionsc.h" | 48 | #include "actionsc.h" |
src/lib3270/glue.c
@@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
52 | #include <stdarg.h> | 52 | #include <stdarg.h> |
53 | 53 | ||
54 | //#include "appres.h" | 54 | //#include "appres.h" |
55 | -#include "3270ds.h" | 55 | +#include <lib3270/3270ds.h> |
56 | #include "resources.h" | 56 | #include "resources.h" |
57 | 57 | ||
58 | #include "actionsc.h" | 58 | #include "actionsc.h" |
src/lib3270/html.c
@@ -27,8 +27,10 @@ | @@ -27,8 +27,10 @@ | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <string.h> | 29 | #include <string.h> |
30 | + #include <stdlib.h> | ||
30 | #include <lib3270.h> | 31 | #include <lib3270.h> |
31 | #include <lib3270/session.h> | 32 | #include <lib3270/session.h> |
33 | + #include <lib3270/3270ds.h> | ||
32 | #include <lib3270/html.h> | 34 | #include <lib3270/html.h> |
33 | 35 | ||
34 | #include "globals.h" | 36 | #include "globals.h" |
@@ -68,29 +70,44 @@ | @@ -68,29 +70,44 @@ | ||
68 | 70 | ||
69 | static const char * html_color[] = | 71 | static const char * html_color[] = |
70 | { | 72 | { |
71 | - "black", | ||
72 | - "deepSkyBlue", | ||
73 | - "red", | ||
74 | - "pink", | ||
75 | - "green", | ||
76 | - "turquoise", | ||
77 | - "yellow", | ||
78 | - "white", | ||
79 | - "black", | ||
80 | - "blue", | ||
81 | - "orange", | ||
82 | - "purple", | ||
83 | - "paleGreen", | ||
84 | - "paleTurquoise", | ||
85 | - "grey", | ||
86 | - "white" | 73 | + // Terminal colors |
74 | + "black", | ||
75 | + "deepSkyBlue", | ||
76 | + "red", | ||
77 | + "pink", | ||
78 | + "green", | ||
79 | + "turquoise", | ||
80 | + "yellow", | ||
81 | + "white", | ||
82 | + "black", | ||
83 | + "blue", | ||
84 | + "orange", | ||
85 | + "purple", | ||
86 | + "paleGreen", | ||
87 | + "paleTurquoise", | ||
88 | + "grey", | ||
89 | + "white", | ||
90 | + | ||
91 | + // Field colors | ||
92 | + "green", // Normal/Unprotected | ||
93 | + "red", // Intensified/Unprotected | ||
94 | + "cyan", // Normal/Protected | ||
95 | + "white", // Intensified/Protected | ||
96 | + | ||
87 | }; | 97 | }; |
88 | 98 | ||
89 | struct html_info | 99 | struct html_info |
90 | { | 100 | { |
91 | int szText; | 101 | int szText; |
92 | 102 | ||
93 | - unsigned char fa; /**< field attribute, it nonzero */ | 103 | + enum mode |
104 | + { | ||
105 | + HTML_MODE_TEXT, /**< Non editable */ | ||
106 | + HTML_MODE_INPUT_TEXT, /**< Text input */ | ||
107 | + HTML_MODE_INPUT_VALUE, /**< Value input */ | ||
108 | + HTML_MODE_INPUT_BUTTON, /**< Button input (PFkey) */ | ||
109 | + } mode; | ||
110 | + | ||
94 | char * text; | 111 | char * text; |
95 | int maxlength; | 112 | int maxlength; |
96 | unsigned short fg; | 113 | unsigned short fg; |
@@ -124,9 +141,8 @@ | @@ -124,9 +141,8 @@ | ||
124 | unsigned short bg = ((attr & 0x00F0) >> 4); | 141 | unsigned short bg = ((attr & 0x00F0) >> 4); |
125 | char * txt; | 142 | char * txt; |
126 | 143 | ||
127 | - #warning Fix field colors | ||
128 | if(attr & LIB3270_ATTR_FIELD) | 144 | if(attr & LIB3270_ATTR_FIELD) |
129 | - fg = (attr & 0x0003); | 145 | + fg = 16+(attr & 0x0003); |
130 | else | 146 | else |
131 | fg = (attr & 0x000F); | 147 | fg = (attr & 0x000F); |
132 | 148 | ||
@@ -162,6 +178,34 @@ | @@ -162,6 +178,34 @@ | ||
162 | 178 | ||
163 | } | 179 | } |
164 | 180 | ||
181 | + static void open_input(struct html_info *info, int addr) | ||
182 | + { | ||
183 | + char name[30]; | ||
184 | + | ||
185 | + snprintf(name,29,"F%04d",addr); | ||
186 | + | ||
187 | + append_string(info,"<input type=\"text\" name=\""); | ||
188 | + append_string(info,name); | ||
189 | + append_string(info,"\""); | ||
190 | + info->mode = HTML_MODE_INPUT_TEXT; | ||
191 | + } | ||
192 | + | ||
193 | + static void close_input(struct html_info *info) | ||
194 | + { | ||
195 | + char buffer[80]; | ||
196 | + | ||
197 | + if(info->mode == HTML_MODE_TEXT) | ||
198 | + return; | ||
199 | + | ||
200 | + snprintf(buffer,80," maxlength=\"%d\" class=\"IW%03d\"",info->maxlength,info->maxlength); | ||
201 | + append_string(info,buffer); | ||
202 | + | ||
203 | + append_string(info,"></input>"); | ||
204 | + | ||
205 | + info->mode = HTML_MODE_TEXT; | ||
206 | + info->maxlength = 0; | ||
207 | + } | ||
208 | + | ||
165 | LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option) | 209 | LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option) |
166 | { | 210 | { |
167 | int row, baddr; | 211 | int row, baddr; |
@@ -172,6 +216,7 @@ | @@ -172,6 +216,7 @@ | ||
172 | info.text = lib3270_malloc(info.szText+1); | 216 | info.text = lib3270_malloc(info.szText+1); |
173 | info.fg = 0xFF; | 217 | info.fg = 0xFF; |
174 | info.bg = 0xFF; | 218 | info.bg = 0xFF; |
219 | + info.mode = HTML_MODE_TEXT; | ||
175 | 220 | ||
176 | if(option & LIB3270_HTML_OPTION_HEADERS) | 221 | if(option & LIB3270_HTML_OPTION_HEADERS) |
177 | { | 222 | { |
@@ -193,69 +238,127 @@ | @@ -193,69 +238,127 @@ | ||
193 | len = col; | 238 | len = col; |
194 | } | 239 | } |
195 | 240 | ||
196 | - for(col = 0; col <= len;col++) | 241 | + for(col = 0; col <= len || (col < session->cols && info.mode != HTML_MODE_TEXT);col++) |
197 | { | 242 | { |
198 | - if((option && LIB3270_HTML_OPTION_ALL) || (session->text[baddr+col].attr & LIB3270_ATTR_SELECTED)) | 243 | + if((option & LIB3270_HTML_OPTION_ALL) || (session->text[baddr+col].attr & LIB3270_ATTR_SELECTED)) |
199 | { | 244 | { |
200 | cr++; | 245 | cr++; |
201 | 246 | ||
202 | - if(session->text[baddr+col].attr & LIB3270_ATTR_CG) | 247 | + if((session->text[baddr+col].attr & LIB3270_ATTR_MARKER) && (option & LIB3270_HTML_OPTION_FORM) ) |
203 | { | 248 | { |
204 | - static const struct chr_xlat xlat[] = | ||
205 | - { | ||
206 | - { 0xd3, "+" }, // CG 0xab, plus | ||
207 | - { 0xa2, "-" }, // CG 0x92, horizontal line | ||
208 | - { 0x85, "|" }, // CG 0x184, vertical line | ||
209 | - { 0xd4, "+" }, // CG 0xac, LR corner | ||
210 | - { 0xd5, "+" }, // CG 0xad, UR corner | ||
211 | - { 0xc5, "+" }, // CG 0xa4, UL corner | ||
212 | - { 0xc4, "+" }, // CG 0xa3, LL corner | ||
213 | - { 0xc6, "|" }, // CG 0xa5, left tee | ||
214 | - { 0xd6, "|" }, // CG 0xae, right tee | ||
215 | - { 0xc7, "-" }, // CG 0xa6, bottom tee | ||
216 | - { 0xd7, "-" }, // CG 0xaf, top tee | ||
217 | - { 0x8c, "≤" }, // CG 0xf7, less or equal "≤" | ||
218 | - { 0xae, "≥" }, // CG 0xd9, greater or equal "≥" | ||
219 | - { 0xbe, "≠" }, // CG 0x3e, not equal "≠" | ||
220 | - { 0xad, "[" }, // "[" | ||
221 | - { 0xbd, "]" }, // "]" | ||
222 | - | ||
223 | - { 0x00, NULL } | ||
224 | - }; | 249 | + int fa = (session->ea_buf[baddr+col].fa & FA_MASK); |
250 | + int tx = (info.mode == HTML_MODE_TEXT); | ||
251 | + | ||
252 | + close_input(&info); | ||
225 | 253 | ||
226 | update_colors(&info,session->text[baddr+col].attr); | 254 | update_colors(&info,session->text[baddr+col].attr); |
227 | - append_char(&info, xlat, session->text[baddr+col].chr); | ||
228 | 255 | ||
256 | + if(!FA_IS_PROTECTED(fa)) | ||
257 | + { | ||
258 | + // Input field | ||
259 | + open_input(&info,baddr+col+1); | ||
260 | + } | ||
261 | + else if(col < len && session->text[baddr+col+1].chr == 'F') | ||
262 | + { | ||
263 | + char *text = lib3270_get_field_at(session,baddr+col+1); | ||
264 | + | ||
265 | + if(text) | ||
266 | + { | ||
267 | + char *ptr = text; | ||
268 | + | ||
269 | + while(*ptr && *ptr == ' ') | ||
270 | + ptr++; | ||
271 | + | ||
272 | + if(strlen(ptr)>1) | ||
273 | + { | ||
274 | + int value = atoi(ptr+1); | ||
275 | + if(value > 1 && value < 24) | ||
276 | + { | ||
277 | + // E uma PF, cria um botao | ||
278 | + char name[30]; | ||
279 | + | ||
280 | + snprintf(name,29,"PF%02d",value); | ||
281 | + | ||
282 | + append_string(&info,"<input type=\"button\" name=\""); | ||
283 | + append_string(&info,name); | ||
284 | + append_string(&info,"\" value=\""); | ||
285 | + append_string(&info,ptr); | ||
286 | + append_string(&info,"\""); | ||
287 | + info.mode = HTML_MODE_INPUT_BUTTON; | ||
288 | + } | ||
289 | + } | ||
290 | + lib3270_free(text); | ||
291 | + } | ||
292 | + | ||
293 | + } | ||
294 | + else if(tx) | ||
295 | + { | ||
296 | + append_string(&info," "); | ||
297 | + } | ||
229 | } | 298 | } |
230 | - else | 299 | + else if(info.mode == HTML_MODE_TEXT) |
231 | { | 300 | { |
232 | - static const struct chr_xlat xlat[] = | 301 | + // Normal text |
302 | + update_colors(&info,session->text[baddr+col].attr); | ||
303 | + | ||
304 | + if(session->text[baddr+col].attr & LIB3270_ATTR_CG) | ||
233 | { | 305 | { |
234 | - { '"', """ }, | ||
235 | - { '&', "&" }, | ||
236 | - { '<', "<" }, | ||
237 | - { '>', ">" }, | ||
238 | - { ' ', " " }, | 306 | + static const struct chr_xlat xlat[] = |
307 | + { | ||
308 | + { 0xd3, "+" }, // CG 0xab, plus | ||
309 | + { 0xa2, "-" }, // CG 0x92, horizontal line | ||
310 | + { 0x85, "|" }, // CG 0x184, vertical line | ||
311 | + { 0xd4, "+" }, // CG 0xac, LR corner | ||
312 | + { 0xd5, "+" }, // CG 0xad, UR corner | ||
313 | + { 0xc5, "+" }, // CG 0xa4, UL corner | ||
314 | + { 0xc4, "+" }, // CG 0xa3, LL corner | ||
315 | + { 0xc6, "|" }, // CG 0xa5, left tee | ||
316 | + { 0xd6, "|" }, // CG 0xae, right tee | ||
317 | + { 0xc7, "-" }, // CG 0xa6, bottom tee | ||
318 | + { 0xd7, "-" }, // CG 0xaf, top tee | ||
319 | + { 0x8c, "≤" }, // CG 0xf7, less or equal "≤" | ||
320 | + { 0xae, "≥" }, // CG 0xd9, greater or equal "≥" | ||
321 | + { 0xbe, "≠" }, // CG 0x3e, not equal "≠" | ||
322 | + { 0xad, "[" }, // "[" | ||
323 | + { 0xbd, "]" }, // "]" | ||
324 | + | ||
325 | + { 0x00, NULL } | ||
326 | + }; | ||
239 | 327 | ||
240 | - { 0x00, NULL } | ||
241 | - }; | 328 | + append_char(&info, xlat, session->text[baddr+col].chr); |
242 | 329 | ||
243 | - if((session->text[baddr+col].attr & LIB3270_ATTR_MARKER)) | ||
244 | - { | ||
245 | - update_colors(&info,session->text[baddr+col].attr); | ||
246 | - append_string(&info,"|"); | ||
247 | } | 330 | } |
248 | else | 331 | else |
249 | { | 332 | { |
250 | - update_colors(&info,session->text[baddr+col].attr); | 333 | + static const struct chr_xlat xlat[] = |
334 | + { | ||
335 | + { '"', """ }, | ||
336 | + { '&', "&" }, | ||
337 | + { '<', "<" }, | ||
338 | + { '>', ">" }, | ||
339 | + { ' ', " " }, | ||
340 | + | ||
341 | + { 0x00, NULL } | ||
342 | + }; | ||
251 | append_char(&info, xlat, session->text[baddr+col].chr); | 343 | append_char(&info, xlat, session->text[baddr+col].chr); |
252 | } | 344 | } |
253 | } | 345 | } |
346 | + else | ||
347 | + { | ||
348 | + // Input contents | ||
349 | + info.maxlength++; | ||
350 | + } | ||
254 | } | 351 | } |
255 | } | 352 | } |
256 | 353 | ||
257 | baddr += session->cols; | 354 | baddr += session->cols; |
258 | 355 | ||
356 | + if(info.mode != HTML_MODE_TEXT) | ||
357 | + { | ||
358 | + #warning Incluir o tratamento correto | ||
359 | + close_input(&info); | ||
360 | + } | ||
361 | + | ||
259 | if(cr || (option && LIB3270_HTML_OPTION_ALL)) | 362 | if(cr || (option && LIB3270_HTML_OPTION_ALL)) |
260 | append_element(&info,HTML_ELEMENT_LINE_BREAK); | 363 | append_element(&info,HTML_ELEMENT_LINE_BREAK); |
261 | } | 364 | } |
src/lib3270/kybd.c
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | // #include <X11/keysym.h> | 51 | // #include <X11/keysym.h> |
52 | 52 | ||
53 | #include <fcntl.h> | 53 | #include <fcntl.h> |
54 | -#include "3270ds.h" | 54 | +#include <lib3270/3270ds.h> |
55 | // #include "appres.h" | 55 | // #include "appres.h" |
56 | // #include "ctlr.h" | 56 | // #include "ctlr.h" |
57 | #include "resources.h" | 57 | #include "resources.h" |
src/lib3270/paste.c
src/lib3270/proxy.c
src/lib3270/rpq.c
src/lib3270/screen.c
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | #include "globals.h" | 38 | #include "globals.h" |
39 | #include <signal.h> | 39 | #include <signal.h> |
40 | //#include "appres.h" | 40 | //#include "appres.h" |
41 | -#include "3270ds.h" | 41 | +#include <lib3270/3270ds.h> |
42 | #include "resources.h" | 42 | #include "resources.h" |
43 | // #include "ctlr.h" | 43 | // #include "ctlr.h" |
44 | 44 |
src/lib3270/see.c
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | #include <signal.h> | 44 | #include <signal.h> |
45 | #include <stdarg.h> | 45 | #include <stdarg.h> |
46 | #include <fcntl.h> | 46 | #include <fcntl.h> |
47 | -#include "3270ds.h" | 47 | +#include <lib3270/3270ds.h> |
48 | 48 | ||
49 | #include "tablesc.h" | 49 | #include "tablesc.h" |
50 | #if !defined(PR3287) /*[*/ | 50 | #if !defined(PR3287) /*[*/ |
src/lib3270/selection.c
@@ -497,6 +497,24 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -497,6 +497,24 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
497 | return buffer; | 497 | return buffer; |
498 | } | 498 | } |
499 | 499 | ||
500 | +/** | ||
501 | + * Get field contents | ||
502 | + * | ||
503 | + * @param session Session handle | ||
504 | + * @param baddr Field addr | ||
505 | + * | ||
506 | + * @return String with the field contents (release it with lib3270_free() | ||
507 | + */ | ||
508 | +LIB3270_EXPORT char * lib3270_get_field_at(H3270 *session, int baddr) | ||
509 | +{ | ||
510 | + int first = lib3270_field_addr(session,baddr); | ||
511 | + | ||
512 | + if(first < 0) | ||
513 | + return NULL; | ||
514 | + | ||
515 | + return lib3270_get_text(session,first,lib3270_field_length(session,first)+1); | ||
516 | +} | ||
517 | + | ||
500 | LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession) | 518 | LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession) |
501 | { | 519 | { |
502 | if(!hSession->selected || hSession->select.start == hSession->select.end) | 520 | if(!hSession->selected || hSession->select.start == hSession->select.end) |
src/lib3270/session.c
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | #include "ctlrc.h" | 44 | #include "ctlrc.h" |
45 | #include "ftc.h" | 45 | #include "ftc.h" |
46 | #include "kybdc.h" | 46 | #include "kybdc.h" |
47 | -#include "3270ds.h" | 47 | +#include <lib3270/3270ds.h> |
48 | 48 | ||
49 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ | 49 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
50 | 50 |
src/lib3270/sf.c
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | #if !defined(_WIN32) /*[*/ | 42 | #if !defined(_WIN32) /*[*/ |
43 | #include <netinet/in.h> | 43 | #include <netinet/in.h> |
44 | #endif /*]*/ | 44 | #endif /*]*/ |
45 | -#include "3270ds.h" | 45 | +#include <lib3270/3270ds.h> |
46 | // #include "appres.h" | 46 | // #include "appres.h" |
47 | #include "screen.h" | 47 | #include "screen.h" |
48 | // #include "ctlr.h" | 48 | // #include "ctlr.h" |
src/lib3270/telnet.c
src/lib3270/toggles.c
@@ -77,6 +77,8 @@ static const char *toggle_names[LIB3270_TOGGLE_COUNT] = | @@ -77,6 +77,8 @@ static const char *toggle_names[LIB3270_TOGGLE_COUNT] = | ||
77 | "autoconnect", | 77 | "autoconnect", |
78 | "kpalternative", /**< Keypad +/- move to next/previous field */ | 78 | "kpalternative", /**< Keypad +/- move to next/previous field */ |
79 | "beep", /**< Beep on errors */ | 79 | "beep", /**< Beep on errors */ |
80 | + "fieldattr", /**< View Field attribute */ | ||
81 | + | ||
80 | }; | 82 | }; |
81 | 83 | ||
82 | LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix) | 84 | LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix) |
src/lib3270/trace_ds.c
@@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
52 | #include <signal.h> | 52 | #include <signal.h> |
53 | #include <stdarg.h> | 53 | #include <stdarg.h> |
54 | #include <fcntl.h> | 54 | #include <fcntl.h> |
55 | -#include "3270ds.h" | 55 | +#include <lib3270/3270ds.h> |
56 | //#include "appres.h" | 56 | //#include "appres.h" |
57 | #include "objects.h" | 57 | #include "objects.h" |
58 | #include "resources.h" | 58 | #include "resources.h" |
src/pw3270/v3270/draw.c
@@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <gtk/gtk.h> | 30 | #include <gtk/gtk.h> |
31 | + #include <math.h> | ||
31 | #include <pw3270.h> | 32 | #include <pw3270.h> |
32 | #include <lib3270.h> | 33 | #include <lib3270.h> |
33 | #include <lib3270/session.h> | 34 | #include <lib3270/session.h> |
@@ -131,7 +132,24 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 | @@ -131,7 +132,24 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 | ||
131 | gdk_cairo_set_source_color(cr,fg); | 132 | gdk_cairo_set_source_color(cr,fg); |
132 | 133 | ||
133 | // Draw char | 134 | // Draw char |
134 | - if(attr & LIB3270_ATTR_CG) | 135 | + if( (attr & LIB3270_ATTR_MARKER) && lib3270_get_toggle(session,LIB3270_TOGGLE_VIEW_FIELD) ) |
136 | + { | ||
137 | + double sz = (double) rect->width; | ||
138 | + if(rect->height < rect->width) | ||
139 | + sz = (double) rect->height; | ||
140 | + | ||
141 | + cairo_save(cr); | ||
142 | + | ||
143 | + sz /= 10; | ||
144 | + | ||
145 | + cairo_translate(cr, rect->x + (rect->width / 2), rect->y + (rect->height / 2)); | ||
146 | + cairo_scale(cr, sz, sz); | ||
147 | + cairo_arc(cr, 0., 0., 1., 0., 2 * M_PI); | ||
148 | + | ||
149 | + | ||
150 | + cairo_restore(cr); | ||
151 | + } | ||
152 | + else if(attr & LIB3270_ATTR_CG) | ||
135 | { | 153 | { |
136 | switch(chr) | 154 | switch(chr) |
137 | { | 155 | { |
ui/99debug.xml
@@ -16,8 +16,8 @@ | @@ -16,8 +16,8 @@ | ||
16 | obter mais detalhes. | 16 | obter mais detalhes. |
17 | 17 | ||
18 | Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | 18 | Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este |
19 | - programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
20 | - St, Fifth Floor, Boston, MA 02110-1301 USA | 19 | + programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin |
20 | + St, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | 21 | ||
22 | Contatos: | 22 | Contatos: |
23 | 23 | ||
@@ -40,6 +40,7 @@ | @@ -40,6 +40,7 @@ | ||
40 | <menuitem action='toggle' id='dstrace' label='DS Trace' /> | 40 | <menuitem action='toggle' id='dstrace' label='DS Trace' /> |
41 | <menuitem action='toggle' id='screentrace' label='Screen Trace' /> | 41 | <menuitem action='toggle' id='screentrace' label='Screen Trace' /> |
42 | <menuitem action='toggle' id='eventtrace' label='Event Trace' /> | 42 | <menuitem action='toggle' id='eventtrace' label='Event Trace' /> |
43 | + <menuitem action='toggle' id='fieldattr' label='View Field Delimiters' /> | ||
43 | </menu> | 44 | </menu> |
44 | </menu> | 45 | </menu> |
45 | 46 |