Commit 806591b134f14f881a7cffc5680998f8dbfb39cb

Authored by perry.werneck@gmail.com
1 parent 4908377b

Migrando mais campos de configuração para a estrutura de controle de sessão

@@ -52,8 +52,8 @@ typedef struct { @@ -52,8 +52,8 @@ typedef struct {
52 /* Options (not toggles) */ 52 /* Options (not toggles) */
53 char mono; 53 char mono;
54 char extended; 54 char extended;
55 - char m3279;  
56 - char modified_sel; 55 +// char m3279;
  56 +// char modified_sel;
57 // char once; 57 // char once;
58 //#if defined(X3270_DISPLAY) /*[*/ 58 //#if defined(X3270_DISPLAY) /*[*/
59 // char visual_bell; 59 // char visual_bell;
@@ -1198,7 +1198,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1198,7 +1198,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1198 trace_ds("%sresetMDT", paren); 1198 trace_ds("%sresetMDT", paren);
1199 paren = ","; 1199 paren = ",";
1200 baddr = 0; 1200 baddr = 0;
1201 - if (appres.modified_sel) 1201 + if (h3270.modified_sel)
1202 ALL_CHANGED; 1202 ALL_CHANGED;
1203 do { 1203 do {
1204 if (h3270.ea_buf[baddr].fa) { 1204 if (h3270.ea_buf[baddr].fa) {
@@ -1485,14 +1485,14 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1485,14 +1485,14 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1485 see_efa(*cp, 1485 see_efa(*cp,
1486 *(cp + 1))); 1486 *(cp + 1)));
1487 cp++; 1487 cp++;
1488 - if (appres.m3279) 1488 + if (h3270.m3279)
1489 ctlr_add_fg(h3270.buffer_addr, *cp); 1489 ctlr_add_fg(h3270.buffer_addr, *cp);
1490 } else if (*cp == XA_BACKGROUND) { 1490 } else if (*cp == XA_BACKGROUND) {
1491 trace_ds("%s", 1491 trace_ds("%s",
1492 see_efa(*cp, 1492 see_efa(*cp,
1493 *(cp + 1))); 1493 *(cp + 1)));
1494 cp++; 1494 cp++;
1495 - if (appres.m3279) 1495 + if (h3270.m3279)
1496 ctlr_add_bg(h3270.buffer_addr, *cp); 1496 ctlr_add_bg(h3270.buffer_addr, *cp);
1497 } else if (*cp == XA_HIGHLIGHTING) { 1497 } else if (*cp == XA_HIGHLIGHTING) {
1498 trace_ds("%s", 1498 trace_ds("%s",
@@ -1558,12 +1558,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1558,12 +1558,12 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1558 } else if (*cp == XA_FOREGROUND) { 1558 } else if (*cp == XA_FOREGROUND) {
1559 trace_ds("%s", see_efa(*cp, *(cp + 1))); 1559 trace_ds("%s", see_efa(*cp, *(cp + 1)));
1560 cp++; 1560 cp++;
1561 - if (appres.m3279) 1561 + if (h3270.m3279)
1562 efa_fg = *cp; 1562 efa_fg = *cp;
1563 } else if (*cp == XA_BACKGROUND) { 1563 } else if (*cp == XA_BACKGROUND) {
1564 trace_ds("%s", see_efa(*cp, *(cp + 1))); 1564 trace_ds("%s", see_efa(*cp, *(cp + 1)));
1565 cp++; 1565 cp++;
1566 - if (appres.m3279) 1566 + if (h3270.m3279)
1567 efa_bg = *cp; 1567 efa_bg = *cp;
1568 } else if (*cp == XA_HIGHLIGHTING) { 1568 } else if (*cp == XA_HIGHLIGHTING) {
1569 trace_ds("%s", see_efa(*cp, *(cp + 1))); 1569 trace_ds("%s", see_efa(*cp, *(cp + 1)));
@@ -1608,11 +1608,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1608,11 +1608,11 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1608 cp++; 1608 cp++;
1609 if (*cp == XA_FOREGROUND) { 1609 if (*cp == XA_FOREGROUND) {
1610 trace_ds("%s", see_efa(*cp, *(cp + 1))); 1610 trace_ds("%s", see_efa(*cp, *(cp + 1)));
1611 - if (appres.m3279) 1611 + if (h3270.m3279)
1612 default_fg = *(cp + 1); 1612 default_fg = *(cp + 1);
1613 } else if (*cp == XA_BACKGROUND) { 1613 } else if (*cp == XA_BACKGROUND) {
1614 trace_ds("%s", see_efa(*cp, *(cp + 1))); 1614 trace_ds("%s", see_efa(*cp, *(cp + 1)));
1615 - if (appres.m3279) 1615 + if (h3270.m3279)
1616 default_bg = *(cp + 1); 1616 default_bg = *(cp + 1);
1617 } else if (*cp == XA_HIGHLIGHTING) { 1617 } else if (*cp == XA_HIGHLIGHTING) {
1618 trace_ds("%s", see_efa(*cp, *(cp + 1))); 1618 trace_ds("%s", see_efa(*cp, *(cp + 1)));
@@ -2446,7 +2446,7 @@ ctlr_add_gr(int baddr, unsigned char gr) @@ -2446,7 +2446,7 @@ ctlr_add_gr(int baddr, unsigned char gr)
2446 void 2446 void
2447 ctlr_add_fg(int baddr, unsigned char color) 2447 ctlr_add_fg(int baddr, unsigned char color)
2448 { 2448 {
2449 - if (!appres.m3279) 2449 + if (!h3270.m3279)
2450 return; 2450 return;
2451 if ((color & 0xf0) != 0xf0) 2451 if ((color & 0xf0) != 0xf0)
2452 color = 0; 2452 color = 0;
@@ -2463,7 +2463,7 @@ ctlr_add_fg(int baddr, unsigned char color) @@ -2463,7 +2463,7 @@ ctlr_add_fg(int baddr, unsigned char color)
2463 void 2463 void
2464 ctlr_add_bg(int baddr, unsigned char color) 2464 ctlr_add_bg(int baddr, unsigned char color)
2465 { 2465 {
2466 - if (!appres.m3279) 2466 + if (!h3270.m3279)
2467 return; 2467 return;
2468 if ((color & 0xf0) != 0xf0) 2468 if ((color & 0xf0) != 0xf0)
2469 color = 0; 2469 color = 0;
@@ -2639,7 +2639,7 @@ mdt_set(int baddr) @@ -2639,7 +2639,7 @@ mdt_set(int baddr)
2639 faddr = find_field_attribute(&h3270,baddr); 2639 faddr = find_field_attribute(&h3270,baddr);
2640 if (faddr >= 0 && !(h3270.ea_buf[faddr].fa & FA_MODIFY)) { 2640 if (faddr >= 0 && !(h3270.ea_buf[faddr].fa & FA_MODIFY)) {
2641 h3270.ea_buf[faddr].fa |= FA_MODIFY; 2641 h3270.ea_buf[faddr].fa |= FA_MODIFY;
2642 - if (appres.modified_sel) 2642 + if (h3270.modified_sel)
2643 ALL_CHANGED; 2643 ALL_CHANGED;
2644 } 2644 }
2645 } 2645 }
@@ -2652,7 +2652,7 @@ mdt_clear(int baddr) @@ -2652,7 +2652,7 @@ mdt_clear(int baddr)
2652 faddr = find_field_attribute(&h3270,baddr); 2652 faddr = find_field_attribute(&h3270,baddr);
2653 if (faddr >= 0 && (h3270.ea_buf[faddr].fa & FA_MODIFY)) { 2653 if (faddr >= 0 && (h3270.ea_buf[faddr].fa & FA_MODIFY)) {
2654 h3270.ea_buf[faddr].fa &= ~FA_MODIFY; 2654 h3270.ea_buf[faddr].fa &= ~FA_MODIFY;
2655 - if (appres.modified_sel) 2655 + if (h3270.modified_sel)
2656 ALL_CHANGED; 2656 ALL_CHANGED;
2657 } 2657 }
2658 } 2658 }
@@ -139,12 +139,10 @@ static void initialize(void) @@ -139,12 +139,10 @@ static void initialize(void)
139 appres.extended = True; 139 appres.extended = True;
140 140
141 #if defined(C3270) /*[*/ 141 #if defined(C3270) /*[*/
142 - appres.m3279 = True;  
143 -#else /*][*/  
144 - appres.m3279 = False; 142 + h3270.m3279 = True;
145 #endif /*]*/ 143 #endif /*]*/
146 144
147 - appres.modified_sel = False; 145 +// appres.modified_sel = False;
148 appres.apl_mode = False; 146 appres.apl_mode = False;
149 147
150 /* 148 /*
@@ -430,9 +428,9 @@ static struct { @@ -430,9 +428,9 @@ static struct {
430 { ResLnext, offset(lnext), XRM_STRING }, 428 { ResLnext, offset(lnext), XRM_STRING },
431 #endif /*]*/ 429 #endif /*]*/
432 { ResLoginMacro,offset(login_macro), XRM_STRING }, 430 { ResLoginMacro,offset(login_macro), XRM_STRING },
433 - { ResM3279, offset(m3279), XRM_BOOLEAN }, 431 +// { ResM3279, offset(m3279), XRM_BOOLEAN },
434 // { ResModel, offset(model), XRM_STRING }, 432 // { ResModel, offset(model), XRM_STRING },
435 - { ResModifiedSel, offset(modified_sel), XRM_BOOLEAN }, 433 +// { ResModifiedSel, offset(modified_sel), XRM_BOOLEAN },
436 #if defined(C3270) && !defined(_WIN32) /*[*/ 434 #if defined(C3270) && !defined(_WIN32) /*[*/
437 { ResMono, offset(mono), XRM_BOOLEAN }, 435 { ResMono, offset(mono), XRM_BOOLEAN },
438 #endif /*]*/ 436 #endif /*]*/
@@ -184,13 +184,15 @@ static void lib3270_session_init(H3270 *hSession, const char *model) @@ -184,13 +184,15 @@ static void lib3270_session_init(H3270 *hSession, const char *model)
184 } 184 }
185 185
186 if(appres.mono) 186 if(appres.mono)
187 - appres.m3279 = False; 187 + hSession->m3279 = 0;
  188 + else
  189 + hSession->m3279 = 1;
188 190
189 if(!appres.extended) 191 if(!appres.extended)
190 appres.oversize = CN; 192 appres.oversize = CN;
191 193
192 #if defined(RESTRICT_3279) 194 #if defined(RESTRICT_3279)
193 - if (appres.m3279 && model_number == 4) 195 + if (hSession->m3279 && model_number == 4)
194 model_number = 3; 196 model_number = 3;
195 #endif 197 #endif
196 198
@@ -285,11 +287,16 @@ static int parse_model_number(H3270 *session, const char *m) @@ -285,11 +287,16 @@ static int parse_model_number(H3270 *session, const char *m)
285 * If it's longer than one character, it needs to start with 287 * If it's longer than one character, it needs to start with
286 * '327[89]', and it sets the m3279 resource. 288 * '327[89]', and it sets the m3279 resource.
287 */ 289 */
288 - if (!strncmp(m, "3278", 4)) {  
289 - appres.m3279 = False;  
290 - } else if (!strncmp(m, "3279", 4)) {  
291 - appres.m3279 = True;  
292 - } else { 290 + if (!strncmp(m, "3278", 4))
  291 + {
  292 + session->m3279 = 0;
  293 + }
  294 + else if (!strncmp(m, "3279", 4))
  295 + {
  296 + session->m3279 = 1;
  297 + }
  298 + else
  299 + {
293 return -1; 300 return -1;
294 } 301 }
295 m += 4; 302 m += 4;
@@ -42,6 +42,10 @@ @@ -42,6 +42,10 @@
42 #include "resources.h" 42 #include "resources.h"
43 #endif /*]*/ 43 #endif /*]*/
44 44
  45 +#ifndef ANDROID
  46 + #include <stdlib.h>
  47 +#endif
  48 +
45 #if defined(_WIN32) /*[*/ 49 #if defined(_WIN32) /*[*/
46 #include <winsock2.h> 50 #include <winsock2.h>
47 #include <ws2tcpip.h> 51 #include <ws2tcpip.h>
@@ -148,7 +148,7 @@ int screen_init(H3270 *session) @@ -148,7 +148,7 @@ int screen_init(H3270 *session)
148 /* Map a field attribute to its default colors. */ 148 /* Map a field attribute to its default colors. */
149 static unsigned short color_from_fa(unsigned char fa) 149 static unsigned short color_from_fa(unsigned char fa)
150 { 150 {
151 - if (appres.m3279) 151 + if (h3270.m3279)
152 return get_color_pair(DEFCOLOR_MAP(fa),0) | COLOR_ATTR_FIELD; 152 return get_color_pair(DEFCOLOR_MAP(fa),0) | COLOR_ATTR_FIELD;
153 153
154 // Green on black 154 // Green on black
@@ -166,7 +166,7 @@ static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa) @@ -166,7 +166,7 @@ static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa)
166 /* Compute the color. */ 166 /* Compute the color. */
167 167
168 /* Monochrome is easy, and so is color if nothing is specified. */ 168 /* Monochrome is easy, and so is color if nothing is specified. */
169 - if (!appres.m3279 || 169 + if (!h3270.m3279 ||
170 (!session->ea_buf[baddr].fg && 170 (!session->ea_buf[baddr].fg &&
171 !session->ea_buf[fa_addr].fg && 171 !session->ea_buf[fa_addr].fg &&
172 !session->ea_buf[baddr].bg && 172 !session->ea_buf[baddr].bg &&
@@ -219,10 +219,10 @@ static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa) @@ -219,10 +219,10 @@ static unsigned short calc_attrs(H3270 *session, int baddr, int fa_addr, int fa)
219 a |= LIB3270_ATTR_UNDERLINE; 219 a |= LIB3270_ATTR_UNDERLINE;
220 } 220 }
221 221
222 - if(appres.m3279 && (gr & (GR_BLINK | GR_UNDERLINE)) && !(gr & GR_REVERSE) && !bg) 222 + if(h3270.m3279 && (gr & (GR_BLINK | GR_UNDERLINE)) && !(gr & GR_REVERSE) && !bg)
223 a |= LIB3270_ATTR_BACKGROUND_INTENSITY; 223 a |= LIB3270_ATTR_BACKGROUND_INTENSITY;
224 224
225 - if(!appres.m3279 && ((gr & GR_INTENSIFY) || FA_IS_HIGH(fa))) 225 + if(!h3270.m3279 && ((gr & GR_INTENSIFY) || FA_IS_HIGH(fa)))
226 a |= LIB3270_ATTR_INTENSIFY; 226 a |= LIB3270_ATTR_INTENSIFY;
227 227
228 if (gr & GR_REVERSE) 228 if (gr & GR_REVERSE)
@@ -260,7 +260,7 @@ void update_model_info(H3270 *session, int model, int cols, int rows) @@ -260,7 +260,7 @@ void update_model_info(H3270 *session, int model, int cols, int rows)
260 session->model_num = model; 260 session->model_num = model;
261 261
262 /* Update the model name. */ 262 /* Update the model name. */
263 - (void) sprintf(session->model_name, "327%c-%d%s",appres.m3279 ? '9' : '8',session->model_num,appres.extended ? "-E" : ""); 263 + (void) sprintf(session->model_name, "327%c-%d%s",session->m3279 ? '9' : '8',session->model_num,appres.extended ? "-E" : "");
264 264
265 session->update_model(session, session->model_name,session->model_num,rows,cols); 265 session->update_model(session, session->model_name,session->model_num,rows,cols);
266 } 266 }
@@ -770,7 +770,7 @@ do_qr_color(void) @@ -770,7 +770,7 @@ do_qr_color(void)
770 *obptr++ = 0xf0 + COLOR_GREEN; /* green */ 770 *obptr++ = 0xf0 + COLOR_GREEN; /* green */
771 for (i = 0xf1; i < 0xf1 + color_max - 1; i++) { 771 for (i = 0xf1; i < 0xf1 + color_max - 1; i++) {
772 *obptr++ = i; 772 *obptr++ = i;
773 - if (appres.m3279) 773 + if (h3270.m3279)
774 *obptr++ = i; 774 *obptr++ = i;
775 else 775 else
776 *obptr++ = 0x00; 776 *obptr++ = 0x00;
@@ -779,7 +779,7 @@ do_qr_color(void) @@ -779,7 +779,7 @@ do_qr_color(void)
779 /* 779 /*
780 #if !defined(X3270_DISPLAY) 780 #if !defined(X3270_DISPLAY)
781 // Add background color. 781 // Add background color.
782 - if (appres.m3279) { 782 + if (h3270.m3279) {
783 space3270out(4); 783 space3270out(4);
784 *obptr++ = 4; // length 784 *obptr++ = 4; // length
785 *obptr++ = 0x02; // background color 785 *obptr++ = 0x02; // background color
@@ -677,8 +677,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo @@ -677,8 +677,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
677 /* set up temporary termtype */ 677 /* set up temporary termtype */
678 if (appres.termname == CN && session->std_ds_host) 678 if (appres.termname == CN && session->std_ds_host)
679 { 679 {
680 - (void) sprintf(ttype_tmpval, "IBM-327%c-%d",  
681 - appres.m3279 ? '9' : '8', session->model_num); 680 + (void) sprintf(ttype_tmpval, "IBM-327%c-%d",session->m3279 ? '9' : '8', session->model_num);
682 session->termtype = ttype_tmpval; 681 session->termtype = ttype_tmpval;
683 } 682 }
684 683