Commit 2347f103755804ac8dea62ab3e16e12d8b9e996b
1 parent
a81f0280
Exists in
master
and in
5 other branches
Alterando macros para suportar multi-sessão
Showing
20 changed files
with
799 additions
and
744 deletions
Show diff stats
pw3270.cbp
... | ... | @@ -55,7 +55,6 @@ |
55 | 55 | <Unit filename="pw3270.nsi.in" /> |
56 | 56 | <Unit filename="pw3270.spec.in" /> |
57 | 57 | <Unit filename="src/include/lib3270.h" /> |
58 | - <Unit filename="src/include/lib3270/3270ds.h" /> | |
59 | 58 | <Unit filename="src/include/lib3270/action_table.h" /> |
60 | 59 | <Unit filename="src/include/lib3270/actions.h" /> |
61 | 60 | <Unit filename="src/include/lib3270/config.h.in" /> |
... | ... | @@ -71,6 +70,7 @@ |
71 | 70 | <Unit filename="src/include/lib3270/v3270.h" /> |
72 | 71 | <Unit filename="src/include/pw3270.h" /> |
73 | 72 | <Unit filename="src/include/rules.mak.in" /> |
73 | + <Unit filename="src/lib3270/3270ds.h" /> | |
74 | 74 | <Unit filename="src/lib3270/Makefile.in" /> |
75 | 75 | <Unit filename="src/lib3270/X11keysym.h" /> |
76 | 76 | <Unit filename="src/lib3270/actionsc.h" /> | ... | ... |
src/include/lib3270/3270ds.h
... | ... | @@ -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 |
... | ... | @@ -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) / hSession->cols) | |
139 | +#define BA_TO_COL(ba) ((ba) % hSession->cols) | |
140 | +#define ROWCOL_TO_BA(r,c) (((r) * hSession->cols) + c) | |
141 | +#define INC_BA(ba) { (ba) = ((ba) + 1) % (hSession->cols * hSession->rows); } | |
142 | +#define DEC_BA(ba) { (ba) = (ba) ? (ba - 1) : ((hSession->cols*hSession->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
... | ... | @@ -1177,7 +1177,7 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) |
1177 | 1177 | ctlr_add(hSession,hSession->cursor_addr, ebc_ch, default_cs); |
1178 | 1178 | #if defined(X3270_DBCS) /*[*/ |
1179 | 1179 | if (default_cs == CS_DBCS) |
1180 | - (void) ctlr_dbcs_postprocess(); | |
1180 | + (void) ctlr_dbcs_postprocess(hSession); | |
1181 | 1181 | #endif /*]*/ |
1182 | 1182 | break; |
1183 | 1183 | } | ... | ... |
src/lib3270/ctlr.c
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | |
41 | 41 | #include "globals.h" |
42 | 42 | #include <errno.h> |
43 | -#include <lib3270/3270ds.h> | |
43 | +#include "3270ds.h" | |
44 | 44 | //#include "appres.h" |
45 | 45 | // #include "ctlr.h" |
46 | 46 | #include "screen.h" |
... | ... | @@ -237,19 +237,19 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) |
237 | 237 | * Set the formatted screen flag. A formatted screen is a screen that |
238 | 238 | * has at least one field somewhere on it. |
239 | 239 | */ |
240 | -static void set_formatted(H3270 *session) | |
240 | +static void set_formatted(H3270 *hSession) | |
241 | 241 | { |
242 | 242 | register int baddr; |
243 | 243 | |
244 | - CHECK_SESSION_HANDLE(session); | |
244 | + CHECK_SESSION_HANDLE(hSession); | |
245 | 245 | |
246 | - session->formatted = False; | |
246 | + hSession->formatted = False; | |
247 | 247 | baddr = 0; |
248 | 248 | do |
249 | 249 | { |
250 | - if(session->ea_buf[baddr].fa) | |
250 | + if(hSession->ea_buf[baddr].fa) | |
251 | 251 | { |
252 | - session->formatted = True; | |
252 | + hSession->formatted = True; | |
253 | 253 | break; |
254 | 254 | } |
255 | 255 | INC_BA(baddr); |
... | ... | @@ -259,53 +259,53 @@ static void set_formatted(H3270 *session) |
259 | 259 | /* |
260 | 260 | * Called when a host is half connected. |
261 | 261 | */ |
262 | -static void ctlr_half_connect(H3270 *session, int ignored unused, void *dunno) | |
262 | +static void ctlr_half_connect(H3270 *hSession, int ignored unused, void *dunno) | |
263 | 263 | { |
264 | - ticking_start(session,True); | |
264 | + ticking_start(hSession,True); | |
265 | 265 | } |
266 | 266 | |
267 | 267 | /* |
268 | 268 | * Called when a host connects, disconnects, or changes ANSI/3270 modes. |
269 | 269 | */ |
270 | -static void ctlr_connect(H3270 *session, int ignored unused, void *dunno) | |
270 | +static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) | |
271 | 271 | { |
272 | - ticking_stop(session); | |
273 | - status_untiming(session); | |
272 | + ticking_stop(hSession); | |
273 | + status_untiming(hSession); | |
274 | 274 | |
275 | - if (session->ever_3270) | |
276 | - session->ea_buf[-1].fa = FA_PRINTABLE | FA_MODIFY; | |
275 | + if (hSession->ever_3270) | |
276 | + hSession->ea_buf[-1].fa = FA_PRINTABLE | FA_MODIFY; | |
277 | 277 | else |
278 | - session->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; | |
279 | - if (!IN_3270 || (IN_SSCP && (session->kybdlock & KL_OIA_TWAIT))) | |
278 | + hSession->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; | |
279 | + if (!IN_3270 || (IN_SSCP && (hSession->kybdlock & KL_OIA_TWAIT))) | |
280 | 280 | { |
281 | - lib3270_kybdlock_clear(session,KL_OIA_TWAIT); | |
282 | - status_reset(session); | |
281 | + lib3270_kybdlock_clear(hSession,KL_OIA_TWAIT); | |
282 | + status_reset(hSession); | |
283 | 283 | } |
284 | 284 | |
285 | - session->default_fg = 0x00; | |
286 | - session->default_bg = 0x00; | |
287 | - session->default_gr = 0x00; | |
288 | - session->default_cs = 0x00; | |
289 | - session->default_ic = 0x00; | |
290 | - session->reply_mode = SF_SRM_FIELD; | |
291 | - session->crm_nattr = 0; | |
285 | + hSession->default_fg = 0x00; | |
286 | + hSession->default_bg = 0x00; | |
287 | + hSession->default_gr = 0x00; | |
288 | + hSession->default_cs = 0x00; | |
289 | + hSession->default_ic = 0x00; | |
290 | + hSession->reply_mode = SF_SRM_FIELD; | |
291 | + hSession->crm_nattr = 0; | |
292 | 292 | } |
293 | 293 | |
294 | 294 | |
295 | 295 | |
296 | -LIB3270_EXPORT int lib3270_field_addr(H3270 *h, int baddr) | |
296 | +LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr) | |
297 | 297 | { |
298 | 298 | int sbaddr; |
299 | 299 | |
300 | - CHECK_SESSION_HANDLE(h); | |
300 | + CHECK_SESSION_HANDLE(hSession); | |
301 | 301 | |
302 | - if (!h->formatted) | |
302 | + if (!hSession->formatted) | |
303 | 303 | return -1; |
304 | 304 | |
305 | 305 | sbaddr = baddr; |
306 | 306 | do |
307 | 307 | { |
308 | - if(h->ea_buf[baddr].fa) | |
308 | + if(hSession->ea_buf[baddr].fa) | |
309 | 309 | return baddr; |
310 | 310 | DEC_BA(baddr); |
311 | 311 | } while (baddr != sbaddr); |
... | ... | @@ -316,23 +316,24 @@ LIB3270_EXPORT int lib3270_field_addr(H3270 *h, int baddr) |
316 | 316 | /* |
317 | 317 | * Get Field width |
318 | 318 | */ |
319 | -int lib3270_field_length(H3270 *h, int baddr) | |
319 | +int lib3270_field_length(H3270 *hSession, int baddr) | |
320 | 320 | { |
321 | 321 | int saddr; |
322 | 322 | int addr; |
323 | 323 | int width = 0; |
324 | 324 | |
325 | - CHECK_SESSION_HANDLE(h); | |
325 | + CHECK_SESSION_HANDLE(hSession); | |
326 | 326 | |
327 | - addr = find_field_attribute(h,baddr); | |
327 | + addr = find_field_attribute(hSession,baddr); | |
328 | 328 | |
329 | 329 | if(addr < 0) |
330 | 330 | return -1; |
331 | 331 | |
332 | 332 | saddr = addr; |
333 | 333 | INC_BA(addr); |
334 | - do { | |
335 | - if(h->ea_buf[addr].fa) | |
334 | + do | |
335 | + { | |
336 | + if(hSession->ea_buf[addr].fa) | |
336 | 337 | return width; |
337 | 338 | INC_BA(addr); |
338 | 339 | width++; |
... | ... | @@ -346,9 +347,9 @@ int lib3270_field_length(H3270 *h, int baddr) |
346 | 347 | * Find the field attribute for the given buffer address. Return its address |
347 | 348 | * rather than its value. |
348 | 349 | */ |
349 | -unsigned char get_field_attribute(H3270 *h, int baddr) | |
350 | +unsigned char get_field_attribute(H3270 *hSession, int baddr) | |
350 | 351 | { |
351 | - return h->ea_buf[find_field_attribute(h,baddr)].fa; | |
352 | + return hSession->ea_buf[find_field_attribute(hSession,baddr)].fa; | |
352 | 353 | } |
353 | 354 | |
354 | 355 | /* |
... | ... | @@ -356,7 +357,7 @@ unsigned char get_field_attribute(H3270 *h, int baddr) |
356 | 357 | * unprotected attribute byte, or 0 if no nonzero-width unprotected field |
357 | 358 | * can be found. |
358 | 359 | */ |
359 | -int next_unprotected(H3270 *session, int baddr0) | |
360 | +int next_unprotected(H3270 *hSession, int baddr0) | |
360 | 361 | { |
361 | 362 | register int baddr, nbaddr; |
362 | 363 | |
... | ... | @@ -365,7 +366,7 @@ int next_unprotected(H3270 *session, int baddr0) |
365 | 366 | { |
366 | 367 | baddr = nbaddr; |
367 | 368 | INC_BA(nbaddr); |
368 | - if(session->ea_buf[baddr].fa &&!FA_IS_PROTECTED(session->ea_buf[baddr].fa) &&!session->ea_buf[nbaddr].fa) | |
369 | + if(hSession->ea_buf[baddr].fa &&!FA_IS_PROTECTED(hSession->ea_buf[baddr].fa) &&!hSession->ea_buf[nbaddr].fa) | |
369 | 370 | return nbaddr; |
370 | 371 | } while (nbaddr != baddr0); |
371 | 372 | |
... | ... | @@ -1267,7 +1268,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1267 | 1268 | trace_ds(hSession,"%s",rcba(hSession,baddr)); |
1268 | 1269 | |
1269 | 1270 | previous = ORDER; |
1270 | - if (baddr >= h3270.cols * h3270.rows) | |
1271 | + if (baddr >= hSession->cols * hSession->rows) | |
1271 | 1272 | { |
1272 | 1273 | ABORT_WRITE("invalid EUA address"); |
1273 | 1274 | } |
... | ... | @@ -1283,16 +1284,15 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1283 | 1284 | } |
1284 | 1285 | do |
1285 | 1286 | { |
1286 | - if (h3270.ea_buf[h3270.buffer_addr].fa) | |
1287 | - current_fa = h3270.ea_buf[h3270.buffer_addr].fa; | |
1287 | + if (hSession->ea_buf[hSession->buffer_addr].fa) | |
1288 | + current_fa = hSession->ea_buf[hSession->buffer_addr].fa; | |
1288 | 1289 | else if (!FA_IS_PROTECTED(current_fa)) |
1289 | 1290 | { |
1290 | - ctlr_add(&h3270,h3270.buffer_addr, EBC_null, | |
1291 | - CS_BASE); | |
1291 | + ctlr_add(hSession,hSession->buffer_addr, EBC_null,CS_BASE); | |
1292 | 1292 | } |
1293 | - INC_BA(h3270.buffer_addr); | |
1294 | - } while (h3270.buffer_addr != baddr); | |
1295 | - current_fa = get_field_attribute(hSession,h3270.buffer_addr); | |
1293 | + INC_BA(hSession->buffer_addr); | |
1294 | + } while (hSession->buffer_addr != baddr); | |
1295 | + current_fa = get_field_attribute(hSession,hSession->buffer_addr); | |
1296 | 1296 | last_cmd = True; |
1297 | 1297 | last_zpt = False; |
1298 | 1298 | break; |
... | ... | @@ -1308,14 +1308,14 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1308 | 1308 | if (*cp) |
1309 | 1309 | trace_ds(hSession,"'"); |
1310 | 1310 | |
1311 | - ctlr_add(hSession,h3270.buffer_addr, *cp, CS_GE); | |
1312 | - ctlr_add_fg(hSession,h3270.buffer_addr, h3270.default_fg); | |
1313 | - ctlr_add_bg(hSession,h3270.buffer_addr, h3270.default_bg); | |
1314 | - ctlr_add_gr(hSession,h3270.buffer_addr, h3270.default_gr); | |
1315 | - ctlr_add_ic(hSession,h3270.buffer_addr, h3270.default_ic); | |
1316 | - INC_BA(h3270.buffer_addr); | |
1311 | + ctlr_add(hSession,hSession->buffer_addr, *cp, CS_GE); | |
1312 | + ctlr_add_fg(hSession,hSession->buffer_addr, hSession->default_fg); | |
1313 | + ctlr_add_bg(hSession,hSession->buffer_addr, hSession->default_bg); | |
1314 | + ctlr_add_gr(hSession,hSession->buffer_addr, hSession->default_gr); | |
1315 | + ctlr_add_ic(hSession,hSession->buffer_addr, hSession->default_ic); | |
1316 | + INC_BA(hSession->buffer_addr); | |
1317 | 1317 | |
1318 | - current_fa = get_field_attribute(hSession,h3270.buffer_addr); | |
1318 | + current_fa = get_field_attribute(hSession,hSession->buffer_addr); | |
1319 | 1319 | last_cmd = False; |
1320 | 1320 | last_zpt = False; |
1321 | 1321 | break; |
... | ... | @@ -1323,11 +1323,11 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1323 | 1323 | case ORDER_MF: /* modify field */ |
1324 | 1324 | END_TEXT("ModifyField"); |
1325 | 1325 | if (previous != SBA) |
1326 | - trace_ds(hSession,"%s",rcba(hSession,h3270.buffer_addr)); | |
1326 | + trace_ds(hSession,"%s",rcba(hSession,hSession->buffer_addr)); | |
1327 | 1327 | previous = ORDER; |
1328 | 1328 | cp++; |
1329 | 1329 | na = *cp; |
1330 | - if (h3270.ea_buf[h3270.buffer_addr].fa) | |
1330 | + if (hSession->ea_buf[hSession->buffer_addr].fa) | |
1331 | 1331 | { |
1332 | 1332 | for (i = 0; i < (int)na; i++) |
1333 | 1333 | { |
... | ... | @@ -1336,8 +1336,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1336 | 1336 | { |
1337 | 1337 | trace_ds(hSession," 3270"); |
1338 | 1338 | cp++; |
1339 | - ctlr_add_fa(hSession,h3270.buffer_addr, *cp, | |
1340 | - h3270.ea_buf[h3270.buffer_addr].cs); | |
1339 | + ctlr_add_fa(hSession,hSession->buffer_addr, *cp,hSession->ea_buf[hSession->buffer_addr].cs); | |
1341 | 1340 | trace_ds(hSession,"%s",see_attr(*cp)); |
1342 | 1341 | } |
1343 | 1342 | else if (*cp == XA_FOREGROUND) |
... | ... | @@ -1456,12 +1455,12 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1456 | 1455 | } |
1457 | 1456 | if (!any_fa) |
1458 | 1457 | START_FIELD(0); |
1459 | - ctlr_add_cs(&h3270,h3270.buffer_addr, efa_cs); | |
1460 | - ctlr_add_fg(&h3270,h3270.buffer_addr, efa_fg); | |
1461 | - ctlr_add_bg(&h3270,h3270.buffer_addr, efa_bg); | |
1462 | - ctlr_add_gr(&h3270,h3270.buffer_addr, efa_gr); | |
1463 | - ctlr_add_ic(&h3270,h3270.buffer_addr, efa_ic); | |
1464 | - INC_BA(h3270.buffer_addr); | |
1458 | + ctlr_add_cs(hSession,h3270.buffer_addr, efa_cs); | |
1459 | + ctlr_add_fg(hSession,h3270.buffer_addr, efa_fg); | |
1460 | + ctlr_add_bg(hSession,h3270.buffer_addr, efa_bg); | |
1461 | + ctlr_add_gr(hSession,h3270.buffer_addr, efa_gr); | |
1462 | + ctlr_add_ic(hSession,h3270.buffer_addr, efa_ic); | |
1463 | + INC_BA(hSession->buffer_addr); | |
1465 | 1464 | last_cmd = True; |
1466 | 1465 | last_zpt = False; |
1467 | 1466 | break; |
... | ... | @@ -1526,12 +1525,12 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1526 | 1525 | if (h3270.default_cs == CS_DBCS || d != DBCS_NONE) { |
1527 | 1526 | ABORT_WRITE("invalid format control order in DBCS field"); |
1528 | 1527 | } |
1529 | - ctlr_add(&h3270,h3270.buffer_addr, *cp, h3270.default_cs); | |
1530 | - ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); | |
1531 | - ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); | |
1532 | - ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); | |
1533 | - ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); | |
1534 | - INC_BA(h3270.buffer_addr); | |
1528 | + ctlr_add(&h3270,hSession->buffer_addr, *cp, hSession->default_cs); | |
1529 | + ctlr_add_fg(&h3270,hSession->buffer_addr, hSession->default_fg); | |
1530 | + ctlr_add_bg(&h3270,hSession->buffer_addr, hSession->default_bg); | |
1531 | + ctlr_add_gr(&h3270,hSession->buffer_addr, hSession->default_gr); | |
1532 | + ctlr_add_ic(&h3270,hSession->buffer_addr, hSession->default_ic); | |
1533 | + INC_BA(hSession->buffer_addr); | |
1535 | 1534 | last_cmd = True; |
1536 | 1535 | last_zpt = False; |
1537 | 1536 | break; |
... | ... | @@ -1555,7 +1554,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1555 | 1554 | ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); |
1556 | 1555 | ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); |
1557 | 1556 | ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); |
1558 | - INC_BA(h3270.buffer_addr); | |
1557 | + INC_BA(hSession->buffer_addr); | |
1559 | 1558 | last_cmd = True; |
1560 | 1559 | last_zpt = False; |
1561 | 1560 | break; |
... | ... | @@ -1594,7 +1593,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1594 | 1593 | ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); |
1595 | 1594 | ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); |
1596 | 1595 | ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); |
1597 | - INC_BA(h3270.buffer_addr); | |
1596 | + INC_BA(hSession->buffer_addr); | |
1598 | 1597 | last_cmd = True; |
1599 | 1598 | last_zpt = False; |
1600 | 1599 | break; |
... | ... | @@ -1646,14 +1645,14 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1646 | 1645 | ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); |
1647 | 1646 | ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); |
1648 | 1647 | ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); |
1649 | - INC_BA(h3270.buffer_addr); | |
1648 | + INC_BA(hSession->buffer_addr); | |
1650 | 1649 | if (add_dbcs) { |
1651 | 1650 | ctlr_add(&h3270,h3270.buffer_addr, add_c2, h3270.default_cs); |
1652 | 1651 | ctlr_add_fg(&h3270,h3270.buffer_addr, h3270.default_fg); |
1653 | 1652 | ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); |
1654 | 1653 | ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); |
1655 | 1654 | ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); |
1656 | - INC_BA(h3270.buffer_addr); | |
1655 | + INC_BA(hSession->buffer_addr); | |
1657 | 1656 | } |
1658 | 1657 | last_cmd = False; |
1659 | 1658 | last_zpt = False; |
... | ... | @@ -1703,7 +1702,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1703 | 1702 | ctlr_add_bg(&h3270,h3270.buffer_addr, h3270.default_bg); |
1704 | 1703 | ctlr_add_gr(&h3270,h3270.buffer_addr, h3270.default_gr); |
1705 | 1704 | ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); |
1706 | - INC_BA(h3270.buffer_addr); | |
1705 | + INC_BA(hSession->buffer_addr); | |
1707 | 1706 | #if defined(X3270_DBCS) /*[*/ |
1708 | 1707 | if (add_dbcs) { |
1709 | 1708 | ctlr_add(h3270.buffer_addr, add_c2, h3270.default_cs); |
... | ... | @@ -1711,7 +1710,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1711 | 1710 | ctlr_add_bg(h3270.buffer_addr, h3270.default_bg); |
1712 | 1711 | ctlr_add_gr(h3270.buffer_addr, h3270.default_gr); |
1713 | 1712 | ctlr_add_ic(&h3270,h3270.buffer_addr, h3270.default_ic); |
1714 | - INC_BA(h3270.buffer_addr); | |
1713 | + INC_BA(hSession->buffer_addr); | |
1715 | 1714 | } |
1716 | 1715 | #endif /*]*/ |
1717 | 1716 | last_cmd = False; |
... | ... | @@ -1733,10 +1732,10 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1733 | 1732 | lib3270_ring_bell(hSession); |
1734 | 1733 | |
1735 | 1734 | /* Set up the DBCS state. */ |
1736 | - if (ctlr_dbcs_postprocess() < 0 && rv == PDS_OKAY_NO_OUTPUT) | |
1735 | + if (ctlr_dbcs_postprocess(hSession) < 0 && rv == PDS_OKAY_NO_OUTPUT) | |
1737 | 1736 | rv = PDS_BAD_ADDR; |
1738 | 1737 | |
1739 | - h3270.trace_primed = 0; | |
1738 | + hSession->trace_primed = 0; | |
1740 | 1739 | |
1741 | 1740 | ps_process(hSession); |
1742 | 1741 | |
... | ... | @@ -1977,16 +1976,14 @@ valid_dbcs_char(unsigned char c1, unsigned char c2) |
1977 | 1976 | * |
1978 | 1977 | * Returns 0 for success, -1 for failure. |
1979 | 1978 | */ |
1980 | -int | |
1981 | -ctlr_dbcs_postprocess(void) | |
1979 | +int ctlr_dbcs_postprocess(H3270 *hSession) | |
1982 | 1980 | { |
1983 | 1981 | int baddr; /* current buffer address */ |
1984 | 1982 | int faddr0; /* address of first field attribute */ |
1985 | 1983 | int faddr; /* address of current field attribute */ |
1986 | 1984 | int last_baddr; /* last buffer address to search */ |
1987 | 1985 | int pbaddr = -1; /* previous buffer address */ |
1988 | - int dbaddr = -1; /* first data position of current DBCS (sub-) | |
1989 | - field */ | |
1986 | + int dbaddr = -1; /* first data position of current DBCS (sub-) field */ | |
1990 | 1987 | Boolean so = False, si = False; |
1991 | 1988 | Boolean dbcs_field = False; |
1992 | 1989 | int rc = 0; |
... | ... | @@ -2032,7 +2029,7 @@ ctlr_dbcs_postprocess(void) |
2032 | 2029 | case EBC_so: |
2033 | 2030 | /* Two SO's or SO in DBCS field are invalid. */ |
2034 | 2031 | if (so || dbcs_field) { |
2035 | - trace_ds(&h3270,"DBCS postprocess: invalid SO found at %s\n", rcba(baddr)); | |
2032 | + trace_ds(hSession,"DBCS postprocess: invalid SO found at %s\n", rcba(baddr)); | |
2036 | 2033 | rc = -1; |
2037 | 2034 | } else { |
2038 | 2035 | dbaddr = baddr; |
... | ... | @@ -2045,7 +2042,7 @@ ctlr_dbcs_postprocess(void) |
2045 | 2042 | case EBC_si: |
2046 | 2043 | /* Two SI's or SI in DBCS field are invalid. */ |
2047 | 2044 | if (si || dbcs_field) { |
2048 | - trace_ds(&h3270,"Postprocess: Invalid SO found at %s\n", rcba(baddr)); | |
2045 | + trace_ds(hSession,"Postprocess: Invalid SO found at %s\n", rcba(baddr)); | |
2049 | 2046 | rc = -1; |
2050 | 2047 | ea_buf[baddr].db = DBCS_NONE; |
2051 | 2048 | } else { |
... | ... | @@ -2058,7 +2055,7 @@ ctlr_dbcs_postprocess(void) |
2058 | 2055 | default: |
2059 | 2056 | /* Non-base CS in DBCS subfield is invalid. */ |
2060 | 2057 | if (so && ea_buf[baddr].cs != CS_BASE) { |
2061 | - trace_ds(&h3270,"DBCS postprocess: invalid character set found at %s\n",rcba(baddr)); | |
2058 | + trace_ds(hSession,"DBCS postprocess: invalid character set found at %s\n",rcba(baddr)); | |
2062 | 2059 | rc = -1; |
2063 | 2060 | ea_buf[baddr].cs = CS_BASE; |
2064 | 2061 | } |
... | ... | @@ -2109,7 +2106,7 @@ ctlr_dbcs_postprocess(void) |
2109 | 2106 | !IS_RIGHT(ea_buf[baddr].db) && |
2110 | 2107 | ea_buf[pbaddr].db != DBCS_DEAD) { |
2111 | 2108 | if (!ea_buf[baddr].fa) { |
2112 | - trace_ds(&h3270,"DBCS postprocess: dead position at %s\n", rcba(pbaddr)); | |
2109 | + trace_ds(hSession,"DBCS postprocess: dead position at %s\n", rcba(pbaddr)); | |
2113 | 2110 | rc = -1; |
2114 | 2111 | } |
2115 | 2112 | ea_buf[pbaddr].cc = EBC_null; | ... | ... |
src/lib3270/ctlrc.h
... | ... | @@ -91,9 +91,9 @@ enum dbcs_why { DBCS_FIELD, DBCS_SUBFIELD, DBCS_ATTRIBUTE }; |
91 | 91 | #if defined(X3270_DBCS) /*[*/ |
92 | 92 | LIB3270_INTERNAL enum dbcs_state ctlr_dbcs_state(int baddr); |
93 | 93 | LIB3270_INTERNAL enum dbcs_state ctlr_lookleft_state(int baddr, enum dbcs_why *why); |
94 | - LIB3270_INTERNAL int ctlr_dbcs_postprocess(void); | |
94 | + LIB3270_INTERNAL int ctlr_dbcs_postprocess(H3270 *hSession); | |
95 | 95 | #else /*][*/ |
96 | 96 | #define ctlr_dbcs_state(b) DBCS_NONE |
97 | 97 | #define ctlr_lookleft_state(b, w) DBCS_NONE |
98 | - #define ctlr_dbcs_postprocess() 0 | |
98 | + #define ctlr_dbcs_postprocess(hSession) 0 | |
99 | 99 | #endif /*]*/ | ... | ... |
src/lib3270/ft_cut.c
... | ... | @@ -41,12 +41,7 @@ |
41 | 41 | |
42 | 42 | #if defined(X3270_FT) /*[*/ |
43 | 43 | |
44 | -// #include <lib3270/api.h> | |
45 | - | |
46 | -//#include "appres.h" | |
47 | -// #include "ctlr.h" | |
48 | -#include <lib3270/3270ds.h> | |
49 | - | |
44 | +#include "3270ds.h" | |
50 | 45 | #include "actionsc.h" |
51 | 46 | #include "ctlrc.h" |
52 | 47 | #include "ft_cutc.h" | ... | ... |
src/lib3270/ft_dft.c
src/lib3270/glue.c
src/lib3270/html.c
src/lib3270/kybd.c
... | ... | @@ -54,7 +54,7 @@ struct ta; |
54 | 54 | // #include <X11/keysym.h> |
55 | 55 | |
56 | 56 | #include <fcntl.h> |
57 | -#include <lib3270/3270ds.h> | |
57 | +#include "3270ds.h" | |
58 | 58 | // #include "appres.h" |
59 | 59 | // #include "ctlr.h" |
60 | 60 | #include "resources.h" |
... | ... | @@ -982,7 +982,7 @@ static Boolean key_Character(H3270 *hSession, int code, Boolean with_ge, Boolean |
982 | 982 | cursor_move(hSession,baddr); |
983 | 983 | } |
984 | 984 | |
985 | - (void) ctlr_dbcs_postprocess(); | |
985 | + (void) ctlr_dbcs_postprocess(hSession); | |
986 | 986 | return True; |
987 | 987 | } |
988 | 988 | |
... | ... | @@ -1367,7 +1367,7 @@ static Boolean do_delete(H3270 *hSession) |
1367 | 1367 | mdt_set(hSession,hSession->cursor_addr); |
1368 | 1368 | |
1369 | 1369 | /* Patch up the DBCS state for display. */ |
1370 | - (void) ctlr_dbcs_postprocess(); | |
1370 | + (void) ctlr_dbcs_postprocess(hSession); | |
1371 | 1371 | return True; |
1372 | 1372 | } |
1373 | 1373 | |
... | ... | @@ -1650,22 +1650,30 @@ static int nu_word(H3270 *hSession, int baddr) |
1650 | 1650 | return -1; |
1651 | 1651 | } |
1652 | 1652 | |
1653 | -/* Find the next word in this field, or -1 */ | |
1654 | -static int | |
1655 | -nt_word(int baddr) | |
1653 | +/** | |
1654 | + * Find the next word in this field | |
1655 | + * | |
1656 | + * @return Next word or -1 | |
1657 | + */ | |
1658 | +static int nt_word(H3270 *hSession, int baddr) | |
1656 | 1659 | { |
1657 | 1660 | int baddr0 = baddr; |
1658 | 1661 | unsigned char c; |
1659 | 1662 | Boolean in_word = True; |
1660 | 1663 | |
1661 | - do { | |
1662 | - c = h3270.ea_buf[baddr].cc; | |
1663 | - if (h3270.ea_buf[baddr].fa) | |
1664 | + do | |
1665 | + { | |
1666 | + c = hSession->ea_buf[baddr].cc; | |
1667 | + | |
1668 | + if (hSession->ea_buf[baddr].fa) | |
1664 | 1669 | return -1; |
1665 | - if (in_word) { | |
1670 | + | |
1671 | + if (in_word) | |
1672 | + { | |
1666 | 1673 | if (c == EBC_space || c == EBC_null) |
1667 | 1674 | in_word = False; |
1668 | - } else { | |
1675 | + } else | |
1676 | + { | |
1669 | 1677 | if (c != EBC_space && c != EBC_null) |
1670 | 1678 | return baddr; |
1671 | 1679 | } |
... | ... | @@ -1707,7 +1715,7 @@ LIB3270_ACTION( nextword ) |
1707 | 1715 | } |
1708 | 1716 | |
1709 | 1717 | /* If there's another word in this field, go to it. */ |
1710 | - baddr = nt_word(hSession->cursor_addr); | |
1718 | + baddr = nt_word(hSession,hSession->cursor_addr); | |
1711 | 1719 | if (baddr != -1) { |
1712 | 1720 | cursor_move(hSession,baddr); |
1713 | 1721 | return 0; |
... | ... | @@ -1985,22 +1993,22 @@ LIB3270_ACTION( eraseeol ) |
1985 | 1993 | return 0; |
1986 | 1994 | #endif /*]*/ |
1987 | 1995 | |
1988 | - baddr = h3270.cursor_addr; | |
1989 | - fa = get_field_attribute(&h3270,baddr); | |
1990 | - if (FA_IS_PROTECTED(fa) || h3270.ea_buf[baddr].fa) | |
1996 | + baddr = hSession->cursor_addr; | |
1997 | + fa = get_field_attribute(hSession,baddr); | |
1998 | + if (FA_IS_PROTECTED(fa) || hSession->ea_buf[baddr].fa) | |
1991 | 1999 | { |
1992 | - operator_error(&h3270,KL_OERR_PROTECTED); | |
2000 | + operator_error(hSession,KL_OERR_PROTECTED); | |
1993 | 2001 | return -1; |
1994 | 2002 | } |
1995 | 2003 | |
1996 | - if (h3270.formatted) | |
2004 | + if (hSession->formatted) | |
1997 | 2005 | { |
1998 | 2006 | /* erase to next field attribute or current line */ |
1999 | 2007 | do |
2000 | 2008 | { |
2001 | - ctlr_add(&h3270,baddr, EBC_null, 0); | |
2009 | + ctlr_add(hSession,baddr, EBC_null, 0); | |
2002 | 2010 | INC_BA(baddr); |
2003 | - } while (!h3270.ea_buf[baddr].fa && BA_TO_COL(baddr) > 0); | |
2011 | + } while (!hSession->ea_buf[baddr].fa && BA_TO_COL(baddr) > 0); | |
2004 | 2012 | |
2005 | 2013 | mdt_set(hSession,hSession->cursor_addr); |
2006 | 2014 | } |
... | ... | @@ -2009,23 +2017,25 @@ LIB3270_ACTION( eraseeol ) |
2009 | 2017 | /* erase to end of current line */ |
2010 | 2018 | do |
2011 | 2019 | { |
2012 | - ctlr_add(&h3270,baddr, EBC_null, 0); | |
2020 | + ctlr_add(hSession,baddr, EBC_null, 0); | |
2013 | 2021 | INC_BA(baddr); |
2014 | 2022 | } while(baddr != 0 && BA_TO_COL(baddr) > 0); |
2015 | 2023 | } |
2016 | 2024 | |
2017 | 2025 | /* If the cursor was in a DBCS subfield, re-create the SI. */ |
2018 | 2026 | d = ctlr_lookleft_state(cursor_addr, &why); |
2019 | - if (IS_DBCS(d) && why == DBCS_SUBFIELD) { | |
2020 | - if (d == DBCS_RIGHT) { | |
2021 | - baddr = h3270.cursor_addr; | |
2027 | + if (IS_DBCS(d) && why == DBCS_SUBFIELD) | |
2028 | + { | |
2029 | + if (d == DBCS_RIGHT) | |
2030 | + { | |
2031 | + baddr = hSession->cursor_addr; | |
2022 | 2032 | DEC_BA(baddr); |
2023 | - h3270.ea_buf[baddr].cc = EBC_si; | |
2033 | + hSession->ea_buf[baddr].cc = EBC_si; | |
2024 | 2034 | } else |
2025 | - h3270.ea_buf[h3270.cursor_addr].cc = EBC_si; | |
2035 | + hSession->ea_buf[hSession->cursor_addr].cc = EBC_si; | |
2026 | 2036 | } |
2027 | - (void) ctlr_dbcs_postprocess(); | |
2028 | - h3270.display(&h3270); | |
2037 | + (void) ctlr_dbcs_postprocess(hSession); | |
2038 | + hSession->display(hSession); | |
2029 | 2039 | return 0; |
2030 | 2040 | } |
2031 | 2041 | |
... | ... | @@ -2079,7 +2089,7 @@ LIB3270_ACTION( eraseeof ) |
2079 | 2089 | } else |
2080 | 2090 | h3270.ea_buf[hSession->cursor_addr].cc = EBC_si; |
2081 | 2091 | } |
2082 | - (void) ctlr_dbcs_postprocess(); | |
2092 | + (void) ctlr_dbcs_postprocess(hSession); | |
2083 | 2093 | hSession->display(hSession); |
2084 | 2094 | return 0; |
2085 | 2095 | } |
... | ... | @@ -2440,7 +2450,7 @@ static Boolean remargin(H3270 *hSession, int lmargin) |
2440 | 2450 | return True; |
2441 | 2451 | } |
2442 | 2452 | |
2443 | -LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int pasting) | |
2453 | +LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int pasting) | |
2444 | 2454 | { |
2445 | 2455 | enum { BASE, BACKSLASH, BACKX, BACKP, BACKPA, BACKPF, OCTAL, HEX, XGE } state = BASE; |
2446 | 2456 | int literal = 0; |
... | ... | @@ -2462,10 +2472,10 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p |
2462 | 2472 | char *ws; |
2463 | 2473 | #endif /*]*/ |
2464 | 2474 | |
2465 | - CHECK_SESSION_HANDLE(session); | |
2475 | + CHECK_SESSION_HANDLE(hSession); | |
2466 | 2476 | |
2467 | - orig_addr = session->cursor_addr; | |
2468 | - orig_col = BA_TO_COL(session->cursor_addr); | |
2477 | + orig_addr = hSession->cursor_addr; | |
2478 | + orig_col = BA_TO_COL(hSession->cursor_addr); | |
2469 | 2479 | |
2470 | 2480 | if(len < 0) |
2471 | 2481 | len = strlen(s); |
... | ... | @@ -2474,12 +2484,14 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p |
2474 | 2484 | * Convert from a multi-byte string to a Unicode string. |
2475 | 2485 | */ |
2476 | 2486 | #if defined(X3270_DBCS) /*[*/ |
2477 | - if (len > w_ibuf_len) { | |
2487 | + if (len > w_ibuf_len) | |
2488 | + { | |
2478 | 2489 | w_ibuf_len = len; |
2479 | 2490 | w_ibuf = (UChar *)Realloc(w_ibuf, w_ibuf_len * sizeof(UChar)); |
2480 | 2491 | } |
2481 | 2492 | len = mb_to_unicode(s, len, w_ibuf, w_ibuf_len, NULL); |
2482 | - if (len < 0) { | |
2493 | + if (len < 0) | |
2494 | + { | |
2483 | 2495 | return 0; /* failed */ |
2484 | 2496 | } |
2485 | 2497 | ws = w_ibuf; |
... | ... | @@ -2491,13 +2503,14 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p |
2491 | 2503 | * In the switch statements below, "break" generally means "consume |
2492 | 2504 | * this character," while "continue" means "rescan this character." |
2493 | 2505 | */ |
2494 | - while (len) { | |
2506 | + while (len) | |
2507 | + { | |
2495 | 2508 | |
2496 | 2509 | /* |
2497 | 2510 | * It isn't possible to unlock the keyboard from a string, |
2498 | 2511 | * so if the keyboard is locked, it's fatal |
2499 | 2512 | */ |
2500 | - if (session->kybdlock) | |
2513 | + if (hSession->kybdlock) | |
2501 | 2514 | { |
2502 | 2515 | trace_event(" keyboard locked, string dropped\n"); |
2503 | 2516 | return 0; |
... | ... | @@ -2506,13 +2519,13 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p |
2506 | 2519 | if (pasting && IN_3270) { |
2507 | 2520 | |
2508 | 2521 | /* Check for cursor wrap to top of screen. */ |
2509 | - if (session->cursor_addr < orig_addr) | |
2522 | + if (hSession->cursor_addr < orig_addr) | |
2510 | 2523 | return len-1; /* wrapped */ |
2511 | 2524 | |
2512 | 2525 | /* Jump cursor over left margin. */ |
2513 | - if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) && | |
2514 | - BA_TO_COL(session->cursor_addr) < orig_col) { | |
2515 | - if (!remargin(&h3270,orig_col)) | |
2526 | + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_MARGINED_PASTE) && BA_TO_COL(hSession->cursor_addr) < orig_col) | |
2527 | + { | |
2528 | + if (!remargin(hSession,orig_col)) | |
2516 | 2529 | return len-1; |
2517 | 2530 | skipped = True; |
2518 | 2531 | } |
... | ... | @@ -2520,59 +2533,73 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p |
2520 | 2533 | |
2521 | 2534 | c = *ws; |
2522 | 2535 | |
2523 | - switch (state) { | |
2536 | + switch (state) | |
2537 | + { | |
2524 | 2538 | case BASE: |
2525 | - switch (c) { | |
2526 | - case '\b': | |
2527 | - lib3270_cursor_left(session); | |
2539 | + switch (c) | |
2540 | + { | |
2541 | + case '\b': | |
2542 | + lib3270_cursor_left(hSession); | |
2528 | 2543 | skipped = False; |
2529 | 2544 | break; |
2530 | - case '\f': | |
2531 | - if (pasting) { | |
2532 | - key_ACharacter(session,(unsigned char) ' ',KT_STD, ia, &skipped); | |
2533 | - } else { | |
2534 | - lib3270_clear(session); | |
2545 | + | |
2546 | + case '\f': | |
2547 | + if (pasting) | |
2548 | + { | |
2549 | + key_ACharacter(hSession,(unsigned char) ' ',KT_STD, ia, &skipped); | |
2550 | + } else | |
2551 | + { | |
2552 | + lib3270_clear(hSession); | |
2535 | 2553 | skipped = False; |
2536 | 2554 | if (IN_3270) |
2537 | 2555 | return len-1; |
2538 | 2556 | } |
2539 | 2557 | break; |
2540 | - case '\n': | |
2541 | - if (pasting) { | |
2558 | + | |
2559 | + case '\n': | |
2560 | + if (pasting) | |
2561 | + { | |
2542 | 2562 | if (!skipped) |
2543 | - lib3270_cursor_newline(session); | |
2544 | -// action_internal(Newline_action,ia, CN, CN); | |
2563 | + lib3270_cursor_newline(hSession); | |
2545 | 2564 | skipped = False; |
2546 | - } else { | |
2547 | - lib3270_enter(session); | |
2565 | + } | |
2566 | + else | |
2567 | + { | |
2568 | + lib3270_enter(hSession); | |
2548 | 2569 | skipped = False; |
2549 | 2570 | if (IN_3270) |
2550 | 2571 | return len-1; |
2551 | 2572 | } |
2552 | 2573 | break; |
2553 | - case '\r': /* ignored */ | |
2574 | + | |
2575 | + case '\r': /* ignored */ | |
2554 | 2576 | break; |
2555 | - case '\t': | |
2556 | - lib3270_nextfield(session); | |
2577 | + | |
2578 | + case '\t': | |
2579 | + lib3270_nextfield(hSession); | |
2557 | 2580 | skipped = False; |
2558 | 2581 | break; |
2559 | - case '\\': /* backslashes are NOT special when | |
2560 | - pasting */ | |
2582 | + | |
2583 | + case '\\': /* backslashes are NOT special when pasting */ | |
2561 | 2584 | if (!pasting) |
2562 | 2585 | state = BACKSLASH; |
2563 | 2586 | else |
2564 | - key_ACharacter(session,(unsigned char) c,KT_STD, ia, &skipped); | |
2587 | + key_ACharacter(hSession,(unsigned char) c,KT_STD, ia, &skipped); | |
2565 | 2588 | break; |
2566 | - case '\033': /* ESC is special only when pasting */ | |
2589 | + | |
2590 | + case '\033': /* ESC is special only when pasting */ | |
2567 | 2591 | if (pasting) |
2568 | 2592 | state = XGE; |
2569 | 2593 | break; |
2570 | - case '[': /* APL left bracket */ | |
2571 | - key_ACharacter(session,(unsigned char) c, KT_STD, ia, &skipped); | |
2594 | + | |
2595 | + case '[': /* APL left bracket */ | |
2596 | + key_ACharacter(hSession,(unsigned char) c, KT_STD, ia, &skipped); | |
2572 | 2597 | break; |
2573 | - case ']': /* APL right bracket */ | |
2574 | - key_ACharacter(session,(unsigned char) c, KT_STD, ia, &skipped); | |
2598 | + | |
2599 | + case ']': /* APL right bracket */ | |
2600 | + key_ACharacter(hSession,(unsigned char) c, KT_STD, ia, &skipped); | |
2575 | 2601 | break; |
2602 | + | |
2576 | 2603 | default: |
2577 | 2604 | /* |
2578 | 2605 | #if defined(X3270_DBCS) |
... | ... | @@ -2593,232 +2620,271 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p |
2593 | 2620 | break; |
2594 | 2621 | } |
2595 | 2622 | #endif */ |
2596 | - key_ACharacter(session,(unsigned char) c, KT_STD, ia, &skipped); | |
2623 | + key_ACharacter(hSession,(unsigned char) c, KT_STD, ia, &skipped); | |
2597 | 2624 | break; |
2598 | 2625 | } |
2599 | 2626 | break; |
2627 | + | |
2600 | 2628 | case BACKSLASH: /* last character was a backslash */ |
2601 | - switch (c) { | |
2602 | - case 'a': | |
2603 | - popup_an_error(session,"%s: Bell not supported",action_name(String_action)); | |
2604 | -// cancel_if_idle_command(); | |
2605 | - state = BASE; | |
2606 | - break; | |
2607 | - case 'b': | |
2608 | - lib3270_cursor_left(session); | |
2609 | -// action_internal(Left_action, ia, CN, CN); | |
2610 | - skipped = False; | |
2611 | - state = BASE; | |
2612 | - break; | |
2613 | - case 'f': | |
2614 | - lib3270_clear(session); | |
2615 | - skipped = False; | |
2616 | - state = BASE; | |
2617 | - if (IN_3270) | |
2618 | - return len-1; | |
2619 | - else | |
2629 | + switch (c) | |
2630 | + { | |
2631 | + case 'a': | |
2632 | + popup_an_error(hSession,_( "%s: Bell not supported" ),action_name(String_action)); | |
2633 | + state = BASE; | |
2620 | 2634 | break; |
2621 | - case 'n': | |
2622 | - lib3270_enter(session); | |
2623 | - skipped = False; | |
2624 | - state = BASE; | |
2625 | - if (IN_3270) | |
2626 | - return len-1; | |
2627 | - else | |
2635 | + | |
2636 | + case 'b': | |
2637 | + lib3270_cursor_left(hSession); | |
2638 | + skipped = False; | |
2639 | + state = BASE; | |
2628 | 2640 | break; |
2629 | - case 'p': | |
2630 | - state = BACKP; | |
2631 | - break; | |
2632 | 2641 | |
2633 | - case 'r': | |
2634 | - lib3270_cursor_newline(session); | |
2635 | -// action_internal(Newline_action, ia, CN, CN); | |
2642 | + case 'f': | |
2643 | + lib3270_clear(hSession); | |
2644 | + skipped = False; | |
2645 | + state = BASE; | |
2646 | + if (IN_3270) | |
2647 | + return len-1; | |
2648 | + else | |
2649 | + break; | |
2650 | + | |
2651 | + case 'n': | |
2652 | + lib3270_enter(hSession); | |
2653 | + skipped = False; | |
2654 | + state = BASE; | |
2655 | + if (IN_3270) | |
2656 | + return len-1; | |
2657 | + else | |
2658 | + break; | |
2659 | + | |
2660 | + case 'p': | |
2661 | + state = BACKP; | |
2662 | + break; | |
2663 | + | |
2664 | + case 'r': | |
2665 | + lib3270_cursor_newline(hSession); | |
2636 | 2666 | skipped = False; |
2637 | 2667 | state = BASE; |
2638 | 2668 | break; |
2639 | 2669 | |
2640 | - case 't': | |
2641 | - lib3270_nextfield(session); | |
2642 | - skipped = False; | |
2643 | - state = BASE; | |
2644 | - break; | |
2645 | - case 'T': | |
2646 | - lib3270_nextfield(session); | |
2647 | - skipped = False; | |
2648 | - state = BASE; | |
2649 | - break; | |
2650 | - case 'v': | |
2651 | - popup_an_error(NULL,"%s: Vertical tab not supported",action_name(String_action)); | |
2652 | -// cancel_if_idle_command(); | |
2653 | - state = BASE; | |
2654 | - break; | |
2655 | - case 'x': | |
2656 | - state = BACKX; | |
2657 | - break; | |
2658 | - case '\\': | |
2659 | - key_ACharacter(session,(unsigned char) c, KT_STD, ia,&skipped); | |
2660 | - state = BASE; | |
2670 | + case 't': | |
2671 | + lib3270_nextfield(hSession); | |
2672 | + skipped = False; | |
2673 | + state = BASE; | |
2674 | + break; | |
2675 | + | |
2676 | + case 'T': | |
2677 | + lib3270_nextfield(hSession); | |
2678 | + skipped = False; | |
2679 | + state = BASE; | |
2680 | + break; | |
2681 | + | |
2682 | + case 'v': | |
2683 | + popup_an_error(hSession,_( "%s: Vertical tab not supported" ),action_name(String_action)); | |
2684 | + state = BASE; | |
2685 | + break; | |
2686 | + | |
2687 | + case 'x': | |
2688 | + state = BACKX; | |
2689 | + break; | |
2690 | + | |
2691 | + case '\\': | |
2692 | + key_ACharacter(hSession,(unsigned char) c, KT_STD, ia,&skipped); | |
2693 | + state = BASE; | |
2694 | + break; | |
2695 | + | |
2696 | + case '0': | |
2697 | + case '1': | |
2698 | + case '2': | |
2699 | + case '3': | |
2700 | + case '4': | |
2701 | + case '5': | |
2702 | + case '6': | |
2703 | + case '7': | |
2704 | + state = OCTAL; | |
2705 | + literal = 0; | |
2706 | + nc = 0; | |
2707 | + continue; | |
2708 | + | |
2709 | + default: | |
2710 | + state = BASE; | |
2711 | + continue; | |
2712 | + } | |
2661 | 2713 | break; |
2662 | - case '0': | |
2663 | - case '1': | |
2664 | - case '2': | |
2665 | - case '3': | |
2666 | - case '4': | |
2667 | - case '5': | |
2668 | - case '6': | |
2669 | - case '7': | |
2670 | - state = OCTAL; | |
2671 | - literal = 0; | |
2672 | - nc = 0; | |
2673 | - continue; | |
2674 | - default: | |
2675 | - state = BASE; | |
2676 | - continue; | |
2677 | - } | |
2678 | - break; | |
2714 | + | |
2679 | 2715 | case BACKP: /* last two characters were "\p" */ |
2680 | - switch (c) { | |
2681 | - case 'a': | |
2682 | - literal = 0; | |
2683 | - nc = 0; | |
2684 | - state = BACKPA; | |
2685 | - break; | |
2686 | - case 'f': | |
2687 | - literal = 0; | |
2688 | - nc = 0; | |
2689 | - state = BACKPF; | |
2690 | - break; | |
2691 | - default: | |
2692 | - popup_an_error(NULL,"%s: Unknown character after \\p", | |
2693 | - action_name(String_action)); | |
2694 | -// cancel_if_idle_command(); | |
2695 | - state = BASE; | |
2716 | + switch (c) | |
2717 | + { | |
2718 | + case 'a': | |
2719 | + literal = 0; | |
2720 | + nc = 0; | |
2721 | + state = BACKPA; | |
2722 | + break; | |
2723 | + | |
2724 | + case 'f': | |
2725 | + literal = 0; | |
2726 | + nc = 0; | |
2727 | + state = BACKPF; | |
2728 | + break; | |
2729 | + | |
2730 | + default: | |
2731 | + popup_an_error(hSession,_( "%s: Unknown character after \\p" ),action_name(String_action)); | |
2732 | + state = BASE; | |
2733 | + break; | |
2734 | + } | |
2696 | 2735 | break; |
2697 | - } | |
2698 | - break; | |
2736 | + | |
2699 | 2737 | case BACKPF: /* last three characters were "\pf" */ |
2700 | - if (nc < 2 && isdigit(c)) { | |
2701 | - literal = (literal * 10) + (c - '0'); | |
2702 | - nc++; | |
2703 | - } else if (!nc) { | |
2704 | - popup_an_error(NULL,"%s: Unknown character after \\pf", | |
2705 | - action_name(String_action)); | |
2706 | -// cancel_if_idle_command(); | |
2707 | - state = BASE; | |
2708 | - } else { | |
2709 | - do_pf(literal); | |
2710 | - skipped = False; | |
2711 | - if (IN_3270) | |
2712 | - return len-1; | |
2713 | - state = BASE; | |
2714 | - continue; | |
2715 | - } | |
2716 | - break; | |
2738 | + if (nc < 2 && isdigit(c)) | |
2739 | + { | |
2740 | + literal = (literal * 10) + (c - '0'); | |
2741 | + nc++; | |
2742 | + } | |
2743 | + else if (!nc) | |
2744 | + { | |
2745 | + popup_an_error(hSession,_( "%s: Unknown character after \\pf" ),action_name(String_action)); | |
2746 | + state = BASE; | |
2747 | + } | |
2748 | + else | |
2749 | + { | |
2750 | + do_pf(literal); | |
2751 | + skipped = False; | |
2752 | + if (IN_3270) | |
2753 | + return len-1; | |
2754 | + state = BASE; | |
2755 | + continue; | |
2756 | + } | |
2757 | + break; | |
2758 | + | |
2717 | 2759 | case BACKPA: /* last three characters were "\pa" */ |
2718 | - if (nc < 1 && isdigit(c)) { | |
2719 | - literal = (literal * 10) + (c - '0'); | |
2720 | - nc++; | |
2721 | - } else if (!nc) { | |
2722 | - popup_an_error(NULL,"%s: Unknown character after \\pa", | |
2723 | - action_name(String_action)); | |
2724 | -// cancel_if_idle_command(); | |
2725 | - state = BASE; | |
2726 | - } else { | |
2727 | - do_pa(literal); | |
2728 | - skipped = False; | |
2729 | - if (IN_3270) | |
2730 | - return len-1; | |
2731 | - state = BASE; | |
2732 | - continue; | |
2733 | - } | |
2734 | - break; | |
2760 | + if (nc < 1 && isdigit(c)) | |
2761 | + { | |
2762 | + literal = (literal * 10) + (c - '0'); | |
2763 | + nc++; | |
2764 | + } | |
2765 | + else if (!nc) | |
2766 | + { | |
2767 | + popup_an_error(hSession,_( "%s: Unknown character after \\pa" ),action_name(String_action)); | |
2768 | + state = BASE; | |
2769 | + } | |
2770 | + else | |
2771 | + { | |
2772 | + do_pa(literal); | |
2773 | + skipped = False; | |
2774 | + if (IN_3270) | |
2775 | + return len-1; | |
2776 | + state = BASE; | |
2777 | + continue; | |
2778 | + } | |
2779 | + break; | |
2780 | + | |
2735 | 2781 | case BACKX: /* last two characters were "\x" */ |
2736 | - if (isxdigit(c)) { | |
2737 | - state = HEX; | |
2738 | - literal = 0; | |
2739 | - nc = 0; | |
2740 | - continue; | |
2741 | - } else { | |
2742 | - popup_an_error(session,_( "%s: Missing hex digits after \\x" ),action_name(String_action)); | |
2743 | -// cancel_if_idle_command(); | |
2744 | - state = BASE; | |
2782 | + if (isxdigit(c)) | |
2783 | + { | |
2784 | + state = HEX; | |
2785 | + literal = 0; | |
2786 | + nc = 0; | |
2787 | + continue; | |
2788 | + } | |
2789 | + else | |
2790 | + { | |
2791 | + popup_an_error(hSession,_( "%s: Missing hex digits after \\x" ),action_name(String_action)); | |
2792 | + state = BASE; | |
2793 | + continue; | |
2794 | + } | |
2745 | 2795 | continue; |
2746 | - } | |
2796 | + | |
2747 | 2797 | case OCTAL: /* have seen \ and one or more octal digits */ |
2748 | - if (nc < 3 && isdigit(c) && c < '8') { | |
2749 | - literal = (literal * 8) + FROM_HEX(c); | |
2750 | - nc++; | |
2751 | - break; | |
2752 | - } else { | |
2753 | - key_ACharacter(session,(unsigned char) literal, KT_STD,ia, &skipped); | |
2754 | - state = BASE; | |
2755 | - continue; | |
2756 | - } | |
2798 | + if (nc < 3 && isdigit(c) && c < '8') | |
2799 | + { | |
2800 | + literal = (literal * 8) + FROM_HEX(c); | |
2801 | + nc++; | |
2802 | + break; | |
2803 | + } | |
2804 | + else | |
2805 | + { | |
2806 | + key_ACharacter(hSession,(unsigned char) literal, KT_STD,ia, &skipped); | |
2807 | + state = BASE; | |
2808 | + continue; | |
2809 | + } | |
2810 | + | |
2757 | 2811 | case HEX: /* have seen \ and one or more hex digits */ |
2758 | - if (nc < 2 && isxdigit(c)) { | |
2759 | - literal = (literal * 16) + FROM_HEX(c); | |
2760 | - nc++; | |
2761 | - break; | |
2762 | - } else { | |
2763 | - key_ACharacter(session,(unsigned char) literal, KT_STD, ia, &skipped); | |
2764 | - state = BASE; | |
2765 | - continue; | |
2766 | - } | |
2812 | + if (nc < 2 && isxdigit(c)) | |
2813 | + { | |
2814 | + literal = (literal * 16) + FROM_HEX(c); | |
2815 | + nc++; | |
2816 | + break; | |
2817 | + } | |
2818 | + else | |
2819 | + { | |
2820 | + key_ACharacter(hSession,(unsigned char) literal, KT_STD, ia, &skipped); | |
2821 | + state = BASE; | |
2822 | + continue; | |
2823 | + } | |
2824 | + | |
2767 | 2825 | case XGE: /* have seen ESC */ |
2768 | - switch (c) { | |
2769 | - case ';': /* FM */ | |
2770 | - key_Character(session, EBC_fm, False, True, &skipped); | |
2771 | - break; | |
2772 | - case '*': /* DUP */ | |
2773 | - key_Character(session, EBC_dup, False, True, &skipped); | |
2774 | - break; | |
2775 | - default: | |
2776 | - key_ACharacter(session,(unsigned char) c, KT_GE, ia,&skipped); | |
2826 | + switch (c) | |
2827 | + { | |
2828 | + case ';': /* FM */ | |
2829 | + key_Character(hSession, EBC_fm, False, True, &skipped); | |
2830 | + break; | |
2831 | + | |
2832 | + case '*': /* DUP */ | |
2833 | + key_Character(hSession, EBC_dup, False, True, &skipped); | |
2834 | + break; | |
2835 | + | |
2836 | + default: | |
2837 | + key_ACharacter(hSession,(unsigned char) c, KT_GE, ia,&skipped); | |
2838 | + break; | |
2839 | + } | |
2840 | + state = BASE; | |
2777 | 2841 | break; |
2778 | - } | |
2779 | - state = BASE; | |
2780 | - break; | |
2781 | 2842 | } |
2782 | 2843 | ws++; |
2783 | 2844 | len--; |
2784 | 2845 | } |
2785 | 2846 | |
2786 | - switch (state) { | |
2847 | + switch (state) | |
2848 | + { | |
2787 | 2849 | case BASE: |
2788 | - if (lib3270_get_toggle(session,LIB3270_TOGGLE_MARGINED_PASTE) && | |
2789 | - BA_TO_COL(session->cursor_addr) < orig_col) { | |
2790 | - (void) remargin(session,orig_col); | |
2791 | - } | |
2792 | - break; | |
2850 | + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_MARGINED_PASTE) && BA_TO_COL(hSession->cursor_addr) < orig_col) | |
2851 | + { | |
2852 | + (void) remargin(hSession,orig_col); | |
2853 | + } | |
2854 | + break; | |
2855 | + | |
2793 | 2856 | case OCTAL: |
2794 | 2857 | case HEX: |
2795 | - key_ACharacter(session,(unsigned char) literal, KT_STD, ia, &skipped); | |
2796 | - state = BASE; | |
2797 | - if (lib3270_get_toggle(session,LIB3270_TOGGLE_MARGINED_PASTE) && | |
2798 | - BA_TO_COL(session->cursor_addr) < orig_col) { | |
2799 | - (void) remargin(session,orig_col); | |
2800 | - } | |
2801 | - break; | |
2802 | - case BACKPF: | |
2803 | - if (nc > 0) { | |
2804 | - do_pf(literal); | |
2858 | + key_ACharacter(hSession,(unsigned char) literal, KT_STD, ia, &skipped); | |
2805 | 2859 | state = BASE; |
2806 | - } | |
2807 | - break; | |
2860 | + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_MARGINED_PASTE) && BA_TO_COL(hSession->cursor_addr) < orig_col) | |
2861 | + { | |
2862 | + (void) remargin(hSession,orig_col); | |
2863 | + } | |
2864 | + break; | |
2865 | + | |
2866 | + case BACKPF: | |
2867 | + if (nc > 0) | |
2868 | + { | |
2869 | + do_pf(literal); | |
2870 | + state = BASE; | |
2871 | + } | |
2872 | + break; | |
2873 | + | |
2808 | 2874 | case BACKPA: |
2809 | - if (nc > 0) { | |
2810 | - do_pa(literal); | |
2811 | - state = BASE; | |
2812 | - } | |
2813 | - break; | |
2875 | + if (nc > 0) | |
2876 | + { | |
2877 | + do_pa(literal); | |
2878 | + state = BASE; | |
2879 | + } | |
2880 | + break; | |
2881 | + | |
2814 | 2882 | default: |
2815 | - popup_an_error(NULL,"%s: Missing data after \\", | |
2816 | - action_name(String_action)); | |
2817 | -// cancel_if_idle_command(); | |
2818 | - break; | |
2883 | + popup_an_error(hSession,"%s: Missing data after \\",action_name(String_action)); | |
2884 | + break; | |
2819 | 2885 | } |
2820 | 2886 | |
2821 | - session->display(session); | |
2887 | + hSession->display(hSession); | |
2822 | 2888 | return len; |
2823 | 2889 | } |
2824 | 2890 | ... | ... |
src/lib3270/paste.c
... | ... | @@ -46,8 +46,7 @@ |
46 | 46 | |
47 | 47 | #include <fcntl.h> |
48 | 48 | |
49 | -#include <lib3270/3270ds.h> | |
50 | -//#include "appres.h" | |
49 | +#include "3270ds.h" | |
51 | 50 | #include "resources.h" |
52 | 51 | |
53 | 52 | #include "actionsc.h" |
... | ... | @@ -99,16 +98,16 @@ |
99 | 98 | * Move the cursor back within the legal paste area. |
100 | 99 | * Returns a Boolean indicating success. |
101 | 100 | */ |
102 | - static int remargin(H3270 *session, int lmargin) | |
101 | + static int remargin(H3270 *hSession, int lmargin) | |
103 | 102 | { |
104 | 103 | int ever = False; |
105 | 104 | int baddr, b0 = 0; |
106 | 105 | int faddr; |
107 | 106 | unsigned char fa; |
108 | 107 | |
109 | - if(lib3270_get_toggle(session,LIB3270_TOGGLE_MARGINED_PASTE)) | |
108 | + if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_MARGINED_PASTE)) | |
110 | 109 | { |
111 | - baddr = session->cursor_addr; | |
110 | + baddr = hSession->cursor_addr; | |
112 | 111 | while(BA_TO_COL(baddr) < lmargin) |
113 | 112 | { |
114 | 113 | baddr = ROWCOL_TO_BA(BA_TO_ROW(baddr), lmargin); |
... | ... | @@ -118,46 +117,46 @@ |
118 | 117 | ever = True; |
119 | 118 | } |
120 | 119 | |
121 | - faddr = find_field_attribute(session,baddr); | |
122 | - fa = session->ea_buf[faddr].fa; | |
120 | + faddr = find_field_attribute(hSession,baddr); | |
121 | + fa = hSession->ea_buf[faddr].fa; | |
123 | 122 | if (faddr == baddr || FA_IS_PROTECTED(fa)) |
124 | 123 | { |
125 | - baddr = next_unprotected(session,baddr); | |
124 | + baddr = next_unprotected(hSession,baddr); | |
126 | 125 | if (baddr <= b0) |
127 | 126 | return 0; |
128 | 127 | } |
129 | 128 | |
130 | 129 | } |
131 | - cursor_move(session,baddr); | |
130 | + cursor_move(hSession,baddr); | |
132 | 131 | } |
133 | 132 | |
134 | 133 | return -1; |
135 | 134 | } |
136 | 135 | |
137 | - static int paste_char(H3270 *session, PASTE_DATA *data, unsigned char c) | |
136 | + static int paste_char(H3270 *hSession, PASTE_DATA *data, unsigned char c) | |
138 | 137 | { |
139 | 138 | |
140 | - if(lib3270_get_toggle(session,LIB3270_TOGGLE_SMART_PASTE)) | |
139 | + if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SMART_PASTE)) | |
141 | 140 | { |
142 | - int faddr = find_field_attribute(session,session->cursor_addr); | |
143 | - if(FA_IS_PROTECTED(session->ea_buf[faddr].fa)) | |
144 | - session->cursor_addr++; | |
141 | + int faddr = find_field_attribute(hSession,hSession->cursor_addr); | |
142 | + if(FA_IS_PROTECTED(hSession->ea_buf[faddr].fa)) | |
143 | + hSession->cursor_addr++; | |
145 | 144 | else |
146 | - key_ACharacter(session, c, KT_STD, IA_PASTE, NULL); | |
145 | + key_ACharacter(hSession, c, KT_STD, IA_PASTE, NULL); | |
147 | 146 | } |
148 | 147 | else |
149 | 148 | { |
150 | - key_ACharacter(session, c, KT_STD, IA_PASTE, NULL); | |
149 | + key_ACharacter(hSession, c, KT_STD, IA_PASTE, NULL); | |
151 | 150 | } |
152 | 151 | |
153 | 152 | data->qtd++; |
154 | 153 | |
155 | - if(BA_TO_ROW(session->cursor_addr) != data->row) | |
154 | + if(BA_TO_ROW(hSession->cursor_addr) != data->row) | |
156 | 155 | { |
157 | - trace("Row changed from %d to %d",data->row,BA_TO_ROW(session->cursor_addr)); | |
158 | - if(!remargin(session,data->orig_col)) | |
156 | + trace("Row changed from %d to %d",data->row,BA_TO_ROW(hSession->cursor_addr)); | |
157 | + if(!remargin(hSession,data->orig_col)) | |
159 | 158 | return 0; |
160 | - data->row = BA_TO_ROW(session->cursor_addr); | |
159 | + data->row = BA_TO_ROW(hSession->cursor_addr); | |
161 | 160 | return '\n'; |
162 | 161 | } |
163 | 162 | |
... | ... | @@ -167,35 +166,35 @@ |
167 | 166 | /** |
168 | 167 | * Set string at cursor position. |
169 | 168 | * |
170 | - * @param h Session handle. | |
171 | - * @param str String to set | |
169 | + * @param hSession Session handle. | |
170 | + * @param str String to set | |
172 | 171 | * |
173 | 172 | * @return Number of characters inserted; <0 in case of error. |
174 | 173 | * |
175 | 174 | */ |
176 | -LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | |
175 | +LIB3270_EXPORT int lib3270_set_string(H3270 *hSession, const unsigned char *str) | |
177 | 176 | { |
178 | 177 | PASTE_DATA data; |
179 | 178 | unsigned char last = 1; |
180 | 179 | |
181 | - CHECK_SESSION_HANDLE(h); | |
180 | + CHECK_SESSION_HANDLE(hSession); | |
182 | 181 | |
183 | 182 | memset(&data,0,sizeof(data)); |
184 | - data.row = BA_TO_ROW(h->cursor_addr); | |
185 | - data.orig_addr = h->cursor_addr; | |
186 | - data.orig_col = BA_TO_COL(h->cursor_addr); | |
183 | + data.row = BA_TO_ROW(hSession->cursor_addr); | |
184 | + data.orig_addr = hSession->cursor_addr; | |
185 | + data.orig_col = BA_TO_COL(hSession->cursor_addr); | |
187 | 186 | |
188 | - if(h->kybdlock) | |
187 | + if(hSession->kybdlock) | |
189 | 188 | return -EINVAL; |
190 | 189 | |
191 | - h->suspend(h); | |
190 | + hSession->suspend(hSession); | |
192 | 191 | |
193 | - while(*str && last && !h->kybdlock && h->cursor_addr >= data.orig_addr) | |
192 | + while(*str && last && !hSession->kybdlock && hSession->cursor_addr >= data.orig_addr) | |
194 | 193 | { |
195 | 194 | switch(*str) |
196 | 195 | { |
197 | 196 | case '\t': |
198 | - last = paste_char(h,&data, ' '); | |
197 | + last = paste_char(hSession,&data, ' '); | |
199 | 198 | break; |
200 | 199 | |
201 | 200 | case '\n': |
... | ... | @@ -205,37 +204,37 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) |
205 | 204 | int faddr; |
206 | 205 | unsigned char fa; |
207 | 206 | |
208 | - baddr = (h->cursor_addr + h->cols) % (h->cols * h->rows); /* down */ | |
209 | - baddr = (baddr / h->cols) * h->cols; /* 1st col */ | |
210 | - faddr = find_field_attribute(h,baddr); | |
211 | - fa = h->ea_buf[faddr].fa; | |
207 | + baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); /* down */ | |
208 | + baddr = (baddr / hSession->cols) * hSession->cols; /* 1st col */ | |
209 | + faddr = find_field_attribute(hSession,baddr); | |
210 | + fa = hSession->ea_buf[faddr].fa; | |
212 | 211 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) |
213 | - cursor_move(h,baddr); | |
212 | + cursor_move(hSession,baddr); | |
214 | 213 | else |
215 | - cursor_move(h,next_unprotected(h,baddr)); | |
216 | - data.row = BA_TO_ROW(h->cursor_addr); | |
214 | + cursor_move(hSession,next_unprotected(hSession,baddr)); | |
215 | + data.row = BA_TO_ROW(hSession->cursor_addr); | |
217 | 216 | } |
218 | 217 | last = ' '; |
219 | 218 | data.qtd++; |
220 | 219 | break; |
221 | 220 | |
222 | 221 | default: |
223 | - last = paste_char(h,&data, *str); | |
222 | + last = paste_char(hSession,&data, *str); | |
224 | 223 | |
225 | 224 | } |
226 | 225 | str++; |
227 | 226 | |
228 | - if(IN_3270 && lib3270_get_toggle(h,LIB3270_TOGGLE_MARGINED_PASTE) && BA_TO_COL(h->cursor_addr) < data.orig_col) | |
227 | + if(IN_3270 && lib3270_get_toggle(hSession,LIB3270_TOGGLE_MARGINED_PASTE) && BA_TO_COL(hSession->cursor_addr) < data.orig_col) | |
229 | 228 | { |
230 | - if(!remargin(h,data.orig_col)) | |
229 | + if(!remargin(hSession,data.orig_col)) | |
231 | 230 | last = 0; |
232 | 231 | } |
233 | 232 | |
234 | - if(h->cursor_addr == data.orig_addr) | |
233 | + if(hSession->cursor_addr == data.orig_addr) | |
235 | 234 | break; |
236 | 235 | } |
237 | 236 | |
238 | - h->resume(h); | |
237 | + hSession->resume(hSession); | |
239 | 238 | |
240 | 239 | return data.qtd; |
241 | 240 | } | ... | ... |
src/lib3270/proxy.c
src/lib3270/rpq.c
src/lib3270/screen.c
src/lib3270/see.c
src/lib3270/session.c
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 | #include "ctlrc.h" |
44 | 44 | #include "ftc.h" |
45 | 45 | #include "kybdc.h" |
46 | -#include <lib3270/3270ds.h> | |
46 | +#include "3270ds.h" | |
47 | 47 | |
48 | 48 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
49 | 49 | ... | ... |
src/lib3270/sf.c
src/lib3270/telnet.c
... | ... | @@ -81,7 +81,7 @@ |
81 | 81 | // #include <stdarg.h> |
82 | 82 | |
83 | 83 | #include "tn3270e.h" |
84 | -#include <lib3270/3270ds.h> | |
84 | +#include "3270ds.h" | |
85 | 85 | |
86 | 86 | // #include "appres.h" |
87 | 87 | |
... | ... | @@ -1001,7 +1001,7 @@ LIB3270_EXPORT void lib3270_data_recv(H3270 *hSession, size_t nr, const unsigned |
1001 | 1001 | { |
1002 | 1002 | if(telnet_fsm(hSession,*cp)) |
1003 | 1003 | { |
1004 | - (void) ctlr_dbcs_postprocess(); | |
1004 | + (void) ctlr_dbcs_postprocess(hSession); | |
1005 | 1005 | host_disconnect(hSession,True); |
1006 | 1006 | return; |
1007 | 1007 | } |
... | ... | @@ -1010,7 +1010,7 @@ LIB3270_EXPORT void lib3270_data_recv(H3270 *hSession, size_t nr, const unsigned |
1010 | 1010 | #if defined(X3270_ANSI) |
1011 | 1011 | if (IN_ANSI) |
1012 | 1012 | { |
1013 | - (void) ctlr_dbcs_postprocess(); | |
1013 | + (void) ctlr_dbcs_postprocess(hSession); | |
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | if (hSession->ansi_data) |
... | ... | @@ -1135,7 +1135,7 @@ void net_input(H3270 *session) |
1135 | 1135 | { |
1136 | 1136 | if (telnet_fsm(session,*cp)) |
1137 | 1137 | { |
1138 | - (void) ctlr_dbcs_postprocess(); | |
1138 | + (void) ctlr_dbcs_postprocess(hSession); | |
1139 | 1139 | host_disconnect(session,True); |
1140 | 1140 | return; |
1141 | 1141 | } |
... | ... | @@ -1144,7 +1144,7 @@ void net_input(H3270 *session) |
1144 | 1144 | #if defined(X3270_ANSI) |
1145 | 1145 | if (IN_ANSI) |
1146 | 1146 | { |
1147 | - (void) ctlr_dbcs_postprocess(); | |
1147 | + (void) ctlr_dbcs_postprocess(hSession); | |
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | if (session->ansi_data) | ... | ... |
src/lib3270/trace_ds.c