Commit 4908377b3ffb2edd80eb4718dc544b64d17c2142

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

Implementando biblioteca básica para android

@@ -34,15 +34,18 @@ @@ -34,15 +34,18 @@
34 34
35 #include "globals.h" 35 #include "globals.h"
36 #include "api.h" 36 #include "api.h"
37 -#if defined(_WIN32) /*[*/  
38 -#include "appres.h"  
39 -#include "trace_dsc.h"  
40 -#include "xioc.h"  
41 -#endif /*]*/ 37 +#include <malloc.h>
  38 +
  39 +#if defined(_WIN32)
  40 + #include "appres.h"
  41 + #include "trace_dsc.h"
  42 + #include "xioc.h"
  43 +#endif
  44 +
42 #include "utilc.h" 45 #include "utilc.h"
43 46
44 #include <stdio.h> 47 #include <stdio.h>
45 -#include <stdlib.h> 48 +// #include <stdlib.h>
46 #include <string.h> 49 #include <string.h>
47 #include <errno.h> 50 #include <errno.h>
48 #include "X11keysym.h" 51 #include "X11keysym.h"
@@ -78,6 +81,10 @@ @@ -78,6 +81,10 @@
78 81
79 #define MILLION 1000000L 82 #define MILLION 1000000L
80 83
  84 +/*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/
  85 +
  86 + H3270 h3270;
  87 +
81 /*---[ Callbacks ]------------------------------------------------------------------------------------------*/ 88 /*---[ Callbacks ]------------------------------------------------------------------------------------------*/
82 89
83 static void DefaultRemoveTimeOut(unsigned long timer); 90 static void DefaultRemoveTimeOut(unsigned long timer);
@@ -477,7 +477,7 @@ void ctlr_erase(H3270 *session, int alt) @@ -477,7 +477,7 @@ void ctlr_erase(H3270 *session, int alt)
477 /* Going from maximum to 24x80. */ 477 /* Going from maximum to 24x80. */
478 if (session->maxROWS > 24 || session->maxCOLS > 80) 478 if (session->maxROWS > 24 || session->maxCOLS > 80)
479 { 479 {
480 - if (visible_control) 480 + if(session->vcontrol)
481 { 481 {
482 ctlr_blanks(); 482 ctlr_blanks();
483 screen_disp(session); 483 screen_disp(session);
@@ -2282,7 +2282,7 @@ ps_process(void) @@ -2282,7 +2282,7 @@ ps_process(void)
2282 ; 2282 ;
2283 // sms_continue(); 2283 // sms_continue();
2284 2284
2285 -#if defined(X3270_FT) /*[*/ 2285 +#if defined(X3270_FT)
2286 /* Process file transfers. */ 2286 /* Process file transfers. */
2287 if (lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE && /* transfer in progress */ 2287 if (lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE && /* transfer in progress */
2288 h3270.formatted && /* screen is formatted */ 2288 h3270.formatted && /* screen is formatted */
@@ -2292,7 +2292,7 @@ ps_process(void) @@ -2292,7 +2292,7 @@ ps_process(void)
2292 h3270.ea_buf[1919].fa && FA_IS_SKIP(h3270.ea_buf[1919].fa)) { 2292 h3270.ea_buf[1919].fa && FA_IS_SKIP(h3270.ea_buf[1919].fa)) {
2293 ft_cut_data(); 2293 ft_cut_data();
2294 } 2294 }
2295 -#endif /*]*/ 2295 +#endif
2296 } 2296 }
2297 2297
2298 /* 2298 /*
@@ -2666,9 +2666,10 @@ ctlr_shrink(void) @@ -2666,9 +2666,10 @@ ctlr_shrink(void)
2666 { 2666 {
2667 int baddr; 2667 int baddr;
2668 2668
2669 - for (baddr = 0; baddr < h3270.rows*h3270.cols; baddr++) { 2669 + for (baddr = 0; baddr < h3270.rows*h3270.cols; baddr++)
  2670 + {
2670 if (!h3270.ea_buf[baddr].fa) 2671 if (!h3270.ea_buf[baddr].fa)
2671 - h3270.ea_buf[baddr].cc = visible_control? EBC_space : EBC_null; 2672 + h3270.ea_buf[baddr].cc = h3270.vcontrol ? EBC_space : EBC_null;
2672 } 2673 }
2673 ALL_CHANGED; 2674 ALL_CHANGED;
2674 screen_disp(&h3270); 2675 screen_disp(&h3270);
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 #include "globals.h" 36 #include "globals.h"
37 37
38 #include <errno.h> 38 #include <errno.h>
  39 +#include <malloc.h>
39 40
40 #include "appres.h" 41 #include "appres.h"
41 #include "actionsc.h" 42 #include "actionsc.h"
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 */ 36 */
37 37
38 #include <errno.h> 38 #include <errno.h>
  39 +#include <malloc.h>
39 40
40 #include "globals.h" 41 #include "globals.h"
41 42
@@ -55,6 +55,7 @@ @@ -55,6 +55,7 @@
55 #include "utilc.h" 55 #include "utilc.h"
56 56
57 #include <errno.h> 57 #include <errno.h>
  58 +#include <malloc.h>
58 59
59 extern unsigned char aid; 60 extern unsigned char aid;
60 61
@@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
106 * Prerequisite #includes. 106 * Prerequisite #includes.
107 */ 107 */
108 #include <stdio.h> /* Unix standard I/O library */ 108 #include <stdio.h> /* Unix standard I/O library */
109 -#include <stdlib.h> /* Other Unix library functions */ 109 +// #include <stdlib.h> /* Other Unix library functions */
110 #include <unistd.h> /* Unix system calls */ 110 #include <unistd.h> /* Unix system calls */
111 #include <ctype.h> /* Character classes */ 111 #include <ctype.h> /* Character classes */
112 #include <string.h> /* String manipulations */ 112 #include <string.h> /* String manipulations */
@@ -248,7 +248,7 @@ LIB3270_INTERNAL Boolean *standard_font; @@ -248,7 +248,7 @@ LIB3270_INTERNAL Boolean *standard_font;
248 LIB3270_INTERNAL Boolean std_ds_host; 248 LIB3270_INTERNAL Boolean std_ds_host;
249 LIB3270_INTERNAL char *termtype; 249 LIB3270_INTERNAL char *termtype;
250 LIB3270_INTERNAL Widget toplevel; 250 LIB3270_INTERNAL Widget toplevel;
251 -LIB3270_INTERNAL Boolean visible_control; 251 +// LIB3270_INTERNAL Boolean visible_control;
252 LIB3270_INTERNAL int *xtra_width; 252 LIB3270_INTERNAL int *xtra_width;
253 253
254 /* 254 /*
@@ -100,7 +100,6 @@ @@ -100,7 +100,6 @@
100 #define LAST_ARG "--" 100 #define LAST_ARG "--"
101 101
102 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ 102 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/
103 - H3270 h3270;  
104 const char * programname; 103 const char * programname;
105 AppRes appres; 104 AppRes appres;
106 int children = 0; 105 int children = 0;
@@ -798,8 +797,6 @@ int *char_width = &amp;cw; @@ -798,8 +797,6 @@ int *char_width = &amp;cw;
798 static int ch = 7; 797 static int ch = 7;
799 int *char_height = &ch; 798 int *char_height = &ch;
800 799
801 -Boolean visible_control = False;  
802 -  
803 // Boolean flipped = False; 800 // Boolean flipped = False;
804 801
805 /* Replacements for functions in popups.c. */ 802 /* Replacements for functions in popups.c. */
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
52 #include "xioc.h" 52 #include "xioc.h"
53 53
54 #include <errno.h> 54 #include <errno.h>
  55 +#include <malloc.h>
55 56
56 #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */ 57 #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */
57 #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */ 58 #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */
@@ -35,6 +35,8 @@ @@ -35,6 +35,8 @@
35 #include "appres.h" 35 #include "appres.h"
36 #include "charsetc.h" 36 #include "charsetc.h"
37 37
  38 +#include <malloc.h>
  39 +
38 /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ 40 /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/
39 41
40 static int parse_model_number(H3270 *session, const char *m); 42 static int parse_model_number(H3270 *session, const char *m);
@@ -45,9 +45,10 @@ @@ -45,9 +45,10 @@
45 #endif 45 #endif
46 46
47 #include <fcntl.h> 47 #include <fcntl.h>
  48 +#include <malloc.h>
  49 +
48 #include "3270ds.h" 50 #include "3270ds.h"
49 #include "appres.h" 51 #include "appres.h"
50 -// #include "ctlr.h"  
51 #include "resources.h" 52 #include "resources.h"
52 53
53 #include "actionsc.h" 54 #include "actionsc.h"
@@ -46,6 +46,8 @@ @@ -46,6 +46,8 @@
46 #include <winsock2.h> 46 #include <winsock2.h>
47 #include <ws2tcpip.h> 47 #include <ws2tcpip.h>
48 #else /*][*/ 48 #else /*][*/
  49 +
  50 +#include <malloc.h>
49 #include <sys/socket.h> 51 #include <sys/socket.h>
50 #include <sys/ioctl.h> 52 #include <sys/ioctl.h>
51 #include <netinet/in.h> 53 #include <netinet/in.h>
@@ -48,6 +48,8 @@ @@ -48,6 +48,8 @@
48 #include <netdb.h> 48 #include <netdb.h>
49 #endif /*]*/ 49 #endif /*]*/
50 50
  51 +#include <stdlib.h>
  52 +
51 #include "api.h" 53 #include "api.h"
52 54
53 #include <assert.h> 55 #include <assert.h>
@@ -29,6 +29,7 @@ @@ -29,6 +29,7 @@
29 29
30 #include "globals.h" 30 #include "globals.h"
31 #include "appres.h" 31 #include "appres.h"
  32 + #include <malloc.h>
32 #include <lib3270.h> 33 #include <lib3270.h>
33 #include <lib3270/session.h> 34 #include <lib3270/session.h>
34 #include <lib3270/selection.h> 35 #include <lib3270/selection.h>
@@ -38,10 +38,14 @@ @@ -38,10 +38,14 @@
38 */ 38 */
39 39
40 #if defined(_WIN32) 40 #if defined(_WIN32)
41 - #include <winsock2.h>  
42 - #include <windows.h> 41 + #include <winsock2.h>
  42 + #include <windows.h>
43 #endif 43 #endif
44 44
  45 +#ifndef ANDROID
  46 + #include <stdlib.h>
  47 +#endif // !ANDROID
  48 +
45 #include <lib3270/config.h> 49 #include <lib3270/config.h>
46 #if defined(HAVE_LIBSSL) 50 #if defined(HAVE_LIBSSL)
47 #include <openssl/ssl.h> 51 #include <openssl/ssl.h>
@@ -533,9 +537,12 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo @@ -533,9 +537,12 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
533 537
534 /* get the passthru host and port number */ 538 /* get the passthru host and port number */
535 if (session->passthru_host) { 539 if (session->passthru_host) {
536 - const char *hn; 540 + const char *hn = CN;
537 541
  542 +#ifndef ANDROID
538 hn = getenv("INTERNET_HOST"); 543 hn = getenv("INTERNET_HOST");
  544 +#endif // ANDROID
  545 +
539 if (hn == CN) 546 if (hn == CN)
540 hn = "internet-gateway"; 547 hn = "internet-gateway";
541 548
@@ -3432,7 +3439,7 @@ int net_getsockname(const H3270 *session, void *buf, int *len) @@ -3432,7 +3439,7 @@ int net_getsockname(const H3270 *session, void *buf, int *len)
3432 char * 3439 char *
3433 net_proxy_type(void) 3440 net_proxy_type(void)
3434 { 3441 {
3435 - if (proxy_type > 0) 3442 + if (proxy_type > 0)
3436 return proxy_type_name(proxy_type); 3443 return proxy_type_name(proxy_type);
3437 else 3444 else
3438 return NULL; 3445 return NULL;
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 #define MARGINED_PASTE LIB3270_TOGGLE_MARGINED_PASTE 55 #define MARGINED_PASTE LIB3270_TOGGLE_MARGINED_PASTE
56 #define RECTANGLE_SELECT LIB3270_TOGGLE_RECTANGLE_SELECT 56 #define RECTANGLE_SELECT LIB3270_TOGGLE_RECTANGLE_SELECT
57 #define CROSSHAIR LIB3270_TOGGLE_CROSSHAIR 57 #define CROSSHAIR LIB3270_TOGGLE_CROSSHAIR
58 - #define VISIBLE_CONTROL LIB3270_TOGGLE_VISIBLE_CONTROL 58 +// #define VISIBLE_CONTROL LIB3270_TOGGLE_VISIBLE_CONTROL
59 #define AID_WAIT LIB3270_TOGGLE_AID_WAIT 59 #define AID_WAIT LIB3270_TOGGLE_AID_WAIT
60 #define FULL_SCREEN LIB3270_TOGGLE_FULL_SCREEN 60 #define FULL_SCREEN LIB3270_TOGGLE_FULL_SCREEN
61 #define RECONNECT LIB3270_TOGGLE_RECONNECT 61 #define RECONNECT LIB3270_TOGGLE_RECONNECT
@@ -53,6 +53,10 @@ @@ -53,6 +53,10 @@
53 #include <pwd.h> 53 #include <pwd.h>
54 #endif // _WIN32 54 #endif // _WIN32
55 55
  56 +#ifndef ANDROID
  57 + #include <stdlib.h>
  58 +#endif // !ANDROID
  59 +
56 #include <stdarg.h> 60 #include <stdarg.h>
57 #include "resources.h" 61 #include "resources.h"
58 62
@@ -516,7 +520,7 @@ get_message(const char *key) @@ -516,7 +520,7 @@ get_message(const char *key)
516 #endif 520 #endif
517 */ 521 */
518 522
519 -#define ex_getenv getenv 523 +// #define ex_getenv getenv
520 524
521 /* Variable and tilde substitution functions. */ 525 /* Variable and tilde substitution functions. */
522 static char * 526 static char *
@@ -602,7 +606,10 @@ var_subst(const char *s) @@ -602,7 +606,10 @@ var_subst(const char *s)
602 vn = Malloc(vn_len + 1); 606 vn = Malloc(vn_len + 1);
603 (void) strncpy(vn, vn_start, vn_len); 607 (void) strncpy(vn, vn_start, vn_len);
604 vn[vn_len] = '\0'; 608 vn[vn_len] = '\0';
605 - if ((vv = ex_getenv(vn))) { 609 +
  610 +#ifndef ANDROID
  611 + if((vv = getenv(vn)))
  612 + {
606 *o = '\0'; 613 *o = '\0';
607 o_len = o_len 614 o_len = o_len
608 - 1 /* '$' */ 615 - 1 /* '$' */
@@ -615,6 +622,8 @@ var_subst(const char *s) @@ -615,6 +622,8 @@ var_subst(const char *s)
615 (void) strcpy(o, vv); 622 (void) strcpy(o, vv);
616 o += strlen(vv); 623 o += strlen(vv);
617 } 624 }
  625 +#endif // !ANDROID
  626 +
618 Free(vn); 627 Free(vn);
619 if (state == VS_VNB) { 628 if (state == VS_VNB) {
620 state = VS_BASE; 629 state = VS_BASE;