Commit ab2a33030f44fa48799708d8c1a861376a86b07b
1 parent
e5e48823
Exists in
master
Incluindo função para obter o buffer de sessão
Showing
4 changed files
with
44 additions
and
16 deletions
Show diff stats
latest/src/gtk2/screen.c
... | ... | @@ -71,7 +71,7 @@ |
71 | 71 | static int SetSuspended(int state); |
72 | 72 | static void SetScript(SCRIPT_STATE state); |
73 | 73 | static void set_cursor(CURSOR_MODE mode); |
74 | - static void set_oia(OIA_FLAG id, unsigned char on); | |
74 | + static void set_oia(H3270 *session, OIA_FLAG id, unsigned char on); | |
75 | 75 | static void set_lu(const char *lu); |
76 | 76 | // static void changed(int bstart, int bend); |
77 | 77 | static void error(const char *fmt, va_list arg); |
... | ... | @@ -121,9 +121,9 @@ |
121 | 121 | erase, // void (*erase)(void); |
122 | 122 | display, // void (*display)(H3270 *session); |
123 | 123 | #ifdef HAVE_ALTSCREEN |
124 | - view_changed, // void (*set_viewsize)(H3270 *session, int rows, int cols); | |
124 | + view_changed, // void (*set_viewsize)(H3270 *session, unsigned short rows, unsigned short cols); | |
125 | 125 | #else |
126 | - NULL, // void (*set_viewsize)(int rows, int cols); | |
126 | + NULL, // void (*set_viewsize)(unsigned short rows, unsigned short cols); | |
127 | 127 | #endif |
128 | 128 | |
129 | 129 | update_toggle, // void (*toggle_changed)(int ix, int value, int reason, const char *name); |
... | ... | @@ -454,7 +454,7 @@ |
454 | 454 | g_free(luname); |
455 | 455 | } |
456 | 456 | |
457 | - static void set_oia(OIA_FLAG id, unsigned char on) | |
457 | + static void set_oia(H3270 *session, OIA_FLAG id, unsigned char on) | |
458 | 458 | { |
459 | 459 | if(id > OIA_FLAG_USER) |
460 | 460 | return; | ... | ... |
latest/src/include/lib3270.h
... | ... | @@ -186,6 +186,17 @@ |
186 | 186 | */ |
187 | 187 | LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h); |
188 | 188 | |
189 | + /** | |
190 | + * Get buffer contents. | |
191 | + * | |
192 | + * @param h Session handle. | |
193 | + * @param first First element to get. | |
194 | + * @param last Last element to get. | |
195 | + * @param chr Pointer to buffer which will receive the read chars. | |
196 | + * @param attr Pointer to buffer which will receive the chars attributes. | |
197 | + * | |
198 | + */ | |
199 | + LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr); | |
189 | 200 | |
190 | 201 | LIB3270_EXPORT STATUS_CODE lib3270_get_oia_status(H3270 *h); |
191 | 202 | LIB3270_EXPORT const char * lib3270_get_luname(H3270 *h); | ... | ... |
latest/src/include/lib3270/api.h
... | ... | @@ -241,8 +241,8 @@ |
241 | 241 | // int last_changed; |
242 | 242 | int maxROWS; |
243 | 243 | int maxCOLS; |
244 | - int rows; | |
245 | - int cols; | |
244 | + unsigned short rows; | |
245 | + unsigned short cols; | |
246 | 246 | int cursor_addr; |
247 | 247 | char flipped; |
248 | 248 | int screen_alt; /**< alternate screen? */ |
... | ... | @@ -502,7 +502,7 @@ |
502 | 502 | |
503 | 503 | void (*erase)(void); |
504 | 504 | void (*display)(H3270 *session); |
505 | - void (*set_viewsize)(H3270 *session, int rows, int cols); | |
505 | + void (*set_viewsize)(H3270 *session, unsigned short rows, unsigned short cols); | |
506 | 506 | |
507 | 507 | void (*toggle_changed)(int ix, int value, int reason, const char *name); |
508 | 508 | void (*show_timer)(long seconds); | ... | ... |
latest/src/lib/screen.c
... | ... | @@ -140,6 +140,10 @@ int screen_init(H3270 *session) |
140 | 140 | |
141 | 141 | if(callbacks->set_oia) |
142 | 142 | session->set_oia = callbacks->set_oia; |
143 | + | |
144 | + if(callbacks->set_viewsize) | |
145 | + session->configure = callbacks->set_viewsize; | |
146 | + | |
143 | 147 | } |
144 | 148 | |
145 | 149 | /* Set up callbacks for state changes. */ |
... | ... | @@ -302,6 +306,27 @@ void update_model_info(H3270 *session, int model, int cols, int rows) |
302 | 306 | callbacks->model_changed(session, session->model_name,session->model_num,cols,rows); |
303 | 307 | } |
304 | 308 | |
309 | +LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr) | |
310 | +{ | |
311 | + int baddr; | |
312 | + int len; | |
313 | + | |
314 | + CHECK_SESSION_HANDLE(h); | |
315 | + | |
316 | + len = h->rows * h->cols; | |
317 | + | |
318 | + if(first > len || last > len || first < 0 || last < 0) | |
319 | + return EFAULT; | |
320 | + | |
321 | + for(baddr = first; baddr < last;baddr++) | |
322 | + { | |
323 | + *(chr++) = ea_buf[baddr].chr; | |
324 | + *(attr++) = ea_buf[baddr].attr; | |
325 | + } | |
326 | + | |
327 | + return 0; | |
328 | +} | |
329 | + | |
305 | 330 | /* Get screen contents */ |
306 | 331 | int screen_read(char *dest, int baddr, int count) |
307 | 332 | { |
... | ... | @@ -451,11 +476,6 @@ LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *h, int baddr) |
451 | 476 | if(h->update_cursor) |
452 | 477 | h->update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols)); |
453 | 478 | |
454 | -/* | |
455 | - if(callbacks && callbacks->move_cursor) | |
456 | - callbacks->move_cursor(h,row,col); | |
457 | -*/ | |
458 | - | |
459 | 479 | return ret; |
460 | 480 | } |
461 | 481 | |
... | ... | @@ -584,11 +604,8 @@ void set_viewsize(H3270 *session, int rows, int cols) |
584 | 604 | session->rows = rows; |
585 | 605 | session->cols = cols; |
586 | 606 | |
587 | - if(callbacks && callbacks->set_viewsize) | |
588 | - callbacks->set_viewsize(session,rows,cols); | |
589 | - | |
590 | 607 | if(session->configure) |
591 | - session->configure(session,rows,cols); | |
608 | + session->configure(session,session->rows,session->cols); | |
592 | 609 | |
593 | 610 | } |
594 | 611 | ... | ... |