Commit 311e84700a55c057695759eca810188fcd3c9624

Authored by perry.werneck@gmail.com
1 parent 70142987

Limpando código, mais ajustes para multi-sessao

ansi.c
... ... @@ -1666,7 +1666,7 @@ ansi_scroll(void)
1666 1666 {
1667 1667 // if (!h3270.is_altbuffer)
1668 1668 // scroll_save(1, False);
1669   - ctlr_scroll();
  1669 + ctlr_scroll(&h3270);
1670 1670 return;
1671 1671 }
1672 1672  
... ...
ctlr.c
... ... @@ -89,7 +89,7 @@ Boolean dbcs = False;
89 89  
90 90 /* Statics */
91 91 // static struct ea *aea_buf; /* alternate 3270 extended attribute buffer */
92   -static unsigned char *zero_buf; // empty buffer, for area clears
  92 +// static unsigned char *zero_buf; // empty buffer, for area clears
93 93 static void set_formatted(H3270 *session);
94 94 static void ctlr_blanks(H3270 *session);
95 95 // static Boolean trace_primed = False;
... ... @@ -105,7 +105,7 @@ static void ctlr_connect(H3270 *session, int ignored, void *dunno);
105 105 // static int sscp_start;
106 106 static void ticking_stop(H3270 *session);
107 107 static void ctlr_add_ic(int baddr, unsigned char ic);
108   -static void changed(H3270 *session, int bstart, int bend);
  108 +// static void changed(H3270 *session, int bstart, int bend);
109 109  
110 110 /*
111 111 * code_table is used to translate buffer addresses and attributes to the 3270
... ... @@ -177,7 +177,7 @@ void ctlr_reinit(H3270 *session, unsigned cmask)
177 177  
178 178 session->text = lib3270_calloc(sizeof(struct lib3270_text),sz,session->text);
179 179  
180   - Replace(zero_buf, (unsigned char *)Calloc(sizeof(struct ea),sz));
  180 + Replace(session->zero_buf, (unsigned char *)Calloc(sizeof(struct ea),sz));
181 181  
182 182 session->cursor_addr = 0;
183 183 session->buffer_addr = 0;
... ... @@ -2543,7 +2543,7 @@ ctlr_bcopy(int baddr_from, int baddr_to, int count, int move_ea)
2543 2543 */
2544 2544 void ctlr_aclear(int baddr, int count, int clear_ea)
2545 2545 {
2546   - if (memcmp((char *) &h3270.ea_buf[baddr], (char *) zero_buf,
  2546 + if (memcmp((char *) &h3270.ea_buf[baddr], (char *) h3270.zero_buf,
2547 2547 count * sizeof(struct ea))) {
2548 2548 (void) memset((char *) &h3270.ea_buf[baddr], 0,
2549 2549 count * sizeof(struct ea));
... ... @@ -2558,9 +2558,9 @@ void ctlr_aclear(int baddr, int count, int clear_ea)
2558 2558 * This could be accomplished with ctlr_bcopy() and ctlr_aclear(), but this
2559 2559 * operation is common enough to warrant a separate path.
2560 2560 */
2561   -void ctlr_scroll(void)
  2561 +void ctlr_scroll(H3270 *hSession)
2562 2562 {
2563   - int qty = (h3270.rows - 1) * h3270.cols;
  2563 + int qty = (hSession->rows - 1) * hSession->cols;
2564 2564  
2565 2565 /* Make sure nothing is selected. (later this can be fixed) */
2566 2566 // unselect(0, ROWS*COLS);
... ... @@ -2568,12 +2568,12 @@ void ctlr_scroll(void)
2568 2568 /* Synchronize pending changes prior to this. */
2569 2569  
2570 2570 /* Move ea_buf. */
2571   - (void) memmove(&h3270.ea_buf[0], &h3270.ea_buf[h3270.cols],qty * sizeof(struct ea));
  2571 + (void) memmove(&hSession->ea_buf[0], &hSession->ea_buf[h3270.cols],qty * sizeof(struct ea));
2572 2572  
2573 2573 /* Clear the last line. */
2574   - (void) memset((char *) &h3270.ea_buf[qty], 0, h3270.cols * sizeof(struct ea));
  2574 + (void) memset((char *) &hSession->ea_buf[qty], 0, hSession->cols * sizeof(struct ea));
2575 2575  
2576   - h3270.display(&h3270);
  2576 + hSession->display(hSession);
2577 2577  
2578 2578 }
2579 2579 #endif /*]*/
... ... @@ -2581,8 +2581,9 @@ void ctlr_scroll(void)
2581 2581 /*
2582 2582 * Note that a particular region of the screen has changed.
2583 2583 */
2584   -void changed(H3270 *session, int bstart, int bend)
2585   -{
  2584 +
  2585 +// void changed(H3270 *session, int bstart, int bend)
  2586 +// {
2586 2587 /*
2587 2588 if(session->first_changed < 0)
2588 2589 {
... ... @@ -2596,7 +2597,7 @@ void changed(H3270 *session, int bstart, int bend)
2596 2597 if(bend > session->last_changed)
2597 2598 session->last_changed = bend;
2598 2599 */
2599   -}
  2600 +// }
2600 2601  
2601 2602 /*
2602 2603 * Swap the regular and alternate screen buffers
... ...
ctlrc.h
... ... @@ -41,7 +41,7 @@ LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask);
41 41 LIB3270_INTERNAL void ctlr_read_buffer(unsigned char aid_byte);
42 42 LIB3270_INTERNAL void ctlr_read_modified(unsigned char aid_byte, Boolean all);
43 43 LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask);
44   -LIB3270_INTERNAL void ctlr_scroll(void);
  44 +LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession);
45 45 LIB3270_INTERNAL void ctlr_shrink(void);
46 46 LIB3270_INTERNAL void ctlr_snap_buffer(void);
47 47 LIB3270_INTERNAL Boolean ctlr_snap_modes(void);
... ...
ft.c
... ... @@ -36,7 +36,10 @@
36 36 #include "globals.h"
37 37  
38 38 #include <errno.h>
39   -#include <malloc.h>
  39 +
  40 +#ifdef HAVE_MALLOC_H
  41 + #include <malloc.h>
  42 +#endif // HAVE_MALLOC_H
40 43  
41 44 //#include "appres.h"
42 45 #include "actionsc.h"
... ...
ft_cut.c
... ... @@ -36,7 +36,6 @@
36 36 */
37 37  
38 38 #include <errno.h>
39   -// #include <malloc.h>
40 39  
41 40 #include "globals.h"
42 41  
... ...
ft_dft.c
... ... @@ -55,7 +55,6 @@
55 55 #include "utilc.h"
56 56  
57 57 #include <errno.h>
58   -// #include <malloc.h>
59 58  
60 59 // extern unsigned char aid;
61 60  
... ...
host.c
... ... @@ -52,7 +52,6 @@
52 52 #include "xioc.h"
53 53  
54 54 #include <errno.h>
55   -// #include <malloc.h>
56 55  
57 56 #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */
58 57 #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */
... ...
paste.c
... ... @@ -45,7 +45,6 @@
45 45 #endif
46 46  
47 47 #include <fcntl.h>
48   -// #include <malloc.h>
49 48  
50 49 #include "3270ds.h"
51 50 //#include "appres.h"
... ... @@ -107,7 +106,7 @@
107 106 int faddr;
108 107 unsigned char fa;
109 108  
110   - if(lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE))
  109 + if(lib3270_get_toggle(session,LIB3270_TOGGLE_MARGINED_PASTE))
111 110 {
112 111 baddr = session->cursor_addr;
113 112 while(BA_TO_COL(baddr) < lmargin)
... ...
proxy.c
... ... @@ -56,7 +56,6 @@
56 56  
57 57 #else
58 58  
59   -// #include <malloc.h>
60 59 #include <sys/socket.h>
61 60 #include <sys/ioctl.h>
62 61 #include <netinet/in.h>
... ...
selection.c
... ... @@ -29,7 +29,6 @@
29 29  
30 30 #include "globals.h"
31 31 // #include "appres.h"
32   -// #include <malloc.h>
33 32 #include <lib3270.h>
34 33 #include <lib3270/session.h>
35 34 #include <lib3270/selection.h>
... ...