Commit 4b5c614f3cb43259d4299f083c1c101aea8b4f7e
1 parent
45c502d8
Exists in
master
and in
5 other branches
Movendo campos estaticos do ansi.c para a estrutura de sessão
Showing
4 changed files
with
402 additions
and
317 deletions
Show diff stats
src/include/lib3270/session.h
@@ -73,6 +73,8 @@ | @@ -73,6 +73,8 @@ | ||
73 | #define LIB3270_TA void | 73 | #define LIB3270_TA void |
74 | #endif // !LIB3270_TA | 74 | #endif // !LIB3270_TA |
75 | 75 | ||
76 | + #define LIB3270_MB_MAX 16 | ||
77 | + | ||
76 | struct _h3270 | 78 | struct _h3270 |
77 | { | 79 | { |
78 | unsigned short sz; /**< Struct size */ | 80 | unsigned short sz; /**< Struct size */ |
@@ -291,6 +293,55 @@ | @@ -291,6 +293,55 @@ | ||
291 | int saved_wide_mode : 1; | 293 | int saved_wide_mode : 1; |
292 | 294 | ||
293 | int saved_altbuffer : 1; | 295 | int saved_altbuffer : 1; |
296 | + int ansi_reset : 1; /**< Non zero if the ansi_reset() was called in this session */ | ||
297 | + | ||
298 | + int ansi_ch; | ||
299 | + int cs_to_change; | ||
300 | + | ||
301 | + /** ANSI Character sets. */ | ||
302 | + enum lib3270_ansi_cs | ||
303 | + { | ||
304 | + LIB3270_ANSI_CS_G0 = 0, | ||
305 | + LIB3270_ANSI_CS_G1 = 1, | ||
306 | + LIB3270_ANSI_CS_G2 = 2, | ||
307 | + LIB3270_ANSI_CS_G3 = 3 | ||
308 | + } cset; | ||
309 | + enum lib3270_ansi_cs saved_cset; | ||
310 | + | ||
311 | + /** Character set designations. */ | ||
312 | + enum lib3270_ansi_csd | ||
313 | + { | ||
314 | + LIB3270_ANSI_CSD_LD = 0, | ||
315 | + LIB3270_ANSI_CSD_UK = 1, | ||
316 | + LIB3270_ANSI_CSD_US = 2 | ||
317 | + } csd[4]; | ||
318 | + enum lib3270_ansi_csd saved_csd[4]; | ||
319 | + | ||
320 | + enum lib3270_ansi_state | ||
321 | + { | ||
322 | + LIB3270_ANSI_STATE_DATA = 0, | ||
323 | + LIB3270_ANSI_STATE_ESC = 1, | ||
324 | + LIB3270_ANSI_STATE_CSDES = 2, | ||
325 | + LIB3270_ANSI_STATE_N1 = 3, | ||
326 | + LIB3270_ANSI_STATE_DECP = 4, | ||
327 | + LIB3270_ANSI_STATE_TEXT = 5, | ||
328 | + LIB3270_ANSI_STATE_TEXT2 = 6, | ||
329 | + LIB3270_ANSI_STATE_MBPEND = 7 | ||
330 | + } state; | ||
331 | + | ||
332 | + unsigned char * tabs; | ||
333 | + | ||
334 | + int pmi; | ||
335 | + char pending_mbs[LIB3270_MB_MAX]; | ||
336 | + | ||
337 | + unsigned char gr; | ||
338 | + unsigned char saved_gr; | ||
339 | + | ||
340 | + unsigned char fg; | ||
341 | + unsigned char saved_fg; | ||
342 | + | ||
343 | + unsigned char bg; | ||
344 | + unsigned char saved_bg; | ||
294 | 345 | ||
295 | // xio | 346 | // xio |
296 | void * ns_read_id; | 347 | void * ns_read_id; |
@@ -315,6 +366,7 @@ | @@ -315,6 +366,7 @@ | ||
315 | void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor); | 366 | void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor); |
316 | void (*changed)(H3270 *session, int offset, int len); | 367 | void (*changed)(H3270 *session, int offset, int len); |
317 | void (*display)(H3270 *session); | 368 | void (*display)(H3270 *session); |
369 | + void (*set_width)(H3270 *session, int width); | ||
318 | 370 | ||
319 | void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); | 371 | void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); |
320 | void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on); | 372 | void (*update_oia)(H3270 *session, LIB3270_FLAG id, unsigned char on); |
src/lib3270/ansi.c
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin |
19 | * St, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * St, Fifth Floor, Boston, MA 02110-1301 USA |
20 | * | 20 | * |
21 | - * Este programa está nomeado como ansi.c e possui 1902 linhas de código. | 21 | + * Este programa está nomeado como ansi.c e possui - linhas de código. |
22 | * | 22 | * |
23 | * Contatos: | 23 | * Contatos: |
24 | * | 24 | * |
@@ -26,7 +26,6 @@ | @@ -26,7 +26,6 @@ | ||
26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | 26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) |
27 | * licinio@bb.com.br (Licínio Luis Branco) | 27 | * licinio@bb.com.br (Licínio Luis Branco) |
28 | * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | 28 | * kraucer@bb.com.br (Kraucer Fernandes Mazuco) |
29 | - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | ||
30 | * | 29 | * |
31 | */ | 30 | */ |
32 | 31 | ||
@@ -62,7 +61,7 @@ | @@ -62,7 +61,7 @@ | ||
62 | #include "widec.h" | 61 | #include "widec.h" |
63 | #endif /*]*/ | 62 | #endif /*]*/ |
64 | 63 | ||
65 | -#define MB_MAX 16 | 64 | +#define MB_MAX LIB3270_MB_MAX |
66 | 65 | ||
67 | #define SC 1 /* save cursor position */ | 66 | #define SC 1 /* save cursor position */ |
68 | #define RC 2 /* restore cursor position */ | 67 | #define RC 2 /* restore cursor position */ |
@@ -120,70 +119,73 @@ | @@ -120,70 +119,73 @@ | ||
120 | #define S3 54 /* select G3 for next character */ | 119 | #define S3 54 /* select G3 for next character */ |
121 | #define MB 55 /* process multi-byte character */ | 120 | #define MB 55 /* process multi-byte character */ |
122 | 121 | ||
123 | -static enum state { | ||
124 | - DATA = 0, ESC = 1, CSDES = 2, | ||
125 | - N1 = 3, DECP = 4, TEXT = 5, TEXT2 = 6, | ||
126 | - MBPEND = 7 | ||
127 | -} state = DATA; | ||
128 | - | ||
129 | -static enum state ansi_data_mode(H3270 *, int, int); | ||
130 | -static enum state dec_save_cursor(H3270 *, int, int); | ||
131 | -static enum state dec_restore_cursor(H3270 *, int, int); | ||
132 | -static enum state ansi_newline(H3270 *, int, int); | ||
133 | -static enum state ansi_cursor_up(H3270 *, int, int); | ||
134 | -static enum state ansi_esc2(H3270 *, int, int); | ||
135 | -static enum state ansi_reset(H3270 *, int, int); | ||
136 | -static enum state ansi_insert_chars(H3270 *, int, int); | ||
137 | -static enum state ansi_cursor_down(H3270 *, int, int); | ||
138 | -static enum state ansi_cursor_right(H3270 *, int, int); | ||
139 | -static enum state ansi_cursor_left(H3270 *, int, int); | ||
140 | -static enum state ansi_cursor_motion(H3270 *, int, int); | ||
141 | -static enum state ansi_erase_in_display(H3270 *, int, int); | ||
142 | -static enum state ansi_erase_in_line(H3270 *, int, int); | ||
143 | -static enum state ansi_insert_lines(H3270 *, int, int); | ||
144 | -static enum state ansi_delete_lines(H3270 *, int, int); | ||
145 | -static enum state ansi_delete_chars(H3270 *, int, int); | ||
146 | -static enum state ansi_sgr(H3270 *, int, int); | ||
147 | -static enum state ansi_bell(H3270 *, int, int); | ||
148 | -static enum state ansi_newpage(H3270 *, int, int); | ||
149 | -static enum state ansi_backspace(H3270 *, int, int); | ||
150 | -static enum state ansi_cr(H3270 *, int, int); | ||
151 | -static enum state ansi_lf(H3270 *, int, int); | ||
152 | -static enum state ansi_htab(H3270 *, int, int); | ||
153 | -static enum state ansi_escape(H3270 *, int, int); | ||
154 | -static enum state ansi_nop(H3270 *, int, int); | ||
155 | -static enum state ansi_printing(H3270 *, int, int); | ||
156 | -static enum state ansi_semicolon(H3270 *, int, int); | ||
157 | -static enum state ansi_digit(H3270 *, int, int); | ||
158 | -static enum state ansi_reverse_index(H3270 *, int, int); | ||
159 | -static enum state ansi_send_attributes(H3270 *, int, int); | ||
160 | -static enum state ansi_set_mode(H3270 *, int, int); | ||
161 | -static enum state ansi_reset_mode(H3270 *, int, int); | ||
162 | -static enum state dec_return_terminal_id(H3270 *, int, int); | ||
163 | -static enum state ansi_status_report(H3270 *, int, int); | ||
164 | -static enum state ansi_cs_designate(H3270 *, int, int); | ||
165 | -static enum state ansi_esc3(H3270 *, int, int); | ||
166 | -static enum state dec_set(H3270 *, int, int); | ||
167 | -static enum state dec_reset(H3270 *, int, int); | ||
168 | -static enum state dec_save(H3270 *, int, int); | ||
169 | -static enum state dec_restore(H3270 *, int, int); | ||
170 | -static enum state dec_scrolling_region(H3270 *, int, int); | ||
171 | -static enum state xterm_text_mode(H3270 *, int, int); | ||
172 | -static enum state xterm_text_semicolon(H3270 *, int, int); | ||
173 | -static enum state xterm_text(H3270 *, int, int); | ||
174 | -static enum state xterm_text_do(H3270 *, int, int); | ||
175 | -static enum state ansi_htab_set(H3270 *, int, int); | ||
176 | -static enum state ansi_htab_clear(H3270 *, int, int); | ||
177 | -static enum state ansi_cs_designate2(H3270 *, int, int); | ||
178 | -static enum state ansi_select_g0(H3270 *, int, int); | ||
179 | -static enum state ansi_select_g1(H3270 *, int, int); | ||
180 | -static enum state ansi_select_g2(H3270 *, int, int); | ||
181 | -static enum state ansi_select_g3(H3270 *, int, int); | ||
182 | -static enum state ansi_one_g2(H3270 *, int, int); | ||
183 | -static enum state ansi_one_g3(H3270 *, int, int); | ||
184 | -static enum state ansi_multibyte(H3270 *, int, int); | ||
185 | - | ||
186 | -typedef enum state (*afn_t)(H3270 *, int, int); | 122 | +#define DATA LIB3270_ANSI_STATE_DATA |
123 | +#define ESC LIB3270_ANSI_STATE_ESC | ||
124 | +#define CSDES LIB3270_ANSI_STATE_CSDES | ||
125 | +#define N1 LIB3270_ANSI_STATE_N1 | ||
126 | +#define DECP LIB3270_ANSI_STATE_DECP | ||
127 | +#define TEXT LIB3270_ANSI_STATE_TEXT | ||
128 | +#define TEXT2 LIB3270_ANSI_STATE_TEXT2 | ||
129 | +#define MBPEND LIB3270_ANSI_STATE_MBPEND | ||
130 | + | ||
131 | +static enum lib3270_ansi_state ansi_data_mode(H3270 *, int, int); | ||
132 | +static enum lib3270_ansi_state dec_save_cursor(H3270 *, int, int); | ||
133 | +static enum lib3270_ansi_state dec_restore_cursor(H3270 *, int, int); | ||
134 | +static enum lib3270_ansi_state ansi_newline(H3270 *, int, int); | ||
135 | +static enum lib3270_ansi_state ansi_cursor_up(H3270 *, int, int); | ||
136 | +static enum lib3270_ansi_state ansi_esc2(H3270 *, int, int); | ||
137 | +static enum lib3270_ansi_state ansi_reset(H3270 *, int, int); | ||
138 | +static enum lib3270_ansi_state ansi_insert_chars(H3270 *, int, int); | ||
139 | +static enum lib3270_ansi_state ansi_cursor_down(H3270 *, int, int); | ||
140 | +static enum lib3270_ansi_state ansi_cursor_right(H3270 *, int, int); | ||
141 | +static enum lib3270_ansi_state ansi_cursor_left(H3270 *, int, int); | ||
142 | +static enum lib3270_ansi_state ansi_cursor_motion(H3270 *, int, int); | ||
143 | +static enum lib3270_ansi_state ansi_erase_in_display(H3270 *, int, int); | ||
144 | +static enum lib3270_ansi_state ansi_erase_in_line(H3270 *, int, int); | ||
145 | +static enum lib3270_ansi_state ansi_insert_lines(H3270 *, int, int); | ||
146 | +static enum lib3270_ansi_state ansi_delete_lines(H3270 *, int, int); | ||
147 | +static enum lib3270_ansi_state ansi_delete_chars(H3270 *, int, int); | ||
148 | +static enum lib3270_ansi_state ansi_sgr(H3270 *, int, int); | ||
149 | +static enum lib3270_ansi_state ansi_bell(H3270 *, int, int); | ||
150 | +static enum lib3270_ansi_state ansi_newpage(H3270 *, int, int); | ||
151 | +static enum lib3270_ansi_state ansi_backspace(H3270 *, int, int); | ||
152 | +static enum lib3270_ansi_state ansi_cr(H3270 *, int, int); | ||
153 | +static enum lib3270_ansi_state ansi_lf(H3270 *, int, int); | ||
154 | +static enum lib3270_ansi_state ansi_htab(H3270 *, int, int); | ||
155 | +static enum lib3270_ansi_state ansi_escape(H3270 *, int, int); | ||
156 | +static enum lib3270_ansi_state ansi_nop(H3270 *, int, int); | ||
157 | +static enum lib3270_ansi_state ansi_printing(H3270 *, int, int); | ||
158 | +static enum lib3270_ansi_state ansi_semicolon(H3270 *, int, int); | ||
159 | +static enum lib3270_ansi_state ansi_digit(H3270 *, int, int); | ||
160 | +static enum lib3270_ansi_state ansi_reverse_index(H3270 *, int, int); | ||
161 | +static enum lib3270_ansi_state ansi_send_attributes(H3270 *, int, int); | ||
162 | +static enum lib3270_ansi_state ansi_set_mode(H3270 *, int, int); | ||
163 | +static enum lib3270_ansi_state ansi_reset_mode(H3270 *, int, int); | ||
164 | +static enum lib3270_ansi_state dec_return_terminal_id(H3270 *, int, int); | ||
165 | +static enum lib3270_ansi_state ansi_status_report(H3270 *, int, int); | ||
166 | +static enum lib3270_ansi_state ansi_cs_designate(H3270 *, int, int); | ||
167 | +static enum lib3270_ansi_state ansi_esc3(H3270 *, int, int); | ||
168 | +static enum lib3270_ansi_state dec_set(H3270 *, int, int); | ||
169 | +static enum lib3270_ansi_state dec_reset(H3270 *, int, int); | ||
170 | +static enum lib3270_ansi_state dec_save(H3270 *, int, int); | ||
171 | +static enum lib3270_ansi_state dec_restore(H3270 *, int, int); | ||
172 | +static enum lib3270_ansi_state dec_scrolling_region(H3270 *, int, int); | ||
173 | +static enum lib3270_ansi_state xterm_text_mode(H3270 *, int, int); | ||
174 | +static enum lib3270_ansi_state xterm_text_semicolon(H3270 *, int, int); | ||
175 | +static enum lib3270_ansi_state xterm_text(H3270 *, int, int); | ||
176 | +static enum lib3270_ansi_state xterm_text_do(H3270 *, int, int); | ||
177 | +static enum lib3270_ansi_state ansi_htab_set(H3270 *, int, int); | ||
178 | +static enum lib3270_ansi_state ansi_htab_clear(H3270 *, int, int); | ||
179 | +static enum lib3270_ansi_state ansi_cs_designate2(H3270 *, int, int); | ||
180 | +static enum lib3270_ansi_state ansi_select_g0(H3270 *, int, int); | ||
181 | +static enum lib3270_ansi_state ansi_select_g1(H3270 *, int, int); | ||
182 | +static enum lib3270_ansi_state ansi_select_g2(H3270 *, int, int); | ||
183 | +static enum lib3270_ansi_state ansi_select_g3(H3270 *, int, int); | ||
184 | +static enum lib3270_ansi_state ansi_one_g2(H3270 *, int, int); | ||
185 | +static enum lib3270_ansi_state ansi_one_g3(H3270 *, int, int); | ||
186 | +static enum lib3270_ansi_state ansi_multibyte(H3270 *, int, int); | ||
187 | + | ||
188 | +typedef enum lib3270_ansi_state (*afn_t)(H3270 *, int, int); | ||
187 | 189 | ||
188 | static const afn_t ansi_fn[] = { | 190 | static const afn_t ansi_fn[] = { |
189 | /* 0 */ &ansi_data_mode, | 191 | /* 0 */ &ansi_data_mode, |
@@ -429,16 +431,14 @@ static const unsigned char st[8][256] = { | @@ -429,16 +431,14 @@ static const unsigned char st[8][256] = { | ||
429 | }, | 431 | }, |
430 | }; | 432 | }; |
431 | 433 | ||
432 | -/* Character sets. */ | ||
433 | -#define CS_G0 0 | ||
434 | -#define CS_G1 1 | ||
435 | -#define CS_G2 2 | ||
436 | -#define CS_G3 3 | 434 | +#define CS_G0 LIB3270_ANSI_CS_G0 |
435 | +#define CS_G1 LIB3270_ANSI_CS_G1 | ||
436 | +#define CS_G2 LIB3270_ANSI_CS_G3 | ||
437 | +#define CS_G3 LIB3270_ANSI_CS_G3 | ||
437 | 438 | ||
438 | -/* Character set designations. */ | ||
439 | -#define CSD_LD 0 | ||
440 | -#define CSD_UK 1 | ||
441 | -#define CSD_US 2 | 439 | +#define CSD_LD LIB3270_ANSI_CSD_LD |
440 | +#define CSD_UK LIB3270_ANSI_CSD_UK | ||
441 | +#define CSD_US LIB3270_ANSI_CSD_US | ||
442 | 442 | ||
443 | // static int saved_cursor = 0; | 443 | // static int saved_cursor = 0; |
444 | #define NN 20 | 444 | #define NN 20 |
@@ -446,17 +446,17 @@ static int n[NN], nx = 0; | @@ -446,17 +446,17 @@ static int n[NN], nx = 0; | ||
446 | #define NT 256 | 446 | #define NT 256 |
447 | static char text[NT + 1]; | 447 | static char text[NT + 1]; |
448 | static int tx = 0; | 448 | static int tx = 0; |
449 | -static int ansi_ch; | ||
450 | -static unsigned char gr = 0; | ||
451 | -static unsigned char saved_gr = 0; | ||
452 | -static unsigned char fg = 0; | ||
453 | -static unsigned char saved_fg = 0; | ||
454 | -static unsigned char bg = 0; | ||
455 | -static unsigned char saved_bg = 0; | ||
456 | -static int cset = CS_G0; | ||
457 | -static int saved_cset = CS_G0; | ||
458 | -static int csd[4] = { CSD_US, CSD_US, CSD_US, CSD_US }; | ||
459 | -static int saved_csd[4] = { CSD_US, CSD_US, CSD_US, CSD_US }; | 449 | +// static int ansi_ch; |
450 | +// static unsigned char gr = 0; | ||
451 | +//static unsigned char saved_gr = 0; | ||
452 | +// static unsigned char fg = 0; | ||
453 | +// static unsigned char saved_fg = 0; | ||
454 | +// static unsigned char bg = 0; | ||
455 | +//static unsigned char saved_bg = 0; | ||
456 | +// static int cset = CS_G0; | ||
457 | +// static int saved_cset = CS_G0; | ||
458 | +// static int csd[4] = { CSD_US, CSD_US, CSD_US, CSD_US }; | ||
459 | +// static int saved_csd[4] = { CSD_US, CSD_US, CSD_US, CSD_US }; | ||
460 | // static int once_cset = -1; | 460 | // static int once_cset = -1; |
461 | // static int insert_mode = 0; | 461 | // static int insert_mode = 0; |
462 | // static int auto_newline_mode = 0; | 462 | // static int auto_newline_mode = 0; |
@@ -473,61 +473,61 @@ static int saved_csd[4] = { CSD_US, CSD_US, CSD_US, CSD_US }; | @@ -473,61 +473,61 @@ static int saved_csd[4] = { CSD_US, CSD_US, CSD_US, CSD_US }; | ||
473 | // static Boolean saved_altbuffer = False; | 473 | // static Boolean saved_altbuffer = False; |
474 | // static int scroll_top = -1; | 474 | // static int scroll_top = -1; |
475 | // static int scroll_bottom = -1; | 475 | // static int scroll_bottom = -1; |
476 | -static unsigned char *tabs = (unsigned char *) NULL; | 476 | +// static unsigned char *tabs = (unsigned char *) NULL; |
477 | 477 | ||
478 | static const char gnnames[] = "()*+"; | 478 | static const char gnnames[] = "()*+"; |
479 | static const char csnames[] = "0AB"; | 479 | static const char csnames[] = "0AB"; |
480 | 480 | ||
481 | -static int cs_to_change; | 481 | +//static int cs_to_change; |
482 | #if defined(X3270_DBCS) /*[*/ | 482 | #if defined(X3270_DBCS) /*[*/ |
483 | static unsigned char mb_pending = 0; | 483 | static unsigned char mb_pending = 0; |
484 | -static char mb_buffer[MB_MAX]; | 484 | +static char mb_buffer[LIB3270_MB_MAX]; |
485 | static int dbcs_process(int ch, unsigned char ebc[]); | 485 | static int dbcs_process(int ch, unsigned char ebc[]); |
486 | #endif /*]*/ | 486 | #endif /*]*/ |
487 | -static int pmi = 0; | ||
488 | -static char pending_mbs[MB_MAX]; | 487 | +// static int pmi = 0; |
488 | +// static char pending_mbs[LIB3270_MB_MAX]; | ||
489 | 489 | ||
490 | // static Boolean held_wrap = False; | 490 | // static Boolean held_wrap = False; |
491 | 491 | ||
492 | static void ansi_scroll(H3270 *hSession); | 492 | static void ansi_scroll(H3270 *hSession); |
493 | 493 | ||
494 | -static enum state | 494 | +static enum lib3270_ansi_state |
495 | ansi_data_mode(H3270 *hSession, int ig1 unused, int ig2 unused) | 495 | ansi_data_mode(H3270 *hSession, int ig1 unused, int ig2 unused) |
496 | { | 496 | { |
497 | return DATA; | 497 | return DATA; |
498 | } | 498 | } |
499 | 499 | ||
500 | -static enum state | 500 | +static enum lib3270_ansi_state |
501 | dec_save_cursor(H3270 *hSession, int ig1 unused, int ig2 unused) | 501 | dec_save_cursor(H3270 *hSession, int ig1 unused, int ig2 unused) |
502 | { | 502 | { |
503 | int i; | 503 | int i; |
504 | 504 | ||
505 | hSession->saved_cursor = hSession->cursor_addr; | 505 | hSession->saved_cursor = hSession->cursor_addr; |
506 | - saved_cset = cset; | 506 | + hSession->saved_cset = hSession->cset; |
507 | for (i = 0; i < 4; i++) | 507 | for (i = 0; i < 4; i++) |
508 | - saved_csd[i] = csd[i]; | ||
509 | - saved_fg = fg; | ||
510 | - saved_bg = bg; | ||
511 | - saved_gr = gr; | 508 | + hSession->saved_csd[i] = hSession->csd[i]; |
509 | + hSession->saved_fg = hSession->fg; | ||
510 | + hSession->saved_bg = hSession->bg; | ||
511 | + hSession->saved_gr = hSession->gr; | ||
512 | return DATA; | 512 | return DATA; |
513 | } | 513 | } |
514 | 514 | ||
515 | -static enum state dec_restore_cursor(H3270 *hSession, int ig1 unused, int ig2 unused) | 515 | +static enum lib3270_ansi_state dec_restore_cursor(H3270 *hSession, int ig1 unused, int ig2 unused) |
516 | { | 516 | { |
517 | int i; | 517 | int i; |
518 | 518 | ||
519 | - cset = saved_cset; | 519 | + hSession->cset = hSession->saved_cset; |
520 | for (i = 0; i < 4; i++) | 520 | for (i = 0; i < 4; i++) |
521 | - csd[i] = saved_csd[i]; | ||
522 | - fg = saved_fg; | ||
523 | - bg = saved_bg; | ||
524 | - gr = saved_gr; | 521 | + hSession->csd[i] = hSession->saved_csd[i]; |
522 | + hSession->fg = hSession->saved_fg; | ||
523 | + hSession->bg = hSession->saved_bg; | ||
524 | + hSession->gr = hSession->saved_gr; | ||
525 | cursor_move(hSession,hSession->saved_cursor); | 525 | cursor_move(hSession,hSession->saved_cursor); |
526 | hSession->held_wrap = 0; | 526 | hSession->held_wrap = 0; |
527 | return DATA; | 527 | return DATA; |
528 | } | 528 | } |
529 | 529 | ||
530 | -static enum state ansi_newline(H3270 *hSession, int ig1 unused, int ig2 unused) | 530 | +static enum lib3270_ansi_state ansi_newline(H3270 *hSession, int ig1 unused, int ig2 unused) |
531 | { | 531 | { |
532 | int nc; | 532 | int nc; |
533 | 533 | ||
@@ -543,23 +543,23 @@ static enum state ansi_newline(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -543,23 +543,23 @@ static enum state ansi_newline(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
543 | return DATA; | 543 | return DATA; |
544 | } | 544 | } |
545 | 545 | ||
546 | -static enum state | 546 | +static enum lib3270_ansi_state |
547 | ansi_cursor_up(H3270 *hSession, int nn, int ig2 unused) | 547 | ansi_cursor_up(H3270 *hSession, int nn, int ig2 unused) |
548 | { | 548 | { |
549 | int rr; | 549 | int rr; |
550 | 550 | ||
551 | if (nn < 1) | 551 | if (nn < 1) |
552 | nn = 1; | 552 | nn = 1; |
553 | - rr = h3270.cursor_addr / h3270.cols; | 553 | + rr = hSession->cursor_addr / hSession->cols; |
554 | if (rr - nn < 0) | 554 | if (rr - nn < 0) |
555 | - cursor_move(&h3270, h3270.cursor_addr % h3270.cols); | 555 | + cursor_move(hSession, hSession->cursor_addr % hSession->cols); |
556 | else | 556 | else |
557 | - cursor_move(&h3270, h3270.cursor_addr - (nn * h3270.cols)); | 557 | + cursor_move(hSession, hSession->cursor_addr - (nn * hSession->cols)); |
558 | hSession->held_wrap = 0; | 558 | hSession->held_wrap = 0; |
559 | return DATA; | 559 | return DATA; |
560 | } | 560 | } |
561 | 561 | ||
562 | -static enum state | 562 | +static enum lib3270_ansi_state |
563 | ansi_esc2(H3270 *hSession, int ig1 unused, int ig2 unused) | 563 | ansi_esc2(H3270 *hSession, int ig1 unused, int ig2 unused) |
564 | { | 564 | { |
565 | register int i; | 565 | register int i; |
@@ -570,22 +570,23 @@ ansi_esc2(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -570,22 +570,23 @@ ansi_esc2(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
570 | return N1; | 570 | return N1; |
571 | } | 571 | } |
572 | 572 | ||
573 | -static enum state | ||
574 | -ansi_reset(H3270 *hSession, int ig1 unused, int ig2 unused) | 573 | +static enum lib3270_ansi_state ansi_reset(H3270 *hSession, int ig1 unused, int ig2 unused) |
575 | { | 574 | { |
576 | int i; | 575 | int i; |
577 | - static Boolean first = True; | ||
578 | - | ||
579 | - gr = 0; | ||
580 | - saved_gr = 0; | ||
581 | - fg = 0; | ||
582 | - saved_fg = 0; | ||
583 | - bg = 0; | ||
584 | - saved_bg = 0; | ||
585 | - cset = CS_G0; | ||
586 | - saved_cset = CS_G0; | ||
587 | - csd[0] = csd[1] = csd[2] = csd[3] = CSD_US; | ||
588 | - saved_csd[0] = saved_csd[1] = saved_csd[2] = saved_csd[3] = CSD_US; | 576 | +// static Boolean first = True; |
577 | + | ||
578 | + hSession->gr = 0; | ||
579 | + hSession->saved_gr = 0; | ||
580 | + hSession->fg = 0; | ||
581 | + hSession->saved_fg = 0; | ||
582 | + hSession->bg = 0; | ||
583 | + hSession->saved_bg = 0; | ||
584 | + hSession->cset = CS_G0; | ||
585 | + hSession->saved_cset = CS_G0; | ||
586 | + | ||
587 | + for(i=0;i<4;i++) | ||
588 | + hSession->csd[i] = hSession->saved_csd[i] = LIB3270_ANSI_CSD_US; | ||
589 | + | ||
589 | hSession->once_cset = -1; | 590 | hSession->once_cset = -1; |
590 | hSession->saved_cursor = 0; | 591 | hSession->saved_cursor = 0; |
591 | hSession->insert_mode = 0; | 592 | hSession->insert_mode = 0; |
@@ -606,27 +607,29 @@ ansi_reset(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -606,27 +607,29 @@ ansi_reset(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
606 | hSession->scroll_top = 1; | 607 | hSession->scroll_top = 1; |
607 | hSession->scroll_bottom = hSession->rows; | 608 | hSession->scroll_bottom = hSession->rows; |
608 | 609 | ||
609 | - Replace(tabs, (unsigned char *)lib3270_malloc((h3270.cols+7)/8)); | ||
610 | - for (i = 0; i < (h3270.cols+7)/8; i++) | ||
611 | - tabs[i] = 0x01; | 610 | + Replace(hSession->tabs, (unsigned char *)lib3270_malloc((hSession->cols+7)/8)); |
611 | + for (i = 0; i < (hSession->cols+7)/8; i++) | ||
612 | + hSession->tabs[i] = 0x01; | ||
613 | + | ||
612 | hSession->held_wrap = 0; | 614 | hSession->held_wrap = 0; |
613 | - if (!first) { | ||
614 | - ctlr_altbuffer(&h3270,True); | ||
615 | - ctlr_aclear(&h3270, 0, h3270.rows * h3270.cols, 1); | ||
616 | - ctlr_altbuffer(&h3270,False); | ||
617 | - ctlr_clear(&h3270,False); | ||
618 | - screen_80(); | 615 | + if (!hSession->ansi_reset) |
616 | + { | ||
617 | + ctlr_altbuffer(hSession,True); | ||
618 | + ctlr_aclear(hSession, 0, hSession->rows * hSession->cols, 1); | ||
619 | + ctlr_altbuffer(hSession,False); | ||
620 | + ctlr_clear(hSession,False); | ||
621 | + hSession->set_width(hSession,80); | ||
622 | + hSession->ansi_reset = 1; | ||
619 | } | 623 | } |
620 | - first = False; | ||
621 | - pmi = 0; | 624 | + hSession->pmi = 0; |
622 | return DATA; | 625 | return DATA; |
623 | } | 626 | } |
624 | 627 | ||
625 | -static enum state | 628 | +static enum lib3270_ansi_state |
626 | ansi_insert_chars(H3270 *hSession, int nn, int ig2 unused) | 629 | ansi_insert_chars(H3270 *hSession, int nn, int ig2 unused) |
627 | { | 630 | { |
628 | - int cc = h3270.cursor_addr % h3270.cols; /* current col */ | ||
629 | - int mc = h3270.cols - cc; /* max chars that can be inserted */ | 631 | + int cc = hSession->cursor_addr % hSession->cols; /* current col */ |
632 | + int mc = hSession->cols - cc; /* max chars that can be inserted */ | ||
630 | int ns; /* chars that are shifting */ | 633 | int ns; /* chars that are shifting */ |
631 | 634 | ||
632 | if (nn < 1) | 635 | if (nn < 1) |
@@ -637,47 +640,47 @@ ansi_insert_chars(H3270 *hSession, int nn, int ig2 unused) | @@ -637,47 +640,47 @@ ansi_insert_chars(H3270 *hSession, int nn, int ig2 unused) | ||
637 | /* Move the surviving chars right */ | 640 | /* Move the surviving chars right */ |
638 | ns = mc - nn; | 641 | ns = mc - nn; |
639 | if (ns) | 642 | if (ns) |
640 | - ctlr_bcopy(h3270.cursor_addr, h3270.cursor_addr + nn, ns, 1); | 643 | + ctlr_bcopy(hSession->cursor_addr, hSession->cursor_addr + nn, ns, 1); |
641 | 644 | ||
642 | /* Clear the middle of the line */ | 645 | /* Clear the middle of the line */ |
643 | - ctlr_aclear(&h3270, h3270.cursor_addr, nn, 1); | 646 | + ctlr_aclear(hSession, hSession->cursor_addr, nn, 1); |
644 | return DATA; | 647 | return DATA; |
645 | } | 648 | } |
646 | 649 | ||
647 | -static enum state | 650 | +static enum lib3270_ansi_state |
648 | ansi_cursor_down(H3270 *hSession, int nn, int ig2 unused) | 651 | ansi_cursor_down(H3270 *hSession, int nn, int ig2 unused) |
649 | { | 652 | { |
650 | int rr; | 653 | int rr; |
651 | 654 | ||
652 | if (nn < 1) | 655 | if (nn < 1) |
653 | nn = 1; | 656 | nn = 1; |
654 | - rr = h3270.cursor_addr / h3270.cols; | ||
655 | - if (rr + nn >= h3270.cols) | ||
656 | - cursor_move(&h3270,(h3270.cols-1)*h3270.cols + (h3270.cursor_addr%h3270.cols)); | 657 | + rr = hSession->cursor_addr / hSession->cols; |
658 | + if (rr + nn >= hSession->cols) | ||
659 | + cursor_move(hSession,(hSession->cols-1)*hSession->cols + (hSession->cursor_addr%hSession->cols)); | ||
657 | else | 660 | else |
658 | - cursor_move(&h3270,h3270.cursor_addr + (nn * h3270.cols)); | 661 | + cursor_move(hSession,hSession->cursor_addr + (nn * hSession->cols)); |
659 | hSession->held_wrap = 0; | 662 | hSession->held_wrap = 0; |
660 | return DATA; | 663 | return DATA; |
661 | } | 664 | } |
662 | 665 | ||
663 | -static enum state | 666 | +static enum lib3270_ansi_state |
664 | ansi_cursor_right(H3270 *hSession, int nn, int ig2 unused) | 667 | ansi_cursor_right(H3270 *hSession, int nn, int ig2 unused) |
665 | { | 668 | { |
666 | int cc; | 669 | int cc; |
667 | 670 | ||
668 | if (nn < 1) | 671 | if (nn < 1) |
669 | nn = 1; | 672 | nn = 1; |
670 | - cc = h3270.cursor_addr % h3270.cols; | ||
671 | - if (cc == h3270.cols-1) | 673 | + cc = hSession->cursor_addr % hSession->cols; |
674 | + if (cc == hSession->cols-1) | ||
672 | return DATA; | 675 | return DATA; |
673 | - if (cc + nn >= h3270.cols) | ||
674 | - nn = h3270.cols - 1 - cc; | ||
675 | - cursor_move(&h3270,h3270.cursor_addr + nn); | 676 | + if (cc + nn >= hSession->cols) |
677 | + nn = hSession->cols - 1 - cc; | ||
678 | + cursor_move(hSession,hSession->cursor_addr + nn); | ||
676 | hSession->held_wrap = 0; | 679 | hSession->held_wrap = 0; |
677 | return DATA; | 680 | return DATA; |
678 | } | 681 | } |
679 | 682 | ||
680 | -static enum state | 683 | +static enum lib3270_ansi_state |
681 | ansi_cursor_left(H3270 *hSession, int nn, int ig2 unused) | 684 | ansi_cursor_left(H3270 *hSession, int nn, int ig2 unused) |
682 | { | 685 | { |
683 | int cc; | 686 | int cc; |
@@ -698,7 +701,7 @@ ansi_cursor_left(H3270 *hSession, int nn, int ig2 unused) | @@ -698,7 +701,7 @@ ansi_cursor_left(H3270 *hSession, int nn, int ig2 unused) | ||
698 | return DATA; | 701 | return DATA; |
699 | } | 702 | } |
700 | 703 | ||
701 | -static enum state | 704 | +static enum lib3270_ansi_state |
702 | ansi_cursor_motion(H3270 *hSession, int n1, int n2) | 705 | ansi_cursor_motion(H3270 *hSession, int n1, int n2) |
703 | { | 706 | { |
704 | if (n1 < 1) n1 = 1; | 707 | if (n1 < 1) n1 = 1; |
@@ -710,47 +713,47 @@ ansi_cursor_motion(H3270 *hSession, int n1, int n2) | @@ -710,47 +713,47 @@ ansi_cursor_motion(H3270 *hSession, int n1, int n2) | ||
710 | return DATA; | 713 | return DATA; |
711 | } | 714 | } |
712 | 715 | ||
713 | -static enum state | 716 | +static enum lib3270_ansi_state |
714 | ansi_erase_in_display(H3270 *hSession, int nn, int ig2 unused) | 717 | ansi_erase_in_display(H3270 *hSession, int nn, int ig2 unused) |
715 | { | 718 | { |
716 | switch (nn) { | 719 | switch (nn) { |
717 | case 0: /* below */ | 720 | case 0: /* below */ |
718 | - ctlr_aclear(&h3270, h3270.cursor_addr, (h3270.rows * h3270.cols) - h3270.cursor_addr, 1); | 721 | + ctlr_aclear(hSession, hSession->cursor_addr, (hSession->rows * hSession->cols) - hSession->cursor_addr, 1); |
719 | break; | 722 | break; |
720 | case 1: /* above */ | 723 | case 1: /* above */ |
721 | - ctlr_aclear(&h3270, 0, h3270.cursor_addr + 1, 1); | 724 | + ctlr_aclear(hSession, 0, hSession->cursor_addr + 1, 1); |
722 | break; | 725 | break; |
723 | case 2: /* all (without moving cursor) */ | 726 | case 2: /* all (without moving cursor) */ |
724 | -// if (h3270.cursor_addr == 0 && !h3270.is_altbuffer) scroll_save(h3270.rows, True); | ||
725 | - ctlr_aclear(&h3270, 0, h3270.rows * h3270.cols, 1); | 727 | +// if (hSession->cursor_addr == 0 && !hSession->is_altbuffer) scroll_save(hSession->rows, True); |
728 | + ctlr_aclear(hSession, 0, hSession->rows * hSession->cols, 1); | ||
726 | break; | 729 | break; |
727 | } | 730 | } |
728 | return DATA; | 731 | return DATA; |
729 | } | 732 | } |
730 | 733 | ||
731 | -static enum state | 734 | +static enum lib3270_ansi_state |
732 | ansi_erase_in_line(H3270 *hSession, int nn, int ig2 unused) | 735 | ansi_erase_in_line(H3270 *hSession, int nn, int ig2 unused) |
733 | { | 736 | { |
734 | - int nc = h3270.cursor_addr % h3270.cols; | 737 | + int nc = hSession->cursor_addr % hSession->cols; |
735 | 738 | ||
736 | switch (nn) { | 739 | switch (nn) { |
737 | case 0: /* to right */ | 740 | case 0: /* to right */ |
738 | - ctlr_aclear(&h3270, h3270.cursor_addr, h3270.cols - nc, 1); | 741 | + ctlr_aclear(hSession, hSession->cursor_addr, hSession->cols - nc, 1); |
739 | break; | 742 | break; |
740 | case 1: /* to left */ | 743 | case 1: /* to left */ |
741 | - ctlr_aclear(&h3270, h3270.cursor_addr - nc, nc+1, 1); | 744 | + ctlr_aclear(hSession, hSession->cursor_addr - nc, nc+1, 1); |
742 | break; | 745 | break; |
743 | case 2: /* all */ | 746 | case 2: /* all */ |
744 | - ctlr_aclear(&h3270, h3270.cursor_addr - nc, h3270.cols, 1); | 747 | + ctlr_aclear(hSession, hSession->cursor_addr - nc, hSession->cols, 1); |
745 | break; | 748 | break; |
746 | } | 749 | } |
747 | return DATA; | 750 | return DATA; |
748 | } | 751 | } |
749 | 752 | ||
750 | -static enum state | 753 | +static enum lib3270_ansi_state |
751 | ansi_insert_lines(H3270 *hSession, int nn, int ig2 unused) | 754 | ansi_insert_lines(H3270 *hSession, int nn, int ig2 unused) |
752 | { | 755 | { |
753 | - int rr = h3270.cursor_addr / h3270.cols; /* current row */ | 756 | + int rr = hSession->cursor_addr / hSession->cols; /* current row */ |
754 | int mr = hSession->scroll_bottom - rr; /* rows left at and below this one */ | 757 | int mr = hSession->scroll_bottom - rr; /* rows left at and below this one */ |
755 | int ns; /* rows that are shifting */ | 758 | int ns; /* rows that are shifting */ |
756 | 759 | ||
@@ -766,14 +769,14 @@ ansi_insert_lines(H3270 *hSession, int nn, int ig2 unused) | @@ -766,14 +769,14 @@ ansi_insert_lines(H3270 *hSession, int nn, int ig2 unused) | ||
766 | /* Move the victims down */ | 769 | /* Move the victims down */ |
767 | ns = mr - nn; | 770 | ns = mr - nn; |
768 | if (ns) | 771 | if (ns) |
769 | - ctlr_bcopy(rr * h3270.cols, (rr + nn) * h3270.cols, ns * h3270.cols, 1); | 772 | + ctlr_bcopy(rr * hSession->cols, (rr + nn) * hSession->cols, ns * hSession->cols, 1); |
770 | 773 | ||
771 | /* Clear the middle of the screen */ | 774 | /* Clear the middle of the screen */ |
772 | - ctlr_aclear(&h3270, rr * h3270.cols, nn * h3270.cols, 1); | 775 | + ctlr_aclear(hSession, rr * hSession->cols, nn * hSession->cols, 1); |
773 | return DATA; | 776 | return DATA; |
774 | } | 777 | } |
775 | 778 | ||
776 | -static enum state | 779 | +static enum lib3270_ansi_state |
777 | ansi_delete_lines(H3270 *hSession, int nn, int ig2 unused) | 780 | ansi_delete_lines(H3270 *hSession, int nn, int ig2 unused) |
778 | { | 781 | { |
779 | int rr = hSession->cursor_addr / hSession->cols; /* current row */ | 782 | int rr = hSession->cursor_addr / hSession->cols; /* current row */ |
@@ -799,7 +802,7 @@ ansi_delete_lines(H3270 *hSession, int nn, int ig2 unused) | @@ -799,7 +802,7 @@ ansi_delete_lines(H3270 *hSession, int nn, int ig2 unused) | ||
799 | return DATA; | 802 | return DATA; |
800 | } | 803 | } |
801 | 804 | ||
802 | -static enum state | 805 | +static enum lib3270_ansi_state |
803 | ansi_delete_chars(H3270 *hSession, int nn, int ig2 unused) | 806 | ansi_delete_chars(H3270 *hSession, int nn, int ig2 unused) |
804 | { | 807 | { |
805 | int cc = hSession->cursor_addr % hSession->cols; /* current col */ | 808 | int cc = hSession->cursor_addr % hSession->cols; /* current col */ |
@@ -821,7 +824,7 @@ ansi_delete_chars(H3270 *hSession, int nn, int ig2 unused) | @@ -821,7 +824,7 @@ ansi_delete_chars(H3270 *hSession, int nn, int ig2 unused) | ||
821 | return DATA; | 824 | return DATA; |
822 | } | 825 | } |
823 | 826 | ||
824 | -static enum state | 827 | +static enum lib3270_ansi_state |
825 | ansi_sgr(H3270 *hSession, int ig1 unused, int ig2 unused) | 828 | ansi_sgr(H3270 *hSession, int ig1 unused, int ig2 unused) |
826 | { | 829 | { |
827 | int i; | 830 | int i; |
@@ -829,111 +832,111 @@ ansi_sgr(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -829,111 +832,111 @@ ansi_sgr(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
829 | for (i = 0; i <= nx && i < NN; i++) | 832 | for (i = 0; i <= nx && i < NN; i++) |
830 | switch (n[i]) { | 833 | switch (n[i]) { |
831 | case 0: | 834 | case 0: |
832 | - gr = 0; | ||
833 | - fg = 0; | ||
834 | - bg = 0; | 835 | + hSession->gr = 0; |
836 | + hSession->fg = 0; | ||
837 | + hSession->bg = 0; | ||
835 | break; | 838 | break; |
836 | case 1: | 839 | case 1: |
837 | - gr |= GR_INTENSIFY; | 840 | + hSession->gr |= GR_INTENSIFY; |
838 | break; | 841 | break; |
839 | case 4: | 842 | case 4: |
840 | - gr |= GR_UNDERLINE; | 843 | + hSession->gr |= GR_UNDERLINE; |
841 | break; | 844 | break; |
842 | case 5: | 845 | case 5: |
843 | - gr |= GR_BLINK; | 846 | + hSession->gr |= GR_BLINK; |
844 | break; | 847 | break; |
845 | case 7: | 848 | case 7: |
846 | - gr |= GR_REVERSE; | 849 | + hSession->gr |= GR_REVERSE; |
847 | break; | 850 | break; |
848 | case 30: | 851 | case 30: |
849 | - fg = 0xf0; /* black */ | 852 | + hSession->fg = 0xf0; /* black */ |
850 | break; | 853 | break; |
851 | case 31: | 854 | case 31: |
852 | - fg = 0xf2; /* red */ | 855 | + hSession->fg = 0xf2; /* red */ |
853 | break; | 856 | break; |
854 | case 32: | 857 | case 32: |
855 | - fg = 0xf4; /* green */ | 858 | + hSession->fg = 0xf4; /* green */ |
856 | break; | 859 | break; |
857 | case 33: | 860 | case 33: |
858 | - fg = 0xf6; /* yellow */ | 861 | + hSession->fg = 0xf6; /* yellow */ |
859 | break; | 862 | break; |
860 | case 34: | 863 | case 34: |
861 | - fg = 0xf1; /* blue */ | 864 | + hSession->fg = 0xf1; /* blue */ |
862 | break; | 865 | break; |
863 | case 35: | 866 | case 35: |
864 | - fg = 0xf3; /* magenta */ | 867 | + hSession->fg = 0xf3; /* magenta */ |
865 | break; | 868 | break; |
866 | case 36: | 869 | case 36: |
867 | #if defined(WC3270) /*[*/ | 870 | #if defined(WC3270) /*[*/ |
868 | - fg = 0xf6; /* turquoise */ | 871 | + hSession->fg = 0xf6; /* turquoise */ |
869 | #else /*][*/ | 872 | #else /*][*/ |
870 | - fg = 0xfd; /* cyan */ | 873 | + hSession->fg = 0xfd; /* cyan */ |
871 | #endif /*]*/ | 874 | #endif /*]*/ |
872 | break; | 875 | break; |
873 | case 37: | 876 | case 37: |
874 | #if defined(WC3270) /*[*/ | 877 | #if defined(WC3270) /*[*/ |
875 | - fg = 0xf7; /* white */ | 878 | + hSession->fg = 0xf7; /* white */ |
876 | #else /*][*/ | 879 | #else /*][*/ |
877 | - fg = 0xff; /* white */ | 880 | + hSession->fg = 0xff; /* white */ |
878 | #endif /*]*/ | 881 | #endif /*]*/ |
879 | break; | 882 | break; |
880 | case 39: | 883 | case 39: |
881 | - fg = 0; /* default */ | 884 | + hSession->fg = 0; /* default */ |
882 | break; | 885 | break; |
883 | case 40: | 886 | case 40: |
884 | - bg = 0xf0; /* black */ | 887 | + hSession->bg = 0xf0; /* black */ |
885 | break; | 888 | break; |
886 | case 41: | 889 | case 41: |
887 | - bg = 0xf2; /* red */ | 890 | + hSession->bg = 0xf2; /* red */ |
888 | break; | 891 | break; |
889 | case 42: | 892 | case 42: |
890 | - bg = 0xf4; /* green */ | 893 | + hSession->bg = 0xf4; /* green */ |
891 | break; | 894 | break; |
892 | case 43: | 895 | case 43: |
893 | - bg = 0xf6; /* yellow */ | 896 | + hSession->bg = 0xf6; /* yellow */ |
894 | break; | 897 | break; |
895 | case 44: | 898 | case 44: |
896 | - bg = 0xf1; /* blue */ | 899 | + hSession->bg = 0xf1; /* blue */ |
897 | break; | 900 | break; |
898 | case 45: | 901 | case 45: |
899 | - bg = 0xf3; /* magenta */ | 902 | + hSession->bg = 0xf3; /* magenta */ |
900 | break; | 903 | break; |
901 | case 46: | 904 | case 46: |
902 | #if defined(WC3270) /*[*/ | 905 | #if defined(WC3270) /*[*/ |
903 | - bg = 0xf6; /* turquoise */ | 906 | + hSession->bg = 0xf6; /* turquoise */ |
904 | #else /*][*/ | 907 | #else /*][*/ |
905 | - bg = 0xfd; /* cyan */ | 908 | + hSession->bg = 0xfd; /* cyan */ |
906 | #endif /*]*/ | 909 | #endif /*]*/ |
907 | break; | 910 | break; |
908 | case 47: | 911 | case 47: |
909 | #if defined(WC3270) /*[*/ | 912 | #if defined(WC3270) /*[*/ |
910 | - bg = 0xf7; /* white */ | 913 | + hSession->bg = 0xf7; /* white */ |
911 | #else /*][*/ | 914 | #else /*][*/ |
912 | - bg = 0xff; /* white */ | 915 | + hSession->bg = 0xff; /* white */ |
913 | #endif /*]*/ | 916 | #endif /*]*/ |
914 | break; | 917 | break; |
915 | case 49: | 918 | case 49: |
916 | - bg = 0; /* default */ | 919 | + hSession->bg = 0; /* default */ |
917 | break; | 920 | break; |
918 | } | 921 | } |
919 | 922 | ||
920 | return DATA; | 923 | return DATA; |
921 | } | 924 | } |
922 | 925 | ||
923 | -static enum state | 926 | +static enum lib3270_ansi_state |
924 | ansi_bell(H3270 *hSession, int ig1 unused, int ig2 unused) | 927 | ansi_bell(H3270 *hSession, int ig1 unused, int ig2 unused) |
925 | { | 928 | { |
926 | lib3270_ring_bell(hSession); | 929 | lib3270_ring_bell(hSession); |
927 | return DATA; | 930 | return DATA; |
928 | } | 931 | } |
929 | 932 | ||
930 | -static enum state ansi_newpage(H3270 *hSession, int ig1 unused, int ig2 unused) | 933 | +static enum lib3270_ansi_state ansi_newpage(H3270 *hSession, int ig1 unused, int ig2 unused) |
931 | { | 934 | { |
932 | - ctlr_clear(&h3270,False); | 935 | + ctlr_clear(hSession,False); |
933 | return DATA; | 936 | return DATA; |
934 | } | 937 | } |
935 | 938 | ||
936 | -static enum state ansi_backspace(H3270 *hSession, int ig1 unused, int ig2 unused) | 939 | +static enum lib3270_ansi_state ansi_backspace(H3270 *hSession, int ig1 unused, int ig2 unused) |
937 | { | 940 | { |
938 | if (hSession->held_wrap) | 941 | if (hSession->held_wrap) |
939 | { | 942 | { |
@@ -954,7 +957,7 @@ static enum state ansi_backspace(H3270 *hSession, int ig1 unused, int ig2 unused | @@ -954,7 +957,7 @@ static enum state ansi_backspace(H3270 *hSession, int ig1 unused, int ig2 unused | ||
954 | return DATA; | 957 | return DATA; |
955 | } | 958 | } |
956 | 959 | ||
957 | -static enum state | 960 | +static enum lib3270_ansi_state |
958 | ansi_cr(H3270 *hSession, int ig1 unused, int ig2 unused) | 961 | ansi_cr(H3270 *hSession, int ig1 unused, int ig2 unused) |
959 | { | 962 | { |
960 | if (hSession->cursor_addr % hSession->cols) | 963 | if (hSession->cursor_addr % hSession->cols) |
@@ -967,7 +970,7 @@ ansi_cr(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -967,7 +970,7 @@ ansi_cr(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
967 | return DATA; | 970 | return DATA; |
968 | } | 971 | } |
969 | 972 | ||
970 | -static enum state | 973 | +static enum lib3270_ansi_state |
971 | ansi_lf(H3270 *hSession, int ig1 unused, int ig2 unused) | 974 | ansi_lf(H3270 *hSession, int ig1 unused, int ig2 unused) |
972 | { | 975 | { |
973 | int nc = hSession->cursor_addr + hSession->cols; | 976 | int nc = hSession->cursor_addr + hSession->cols; |
@@ -989,7 +992,7 @@ ansi_lf(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -989,7 +992,7 @@ ansi_lf(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
989 | return DATA; | 992 | return DATA; |
990 | } | 993 | } |
991 | 994 | ||
992 | -static enum state | 995 | +static enum lib3270_ansi_state |
993 | ansi_htab(H3270 *hSession, int ig1 unused, int ig2 unused) | 996 | ansi_htab(H3270 *hSession, int ig1 unused, int ig2 unused) |
994 | { | 997 | { |
995 | int col = hSession->cursor_addr % hSession->cols; | 998 | int col = hSession->cursor_addr % hSession->cols; |
@@ -999,19 +1002,19 @@ ansi_htab(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -999,19 +1002,19 @@ ansi_htab(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
999 | if (col == hSession->cols-1) | 1002 | if (col == hSession->cols-1) |
1000 | return DATA; | 1003 | return DATA; |
1001 | for (i = col+1; i < hSession->cols-1; i++) | 1004 | for (i = col+1; i < hSession->cols-1; i++) |
1002 | - if (tabs[i/8] & 1<<(i%8)) | 1005 | + if (hSession->tabs[i/8] & 1<<(i%8)) |
1003 | break; | 1006 | break; |
1004 | cursor_move(hSession,hSession->cursor_addr - col + i); | 1007 | cursor_move(hSession,hSession->cursor_addr - col + i); |
1005 | return DATA; | 1008 | return DATA; |
1006 | } | 1009 | } |
1007 | 1010 | ||
1008 | -static enum state | 1011 | +static enum lib3270_ansi_state |
1009 | ansi_escape(H3270 *hSession, int ig1 unused, int ig2 unused) | 1012 | ansi_escape(H3270 *hSession, int ig1 unused, int ig2 unused) |
1010 | { | 1013 | { |
1011 | return ESC; | 1014 | return ESC; |
1012 | } | 1015 | } |
1013 | 1016 | ||
1014 | -static enum state | 1017 | +static enum lib3270_ansi_state |
1015 | ansi_nop(H3270 *hSession, int ig1 unused, int ig2 unused) | 1018 | ansi_nop(H3270 *hSession, int ig1 unused, int ig2 unused) |
1016 | { | 1019 | { |
1017 | return DATA; | 1020 | return DATA; |
@@ -1031,7 +1034,7 @@ ansi_nop(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1031,7 +1034,7 @@ ansi_nop(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1031 | } \ | 1034 | } \ |
1032 | } | 1035 | } |
1033 | 1036 | ||
1034 | -static enum state | 1037 | +static enum lib3270_ansi_state |
1035 | ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | 1038 | ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) |
1036 | { | 1039 | { |
1037 | int nc; | 1040 | int nc; |
@@ -1042,12 +1045,12 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1042,12 +1045,12 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1042 | Boolean preserve_right = False; | 1045 | Boolean preserve_right = False; |
1043 | #endif /*]*/ | 1046 | #endif /*]*/ |
1044 | 1047 | ||
1045 | - if ((pmi == 0) && (ansi_ch & 0x80)) { | 1048 | + if ((hSession->pmi == 0) && (hSession->ansi_ch & 0x80)) { |
1046 | char mbs[2]; | 1049 | char mbs[2]; |
1047 | enum ulfail fail; | 1050 | enum ulfail fail; |
1048 | unsigned char ch; | 1051 | unsigned char ch; |
1049 | 1052 | ||
1050 | - mbs[0] = (char)ansi_ch; | 1053 | + mbs[0] = (char)hSession->ansi_ch; |
1051 | mbs[1] = '\0'; | 1054 | mbs[1] = '\0'; |
1052 | ch = utf8_lookup(mbs, &fail, NULL); | 1055 | ch = utf8_lookup(mbs, &fail, NULL); |
1053 | if (ch == 0) { | 1056 | if (ch == 0) { |
@@ -1057,12 +1060,12 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1057,12 +1060,12 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1057 | break; | 1060 | break; |
1058 | case ULFAIL_INCOMPLETE: | 1061 | case ULFAIL_INCOMPLETE: |
1059 | /* Start munching multi-byte. */ | 1062 | /* Start munching multi-byte. */ |
1060 | - pmi = 0; | ||
1061 | - pending_mbs[pmi++] = (char)ansi_ch; | 1063 | + hSession->pmi = 0; |
1064 | + hSession->pending_mbs[hSession->pmi++] = (char)hSession->ansi_ch; | ||
1062 | return MBPEND; | 1065 | return MBPEND; |
1063 | case ULFAIL_INVALID: | 1066 | case ULFAIL_INVALID: |
1064 | /* Invalid multi-byte -> '?' */ | 1067 | /* Invalid multi-byte -> '?' */ |
1065 | - ansi_ch = '?'; | 1068 | + hSession->ansi_ch = '?'; |
1066 | /* XXX: If DBCS, we should let | 1069 | /* XXX: If DBCS, we should let |
1067 | * ICU have a crack at it | 1070 | * ICU have a crack at it |
1068 | */ | 1071 | */ |
@@ -1070,7 +1073,7 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1070,7 +1073,7 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1070 | } | 1073 | } |
1071 | } | 1074 | } |
1072 | } | 1075 | } |
1073 | - pmi = 0; | 1076 | + hSession->pmi = 0; |
1074 | 1077 | ||
1075 | if (hSession->held_wrap) | 1078 | if (hSession->held_wrap) |
1076 | { | 1079 | { |
@@ -1081,21 +1084,22 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1081,21 +1084,22 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1081 | if (hSession->insert_mode) | 1084 | if (hSession->insert_mode) |
1082 | (void) ansi_insert_chars(hSession,1, 0); | 1085 | (void) ansi_insert_chars(hSession,1, 0); |
1083 | 1086 | ||
1084 | - switch (csd[(hSession->once_cset != -1) ? hSession->once_cset : cset]) { | 1087 | + switch(hSession->csd[(hSession->once_cset != -1) ? hSession->once_cset : hSession->cset]) |
1088 | + { | ||
1085 | case CSD_LD: /* line drawing "0" */ | 1089 | case CSD_LD: /* line drawing "0" */ |
1086 | - if (ansi_ch >= 0x5f && ansi_ch <= 0x7e) | ||
1087 | - ctlr_add(&h3270,h3270.cursor_addr, (unsigned char)(ansi_ch - 0x5f),CS_LINEDRAW); | 1090 | + if (hSession->ansi_ch >= 0x5f && hSession->ansi_ch <= 0x7e) |
1091 | + ctlr_add(hSession,hSession->cursor_addr, (unsigned char)(hSession->ansi_ch - 0x5f),CS_LINEDRAW); | ||
1088 | else | 1092 | else |
1089 | - ctlr_add(&h3270,h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE); | 1093 | + ctlr_add(hSession,hSession->cursor_addr, asc2ebc[hSession->ansi_ch], CS_BASE); |
1090 | break; | 1094 | break; |
1091 | case CSD_UK: /* UK "A" */ | 1095 | case CSD_UK: /* UK "A" */ |
1092 | - if (ansi_ch == '#') | ||
1093 | - ctlr_add(&h3270,h3270.cursor_addr, 0x1e, CS_LINEDRAW); | 1096 | + if (hSession->ansi_ch == '#') |
1097 | + ctlr_add(hSession,hSession->cursor_addr, 0x1e, CS_LINEDRAW); | ||
1094 | else | 1098 | else |
1095 | - ctlr_add(&h3270,h3270.cursor_addr, asc2ebc[ansi_ch], CS_BASE); | 1099 | + ctlr_add(hSession,hSession->cursor_addr, asc2ebc[hSession->ansi_ch], CS_BASE); |
1096 | break; | 1100 | break; |
1097 | case CSD_US: /* US "B" */ | 1101 | case CSD_US: /* US "B" */ |
1098 | - ebc_ch = asc2ebc[ansi_ch]; | 1102 | + ebc_ch = asc2ebc[hSession->ansi_ch]; |
1099 | #if defined(X3270_DBCS) /*[*/ | 1103 | #if defined(X3270_DBCS) /*[*/ |
1100 | d = ctlr_dbcs_state(cursor_addr); | 1104 | d = ctlr_dbcs_state(cursor_addr); |
1101 | if (dbcs) { | 1105 | if (dbcs) { |
@@ -1178,9 +1182,9 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1178,9 +1182,9 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1178 | break; | 1182 | break; |
1179 | } | 1183 | } |
1180 | hSession->once_cset = -1; | 1184 | hSession->once_cset = -1; |
1181 | - ctlr_add_gr(hSession,hSession->cursor_addr, gr); | ||
1182 | - ctlr_add_fg(hSession,hSession->cursor_addr, fg); | ||
1183 | - ctlr_add_bg(hSession,hSession->cursor_addr, bg); | 1185 | + ctlr_add_gr(hSession,hSession->cursor_addr, hSession->gr); |
1186 | + ctlr_add_fg(hSession,hSession->cursor_addr, hSession->fg); | ||
1187 | + ctlr_add_bg(hSession,hSession->cursor_addr, hSession->bg); | ||
1184 | if (hSession->wraparound_mode) { | 1188 | if (hSession->wraparound_mode) { |
1185 | /* | 1189 | /* |
1186 | * There is a fascinating behavior of xterm which we will | 1190 | * There is a fascinating behavior of xterm which we will |
@@ -1207,69 +1211,73 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1207,69 +1211,73 @@ ansi_printing(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1207 | return DATA; | 1211 | return DATA; |
1208 | } | 1212 | } |
1209 | 1213 | ||
1210 | -static enum state | 1214 | +static enum lib3270_ansi_state |
1211 | ansi_multibyte(H3270 *hSession, int ig1, int ig2) | 1215 | ansi_multibyte(H3270 *hSession, int ig1, int ig2) |
1212 | { | 1216 | { |
1213 | - char mbs[MB_MAX]; | 1217 | + char mbs[MB_MAX]; |
1214 | unsigned char ch; | 1218 | unsigned char ch; |
1215 | enum ulfail fail; | 1219 | enum ulfail fail; |
1216 | afn_t fn; | 1220 | afn_t fn; |
1217 | 1221 | ||
1218 | - if (pmi >= MB_MAX - 2) { | ||
1219 | - /* String too long. */ | ||
1220 | - pmi = 0; | ||
1221 | - ansi_ch = '?'; | 1222 | + if (hSession->pmi >= MB_MAX - 2) |
1223 | + { | ||
1224 | + /* String too long. */ | ||
1225 | + hSession->pmi = 0; | ||
1226 | + hSession->ansi_ch = '?'; | ||
1222 | return ansi_printing(hSession,ig1, ig2); | 1227 | return ansi_printing(hSession,ig1, ig2); |
1223 | } | 1228 | } |
1224 | 1229 | ||
1225 | - strncpy(mbs, pending_mbs, pmi); | ||
1226 | - mbs[pmi] = (char)ansi_ch; | ||
1227 | - mbs[pmi + 1] = '\0'; | 1230 | + strncpy(mbs, hSession->pending_mbs, hSession->pmi); |
1231 | + mbs[hSession->pmi] = (char) hSession->ansi_ch; | ||
1232 | + mbs[hSession->pmi + 1] = '\0'; | ||
1228 | 1233 | ||
1229 | ch = utf8_lookup(mbs, &fail, NULL); | 1234 | ch = utf8_lookup(mbs, &fail, NULL); |
1230 | - if (ch != 0) { | ||
1231 | - // Success! | ||
1232 | - ansi_ch = ch; | 1235 | + if (ch != 0) |
1236 | + { | ||
1237 | + // Success! | ||
1238 | + hSession->ansi_ch = ch; | ||
1233 | return ansi_printing(hSession, ig1, ig2); | 1239 | return ansi_printing(hSession, ig1, ig2); |
1234 | } | 1240 | } |
1235 | - if (fail == ULFAIL_INCOMPLETE) { | ||
1236 | - // Go get more. | ||
1237 | - pending_mbs[pmi++] = (char)ansi_ch; | 1241 | + |
1242 | + if (fail == ULFAIL_INCOMPLETE) | ||
1243 | + { | ||
1244 | + // Go get more. | ||
1245 | + hSession->pending_mbs[hSession->pmi++] = (char)hSession->ansi_ch; | ||
1238 | return MBPEND; | 1246 | return MBPEND; |
1239 | } | 1247 | } |
1240 | 1248 | ||
1241 | /* Failure. */ | 1249 | /* Failure. */ |
1242 | 1250 | ||
1243 | /* Replace the sequence with '?'. */ | 1251 | /* Replace the sequence with '?'. */ |
1244 | - ch = ansi_ch; /* save for later */ | ||
1245 | - pmi = 0; | ||
1246 | - ansi_ch = '?'; | 1252 | + ch = hSession->ansi_ch; /* save for later */ |
1253 | + hSession->pmi = 0; | ||
1254 | + hSession->ansi_ch = '?'; | ||
1247 | (void) ansi_printing(hSession, ig1, ig2); | 1255 | (void) ansi_printing(hSession, ig1, ig2); |
1248 | 1256 | ||
1249 | /* Reprocess whatever we choked on. */ | 1257 | /* Reprocess whatever we choked on. */ |
1250 | - ansi_ch = ch; | ||
1251 | - state = DATA; | ||
1252 | - fn = ansi_fn[st[(int)DATA][ansi_ch]]; | 1258 | + hSession->ansi_ch = ch; |
1259 | + hSession->state = DATA; | ||
1260 | + fn = ansi_fn[st[(int)DATA][hSession->ansi_ch]]; | ||
1253 | return (*fn)(hSession,n[0], n[1]); | 1261 | return (*fn)(hSession,n[0], n[1]); |
1254 | } | 1262 | } |
1255 | 1263 | ||
1256 | -static enum state | 1264 | +static enum lib3270_ansi_state |
1257 | ansi_semicolon(H3270 *hSession, int ig1 unused, int ig2 unused) | 1265 | ansi_semicolon(H3270 *hSession, int ig1 unused, int ig2 unused) |
1258 | { | 1266 | { |
1259 | if (nx >= NN) | 1267 | if (nx >= NN) |
1260 | return DATA; | 1268 | return DATA; |
1261 | nx++; | 1269 | nx++; |
1262 | - return state; | 1270 | + return hSession->state; |
1263 | } | 1271 | } |
1264 | 1272 | ||
1265 | -static enum state | 1273 | +static enum lib3270_ansi_state |
1266 | ansi_digit(H3270 *hSession, int ig1 unused, int ig2 unused) | 1274 | ansi_digit(H3270 *hSession, int ig1 unused, int ig2 unused) |
1267 | { | 1275 | { |
1268 | - n[nx] = (n[nx] * 10) + (ansi_ch - '0'); | ||
1269 | - return state; | 1276 | + n[nx] = (n[nx] * 10) + (hSession->ansi_ch - '0'); |
1277 | + return hSession->state; | ||
1270 | } | 1278 | } |
1271 | 1279 | ||
1272 | -static enum state | 1280 | +static enum lib3270_ansi_state |
1273 | ansi_reverse_index(H3270 *hSession, int ig1 unused, int ig2 unused) | 1281 | ansi_reverse_index(H3270 *hSession, int ig1 unused, int ig2 unused) |
1274 | { | 1282 | { |
1275 | int rr = hSession->cursor_addr / hSession->cols; /* current row */ | 1283 | int rr = hSession->cursor_addr / hSession->cols; /* current row */ |
@@ -1304,7 +1312,7 @@ ansi_reverse_index(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1304,7 +1312,7 @@ ansi_reverse_index(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1304 | return DATA; | 1312 | return DATA; |
1305 | } | 1313 | } |
1306 | 1314 | ||
1307 | -static enum state | 1315 | +static enum lib3270_ansi_state |
1308 | ansi_send_attributes(H3270 *hSession, int nn, int ig2 unused) | 1316 | ansi_send_attributes(H3270 *hSession, int nn, int ig2 unused) |
1309 | { | 1317 | { |
1310 | if (!nn) | 1318 | if (!nn) |
@@ -1312,13 +1320,13 @@ ansi_send_attributes(H3270 *hSession, int nn, int ig2 unused) | @@ -1312,13 +1320,13 @@ ansi_send_attributes(H3270 *hSession, int nn, int ig2 unused) | ||
1312 | return DATA; | 1320 | return DATA; |
1313 | } | 1321 | } |
1314 | 1322 | ||
1315 | -static enum state | 1323 | +static enum lib3270_ansi_state |
1316 | dec_return_terminal_id(H3270 *hSession, int ig1 unused, int ig2 unused) | 1324 | dec_return_terminal_id(H3270 *hSession, int ig1 unused, int ig2 unused) |
1317 | { | 1325 | { |
1318 | return ansi_send_attributes(hSession, 0, 0); | 1326 | return ansi_send_attributes(hSession, 0, 0); |
1319 | } | 1327 | } |
1320 | 1328 | ||
1321 | -static enum state | 1329 | +static enum lib3270_ansi_state |
1322 | ansi_set_mode(H3270 *hSession, int nn, int ig2 unused) | 1330 | ansi_set_mode(H3270 *hSession, int nn, int ig2 unused) |
1323 | { | 1331 | { |
1324 | switch (nn) | 1332 | switch (nn) |
@@ -1333,7 +1341,7 @@ ansi_set_mode(H3270 *hSession, int nn, int ig2 unused) | @@ -1333,7 +1341,7 @@ ansi_set_mode(H3270 *hSession, int nn, int ig2 unused) | ||
1333 | return DATA; | 1341 | return DATA; |
1334 | } | 1342 | } |
1335 | 1343 | ||
1336 | -static enum state | 1344 | +static enum lib3270_ansi_state |
1337 | ansi_reset_mode(H3270 *hSession, int nn, int ig2 unused) | 1345 | ansi_reset_mode(H3270 *hSession, int nn, int ig2 unused) |
1338 | { | 1346 | { |
1339 | switch (nn) | 1347 | switch (nn) |
@@ -1348,7 +1356,7 @@ ansi_reset_mode(H3270 *hSession, int nn, int ig2 unused) | @@ -1348,7 +1356,7 @@ ansi_reset_mode(H3270 *hSession, int nn, int ig2 unused) | ||
1348 | return DATA; | 1356 | return DATA; |
1349 | } | 1357 | } |
1350 | 1358 | ||
1351 | -static enum state | 1359 | +static enum lib3270_ansi_state |
1352 | ansi_status_report(H3270 *hSession, int nn, int ig2 unused) | 1360 | ansi_status_report(H3270 *hSession, int nn, int ig2 unused) |
1353 | { | 1361 | { |
1354 | static char cpr[11]; | 1362 | static char cpr[11]; |
@@ -1359,76 +1367,76 @@ ansi_status_report(H3270 *hSession, int nn, int ig2 unused) | @@ -1359,76 +1367,76 @@ ansi_status_report(H3270 *hSession, int nn, int ig2 unused) | ||
1359 | break; | 1367 | break; |
1360 | case 6: | 1368 | case 6: |
1361 | (void) sprintf(cpr, "\033[%d;%dR", | 1369 | (void) sprintf(cpr, "\033[%d;%dR", |
1362 | - (h3270.cursor_addr/h3270.cols) + 1, (h3270.cursor_addr%h3270.cols) + 1); | 1370 | + (hSession->cursor_addr/hSession->cols) + 1, (hSession->cursor_addr%hSession->cols) + 1); |
1363 | net_sends(cpr); | 1371 | net_sends(cpr); |
1364 | break; | 1372 | break; |
1365 | } | 1373 | } |
1366 | return DATA; | 1374 | return DATA; |
1367 | } | 1375 | } |
1368 | 1376 | ||
1369 | -static enum state | 1377 | +static enum lib3270_ansi_state |
1370 | ansi_cs_designate(H3270 *hSession, int ig1 unused, int ig2 unused) | 1378 | ansi_cs_designate(H3270 *hSession, int ig1 unused, int ig2 unused) |
1371 | { | 1379 | { |
1372 | - cs_to_change = strchr(gnnames, ansi_ch) - gnnames; | 1380 | + hSession->cs_to_change = strchr(gnnames, hSession->ansi_ch) - gnnames; |
1373 | return CSDES; | 1381 | return CSDES; |
1374 | } | 1382 | } |
1375 | 1383 | ||
1376 | -static enum state | 1384 | +static enum lib3270_ansi_state |
1377 | ansi_cs_designate2(H3270 *hSession, int ig1 unused, int ig2 unused) | 1385 | ansi_cs_designate2(H3270 *hSession, int ig1 unused, int ig2 unused) |
1378 | { | 1386 | { |
1379 | - csd[cs_to_change] = strchr(csnames, ansi_ch) - csnames; | 1387 | + hSession->csd[hSession->cs_to_change] = strchr(csnames, hSession->ansi_ch) - csnames; |
1380 | return DATA; | 1388 | return DATA; |
1381 | } | 1389 | } |
1382 | 1390 | ||
1383 | -static enum state | 1391 | +static enum lib3270_ansi_state |
1384 | ansi_select_g0(H3270 *hSession, int ig1 unused, int ig2 unused) | 1392 | ansi_select_g0(H3270 *hSession, int ig1 unused, int ig2 unused) |
1385 | { | 1393 | { |
1386 | - cset = CS_G0; | 1394 | + hSession->cset = CS_G0; |
1387 | return DATA; | 1395 | return DATA; |
1388 | } | 1396 | } |
1389 | 1397 | ||
1390 | -static enum state | 1398 | +static enum lib3270_ansi_state |
1391 | ansi_select_g1(H3270 *hSession, int ig1 unused, int ig2 unused) | 1399 | ansi_select_g1(H3270 *hSession, int ig1 unused, int ig2 unused) |
1392 | { | 1400 | { |
1393 | - cset = CS_G1; | 1401 | + hSession->cset = CS_G1; |
1394 | return DATA; | 1402 | return DATA; |
1395 | } | 1403 | } |
1396 | 1404 | ||
1397 | -static enum state | 1405 | +static enum lib3270_ansi_state |
1398 | ansi_select_g2(H3270 *hSession, int ig1 unused, int ig2 unused) | 1406 | ansi_select_g2(H3270 *hSession, int ig1 unused, int ig2 unused) |
1399 | { | 1407 | { |
1400 | - cset = CS_G2; | 1408 | + hSession->cset = CS_G2; |
1401 | return DATA; | 1409 | return DATA; |
1402 | } | 1410 | } |
1403 | 1411 | ||
1404 | -static enum state | 1412 | +static enum lib3270_ansi_state |
1405 | ansi_select_g3(H3270 *hSession, int ig1 unused, int ig2 unused) | 1413 | ansi_select_g3(H3270 *hSession, int ig1 unused, int ig2 unused) |
1406 | { | 1414 | { |
1407 | - cset = CS_G3; | 1415 | + hSession->cset = CS_G3; |
1408 | return DATA; | 1416 | return DATA; |
1409 | } | 1417 | } |
1410 | 1418 | ||
1411 | -static enum state | 1419 | +static enum lib3270_ansi_state |
1412 | ansi_one_g2(H3270 *hSession, int ig1 unused, int ig2 unused) | 1420 | ansi_one_g2(H3270 *hSession, int ig1 unused, int ig2 unused) |
1413 | { | 1421 | { |
1414 | hSession->once_cset = CS_G2; | 1422 | hSession->once_cset = CS_G2; |
1415 | return DATA; | 1423 | return DATA; |
1416 | } | 1424 | } |
1417 | 1425 | ||
1418 | -static enum state | 1426 | +static enum lib3270_ansi_state |
1419 | ansi_one_g3(H3270 *hSession, int ig1 unused, int ig2 unused) | 1427 | ansi_one_g3(H3270 *hSession, int ig1 unused, int ig2 unused) |
1420 | { | 1428 | { |
1421 | hSession->once_cset = CS_G3; | 1429 | hSession->once_cset = CS_G3; |
1422 | return DATA; | 1430 | return DATA; |
1423 | } | 1431 | } |
1424 | 1432 | ||
1425 | -static enum state | 1433 | +static enum lib3270_ansi_state |
1426 | ansi_esc3(H3270 *hSession, int ig1 unused, int ig2 unused) | 1434 | ansi_esc3(H3270 *hSession, int ig1 unused, int ig2 unused) |
1427 | { | 1435 | { |
1428 | return DECP; | 1436 | return DECP; |
1429 | } | 1437 | } |
1430 | 1438 | ||
1431 | -static enum state | 1439 | +static enum lib3270_ansi_state |
1432 | dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) | 1440 | dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) |
1433 | { | 1441 | { |
1434 | int i; | 1442 | int i; |
@@ -1440,13 +1448,13 @@ dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1440,13 +1448,13 @@ dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1440 | hSession->appl_cursor = 1; | 1448 | hSession->appl_cursor = 1; |
1441 | break; | 1449 | break; |
1442 | case 2: /* set G0-G3 */ | 1450 | case 2: /* set G0-G3 */ |
1443 | - csd[0] = csd[1] = csd[2] = csd[3] = CSD_US; | 1451 | + hSession->csd[0] = hSession->csd[1] = hSession->csd[2] = hSession->csd[3] = CSD_US; |
1444 | break; | 1452 | break; |
1445 | case 3: /* 132-column mode */ | 1453 | case 3: /* 132-column mode */ |
1446 | - if (hSession->allow_wide_mode) | 1454 | + if(hSession->allow_wide_mode) |
1447 | { | 1455 | { |
1448 | hSession->wide_mode = 1; | 1456 | hSession->wide_mode = 1; |
1449 | - screen_132(); | 1457 | + hSession->set_width(hSession,132); |
1450 | } | 1458 | } |
1451 | break; | 1459 | break; |
1452 | case 7: /* wraparound mode */ | 1460 | case 7: /* wraparound mode */ |
@@ -1465,7 +1473,7 @@ dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1465,7 +1473,7 @@ dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1465 | return DATA; | 1473 | return DATA; |
1466 | } | 1474 | } |
1467 | 1475 | ||
1468 | -static enum state | 1476 | +static enum lib3270_ansi_state |
1469 | dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) | 1477 | dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) |
1470 | { | 1478 | { |
1471 | int i; | 1479 | int i; |
@@ -1480,7 +1488,7 @@ dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1480,7 +1488,7 @@ dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1480 | if (hSession->allow_wide_mode) | 1488 | if (hSession->allow_wide_mode) |
1481 | { | 1489 | { |
1482 | hSession->wide_mode = 0; | 1490 | hSession->wide_mode = 0; |
1483 | - screen_80(); | 1491 | + hSession->set_width(hSession,80); |
1484 | } | 1492 | } |
1485 | break; | 1493 | break; |
1486 | case 7: /* no wraparound mode */ | 1494 | case 7: /* no wraparound mode */ |
@@ -1499,7 +1507,7 @@ dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1499,7 +1507,7 @@ dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1499 | return DATA; | 1507 | return DATA; |
1500 | } | 1508 | } |
1501 | 1509 | ||
1502 | -static enum state dec_save(H3270 *hSession, int ig1 unused, int ig2 unused) | 1510 | +static enum lib3270_ansi_state dec_save(H3270 *hSession, int ig1 unused, int ig2 unused) |
1503 | { | 1511 | { |
1504 | int i; | 1512 | int i; |
1505 | 1513 | ||
@@ -1528,7 +1536,7 @@ static enum state dec_save(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1528,7 +1536,7 @@ static enum state dec_save(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1528 | return DATA; | 1536 | return DATA; |
1529 | } | 1537 | } |
1530 | 1538 | ||
1531 | -static enum state | 1539 | +static enum lib3270_ansi_state |
1532 | dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) | 1540 | dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) |
1533 | { | 1541 | { |
1534 | int i; | 1542 | int i; |
@@ -1543,10 +1551,7 @@ dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1543,10 +1551,7 @@ dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1543 | if (hSession->allow_wide_mode) | 1551 | if (hSession->allow_wide_mode) |
1544 | { | 1552 | { |
1545 | hSession->wide_mode = hSession->saved_wide_mode; | 1553 | hSession->wide_mode = hSession->saved_wide_mode; |
1546 | - if (hSession->wide_mode) | ||
1547 | - screen_132(); | ||
1548 | - else | ||
1549 | - screen_80(); | 1554 | + hSession->set_width(hSession,hSession->wide_mode ? 132 : 80); |
1550 | } | 1555 | } |
1551 | break; | 1556 | break; |
1552 | case 7: /* wraparound mode */ | 1557 | case 7: /* wraparound mode */ |
@@ -1565,7 +1570,7 @@ dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1565,7 +1570,7 @@ dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1565 | return DATA; | 1570 | return DATA; |
1566 | } | 1571 | } |
1567 | 1572 | ||
1568 | -static enum state | 1573 | +static enum lib3270_ansi_state |
1569 | dec_scrolling_region(H3270 *hSession, int top, int bottom) | 1574 | dec_scrolling_region(H3270 *hSession, int top, int bottom) |
1570 | { | 1575 | { |
1571 | if (top < 1) | 1576 | if (top < 1) |
@@ -1587,7 +1592,7 @@ dec_scrolling_region(H3270 *hSession, int top, int bottom) | @@ -1587,7 +1592,7 @@ dec_scrolling_region(H3270 *hSession, int top, int bottom) | ||
1587 | return DATA; | 1592 | return DATA; |
1588 | } | 1593 | } |
1589 | 1594 | ||
1590 | -static enum state | 1595 | +static enum lib3270_ansi_state |
1591 | xterm_text_mode(H3270 *hSession, int ig1 unused, int ig2 unused) | 1596 | xterm_text_mode(H3270 *hSession, int ig1 unused, int ig2 unused) |
1592 | { | 1597 | { |
1593 | nx = 0; | 1598 | nx = 0; |
@@ -1595,22 +1600,22 @@ xterm_text_mode(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1595,22 +1600,22 @@ xterm_text_mode(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1595 | return TEXT; | 1600 | return TEXT; |
1596 | } | 1601 | } |
1597 | 1602 | ||
1598 | -static enum state | 1603 | +static enum lib3270_ansi_state |
1599 | xterm_text_semicolon(H3270 *hSession, int ig1 unused, int ig2 unused) | 1604 | xterm_text_semicolon(H3270 *hSession, int ig1 unused, int ig2 unused) |
1600 | { | 1605 | { |
1601 | tx = 0; | 1606 | tx = 0; |
1602 | return TEXT2; | 1607 | return TEXT2; |
1603 | } | 1608 | } |
1604 | 1609 | ||
1605 | -static enum state | 1610 | +static enum lib3270_ansi_state |
1606 | xterm_text(H3270 *hSession, int ig1 unused, int ig2 unused) | 1611 | xterm_text(H3270 *hSession, int ig1 unused, int ig2 unused) |
1607 | { | 1612 | { |
1608 | if (tx < NT) | 1613 | if (tx < NT) |
1609 | - text[tx++] = ansi_ch; | ||
1610 | - return state; | 1614 | + text[tx++] = hSession->ansi_ch; |
1615 | + return hSession->state; | ||
1611 | } | 1616 | } |
1612 | 1617 | ||
1613 | -static enum state | 1618 | +static enum lib3270_ansi_state |
1614 | xterm_text_do(H3270 *hSession, int ig1 unused, int ig2 unused) | 1619 | xterm_text_do(H3270 *hSession, int ig1 unused, int ig2 unused) |
1615 | { | 1620 | { |
1616 | /* | 1621 | /* |
@@ -1654,16 +1659,16 @@ xterm_text_do(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1654,16 +1659,16 @@ xterm_text_do(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
1654 | return DATA; | 1659 | return DATA; |
1655 | } | 1660 | } |
1656 | 1661 | ||
1657 | -static enum state | 1662 | +static enum lib3270_ansi_state |
1658 | ansi_htab_set(H3270 *hSession, int ig1 unused, int ig2 unused) | 1663 | ansi_htab_set(H3270 *hSession, int ig1 unused, int ig2 unused) |
1659 | { | 1664 | { |
1660 | register int col = hSession->cursor_addr % hSession->cols; | 1665 | register int col = hSession->cursor_addr % hSession->cols; |
1661 | 1666 | ||
1662 | - tabs[col/8] |= 1<<(col%8); | 1667 | + hSession->tabs[col/8] |= 1<<(col%8); |
1663 | return DATA; | 1668 | return DATA; |
1664 | } | 1669 | } |
1665 | 1670 | ||
1666 | -static enum state | 1671 | +static enum lib3270_ansi_state |
1667 | ansi_htab_clear(H3270 *hSession, int nn, int ig2 unused) | 1672 | ansi_htab_clear(H3270 *hSession, int nn, int ig2 unused) |
1668 | { | 1673 | { |
1669 | register int col, i; | 1674 | register int col, i; |
@@ -1672,11 +1677,11 @@ ansi_htab_clear(H3270 *hSession, int nn, int ig2 unused) | @@ -1672,11 +1677,11 @@ ansi_htab_clear(H3270 *hSession, int nn, int ig2 unused) | ||
1672 | { | 1677 | { |
1673 | case 0: | 1678 | case 0: |
1674 | col = hSession->cursor_addr % hSession->cols; | 1679 | col = hSession->cursor_addr % hSession->cols; |
1675 | - tabs[col/8] &= ~(1<<(col%8)); | 1680 | + hSession->tabs[col/8] &= ~(1<<(col%8)); |
1676 | break; | 1681 | break; |
1677 | case 3: | 1682 | case 3: |
1678 | for (i = 0; i < (hSession->cols+7)/8; i++) | 1683 | for (i = 0; i < (hSession->cols+7)/8; i++) |
1679 | - tabs[i] = 0; | 1684 | + hSession->tabs[i] = 0; |
1680 | break; | 1685 | break; |
1681 | } | 1686 | } |
1682 | return DATA; | 1687 | return DATA; |
@@ -1692,7 +1697,7 @@ static void ansi_scroll(H3270 *hSession) | @@ -1692,7 +1697,7 @@ static void ansi_scroll(H3270 *hSession) | ||
1692 | /* Save the top line */ | 1697 | /* Save the top line */ |
1693 | if (hSession->scroll_top == 1 && hSession->scroll_bottom == hSession->rows) | 1698 | if (hSession->scroll_top == 1 && hSession->scroll_bottom == hSession->rows) |
1694 | { | 1699 | { |
1695 | -// if (!h3270.is_altbuffer) | 1700 | +// if (!hSession->is_altbuffer) |
1696 | // scroll_save(1, False); | 1701 | // scroll_save(1, False); |
1697 | ctlr_scroll(hSession); | 1702 | ctlr_scroll(hSession); |
1698 | return; | 1703 | return; |
@@ -1738,7 +1743,7 @@ ansi_process(H3270 *hSession, unsigned int c) | @@ -1738,7 +1743,7 @@ ansi_process(H3270 *hSession, unsigned int c) | ||
1738 | afn_t fn; | 1743 | afn_t fn; |
1739 | 1744 | ||
1740 | c &= 0xff; | 1745 | c &= 0xff; |
1741 | - ansi_ch = c; | 1746 | + hSession->ansi_ch = c; |
1742 | 1747 | ||
1743 | // scroll_to_bottom(); | 1748 | // scroll_to_bottom(); |
1744 | 1749 | ||
@@ -1747,7 +1752,7 @@ ansi_process(H3270 *hSession, unsigned int c) | @@ -1747,7 +1752,7 @@ ansi_process(H3270 *hSession, unsigned int c) | ||
1747 | trace_char(hSession,(char)c); | 1752 | trace_char(hSession,(char)c); |
1748 | #endif /*]*/ | 1753 | #endif /*]*/ |
1749 | 1754 | ||
1750 | - fn = ansi_fn[st[(int)state][c]]; | 1755 | + fn = ansi_fn[st[(int)hSession->state][c]]; |
1751 | 1756 | ||
1752 | #if defined(X3270_DBCS) /*[*/ | 1757 | #if defined(X3270_DBCS) /*[*/ |
1753 | if (mb_pending && fn != &ansi_printing) | 1758 | if (mb_pending && fn != &ansi_printing) |
@@ -1759,7 +1764,7 @@ ansi_process(H3270 *hSession, unsigned int c) | @@ -1759,7 +1764,7 @@ ansi_process(H3270 *hSession, unsigned int c) | ||
1759 | } | 1764 | } |
1760 | #endif /*]*/ | 1765 | #endif /*]*/ |
1761 | 1766 | ||
1762 | - state = (*fn)(hSession, n[0], n[1]); | 1767 | + hSession->state = (*fn)(hSession, n[0], n[1]); |
1763 | } | 1768 | } |
1764 | 1769 | ||
1765 | void | 1770 | void |
src/lib3270/screenc.h
1 | /* | 1 | /* |
2 | - * Copyright 1999, 2000, 2002 by Paul Mattes. | ||
3 | - * Permission to use, copy, modify, and distribute this software and its | ||
4 | - * documentation for any purpose and without fee is hereby granted, | ||
5 | - * provided that the above copyright notice appear in all copies and that | ||
6 | - * both that copyright notice and this permission notice appear in | ||
7 | - * supporting documentation. | ||
8 | - * | ||
9 | - * c3270 is distributed in the hope that it will be useful, but WITHOUT ANY | ||
10 | - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
11 | - * FOR A PARTICULAR PURPOSE. See the file LICENSE for more details. | 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como screenc.h e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * licinio@bb.com.br (Licínio Luis Branco) | ||
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | ||
29 | + * | ||
12 | */ | 30 | */ |
13 | 31 | ||
14 | #ifndef SCREENC_H_INCLUDED | 32 | #ifndef SCREENC_H_INCLUDED |
@@ -23,11 +41,11 @@ | @@ -23,11 +41,11 @@ | ||
23 | #define display_width() 1 | 41 | #define display_width() 1 |
24 | // #define screen_obscured() False | 42 | // #define screen_obscured() False |
25 | // #define screen_scroll() screen_disp() | 43 | // #define screen_scroll() screen_disp() |
26 | -#define screen_132() /* */ | ||
27 | -#define screen_80() /* */ | 44 | +// #define screen_132() /* */ |
45 | +// #define screen_80() /* */ | ||
28 | 46 | ||
29 | LIB3270_INTERNAL int screen_init(H3270 *session); | 47 | LIB3270_INTERNAL int screen_init(H3270 *session); |
30 | -LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname); | 48 | +// LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname); |
31 | LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m); | 49 | LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m); |
32 | 50 | ||
33 | #define mcursor_locked(x) mcursor_set(x,CURSOR_MODE_LOCKED) | 51 | #define mcursor_locked(x) mcursor_set(x,CURSOR_MODE_LOCKED) |
src/lib3270/session.c
@@ -157,11 +157,17 @@ static void screen_disp(H3270 *session) | @@ -157,11 +157,17 @@ static void screen_disp(H3270 *session) | ||
157 | screen_update(session,0,session->rows*session->cols); | 157 | screen_update(session,0,session->rows*session->cols); |
158 | } | 158 | } |
159 | 159 | ||
160 | +static void set_width(H3270 *session, int width) | ||
161 | +{ | ||
162 | + return; | ||
163 | +} | ||
164 | + | ||
160 | static void lib3270_session_init(H3270 *hSession, const char *model) | 165 | static void lib3270_session_init(H3270 *hSession, const char *model) |
161 | { | 166 | { |
162 | int ovc, ovr; | 167 | int ovc, ovr; |
163 | char junk; | 168 | char junk; |
164 | int model_number; | 169 | int model_number; |
170 | + int f; | ||
165 | 171 | ||
166 | memset(hSession,0,sizeof(H3270)); | 172 | memset(hSession,0,sizeof(H3270)); |
167 | hSession->sz = sizeof(H3270); | 173 | hSession->sz = sizeof(H3270); |
@@ -184,6 +190,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -184,6 +190,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
184 | hSession->message = message; | 190 | hSession->message = message; |
185 | hSession->update_ssl = update_ssl; | 191 | hSession->update_ssl = update_ssl; |
186 | hSession->display = screen_disp; | 192 | hSession->display = screen_disp; |
193 | + hSession->set_width = set_width; | ||
187 | 194 | ||
188 | // Set the defaults. | 195 | // Set the defaults. |
189 | hSession->extended = 1; | 196 | hSession->extended = 1; |
@@ -207,7 +214,10 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -207,7 +214,10 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
207 | hSession->wraparound_mode = 1; | 214 | hSession->wraparound_mode = 1; |
208 | hSession->saved_wraparound_mode = 1; | 215 | hSession->saved_wraparound_mode = 1; |
209 | hSession->once_cset = -1; | 216 | hSession->once_cset = -1; |
217 | + hSession->state = LIB3270_ANSI_STATE_DATA; | ||
210 | 218 | ||
219 | + for(f=0;f<4;f++) | ||
220 | + hSession->csd[f] = hSession->saved_csd[f] = LIB3270_ANSI_CSD_US; | ||
211 | 221 | ||
212 | #ifdef _WIN32 | 222 | #ifdef _WIN32 |
213 | hSession->sockEvent = NULL; | 223 | hSession->sockEvent = NULL; |