Commit 765a141dc153d2a79bf3b5f1e04fdfa2bbe1f04f
1 parent
fae7d9d2
Exists in
master
and in
3 other branches
Movendo mais "statics" para a estrutura de sessao, simplificando chamadas
Showing
9 changed files
with
104 additions
and
188 deletions
Show diff stats
| ... | ... | @@ -306,45 +306,6 @@ |
| 306 | 306 | |
| 307 | 307 | #define CHAR_ATTR_UNCONVERTED CHAR_ATTR_CG |
| 308 | 308 | |
| 309 | -/* | |
| 310 | - struct lib3270_screen_callbacks | |
| 311 | - { | |
| 312 | - unsigned short sz; | |
| 313 | - | |
| 314 | - int (*init)(void); | |
| 315 | - int (*notify)(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg); | |
| 316 | - void (*model_changed)(H3270 *session, const char *name, int model, int rows, int cols); | |
| 317 | - int (*addch)(int row, int col, unsigned char c, unsigned short attr); | |
| 318 | - void (*charset)(char *dcs); | |
| 319 | - void (*title)(char *text); | |
| 320 | - void (*ring_bell)(void); | |
| 321 | - void (*redraw)(void); | |
| 322 | - void (*move_cursor)(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); | |
| 323 | - int (*set_suspended)(int state); | |
| 324 | - void (*set_script)(SCRIPT_STATE state); | |
| 325 | - void (*reset)(int lock); | |
| 326 | - void (*status)(H3270 *session, LIB3270_STATUS id); | |
| 327 | - void (*cursor)(H3270 *session, LIB3270_CURSOR mode); | |
| 328 | - void (*lu)(H3270 *session, const char *lu); | |
| 329 | - void (*set_oia)(H3270 *session, OIA_FLAG id, unsigned char on); | |
| 330 | - | |
| 331 | - void (*erase)(H3270 *session); | |
| 332 | - void (*display)(H3270 *session); | |
| 333 | - void (*set_viewsize)(H3270 *session, unsigned short rows, unsigned short cols); | |
| 334 | - | |
| 335 | - | |
| 336 | - void (*toggle_changed)(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name); | |
| 337 | - void (*show_timer)(long seconds); | |
| 338 | - | |
| 339 | - // Console/Trace window | |
| 340 | - HCONSOLE (*console_new)(const char *title, const char *label); | |
| 341 | - void (*console_delete)(HCONSOLE hwnd); | |
| 342 | - int (*console_append)(HCONSOLE hwnd, const char *fmt, va_list args); | |
| 343 | - char * (*console_entry)(HCONSOLE hwnd); | |
| 344 | - | |
| 345 | - }; | |
| 346 | -*/ | |
| 347 | - | |
| 348 | 309 | struct lib3270_option |
| 349 | 310 | { |
| 350 | 311 | const char *name; |
| ... | ... | @@ -392,7 +353,7 @@ |
| 392 | 353 | |
| 393 | 354 | |
| 394 | 355 | LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr); |
| 395 | - LOCAL_EXTERN int screen_read(char *dest, int baddr, int count); | |
| 356 | +// LOCAL_EXTERN int screen_read(char *dest, int baddr, int count); | |
| 396 | 357 | LOCAL_EXTERN void Input_String(const unsigned char *str); |
| 397 | 358 | LOCAL_EXTERN void screen_size(int *rows, int *cols); |
| 398 | 359 | |
| ... | ... | @@ -432,8 +393,8 @@ |
| 432 | 393 | // LOCAL_EXTERN int ctlr_get_rows(void) __attribute__ ((deprecated)); |
| 433 | 394 | |
| 434 | 395 | /* Screen calls */ |
| 435 | - LOCAL_EXTERN void screen_resume(H3270 *session); | |
| 436 | - LOCAL_EXTERN void screen_suspend(H3270 *session); | |
| 396 | +// LOCAL_EXTERN void screen_resume(H3270 *session); | |
| 397 | +// LOCAL_EXTERN void screen_suspend(H3270 *session); | |
| 437 | 398 | LOCAL_EXTERN void screen_disp(H3270 *session); |
| 438 | 399 | |
| 439 | 400 | /* Cursor calls */ | ... | ... |
ctlr.c
| ... | ... | @@ -90,7 +90,7 @@ unsigned char crm_attr[16]; |
| 90 | 90 | Boolean dbcs = False; |
| 91 | 91 | |
| 92 | 92 | /* Statics */ |
| 93 | -static struct ea *aea_buf; /* alternate 3270 extended attribute buffer */ | |
| 93 | +// static struct ea *aea_buf; /* alternate 3270 extended attribute buffer */ | |
| 94 | 94 | static unsigned char *zero_buf; // empty buffer, for area clears |
| 95 | 95 | static void set_formatted(H3270 *session); |
| 96 | 96 | static void ctlr_blanks(void); |
| ... | ... | @@ -174,7 +174,7 @@ void ctlr_reinit(H3270 *session, unsigned cmask) |
| 174 | 174 | session->ea_buf = tmp + 1; |
| 175 | 175 | |
| 176 | 176 | session->buffer[1] = tmp = lib3270_calloc(sizeof(struct ea),sz+1,session->buffer[1]); |
| 177 | - aea_buf = tmp + 1; | |
| 177 | + session->aea_buf = tmp + 1; | |
| 178 | 178 | |
| 179 | 179 | session->text = lib3270_calloc(sizeof(struct lib3270_text),sz,session->text); |
| 180 | 180 | |
| ... | ... | @@ -1945,8 +1945,7 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) |
| 1945 | 1945 | /* Some hosts forget they're talking SSCP-LU. */ |
| 1946 | 1946 | cp++; |
| 1947 | 1947 | i++; |
| 1948 | - trace_ds(" StartField%s %s [translated to space]\n", | |
| 1949 | - rcba(buffer_addr), see_attr(*cp)); | |
| 1948 | + trace_ds(" StartField%s %s [translated to space]\n",rcba(buffer_addr), see_attr(*cp)); | |
| 1950 | 1949 | ctlr_add(buffer_addr, EBC_space, default_cs); |
| 1951 | 1950 | ctlr_add_fg(buffer_addr, default_fg); |
| 1952 | 1951 | ctlr_add_bg(buffer_addr, default_bg); |
| ... | ... | @@ -2619,20 +2618,20 @@ void changed(H3270 *session, int bstart, int bend) |
| 2619 | 2618 | */ |
| 2620 | 2619 | void ctlr_altbuffer(H3270 *session, int alt) |
| 2621 | 2620 | { |
| 2622 | - struct ea *etmp; | |
| 2623 | - | |
| 2624 | 2621 | CHECK_SESSION_HANDLE(session); |
| 2625 | 2622 | |
| 2626 | 2623 | if (alt != session->is_altbuffer) |
| 2627 | 2624 | { |
| 2625 | + struct ea *etmp; | |
| 2628 | 2626 | |
| 2629 | 2627 | etmp = session->ea_buf; |
| 2630 | - session->ea_buf = aea_buf; | |
| 2631 | - aea_buf = etmp; | |
| 2628 | + session->ea_buf = session->aea_buf; | |
| 2629 | + session->aea_buf = etmp; | |
| 2632 | 2630 | |
| 2633 | 2631 | session->is_altbuffer = alt; |
| 2632 | + lib3270_unselect(session); | |
| 2633 | + | |
| 2634 | 2634 | ALL_CHANGED; |
| 2635 | - // unselect(0, ROWS*COLS); | |
| 2636 | 2635 | |
| 2637 | 2636 | /* |
| 2638 | 2637 | * There may be blinkers on the alternate screen; schedule one | ... | ... |
init.c
| ... | ... | @@ -77,17 +77,30 @@ void lib3270_session_free(H3270 *h) |
| 77 | 77 | |
| 78 | 78 | static void update_char(H3270 *session, int addr, unsigned char chr, unsigned short attr, unsigned char cursor) |
| 79 | 79 | { |
| 80 | - | |
| 81 | 80 | } |
| 82 | 81 | |
| 83 | 82 | static void nop_char(H3270 *session, unsigned char chr) |
| 84 | 83 | { |
| 85 | - | |
| 86 | 84 | } |
| 87 | 85 | |
| 88 | 86 | static void nop(H3270 *session) |
| 89 | 87 | { |
| 88 | +} | |
| 90 | 89 | |
| 90 | +static void update_model(H3270 *session, const char *name, int model, int rows, int cols) | |
| 91 | +{ | |
| 92 | +} | |
| 93 | + | |
| 94 | +static void changed(H3270 *session, int bstart, int bend) | |
| 95 | +{ | |
| 96 | +} | |
| 97 | + | |
| 98 | +static void update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr) | |
| 99 | +{ | |
| 100 | +} | |
| 101 | + | |
| 102 | +static void update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | |
| 103 | +{ | |
| 91 | 104 | } |
| 92 | 105 | |
| 93 | 106 | static void lib3270_session_init(H3270 *hSession, const char *model) |
| ... | ... | @@ -99,10 +112,17 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
| 99 | 112 | memset(hSession,0,sizeof(H3270)); |
| 100 | 113 | hSession->sz = sizeof(H3270); |
| 101 | 114 | |
| 102 | - // A few dummy calls to avoid "ifs" | |
| 115 | + // Dummy calls to avoid "ifs" | |
| 103 | 116 | hSession->update = update_char; |
| 117 | + hSession->update_model = update_model; | |
| 118 | + hSession->update_cursor = update_cursor; | |
| 104 | 119 | hSession->set_selection = nop_char; |
| 105 | 120 | hSession->ctlr_done = nop; |
| 121 | + hSession->changed = changed; | |
| 122 | + hSession->erase = screen_disp; | |
| 123 | + hSession->suspend = nop; | |
| 124 | + hSession->resume = screen_disp; | |
| 125 | + hSession->update_oia = update_oia; | |
| 106 | 126 | |
| 107 | 127 | hSession->sock = -1; |
| 108 | 128 | hSession->model_num = -1; | ... | ... |
kybd.c
| ... | ... | @@ -1750,10 +1750,9 @@ do_delete(void) |
| 1750 | 1750 | |
| 1751 | 1751 | LIB3270_ACTION( delete ) |
| 1752 | 1752 | { |
| 1753 | -// reset_idle_timer(); | |
| 1754 | - if (kybdlock) { | |
| 1753 | + if (kybdlock) | |
| 1754 | + { | |
| 1755 | 1755 | ENQUEUE_ACTION(lib3270_delete); |
| 1756 | -// enq_ta(Delete_action, CN, CN); | |
| 1757 | 1756 | return 0; |
| 1758 | 1757 | } |
| 1759 | 1758 | #if defined(X3270_ANSI) /*[*/ |
| ... | ... | @@ -1781,8 +1780,8 @@ LIB3270_ACTION( delete ) |
| 1781 | 1780 | */ |
| 1782 | 1781 | LIB3270_ACTION( backspace ) |
| 1783 | 1782 | { |
| 1784 | -// reset_idle_timer(); | |
| 1785 | - if (kybdlock) { | |
| 1783 | + if (kybdlock) | |
| 1784 | + { | |
| 1786 | 1785 | ENQUEUE_ACTION( lib3270_backspace ); |
| 1787 | 1786 | return 0; |
| 1788 | 1787 | } |
| ... | ... | @@ -2316,13 +2315,12 @@ LIB3270_CURSOR_ACTION( newline ) |
| 2316 | 2315 | |
| 2317 | 2316 | /* |
| 2318 | 2317 | * DUP key |
| 2319 | - */ /* | |
| 2320 | -void | |
| 2321 | -Dup_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | |
| 2318 | + */ | |
| 2319 | +LIB3270_ACTION( dup ) | |
| 2322 | 2320 | { |
| 2323 | -// reset_idle_timer(); | |
| 2324 | - if (kybdlock) { | |
| 2325 | - enq_ta(Dup_action, CN, CN); | |
| 2321 | + if (kybdlock) | |
| 2322 | + { | |
| 2323 | + ENQUEUE_ACTION(lib3270_enter); | |
| 2326 | 2324 | return; |
| 2327 | 2325 | } |
| 2328 | 2326 | #if defined(X3270_ANSI) |
| ... | ... | @@ -2330,10 +2328,9 @@ Dup_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) |
| 2330 | 2328 | return; |
| 2331 | 2329 | #endif |
| 2332 | 2330 | if (key_Character(EBC_dup, False, False, NULL)) |
| 2333 | - cursor_move(next_unprotected(h3270.cursor_addr)); | |
| 2331 | + cursor_move(next_unprotected(hSession->cursor_addr)); | |
| 2334 | 2332 | } |
| 2335 | -*/ | |
| 2336 | - | |
| 2333 | + | |
| 2337 | 2334 | /* |
| 2338 | 2335 | * FM key |
| 2339 | 2336 | */ /* | ... | ... |
macros.c
| ... | ... | @@ -104,8 +104,9 @@ |
| 104 | 104 | |
| 105 | 105 | LIB3270_MACRO( get ) |
| 106 | 106 | { |
| 107 | - int start, qtd, rows, cols, row, col; | |
| 108 | 107 | char *buffer = NULL; |
| 108 | +/* | |
| 109 | + int start, qtd, rows, cols, row, col; | |
| 109 | 110 | |
| 110 | 111 | switch(argc) |
| 111 | 112 | { |
| ... | ... | @@ -167,6 +168,7 @@ |
| 167 | 168 | buffer = malloc(qtd+1); |
| 168 | 169 | screen_read(buffer, start, qtd); |
| 169 | 170 | |
| 171 | +*/ | |
| 170 | 172 | return buffer; |
| 171 | 173 | } |
| 172 | 174 | ... | ... |
paste.c
| ... | ... | @@ -190,7 +190,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) |
| 190 | 190 | if(kybdlock) |
| 191 | 191 | return -EINVAL; |
| 192 | 192 | |
| 193 | - screen_suspend(h); | |
| 193 | + h->suspend(h); | |
| 194 | 194 | |
| 195 | 195 | while(*str && last && !kybdlock && h->cursor_addr >= data.orig_addr) |
| 196 | 196 | { |
| ... | ... | @@ -230,7 +230,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - screen_resume(h); | |
| 233 | + h->resume(h); | |
| 234 | 234 | return data.qtd; |
| 235 | 235 | } |
| 236 | 236 | ... | ... |
screen.c
| ... | ... | @@ -96,9 +96,7 @@ static void addch(H3270 *session, int baddr, unsigned char c, unsigned short att |
| 96 | 96 | /* Converted char has changed, update it */ |
| 97 | 97 | session->text[baddr].chr = c; |
| 98 | 98 | session->text[baddr].attr = attr; |
| 99 | - | |
| 100 | - if(session->update) | |
| 101 | - session->update(session,baddr,c,attr,baddr == session->cursor_addr); | |
| 99 | + session->update(session,baddr,c,attr,baddr == session->cursor_addr); | |
| 102 | 100 | } |
| 103 | 101 | |
| 104 | 102 | /** |
| ... | ... | @@ -116,16 +114,12 @@ int screen_init(H3270 *session) |
| 116 | 114 | lib3270_register_schange(session,ST_3270_MODE, status_3270_mode,0); |
| 117 | 115 | lib3270_register_schange(session,ST_PRINTER, status_printer,0); |
| 118 | 116 | |
| 119 | -// lib3270_register_schange(session,ST_HALF_CONNECT, relabel,0); | |
| 120 | -// lib3270_register_schange(session,ST_CONNECT, relabel,0); | |
| 121 | -// lib3270_register_schange(session,ST_3270_MODE, relabel,0); | |
| 122 | - | |
| 123 | 117 | /* Set up the controller. */ |
| 124 | 118 | ctlr_init(session,-1); |
| 125 | 119 | ctlr_reinit(session,-1); |
| 126 | 120 | |
| 127 | 121 | /* Finish screen initialization. */ |
| 128 | - screen_suspend(session); | |
| 122 | + session->suspend(session); | |
| 129 | 123 | |
| 130 | 124 | return 0; |
| 131 | 125 | } |
| ... | ... | @@ -143,7 +137,7 @@ static unsigned short color_from_fa(unsigned char fa) |
| 143 | 137 | /* |
| 144 | 138 | * Find the display attributes for a baddr, fa_addr and fa. |
| 145 | 139 | */ |
| 146 | -static unsigned short calc_attrs(int baddr, int fa_addr, int fa) | |
| 140 | +static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa) | |
| 147 | 141 | { |
| 148 | 142 | unsigned short fg=0, bg=0, a; |
| 149 | 143 | int gr; |
| ... | ... | @@ -152,10 +146,10 @@ static unsigned short calc_attrs(int baddr, int fa_addr, int fa) |
| 152 | 146 | |
| 153 | 147 | /* Monochrome is easy, and so is color if nothing is specified. */ |
| 154 | 148 | if (!appres.m3279 || |
| 155 | - (!h3270.ea_buf[baddr].fg && | |
| 156 | - !h3270.ea_buf[fa_addr].fg && | |
| 157 | - !h3270.ea_buf[baddr].bg && | |
| 158 | - !h3270.ea_buf[fa_addr].bg)) | |
| 149 | + (!session->ea_buf[baddr].fg && | |
| 150 | + !session->ea_buf[fa_addr].fg && | |
| 151 | + !session->ea_buf[baddr].bg && | |
| 152 | + !session->ea_buf[fa_addr].bg)) | |
| 159 | 153 | { |
| 160 | 154 | a = color_from_fa(fa); |
| 161 | 155 | } |
| ... | ... | @@ -163,23 +157,23 @@ static unsigned short calc_attrs(int baddr, int fa_addr, int fa) |
| 163 | 157 | { |
| 164 | 158 | |
| 165 | 159 | /* The current location or the fa specifies the fg or bg. */ |
| 166 | - if (h3270.ea_buf[baddr].fg) | |
| 160 | + if (session->ea_buf[baddr].fg) | |
| 167 | 161 | { |
| 168 | - fg = h3270.ea_buf[baddr].fg & 0x0f; | |
| 162 | + fg = session->ea_buf[baddr].fg & 0x0f; | |
| 169 | 163 | } |
| 170 | - else if (h3270.ea_buf[fa_addr].fg) | |
| 164 | + else if (session->ea_buf[fa_addr].fg) | |
| 171 | 165 | { |
| 172 | - fg = h3270.ea_buf[fa_addr].fg & 0x0f; | |
| 166 | + fg = session->ea_buf[fa_addr].fg & 0x0f; | |
| 173 | 167 | } |
| 174 | 168 | else |
| 175 | 169 | { |
| 176 | 170 | fg = DEFCOLOR_MAP(fa); |
| 177 | 171 | } |
| 178 | 172 | |
| 179 | - if (h3270.ea_buf[baddr].bg) | |
| 180 | - bg = h3270.ea_buf[baddr].bg & 0x0f; | |
| 181 | - else if (h3270.ea_buf[fa_addr].bg) | |
| 182 | - bg = h3270.ea_buf[fa_addr].bg & 0x0f; | |
| 173 | + if (session->ea_buf[baddr].bg) | |
| 174 | + bg = session->ea_buf[baddr].bg & 0x0f; | |
| 175 | + else if (session->ea_buf[fa_addr].bg) | |
| 176 | + bg = session->ea_buf[fa_addr].bg & 0x0f; | |
| 183 | 177 | else |
| 184 | 178 | bg = 0; |
| 185 | 179 | |
| ... | ... | @@ -188,10 +182,10 @@ static unsigned short calc_attrs(int baddr, int fa_addr, int fa) |
| 188 | 182 | |
| 189 | 183 | /* Compute the display attributes. */ |
| 190 | 184 | |
| 191 | - if (h3270.ea_buf[baddr].gr) | |
| 192 | - gr = h3270.ea_buf[baddr].gr; | |
| 193 | - else if (h3270.ea_buf[fa_addr].gr) | |
| 194 | - gr = h3270.ea_buf[fa_addr].gr; | |
| 185 | + if (session->ea_buf[baddr].gr) | |
| 186 | + gr = session->ea_buf[baddr].gr; | |
| 187 | + else if (session->ea_buf[fa_addr].gr) | |
| 188 | + gr = session->ea_buf[fa_addr].gr; | |
| 195 | 189 | else |
| 196 | 190 | gr = 0; |
| 197 | 191 | |
| ... | ... | @@ -216,16 +210,6 @@ static unsigned short calc_attrs(int baddr, int fa_addr, int fa) |
| 216 | 210 | return a; |
| 217 | 211 | } |
| 218 | 212 | |
| 219 | -/* Erase screen */ | |
| 220 | -void screen_erase(H3270 *session) | |
| 221 | -{ | |
| 222 | - /* If the application supplies a callback use it!, if not just redraw with blanks */ | |
| 223 | - if(session->erase) | |
| 224 | - session->erase(session); | |
| 225 | - else | |
| 226 | - screen_update(session,0,session->rows * session->cols); | |
| 227 | -} | |
| 228 | - | |
| 229 | 213 | LIB3270_EXPORT void lib3270_get_screen_size(H3270 *h, int *r, int *c) |
| 230 | 214 | { |
| 231 | 215 | *r = h->rows; |
| ... | ... | @@ -244,8 +228,7 @@ void update_model_info(H3270 *session, int model, int cols, int rows) |
| 244 | 228 | /* Update the model name. */ |
| 245 | 229 | (void) sprintf(session->model_name, "327%c-%d%s",appres.m3279 ? '9' : '8',session->model_num,appres.extended ? "-E" : ""); |
| 246 | 230 | |
| 247 | - if(session->update_model) | |
| 248 | - session->update_model(session, session->model_name,session->model_num,rows,cols); | |
| 231 | + session->update_model(session, session->model_name,session->model_num,rows,cols); | |
| 249 | 232 | } |
| 250 | 233 | |
| 251 | 234 | LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr) |
| ... | ... | @@ -269,40 +252,6 @@ LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned |
| 269 | 252 | return 0; |
| 270 | 253 | } |
| 271 | 254 | |
| 272 | -/* Get screen contents */ | |
| 273 | -int screen_read(char *dest, int baddr, int count) | |
| 274 | -{ | |
| 275 | - unsigned char fa = get_field_attribute(&h3270,baddr); | |
| 276 | - int max = (h3270.maxROWS * h3270.maxCOLS); | |
| 277 | - | |
| 278 | - *dest = 0; | |
| 279 | - | |
| 280 | - while(count-- > 0) | |
| 281 | - { | |
| 282 | - if(baddr > max) | |
| 283 | - { | |
| 284 | - *dest = 0; | |
| 285 | - return EFAULT; | |
| 286 | - } | |
| 287 | - | |
| 288 | - if (h3270.ea_buf[baddr].fa) | |
| 289 | - fa = h3270.ea_buf[baddr].fa; | |
| 290 | - | |
| 291 | - if(FA_IS_ZERO(fa)) | |
| 292 | - *dest = ' '; | |
| 293 | - else if(h3270.ea_buf[baddr].cc) | |
| 294 | - *dest = ebc2asc[h3270.ea_buf[baddr].cc]; | |
| 295 | - else | |
| 296 | - *dest = ' '; | |
| 297 | - | |
| 298 | - dest++; | |
| 299 | - baddr++; | |
| 300 | - } | |
| 301 | - *dest = 0; | |
| 302 | - | |
| 303 | - return 0; | |
| 304 | -} | |
| 305 | - | |
| 306 | 255 | /* Display what's in the buffer. */ |
| 307 | 256 | static void screen_update(H3270 *session, int bstart, int bend) |
| 308 | 257 | { |
| ... | ... | @@ -316,8 +265,6 @@ static void screen_update(H3270 *session, int bstart, int bend) |
| 316 | 265 | a = color_from_fa(fa); |
| 317 | 266 | fa_addr = find_field_attribute(session,bstart); // may be -1, that's okay |
| 318 | 267 | |
| 319 | -// Trace("%s ea_buf=%p",__FUNCTION__,ea_buf); | |
| 320 | - | |
| 321 | 268 | for(baddr = bstart; baddr < bend; baddr++) |
| 322 | 269 | { |
| 323 | 270 | if(session->ea_buf[baddr].fa) |
| ... | ... | @@ -325,7 +272,7 @@ static void screen_update(H3270 *session, int bstart, int bend) |
| 325 | 272 | // Field attribute. |
| 326 | 273 | fa_addr = baddr; |
| 327 | 274 | fa = session->ea_buf[baddr].fa; |
| 328 | - a = calc_attrs(baddr, baddr, fa); | |
| 275 | + a = calc_attrs(session, baddr, baddr, fa); | |
| 329 | 276 | addch(session,baddr,' ',(attr = COLOR_GREEN)|CHAR_ATTR_MARKER); |
| 330 | 277 | } |
| 331 | 278 | else if (FA_IS_ZERO(fa)) |
| ... | ... | @@ -342,14 +289,7 @@ static void screen_update(H3270 *session, int bstart, int bend) |
| 342 | 289 | } |
| 343 | 290 | else |
| 344 | 291 | { |
| 345 | -// unsigned short b; | |
| 346 | - // | |
| 347 | - // Override some of the field | |
| 348 | - // attributes. | |
| 349 | - // | |
| 350 | -// attr = b = calc_attrs(baddr, fa_addr, fa); | |
| 351 | - | |
| 352 | - attr = calc_attrs(baddr, fa_addr, fa); | |
| 292 | + attr = calc_attrs(session, baddr, fa_addr, fa); | |
| 353 | 293 | } |
| 354 | 294 | |
| 355 | 295 | if (session->ea_buf[baddr].cs == CS_LINEDRAW) |
| ... | ... | @@ -370,10 +310,7 @@ static void screen_update(H3270 *session, int bstart, int bend) |
| 370 | 310 | } |
| 371 | 311 | |
| 372 | 312 | } |
| 373 | - | |
| 374 | - if(session->changed) | |
| 375 | - session->changed(session,bstart,bend); | |
| 376 | - | |
| 313 | + session->changed(session,bstart,bend); | |
| 377 | 314 | } |
| 378 | 315 | |
| 379 | 316 | void screen_disp(H3270 *session) |
| ... | ... | @@ -381,15 +318,6 @@ void screen_disp(H3270 *session) |
| 381 | 318 | screen_update(session,0,session->rows*session->cols); |
| 382 | 319 | } |
| 383 | 320 | |
| 384 | -void screen_suspend(H3270 *session) | |
| 385 | -{ | |
| 386 | -} | |
| 387 | - | |
| 388 | -void screen_resume(H3270 *session) | |
| 389 | -{ | |
| 390 | - screen_disp(session); | |
| 391 | -} | |
| 392 | - | |
| 393 | 321 | LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) |
| 394 | 322 | { |
| 395 | 323 | CHECK_SESSION_HANDLE(h); |
| ... | ... | @@ -408,9 +336,7 @@ LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *h, int baddr) |
| 408 | 336 | return ret; |
| 409 | 337 | |
| 410 | 338 | h->cursor_addr = baddr; |
| 411 | - | |
| 412 | - if(h->update_cursor) | |
| 413 | - h->update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols),h->text[baddr].chr,h->text[baddr].attr); | |
| 339 | + h->update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols),h->text[baddr].chr,h->text[baddr].attr); | |
| 414 | 340 | |
| 415 | 341 | return ret; |
| 416 | 342 | } |
| ... | ... | @@ -421,13 +347,8 @@ void set_status(H3270 *session, LIB3270_FLAG id, Boolean on) |
| 421 | 347 | { |
| 422 | 348 | CHECK_SESSION_HANDLE(session); |
| 423 | 349 | |
| 424 | - if(id < LIB3270_FLAG_COUNT) | |
| 425 | - { | |
| 426 | - session->oia_flag[id] = (on != 0); | |
| 427 | - | |
| 428 | - if(session->update_oia) | |
| 429 | - session->update_oia(session,id,session->oia_flag[id]); | |
| 430 | - } | |
| 350 | + session->oia_flag[id] = (on != 0); | |
| 351 | + session->update_oia(session,id,session->oia_flag[id]); | |
| 431 | 352 | |
| 432 | 353 | } |
| 433 | 354 | ... | ... |
screenc.h
| ... | ... | @@ -26,8 +26,9 @@ |
| 26 | 26 | #define screen_132() /* */ |
| 27 | 27 | #define screen_80() /* */ |
| 28 | 28 | |
| 29 | +#define screen_erase(x) x->erase(x) | |
| 30 | +// LIB3270_INTERNAL void screen_erase(H3270 *session); | |
| 29 | 31 | |
| 30 | -LIB3270_INTERNAL void screen_erase(H3270 *session); | |
| 31 | 32 | LIB3270_INTERNAL void screen_changed(H3270 *session, int bstart, int bend); |
| 32 | 33 | LIB3270_INTERNAL int screen_init(H3270 *session); |
| 33 | 34 | // LIB3270_INTERNAL void screen_flip(void); | ... | ... |
trace_dsc.h
| 1 | 1 | /* |
| 2 | - * Copyright 1995, 1999, 2001, 2002, 2003, 2005, 2006 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 | - * x3270, c3270, s3270 and tcl3270 are distributed in the hope that they will | |
| 10 | - * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE | |
| 12 | - * 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., 59 Temple | |
| 19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como trace_dsc.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 | + * | |
| 13 | 28 | */ |
| 14 | 29 | |
| 15 | 30 | /* | ... | ... |