Commit ac6936f06fbf82d6a37a666c85d11acdab6579ae

Authored by perry.werneck@gmail.com
1 parent 458f43a4

Corrigindo indicador de insert, movendo toggles para a estrutura de controle de sessao

src/gtk/v3270/oia.c
@@ -196,6 +196,30 @@ static void setup_single_char_right(GdkRectangle *rect, struct v3270_metrics *me @@ -196,6 +196,30 @@ static void setup_single_char_right(GdkRectangle *rect, struct v3270_metrics *me
196 196
197 } 197 }
198 198
  199 +static void setup_insert_position(GdkRectangle *rect, struct v3270_metrics *metrics, cairo_t *cr, H3270 *host, int cols, GdkColor *color)
  200 +{
  201 + if(rect->width > rect->height)
  202 + {
  203 + rect->width = rect->height;
  204 + }
  205 + else if(rect->height > rect->width)
  206 + {
  207 + rect->y += (rect->height - rect->width)/2;
  208 + rect->height = rect->width;
  209 + }
  210 +
  211 + rect->x -= rect->width;
  212 +
  213 +#ifdef DEBUG
  214 + cairo_set_source_rgb(cr,0.1,0.1,0.1);
  215 + cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);
  216 + cairo_fill(cr);
  217 +#endif
  218 +
  219 +}
  220 +
  221 +
  222 +
199 static void setup_double_char_position(GdkRectangle *rect, struct v3270_metrics *metrics, cairo_t *cr, H3270 *host, int cols, GdkColor *color) 223 static void setup_double_char_position(GdkRectangle *rect, struct v3270_metrics *metrics, cairo_t *cr, H3270 *host, int cols, GdkColor *color)
200 { 224 {
201 rect->width <<= 1; 225 rect->width <<= 1;
@@ -429,6 +453,9 @@ static void draw_insert(cairo_t *cr, H3270 *host, GdkColor *color, GdkRectangle @@ -429,6 +453,9 @@ static void draw_insert(cairo_t *cr, H3270 *host, GdkColor *color, GdkRectangle
429 { 453 {
430 double y = rect->y+(rect->height-2); 454 double y = rect->y+(rect->height-2);
431 455
  456 + cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);
  457 + cairo_clip(cr);
  458 +
432 gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_FOREGROUND); 459 gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_FOREGROUND);
433 460
434 cairo_move_to(cr,rect->x,y); 461 cairo_move_to(cr,rect->x,y);
@@ -453,7 +480,7 @@ void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, struct v3270_me @@ -453,7 +480,7 @@ void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, struct v3270_me
453 { V3270_OIA_LUNAME, setup_luname_position }, 480 { V3270_OIA_LUNAME, setup_luname_position },
454 { V3270_OIA_PRINTER, setup_single_char_right }, 481 { V3270_OIA_PRINTER, setup_single_char_right },
455 { V3270_OIA_SCRIPT, setup_single_char_right }, 482 { V3270_OIA_SCRIPT, setup_single_char_right },
456 - { V3270_OIA_INSERT, setup_single_char_right }, 483 + { V3270_OIA_INSERT, setup_insert_position },
457 { V3270_OIA_TYPEAHEAD, setup_single_char_right }, 484 { V3270_OIA_TYPEAHEAD, setup_single_char_right },
458 { V3270_OIA_SHIFT, setup_double_char_position }, 485 { V3270_OIA_SHIFT, setup_double_char_position },
459 { V3270_OIA_CAPS, setup_single_char_right }, 486 { V3270_OIA_CAPS, setup_single_char_right },
src/include/lib3270/popup.h
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 } LIB3270_NOTIFY; 44 } LIB3270_NOTIFY;
45 45
46 LIB3270_EXPORT void lib3270_set_popup_handler(int (*popup_handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)); 46 LIB3270_EXPORT void lib3270_set_popup_handler(int (*popup_handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list));
47 - LIB3270_EXPORT lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); 47 + LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...);
48 48
49 #endif // LIB3270_POPUP_INCLUDED 49 #endif // LIB3270_POPUP_INCLUDED
50 50
src/include/lib3270/selection.h
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 * @return Non 0 if there's more to paste with lib3270_pastenext 49 * @return Non 0 if there's more to paste with lib3270_pastenext
50 * 50 *
51 */ 51 */
52 - LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str); 52 + LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str);
53 53
54 /** 54 /**
55 * Paste remaining string. 55 * Paste remaining string.
src/include/lib3270/session.h
@@ -55,81 +55,89 @@ @@ -55,81 +55,89 @@
55 unsigned short attr; /**< Converted character attribute (color & etc) */ 55 unsigned short attr; /**< Converted character attribute (color & etc) */
56 }; 56 };
57 57
  58 + struct lib3270_toggle
  59 + {
  60 + char value; /**< toggle value */
  61 + void (*upcall)(H3270 *, struct lib3270_toggle *, LIB3270_TOGGLE_TYPE); /**< change value */
  62 + };
  63 +
58 struct _h3270 64 struct _h3270
59 { 65 {
60 - unsigned short sz; /**< Struct size */ 66 + unsigned short sz; /**< Struct size */
61 67
62 // Connection info 68 // Connection info
63 - int secure_connection;  
64 - int sock; /**< Network socket */  
65 - int net_sock;  
66 - LIB3270_CSTATE cstate; /**< Connection state */ 69 + int secure_connection;
  70 + int sock; /**< Network socket */
  71 + int net_sock;
  72 + LIB3270_CSTATE cstate; /**< Connection state */
67 73
68 - #if defined(_WIN32) /*[*/  
69 - HANDLE sock_handle;  
70 - #endif /*]*/ 74 + #if defined(_WIN32)
  75 + HANDLE sock_handle;
  76 + #endif
71 77
72 // flags 78 // flags
73 - int selected : 1; 79 + int selected : 1;
  80 +
  81 + struct lib3270_toggle toggle[LIB3270_TOGGLE_COUNT];
74 82
75 // Network & Termtype 83 // Network & Termtype
76 - char * hostname;  
77 - char * connected_type;  
78 - char * connected_lu;  
79 - char luname[LIB3270_LUNAME_LENGTH+1]; 84 + char * hostname;
  85 + char * connected_type;
  86 + char * connected_lu;
  87 + char luname[LIB3270_LUNAME_LENGTH+1];
80 88
81 - char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1];  
82 - char * model_name;  
83 - int model_num;  
84 - char * termtype; 89 + char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1];
  90 + char * model_name;
  91 + int model_num;
  92 + char * termtype;
85 93
86 - char * current_host; /**< the hostname part, stripped of qualifiers, luname and port number */  
87 - char * full_current_host; /**< the entire string, for use in reconnecting */  
88 - char * reconnect_host;  
89 - char * qualified_host;  
90 - char auto_reconnect_inprogress; 94 + char * current_host; /**< the hostname part, stripped of qualifiers, luname and port number */
  95 + char * full_current_host; /**< the entire string, for use in reconnecting */
  96 + char * reconnect_host;
  97 + char * qualified_host;
  98 + char auto_reconnect_inprogress;
91 99
92 - LIB3270_MESSAGE oia_status; 100 + LIB3270_MESSAGE oia_status;
93 101
94 - unsigned char oia_flag[LIB3270_FLAG_COUNT]; 102 + unsigned char oia_flag[LIB3270_FLAG_COUNT];
95 103
96 - unsigned short current_port; 104 + unsigned short current_port;
97 105
98 // screen info 106 // screen info
99 - char * charset;  
100 - int ov_rows;  
101 - int ov_cols;  
102 - int maxROWS;  
103 - int maxCOLS;  
104 - unsigned short rows;  
105 - unsigned short cols;  
106 - int cursor_addr;  
107 - int buffer_addr;  
108 - char flipped;  
109 - int screen_alt; /**< alternate screen? */  
110 - int is_altbuffer;  
111 -  
112 - int formatted; /**< set in screen_disp */ 107 + char * charset;
  108 + int ov_rows;
  109 + int ov_cols;
  110 + int maxROWS;
  111 + int maxCOLS;
  112 + unsigned short rows;
  113 + unsigned short cols;
  114 + int cursor_addr;
  115 + int buffer_addr;
  116 + char flipped;
  117 + int screen_alt; /**< alternate screen? */
  118 + int is_altbuffer;
  119 +
  120 + int formatted; /**< set in screen_disp */
113 121
114 // Screen contents 122 // Screen contents
115 - void * buffer[2]; /**< Internal buffers */  
116 - struct ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */  
117 - struct ea * aea_buf; /** alternate 3270 extended attribute buffer */  
118 - struct lib3270_text * text; /**< Converted 3270 chars */ 123 + void * buffer[2]; /**< Internal buffers */
  124 + struct ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */
  125 + struct ea * aea_buf; /** alternate 3270 extended attribute buffer */
  126 + struct lib3270_text * text; /**< Converted 3270 chars */
119 127
120 // host.c 128 // host.c
121 - char std_ds_host;  
122 - char no_login_host;  
123 - char non_tn3270e_host;  
124 - char passthru_host;  
125 - char ssl_host;  
126 - char ever_3270; 129 + char std_ds_host;
  130 + char no_login_host;
  131 + char non_tn3270e_host;
  132 + char passthru_host;
  133 + char ssl_host;
  134 + char ever_3270;
127 135
128 // Widget info 136 // Widget info
129 - void * widget; 137 + void * widget;
130 138
131 // selection 139 // selection
132 - char * paste_buffer; 140 + char * paste_buffer;
133 struct 141 struct
134 { 142 {
135 int begin; 143 int begin;
@@ -137,10 +145,10 @@ @@ -137,10 +145,10 @@
137 } select; 145 } select;
138 146
139 // xio 147 // xio
140 - unsigned long ns_read_id;  
141 - unsigned long ns_exception_id;  
142 - char reading;  
143 - char excepting; 148 + unsigned long ns_read_id;
  149 + unsigned long ns_exception_id;
  150 + char reading;
  151 + char excepting;
144 152
145 // State change callbacks. 153 // State change callbacks.
146 struct lib3270_state_callback *st_callbacks[LIB3270_STATE_USER]; 154 struct lib3270_state_callback *st_callbacks[LIB3270_STATE_USER];
src/lib3270/ansi.c
@@ -1825,7 +1825,7 @@ ansi_send_pa(int nn) @@ -1825,7 +1825,7 @@ ansi_send_pa(int nn)
1825 net_sends(fn_buf); 1825 net_sends(fn_buf);
1826 } 1826 }
1827 1827
1828 -void toggle_lineWrap(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE type unused) 1828 +void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type unused)
1829 { 1829 {
1830 if (toggled(LIB3270_TOGGLE_LINE_WRAP)) 1830 if (toggled(LIB3270_TOGGLE_LINE_WRAP))
1831 wraparound_mode = 1; 1831 wraparound_mode = 1;
src/lib3270/ansic.h
@@ -29,7 +29,7 @@ LIB3270_INTERNAL void ansi_send_pa(int nn); @@ -29,7 +29,7 @@ LIB3270_INTERNAL void ansi_send_pa(int nn);
29 LIB3270_INTERNAL void ansi_send_pf(int nn); 29 LIB3270_INTERNAL void ansi_send_pf(int nn);
30 LIB3270_INTERNAL void ansi_send_right(void); 30 LIB3270_INTERNAL void ansi_send_right(void);
31 LIB3270_INTERNAL void ansi_send_up(void); 31 LIB3270_INTERNAL void ansi_send_up(void);
32 -LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE type); 32 +LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE type);
33 33
34 #else /*][*/ 34 #else /*][*/
35 35
src/lib3270/appres.h
@@ -24,18 +24,21 @@ @@ -24,18 +24,21 @@
24 24
25 /* Toggles */ 25 /* Toggles */
26 26
  27 +/*
27 struct toggle { 28 struct toggle {
28 - char value; /* toggle value */  
29 -// char changed; /* has the value changed since init */  
30 -// Widget w[2]; /* the menu item widgets */  
31 -// const char *label[2]; /* labels */  
32 - void (*upcall)(H3270 *, struct toggle *, LIB3270_TOGGLE_TYPE); /* change value */ 29 + char value; // toggle value
  30 +// char changed; // has the value changed since init
  31 +// Widget w[2]; // the menu item widgets
  32 +// const char *label[2]; // labels
  33 + void (*upcall)(H3270 *, struct toggle *, LIB3270_TOGGLE_TYPE); // change value
33 // void (*callback)(H3270 *, int, LIB3270_TOGGLE_TYPE); 34 // void (*callback)(H3270 *, int, LIB3270_TOGGLE_TYPE);
34 35
35 }; 36 };
36 37
37 -#define toggled(ix) (appres.toggle[ix].value)  
38 // #define toggle_toggle(t) { (t)->value = !(t)->value; } 38 // #define toggle_toggle(t) { (t)->value = !(t)->value; }
  39 +*/
  40 +
  41 +#define toggled(ix) lib3270_get_toggle(NULL,ix)
39 42
40 /* Application resources */ 43 /* Application resources */
41 44
@@ -184,7 +187,7 @@ typedef struct { @@ -184,7 +187,7 @@ typedef struct {
184 char *proxy; 187 char *proxy;
185 188
186 /* Toggles */ 189 /* Toggles */
187 - struct toggle toggle[N_TOGGLES]; 190 +// struct toggle toggle[N_TOGGLES];
188 /* 191 /*
189 #if defined(X3270_DISPLAY) 192 #if defined(X3270_DISPLAY)
190 // Simple widget resources 193 // Simple widget resources
@@ -234,4 +237,4 @@ extern AppRes appres; @@ -234,4 +237,4 @@ extern AppRes appres;
234 #define N_( x ) x 237 #define N_( x ) x
235 #define MSG_( c, s ) s 238 #define MSG_( c, s ) s
236 239
237 -void toggle_rectselect(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt); 240 +void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);
src/lib3270/ctlr.c
@@ -2798,30 +2798,9 @@ static void ticking_stop(H3270 *session) @@ -2798,30 +2798,9 @@ static void ticking_stop(H3270 *session)
2798 } 2798 }
2799 2799
2800 /* 2800 /*
2801 -void toggle_showTiming(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt unused)  
2802 -{  
2803 - if (!toggled(SHOW_TIMING))  
2804 - status_untiming(&h3270);  
2805 -}  
2806 -*/  
2807 -  
2808 -  
2809 -/*  
2810 * No-op toggle. 2801 * No-op toggle.
2811 */ 2802 */
2812 -void  
2813 -toggle_nop(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) 2803 +void toggle_nop(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused)
2814 { 2804 {
2815 } 2805 }
2816 2806
2817 -/*  
2818 -int ctlr_get_rows(void)  
2819 -{  
2820 - return h3270.rows;  
2821 -}  
2822 -  
2823 -int ctlr_get_cols(void)  
2824 -{  
2825 - return h3270.cols;  
2826 -}  
2827 -*/  
src/lib3270/ctlrc.h
@@ -62,18 +62,18 @@ LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ov @@ -62,18 +62,18 @@ LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ov
62 LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); 62 LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt);
63 63
64 LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); 64 LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway);
65 -LIB3270_INTERNAL void toggle_nop(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt);  
66 -LIB3270_INTERNAL void toggle_showTiming(struct toggle *t, LIB3270_TOGGLE_TYPE tt); 65 +LIB3270_INTERNAL void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);
  66 +LIB3270_INTERNAL void toggle_showTiming(struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt);
67 67
68 enum dbcs_state { 68 enum dbcs_state {
69 DBCS_NONE = 0, /* position is not DBCS */ 69 DBCS_NONE = 0, /* position is not DBCS */
70 - DBCS_LEFT, /* position is left half of DBCS character */  
71 - DBCS_RIGHT, /* position is right half of DBCS character */  
72 - DBCS_SI, /* position is SI terminating DBCS subfield */  
73 - DBCS_SB, /* position is SBCS character after the SI */ 70 + DBCS_LEFT, /* position is left half of DBCS character */
  71 + DBCS_RIGHT, /* position is right half of DBCS character */
  72 + DBCS_SI, /* position is SI terminating DBCS subfield */
  73 + DBCS_SB, /* position is SBCS character after the SI */
74 DBCS_LEFT_WRAP, /* position is left half of split DBCS */ 74 DBCS_LEFT_WRAP, /* position is left half of split DBCS */
75 DBCS_RIGHT_WRAP, /* position is right half of split DBCS */ 75 DBCS_RIGHT_WRAP, /* position is right half of split DBCS */
76 - DBCS_DEAD /* position is dead left-half DBCS */ 76 + DBCS_DEAD /* position is dead left-half DBCS */
77 }; 77 };
78 #define IS_LEFT(d) ((d) == DBCS_LEFT || (d) == DBCS_LEFT_WRAP) 78 #define IS_LEFT(d) ((d) == DBCS_LEFT || (d) == DBCS_LEFT_WRAP)
79 #define IS_RIGHT(d) ((d) == DBCS_RIGHT || (d) == DBCS_RIGHT_WRAP) 79 #define IS_RIGHT(d) ((d) == DBCS_RIGHT || (d) == DBCS_RIGHT_WRAP)
src/lib3270/glue.c
@@ -127,7 +127,7 @@ static void initialize(void) @@ -127,7 +127,7 @@ static void initialize(void)
127 127
128 h3270.selected = 0; 128 h3270.selected = 0;
129 h3270.select.begin = h3270.select.end = 0; 129 h3270.select.begin = h3270.select.end = 0;
130 - initialize_toggles(&h3270,appres.toggle); 130 +// initialize_toggles(&h3270);
131 131
132 #if defined(_WIN32) 132 #if defined(_WIN32)
133 (void) get_version_info(); 133 (void) get_version_info();
@@ -148,11 +148,13 @@ static void initialize(void) @@ -148,11 +148,13 @@ static void initialize(void)
148 appres.modified_sel = False; 148 appres.modified_sel = False;
149 appres.apl_mode = False; 149 appres.apl_mode = False;
150 150
151 -#if defined(C3270) || defined(TCL3270) /*[*/  
152 -// appres.scripted = False;  
153 -#else /*][*/ 151 +/*
  152 +#if defined(C3270) || defined(TCL3270)
  153 + appres.scripted = False;
  154 +#else
154 appres.scripted = True; 155 appres.scripted = True;
155 -#endif /*]*/ 156 +#endif
  157 +*/
156 158
157 appres.numeric_lock = False; 159 appres.numeric_lock = False;
158 // appres.secure = False; 160 // appres.secure = False;
@@ -193,9 +195,11 @@ static void initialize(void) @@ -193,9 +195,11 @@ static void initialize(void)
193 appres.trace_dir = "/tmp"; 195 appres.trace_dir = "/tmp";
194 #endif /*]*/ 196 #endif /*]*/
195 197
196 -#if defined(X3270_DISPLAY) || defined(WC3270) /*[*/ 198 +/*
  199 +#if defined(X3270_DISPLAY) || defined(WC3270)
197 appres.trace_monitor = True; 200 appres.trace_monitor = True;
198 -#endif /*]*/ 201 +#endif
  202 +*/
199 203
200 #endif /*]*/ 204 #endif /*]*/
201 205
@@ -227,17 +231,23 @@ static void initialize(void) @@ -227,17 +231,23 @@ static void initialize(void)
227 appres.dft_buffer_size = DFT_BUF; 231 appres.dft_buffer_size = DFT_BUF;
228 #endif /*]*/ 232 #endif /*]*/
229 233
230 -#if defined(C3270) && !defined(LIB3270) /*[*/ 234 +/*
  235 +#if defined(C3270) && !defined(LIB3270)
231 appres.toggle[CURSOR_POS].value = True; 236 appres.toggle[CURSOR_POS].value = True;
232 -#endif /*]*/ 237 +#endif
  238 +*/
233 239
234 -#if defined(X3270_SCRIPT) || defined(TCL3270) /*[*/ 240 +/*
  241 +#if defined(X3270_SCRIPT) || defined(TCL3270)
235 appres.toggle[AID_WAIT].value = True; 242 appres.toggle[AID_WAIT].value = True;
236 -#endif /*]*/ 243 +#endif
  244 +*/
237 245
238 -#if defined(C3270) && defined(X3270_SCRIPT) /*[*/ 246 +/*
  247 +#if defined(C3270) && defined(X3270_SCRIPT)
239 appres.plugin_command = "x3270hist.pl"; 248 appres.plugin_command = "x3270hist.pl";
240 -#endif /*]*/ 249 +#endif
  250 +*/
241 251
242 #if defined(C3270) && defined(_WIN32) /*[*/ 252 #if defined(C3270) && defined(_WIN32) /*[*/
243 appres.highlight_underline = True; 253 appres.highlight_underline = True;
src/lib3270/init.c
@@ -49,7 +49,7 @@ void lib3270_session_free(H3270 *h) @@ -49,7 +49,7 @@ void lib3270_session_free(H3270 *h)
49 if(lib3270_connected(h)) 49 if(lib3270_connected(h))
50 lib3270_disconnect(h); 50 lib3270_disconnect(h);
51 51
52 - shutdown_toggles(h,appres.toggle); 52 + shutdown_toggles(h);
53 53
54 // Release state change callbacks 54 // Release state change callbacks
55 for(f=0;f<N_ST;f++) 55 for(f=0;f<N_ST;f++)
@@ -112,6 +112,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model) @@ -112,6 +112,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model)
112 memset(hSession,0,sizeof(H3270)); 112 memset(hSession,0,sizeof(H3270));
113 hSession->sz = sizeof(H3270); 113 hSession->sz = sizeof(H3270);
114 114
  115 + // Initialize toggles
  116 + initialize_toggles(hSession);
  117 +
115 // Dummy calls to avoid "ifs" 118 // Dummy calls to avoid "ifs"
116 hSession->update = update_char; 119 hSession->update = update_char;
117 hSession->update_model = update_model; 120 hSession->update_model = update_model;
src/lib3270/kybd.c
@@ -2274,11 +2274,11 @@ LIB3270_ACTION( dup ) @@ -2274,11 +2274,11 @@ LIB3270_ACTION( dup )
2274 if (kybdlock) 2274 if (kybdlock)
2275 { 2275 {
2276 ENQUEUE_ACTION(lib3270_enter); 2276 ENQUEUE_ACTION(lib3270_enter);
2277 - return; 2277 + return 0;
2278 } 2278 }
2279 #if defined(X3270_ANSI) 2279 #if defined(X3270_ANSI)
2280 if (IN_ANSI) 2280 if (IN_ANSI)
2281 - return; 2281 + return 0;
2282 #endif 2282 #endif
2283 if (key_Character(EBC_dup, False, False, NULL)) 2283 if (key_Character(EBC_dup, False, False, NULL))
2284 cursor_move(next_unprotected(hSession->cursor_addr)); 2284 cursor_move(next_unprotected(hSession->cursor_addr));
src/lib3270/lib3270.cbp
@@ -7,8 +7,8 @@ @@ -7,8 +7,8 @@
7 <Option compiler="gcc" /> 7 <Option compiler="gcc" />
8 <Build> 8 <Build>
9 <Target title="Debug"> 9 <Target title="Debug">
10 - <Option output=".bin\Debug\lib3270" prefix_auto="1" extension_auto="1" />  
11 - <Option object_output=".obj\Debug\" /> 10 + <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" />
  11 + <Option object_output=".obj/Debug/" />
12 <Option type="1" /> 12 <Option type="1" />
13 <Option compiler="gcc" /> 13 <Option compiler="gcc" />
14 <Option use_console_runner="0" /> 14 <Option use_console_runner="0" />
@@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
21 </Linker> 21 </Linker>
22 </Target> 22 </Target>
23 <Target title="Release"> 23 <Target title="Release">
24 - <Option output=".bin\Release\lib3270" prefix_auto="1" extension_auto="1" />  
25 - <Option object_output=".obj\Release\" /> 24 + <Option output=".bin/Release/lib3270" prefix_auto="1" extension_auto="1" />
  25 + <Option object_output=".obj/Release/" />
26 <Option type="3" /> 26 <Option type="3" />
27 <Option compiler="gcc" /> 27 <Option compiler="gcc" />
28 <Option createDefFile="1" /> 28 <Option createDefFile="1" />
@@ -35,8 +35,8 @@ @@ -35,8 +35,8 @@
35 </Linker> 35 </Linker>
36 </Target> 36 </Target>
37 <Target title="testprogram"> 37 <Target title="testprogram">
38 - <Option output=".bin\Debug\lib3270" prefix_auto="1" extension_auto="1" />  
39 - <Option object_output=".obj\testprogram\" /> 38 + <Option output=".bin/Debug/lib3270" prefix_auto="1" extension_auto="1" />
  39 + <Option object_output=".obj/testprogram/" />
40 <Option type="1" /> 40 <Option type="1" />
41 <Option compiler="gcc" /> 41 <Option compiler="gcc" />
42 <Option use_console_runner="0" /> 42 <Option use_console_runner="0" />
@@ -53,18 +53,18 @@ @@ -53,18 +53,18 @@
53 <Add option="-Wmissing-declarations" /> 53 <Add option="-Wmissing-declarations" />
54 <Add option="-Wall" /> 54 <Add option="-Wall" />
55 <Add option="-DLIB3270=1" /> 55 <Add option="-DLIB3270=1" />
56 - <Add directory="..\include" />  
57 - <Add directory="..\include\lib3270" /> 56 + <Add directory="../include" />
  57 + <Add directory="../include/lib3270" />
58 </Compiler> 58 </Compiler>
59 - <Unit filename="..\include\lib3270.h" />  
60 - <Unit filename="..\include\lib3270\action_table.h" />  
61 - <Unit filename="..\include\lib3270\actions.h" />  
62 - <Unit filename="..\include\lib3270\config.h.in" />  
63 - <Unit filename="..\include\lib3270\log.h" />  
64 - <Unit filename="..\include\lib3270\macros.h" />  
65 - <Unit filename="..\include\lib3270\popup.h" />  
66 - <Unit filename="..\include\lib3270\selection.h" />  
67 - <Unit filename="..\include\lib3270\session.h" /> 59 + <Unit filename="../include/lib3270.h" />
  60 + <Unit filename="../include/lib3270/action_table.h" />
  61 + <Unit filename="../include/lib3270/actions.h" />
  62 + <Unit filename="../include/lib3270/config.h.in" />
  63 + <Unit filename="../include/lib3270/log.h" />
  64 + <Unit filename="../include/lib3270/macros.h" />
  65 + <Unit filename="../include/lib3270/popup.h" />
  66 + <Unit filename="../include/lib3270/selection.h" />
  67 + <Unit filename="../include/lib3270/session.h" />
68 <Unit filename="3270ds.h" /> 68 <Unit filename="3270ds.h" />
69 <Unit filename="Makefile.in" /> 69 <Unit filename="Makefile.in" />
70 <Unit filename="X11keysym.h" /> 70 <Unit filename="X11keysym.h" />
@@ -125,6 +125,9 @@ @@ -125,6 +125,9 @@
125 </Unit> 125 </Unit>
126 <Unit filename="hostc.h" /> 126 <Unit filename="hostc.h" />
127 <Unit filename="icmdc.h" /> 127 <Unit filename="icmdc.h" />
  128 + <Unit filename="init.c">
  129 + <Option compilerVar="CC" />
  130 + </Unit>
128 <Unit filename="keypadc.h" /> 131 <Unit filename="keypadc.h" />
129 <Unit filename="kybd.c"> 132 <Unit filename="kybd.c">
130 <Option compilerVar="CC" /> 133 <Option compilerVar="CC" />
src/lib3270/paste.c
@@ -81,6 +81,7 @@ @@ -81,6 +81,7 @@
81 #include "api.h" 81 #include "api.h"
82 82
83 #include <lib3270/popup.h> 83 #include <lib3270/popup.h>
  84 +#include <lib3270/selection.h>
84 85
85 /*---[ Struct ]-------------------------------------------------------------------------------------------------*/ 86 /*---[ Struct ]-------------------------------------------------------------------------------------------------*/
86 87
@@ -234,7 +235,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) @@ -234,7 +235,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str)
234 return data.qtd; 235 return data.qtd;
235 } 236 }
236 237
237 -LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str) 238 +LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str)
238 { 239 {
239 int sz; 240 int sz;
240 CHECK_SESSION_HANDLE(h); 241 CHECK_SESSION_HANDLE(h);
@@ -262,9 +263,9 @@ LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str) @@ -262,9 +263,9 @@ LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str)
262 return 0; 263 return 0;
263 } 264 }
264 265
265 - if(strlen(str) > sz) 266 + if(strlen((char *) str) > sz)
266 { 267 {
267 - h->paste_buffer = strdup(str+sz); 268 + h->paste_buffer = strdup((char *) (str+sz));
268 return 1; 269 return 1;
269 } 270 }
270 271
@@ -287,7 +288,7 @@ LIB3270_EXPORT int lib3270_pastenext(H3270 *h) @@ -287,7 +288,7 @@ LIB3270_EXPORT int lib3270_pastenext(H3270 *h)
287 ptr = h->paste_buffer; 288 ptr = h->paste_buffer;
288 h->paste_buffer = NULL; 289 h->paste_buffer = NULL;
289 290
290 - rc = lib3270_paste(h,ptr); 291 + rc = lib3270_paste(h,(unsigned char *) ptr);
291 292
292 free(ptr); 293 free(ptr);
293 return rc; 294 return rc;
src/lib3270/selection.c
@@ -34,6 +34,8 @@ @@ -34,6 +34,8 @@
34 #include <lib3270/session.h> 34 #include <lib3270/session.h>
35 #include <lib3270/selection.h> 35 #include <lib3270/selection.h>
36 36
  37 + static void update_selection(H3270 *session);
  38 +
37 /*--[ Implement ]------------------------------------------------------------------------------------*/ 39 /*--[ Implement ]------------------------------------------------------------------------------------*/
38 40
39 static void get_selected_addr(H3270 *session, int *begin, int *end) 41 static void get_selected_addr(H3270 *session, int *begin, int *end)
@@ -156,7 +158,7 @@ static void set_selected(H3270 *session) @@ -156,7 +158,7 @@ static void set_selected(H3270 *session)
156 session->set_selection(session,1); 158 session->set_selection(session,1);
157 } 159 }
158 160
159 -void toggle_rectselect(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt) 161 +void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt)
160 { 162 {
161 if(!session->selected) 163 if(!session->selected)
162 return; 164 return;
@@ -303,7 +305,7 @@ LIB3270_ACTION( reselect ) @@ -303,7 +305,7 @@ LIB3270_ACTION( reselect )
303 CHECK_SESSION_HANDLE(hSession); 305 CHECK_SESSION_HANDLE(hSession);
304 306
305 if(!lib3270_connected(hSession) || hSession->select.begin == hSession->select.end || hSession->selected) 307 if(!lib3270_connected(hSession) || hSession->select.begin == hSession->select.end || hSession->selected)
306 - return; 308 + return 0;
307 309
308 update_selection(hSession); 310 update_selection(hSession);
309 set_selected(hSession); 311 set_selected(hSession);
src/lib3270/toggles.c
@@ -74,8 +74,8 @@ static const char *toggle_names[LIB3270_TOGGLE_COUNT] = @@ -74,8 +74,8 @@ static const char *toggle_names[LIB3270_TOGGLE_COUNT] =
74 "keepselected", 74 "keepselected",
75 "underline", 75 "underline",
76 "autoconnect", 76 "autoconnect",
77 - "kpalternative", /**< Keypad +/- move to next/previous field */  
78 - "beep", /**< Beep on errors */ 77 + "kpalternative", /**< Keypad +/- move to next/previous field */
  78 + "beep", /**< Beep on errors */
79 }; 79 };
80 80
81 LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix) 81 LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE ix)
@@ -84,14 +84,15 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE i @@ -84,14 +84,15 @@ LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *session, LIB3270_TOGGLE i
84 84
85 if(ix < 0 || ix >= N_TOGGLES) 85 if(ix < 0 || ix >= N_TOGGLES)
86 return 0; 86 return 0;
87 - return (unsigned char) appres.toggle[ix].value != 0; 87 + return (unsigned char) session->toggle[ix].value != 0;
88 } 88 }
89 89
90 /* 90 /*
91 * Call the internal update routine 91 * Call the internal update routine
92 */ 92 */
93 -static void toggle_notify(H3270 *session, struct toggle *t, LIB3270_TOGGLE ix) 93 +static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE ix)
94 { 94 {
  95 + Trace("%s: ix=%d upcall=%p",__FUNCTION__,ix,t->upcall);
95 t->upcall(session, t, TT_INTERACTIVE); 96 t->upcall(session, t, TT_INTERACTIVE);
96 97
97 if(session->update_toggle) 98 if(session->update_toggle)
@@ -101,15 +102,15 @@ static void toggle_notify(H3270 *session, struct toggle *t, LIB3270_TOGGLE ix) @@ -101,15 +102,15 @@ static void toggle_notify(H3270 *session, struct toggle *t, LIB3270_TOGGLE ix)
101 102
102 LIB3270_EXPORT void lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int value) 103 LIB3270_EXPORT void lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int value)
103 { 104 {
104 - char v = value ? True : False;  
105 - struct toggle * t; 105 + char v = value ? True : False;
  106 + struct lib3270_toggle * t;
106 107
107 CHECK_SESSION_HANDLE(session); 108 CHECK_SESSION_HANDLE(session);
108 109
109 if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT) 110 if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT)
110 return; 111 return;
111 112
112 - t = &appres.toggle[ix]; 113 + t = &session->toggle[ix];
113 114
114 if(v == t->value) 115 if(v == t->value)
115 return; 116 return;
@@ -121,14 +122,14 @@ LIB3270_EXPORT void lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int va @@ -121,14 +122,14 @@ LIB3270_EXPORT void lib3270_set_toggle(H3270 *session, LIB3270_TOGGLE ix, int va
121 122
122 LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) 123 LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix)
123 { 124 {
124 - struct toggle *t; 125 + struct lib3270_toggle *t;
125 126
126 CHECK_SESSION_HANDLE(session); 127 CHECK_SESSION_HANDLE(session);
127 128
128 if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT) 129 if(ix < 0 || ix >= LIB3270_TOGGLE_COUNT)
129 return 0; 130 return 0;
130 131
131 - t = &appres.toggle[ix]; 132 + t = &session->toggle[ix];
132 133
133 t->value = t->value ? False : True; 134 t->value = t->value ? False : True;
134 toggle_notify(session,t,ix); 135 toggle_notify(session,t,ix);
@@ -136,7 +137,7 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix) @@ -136,7 +137,7 @@ LIB3270_EXPORT int lib3270_toggle(H3270 *session, LIB3270_TOGGLE ix)
136 return (int) t->value; 137 return (int) t->value;
137 } 138 }
138 139
139 -static void toggle_monocase(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt) 140 +static void toggle_monocase(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt)
140 { 141 {
141 screen_disp(session); 142 screen_disp(session);
142 } 143 }
@@ -144,24 +145,24 @@ static void toggle_monocase(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYP @@ -144,24 +145,24 @@ static void toggle_monocase(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYP
144 /* 145 /*
145 * Called from system initialization code to handle initial toggle settings. 146 * Called from system initialization code to handle initial toggle settings.
146 */ 147 */
147 -void initialize_toggles(H3270 *session, struct toggle *toggle) 148 +void initialize_toggles(H3270 *session)
148 { 149 {
149 int f; 150 int f;
150 151
151 for(f=0;f<LIB3270_TOGGLE_COUNT;f++) 152 for(f=0;f<LIB3270_TOGGLE_COUNT;f++)
152 - toggle[f].upcall = toggle_nop; 153 + session->toggle[f].upcall = toggle_nop;
153 154
154 - toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect;  
155 - toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_monocase; 155 + session->toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect;
  156 + session->toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_monocase;
156 157
157 #if defined(X3270_TRACE) 158 #if defined(X3270_TRACE)
158 - toggle[LIB3270_TOGGLE_DS_TRACE].upcall = toggle_dsTrace;  
159 - toggle[LIB3270_TOGGLE_SCREEN_TRACE].upcall = toggle_screenTrace;  
160 - toggle[LIB3270_TOGGLE_EVENT_TRACE].upcall = toggle_eventTrace; 159 + session->toggle[LIB3270_TOGGLE_DS_TRACE].upcall = toggle_dsTrace;
  160 + session->toggle[LIB3270_TOGGLE_SCREEN_TRACE].upcall = toggle_screenTrace;
  161 + session->toggle[LIB3270_TOGGLE_EVENT_TRACE].upcall = toggle_eventTrace;
161 #endif 162 #endif
162 163
163 #if defined(X3270_ANSI) 164 #if defined(X3270_ANSI)
164 - toggle[LIB3270_TOGGLE_LINE_WRAP].upcall = toggle_lineWrap; 165 + session->toggle[LIB3270_TOGGLE_LINE_WRAP].upcall = toggle_lineWrap;
165 #endif 166 #endif
166 167
167 static const LIB3270_TOGGLE active_by_default[] = 168 static const LIB3270_TOGGLE active_by_default[] =
@@ -173,14 +174,14 @@ void initialize_toggles(H3270 *session, struct toggle *toggle) @@ -173,14 +174,14 @@ void initialize_toggles(H3270 *session, struct toggle *toggle)
173 174
174 for(f=0;f< (sizeof(active_by_default)/sizeof(active_by_default[0])); f++) 175 for(f=0;f< (sizeof(active_by_default)/sizeof(active_by_default[0])); f++)
175 { 176 {
176 - toggle[active_by_default[f]].value = True; 177 + session->toggle[active_by_default[f]].value = True;
177 } 178 }
178 179
179 180
180 for(f=0;f<LIB3270_TOGGLE_COUNT;f++) 181 for(f=0;f<LIB3270_TOGGLE_COUNT;f++)
181 { 182 {
182 - if(toggle[f].value)  
183 - toggle[f].upcall(session,&toggle[f],TT_INITIAL); 183 + if(session->toggle[f].value)
  184 + session->toggle[f].upcall(session,&session->toggle[f],TT_INITIAL);
184 } 185 }
185 186
186 } 187 }
@@ -188,7 +189,7 @@ void initialize_toggles(H3270 *session, struct toggle *toggle) @@ -188,7 +189,7 @@ void initialize_toggles(H3270 *session, struct toggle *toggle)
188 /* 189 /*
189 * Called from system exit code to handle toggles. 190 * Called from system exit code to handle toggles.
190 */ 191 */
191 -void shutdown_toggles(H3270 *session, struct toggle *toggle) 192 +void shutdown_toggles(H3270 *session)
192 { 193 {
193 #if defined(X3270_TRACE) 194 #if defined(X3270_TRACE)
194 static const LIB3270_TOGGLE disable_on_shutdown[] = {DS_TRACE, EVENT_TRACE, SCREEN_TRACE}; 195 static const LIB3270_TOGGLE disable_on_shutdown[] = {DS_TRACE, EVENT_TRACE, SCREEN_TRACE};
@@ -198,7 +199,7 @@ void shutdown_toggles(H3270 *session, struct toggle *toggle) @@ -198,7 +199,7 @@ void shutdown_toggles(H3270 *session, struct toggle *toggle)
198 for(f=0;f< (sizeof(disable_on_shutdown)/sizeof(disable_on_shutdown[0])); f++) 199 for(f=0;f< (sizeof(disable_on_shutdown)/sizeof(disable_on_shutdown[0])); f++)
199 { 200 {
200 LIB3270_TOGGLE ix = disable_on_shutdown[f]; 201 LIB3270_TOGGLE ix = disable_on_shutdown[f];
201 - struct toggle * t = &toggle[ix]; 202 + struct toggle * t = &session->toggle[ix];
202 203
203 if(t->value) 204 if(t->value)
204 { 205 {
@@ -209,28 +210,6 @@ void shutdown_toggles(H3270 *session, struct toggle *toggle) @@ -209,28 +210,6 @@ void shutdown_toggles(H3270 *session, struct toggle *toggle)
209 session->update_toggle(session,ix,t->value,TT_FINAL,toggle_names[ix]); 210 session->update_toggle(session,ix,t->value,TT_FINAL,toggle_names[ix]);
210 } 211 }
211 } 212 }
212 -  
213 -/*  
214 - // Clean up the data stream trace monitor window.  
215 - if(toggle[DS_TRACE].value)  
216 - {  
217 - toggle[DS_TRACE].value = False;  
218 - toggle_dsTrace(session, &toggle[DS_TRACE], TT_FINAL);  
219 - }  
220 -  
221 - if(toggle[EVENT_TRACE].value)  
222 - {  
223 - toggle[EVENT_TRACE].value = False;  
224 - toggle_dsTrace(session, &toggle[EVENT_TRACE], TT_FINAL);  
225 - }  
226 -  
227 - // Clean up the screen trace file.  
228 - if (toggle[SCREEN_TRACE].value)  
229 - {  
230 - toggle[SCREEN_TRACE].value = False;  
231 - toggle_screenTrace(session, &toggle[SCREEN_TRACE], TT_FINAL);  
232 - }  
233 -*/  
234 #endif 213 #endif
235 } 214 }
236 215
src/lib3270/togglesc.h
@@ -25,5 +25,5 @@ @@ -25,5 +25,5 @@
25 25
26 // extern const char *toggle_names[N_TOGGLES]; 26 // extern const char *toggle_names[N_TOGGLES];
27 27
28 - LIB3270_INTERNAL void initialize_toggles(H3270 *session, struct toggle *toggle);  
29 - LIB3270_INTERNAL void shutdown_toggles(H3270 *session, struct toggle *toggle); 28 + LIB3270_INTERNAL void initialize_toggles(H3270 *session);
  29 + LIB3270_INTERNAL void shutdown_toggles(H3270 *session);