Commit 2b74680a6841a2c608318d90112666afdfdeec66

Authored by perry.werneck@gmail.com
1 parent 0b463e02

Implementando versão android

android/jni/misc.cpp
... ... @@ -44,3 +44,16 @@ JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getEncoding(JNIEnv *env,
44 44 {
45 45 return env->NewStringUTF(lib3270_get_charset(lib3270_get_default_session_handle()));
46 46 }
  47 +
  48 +JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setToggle(JNIEnv *env, jobject obj, jstring name, jboolean state)
  49 +{
  50 + LIB3270_TOGGLE id = lib3270_get_toggle_id(env->GetStringUTFChars(name, 0));
  51 +
  52 + session_request(env,obj);
  53 +
  54 + if(id >= 0)
  55 + lib3270_set_toggle(session,id,state ? 1 : 0);
  56 +
  57 + session_release();
  58 +
  59 +}
... ...
android/lib3270NDK.cbp
... ... @@ -39,6 +39,9 @@
39 39 <Unit filename="../src/lib3270/html.c">
40 40 <Option compilerVar="CC" />
41 41 </Unit>
  42 + <Unit filename="../src/lib3270/kybd.c">
  43 + <Option compilerVar="CC" />
  44 + </Unit>
42 45 <Unit filename="../src/lib3270/selection.c">
43 46 <Option compilerVar="CC" />
44 47 </Unit>
... ...
android/src/br/com/bb/pw3270/lib3270.java
... ... @@ -33,6 +33,9 @@ public class lib3270
33 33  
34 34 lib3270()
35 35 {
  36 + setToggle("dstrace",true);
  37 + setToggle("screentrace",true);
  38 + setToggle("eventtrace",true);
36 39 changed = false;
37 40 mainloop = null;
38 41 }
... ... @@ -358,6 +361,7 @@ public class lib3270
358 361 public native String getEncoding();
359 362 public native String getVersion();
360 363 public native String getRevision();
  364 + public native void setToggle(String name, boolean state);
361 365  
362 366 // Network I/O
363 367 public native void procRecvdata( byte[] data, int len);
... ...
po/pt_BR.po
... ... @@ -5,7 +5,7 @@ msgid &quot;&quot;
5 5 msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 7 "Report-Msgid-Bugs-To: \n"
8   -"POT-Creation-Date: 2012-07-09 08:24-0300\n"
  8 +"POT-Creation-Date: 2012-07-12 09:26-0300\n"
9 9 "PO-Revision-Date: 2012-06-21 11:08-0300\n"
10 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português do Brasil <>\n"
... ... @@ -43,7 +43,7 @@ msgstr &quot;%s requer GTK versão %d.%d.%d&quot;
43 43 msgid "%s: unknown family %d"
44 44 msgstr "%s: Familia %d é inválida"
45 45  
46   -#: telnet.c:1067
  46 +#: telnet.c:1083
47 47 #, c-format
48 48 msgid "%s:%d"
49 49 msgstr "%s:%d"
... ... @@ -90,7 +90,7 @@ msgstr &quot;&lt;%s&gt; precisa do atributo %s&quot;
90 90 msgid "<%s> should be on toplevel"
91 91 msgstr "<%s> deve estar no primeiro nível"
92 92  
93   -#: telnet.c:3332
  93 +#: telnet.c:3312
94 94 #, c-format
95 95 msgid ""
96 96 "<b>Connection state:</b> %s\n"
... ... @@ -161,7 +161,7 @@ msgstr &quot;BLKSIZE:&quot;
161 161 msgid "Background"
162 162 msgstr "Fundo"
163 163  
164   -#: telnet.c:417
  164 +#: telnet.c:418
165 165 msgid "Bad winsock version"
166 166 msgstr "Versão winsock inválida"
167 167  
... ... @@ -189,6 +189,10 @@ msgstr &quot;Negrito&quot;
189 189 msgid "Brazilian Public Software Portal"
190 190 msgstr "Portal do Software Público Brasileiro"
191 191  
  192 +#: telnet.c:2037
  193 +msgid "Broken pipe"
  194 +msgstr "Broken pipe"
  195 +
192 196 #: dialog.c:99
193 197 msgid "C_haracter Coding:"
194 198 msgstr "C_odificação de caracteres:"
... ... @@ -206,12 +210,12 @@ msgstr &quot;At_ual&quot;
206 210 msgid "Can't accept unnamed %s"
207 211 msgstr "Não posso aceitar elemento %s sem nome"
208 212  
209   -#: telnet.c:699
  213 +#: telnet.c:700
210 214 #, c-format
211 215 msgid "Can't connect to %s:%d"
212 216 msgstr "Não foi possível conectar a %s:%d"
213 217  
214   -#: host.c:315
  218 +#: host.c:316
215 219 msgid "Can't connect to host"
216 220 msgstr "Não foi possível conectar ao servidor"
217 221  
... ... @@ -281,7 +285,7 @@ msgstr &quot;&quot;
281 285 "Não foi possível salvar a seleção para o arquivo\n"
282 286 "%s"
283 287  
284   -#: telnet.c:838
  288 +#: telnet.c:839
285 289 msgid "Can't set SSL socket file descriptor"
286 290 msgstr "Não foi possível definir o descritor de socket SSL"
287 291  
... ... @@ -301,7 +305,7 @@ msgstr &quot;Não foi possível iniciar transferência de arquivo&quot;
301 305 msgid "Can't start upload"
302 306 msgstr "Não foi possível iniciar upload"
303 307  
304   -#: telnet.c:418
  308 +#: telnet.c:419
305 309 #, c-format
306 310 msgid "Can't use winsock version %d.%d"
307 311 msgstr "Não é possível usar a Winsock versão %d.%d"
... ... @@ -310,11 +314,11 @@ msgstr &quot;Não é possível usar a Winsock versão %d.%d&quot;
310 314 msgid "Cancelled by user"
311 315 msgstr "Cancelado pelo usuário"
312 316  
313   -#: telnet.c:733
  317 +#: telnet.c:734
314 318 msgid "Cannot create socket handle"
315 319 msgstr "Não foi possível criar um manipulador de socket"
316 320  
317   -#: session.c:307
  321 +#: session.c:309
318 322 #, c-format
319 323 msgid "Cannot find charset \"%s\", using defaults"
320 324 msgstr "Não encontrei codificação \"%s\", usando defaults"
... ... @@ -347,10 +351,15 @@ msgstr &quot;Completo&quot;
347 351 msgid "Connect on startup"
348 352 msgstr "Conectar ao iniciar"
349 353  
350   -#: telnet.c:838 telnet.c:856
  354 +#: telnet.c:839 telnet.c:857
351 355 msgid "Connection failed"
352 356 msgstr "Conexão falhou"
353 357  
  358 +#: telnet.c:2041
  359 +#, fuzzy
  360 +msgid "Connection reset by peer"
  361 +msgstr "Ação falhou"
  362 +
354 363 #: ui/00default.xml:116
355 364 msgid "Copy"
356 365 msgstr "Copiar"
... ... @@ -416,7 +425,7 @@ msgstr &quot;Mostrar atualizações de janela&quot;
416 425 msgid "Default"
417 426 msgstr "Padrão"
418 427  
419   -#: telnet.c:1673
  428 +#: telnet.c:1692
420 429 msgid "Device type rejected"
421 430 msgstr "Tipo de dispositivo rejeitado"
422 431  
... ... @@ -424,7 +433,7 @@ msgstr &quot;Tipo de dispositivo rejeitado&quot;
424 433 msgid "Disconnected from host"
425 434 msgstr "Desconectado do servidor"
426 435  
427   -#: telnet.c:1266
  436 +#: telnet.c:1285
428 437 msgid "EOR received when not in 3270 mode, ignored."
429 438 msgstr "EOR recebido fora do modo 3270, ignorado."
430 439  
... ... @@ -432,15 +441,15 @@ msgstr &quot;EOR recebido fora do modo 3270, ignorado.&quot;
432 441 msgid "ET_A"
433 442 msgstr "ET_A"
434 443  
435   -#: host.c:339
  444 +#: host.c:340
436 445 msgid "Empty LU name"
437 446 msgstr "Nome da LU está em branco"
438 447  
439   -#: host.c:266 host.c:393
  448 +#: host.c:267 host.c:394
440 449 msgid "Empty hostname"
441 450 msgstr "Nome do host em branco"
442 451  
443   -#: host.c:446
  452 +#: host.c:447
444 453 msgid "Empty port name"
445 454 msgstr "Porta em branco"
446 455  
... ... @@ -541,11 +550,11 @@ msgstr &quot;Servidor desconectou, transferência cancelada&quot;
541 550 msgid "Host is T_SO"
542 551 msgstr "Servidor é T_SO"
543 552  
544   -#: telnet.c:1661
  553 +#: telnet.c:1680
545 554 msgid "Host rejected device type or request type"
546 555 msgstr "Host rejected device type or request type"
547 556  
548   -#: telnet.c:1671
  557 +#: telnet.c:1690
549 558 msgid "Host rejected resource(s)"
550 559 msgstr "Host rejected resource(s)"
551 560  
... ... @@ -553,8 +562,8 @@ msgstr &quot;Host rejected resource(s)&quot;
553 562 msgid "Host to connect"
554 563 msgstr "Servidor a conectar"
555 564  
556   -#: host.c:314 host.c:339 host.c:351 host.c:377 host.c:389 host.c:393
557   -#: host.c:446 host.c:461
  565 +#: host.c:315 host.c:340 host.c:352 host.c:378 host.c:390 host.c:394
  566 +#: host.c:447 host.c:462
558 567 msgid "Hostname syntax error"
559 568 msgstr "Formato inválido no nome do servidor"
560 569  
... ... @@ -578,7 +587,7 @@ msgstr &quot;Intensificado/Protegido&quot;
578 587 msgid "Intensified/Unprotected"
579 588 msgstr "Intensificado/Desprotegido"
580 589  
581   -#: host.c:495
  590 +#: host.c:496
582 591 msgid "Invalid (empty) hostname"
583 592 msgstr "Nome do host é invalido (vazio)"
584 593  
... ... @@ -602,7 +611,7 @@ msgstr &quot;LRECL:&quot;
602 611 msgid "Misc colors"
603 612 msgstr "Cores diversas"
604 613  
605   -#: host.c:389
  614 +#: host.c:390
606 615 msgid "Missing ']'"
607 616 msgstr "Faltando ']'"
608 617  
... ... @@ -619,7 +628,7 @@ msgstr &quot;Só Maiúsculas&quot;
619 628 msgid "Move action needs target & direction attributes"
620 629 msgstr "Ação \"move\" precisa dos atributos \"target\" e \"direction\""
621 630  
622   -#: host.c:461
  631 +#: host.c:462
623 632 msgid "Multiple port names"
624 633 msgstr "Múltiplos nomes de porta"
625 634  
... ... @@ -635,11 +644,11 @@ msgstr &quot;Mostarda&quot;
635 644 msgid "N/A"
636 645 msgstr "N/A"
637 646  
638   -#: telnet.c:447 telnet.c:703
  647 +#: telnet.c:448 telnet.c:704
639 648 msgid "Network error"
640 649 msgstr "Erro de rede"
641 650  
642   -#: telnet.c:405 telnet.c:416 telnet.c:732 telnet.c:743
  651 +#: telnet.c:406 telnet.c:417 telnet.c:733 telnet.c:744
643 652 msgid "Network startup error"
644 653 msgstr "Erro ao iniciar a rede"
645 654  
... ... @@ -679,7 +688,7 @@ msgstr &quot;Estado inválido na OIA&quot;
679 688 msgid "OIA status ok"
680 689 msgstr "Estado normal na OIA"
681 690  
682   -#: host.c:316
  691 +#: host.c:317
683 692 #, c-format
684 693 msgid "Option '%c:' is not supported"
685 694 msgstr "Opção não suportada: '%c:'"
... ... @@ -789,26 +798,33 @@ msgstr &quot;Reselecionar&quot;
789 798 msgid "Return"
790 799 msgstr "Return"
791 800  
792   -#: telnet.c:3330
  801 +#: telnet.c:3310
793 802 msgid "SSL Connect error"
794 803 msgstr "Erro na conexão SSL"
795 804  
796   -#: telnet.c:1050
  805 +#: telnet.c:1066
797 806 msgid "SSL Error"
798 807 msgstr "Erro SSL"
799 808  
800   -#: telnet.c:1050
  809 +#: telnet.c:1066
801 810 msgid "SSL Read error"
802 811 msgstr "Erro de leitura SSL"
803 812  
804   -#: host.c:301
  813 +#: host.c:302
805 814 msgid "SSL error"
806 815 msgstr "Erro SSL"
807 816  
808   -#: telnet.c:856
  817 +#: telnet.c:857
809 818 msgid "SSL negotiation failed"
810 819 msgstr "Negociação SSL falhou"
811 820  
  821 +#: telnet.c:2027
  822 +#, fuzzy, c-format
  823 +msgid ""
  824 +"SSL_write:\n"
  825 +"%s"
  826 +msgstr "write(%s): %s"
  827 +
812 828 #: ui/00default.xml:101
813 829 msgid "Save copy"
814 830 msgstr "Salvar cópia"
... ... @@ -913,11 +929,11 @@ msgstr &quot;Mostrar padrão de teste&quot;
913 929 msgid "Smart paste"
914 930 msgstr "Colar inteligente"
915 931  
916   -#: telnet.c:1071
  932 +#: telnet.c:1087
917 933 msgid "Socket read error"
918 934 msgstr "Erro ao ler dados da rede"
919 935  
920   -#: telnet.c:2043
  936 +#: telnet.c:2048
921 937 msgid "Socket write error"
922 938 msgstr "Erro ao enviar dados para a rede"
923 939  
... ... @@ -925,7 +941,7 @@ msgstr &quot;Erro ao enviar dados para a rede&quot;
925 941 msgid "Space allocation units"
926 942 msgstr "Space allocation units"
927 943  
928   -#: host.c:351
  944 +#: host.c:352
929 945 msgid "Space in LU name"
930 946 msgstr "Espaço no nome da LU"
931 947  
... ... @@ -941,7 +957,7 @@ msgstr &quot;T_otal&quot;
941 957 msgid "Terminal colors"
942 958 msgstr "Cores do terminal"
943 959  
944   -#: host.c:377
  960 +#: host.c:378
945 961 msgid "Text before '['"
946 962 msgstr "Texto antes de '['"
947 963  
... ... @@ -982,7 +998,7 @@ msgstr &quot;&quot;
982 998 "programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple "
983 999 "Place, Suite 330, Boston, MA, 02111-1307, USA"
984 1000  
985   -#: host.c:303
  1001 +#: host.c:304
986 1002 #, c-format
987 1003 msgid ""
988 1004 "This version of %s was built without support for secure sockets layer (SSL)."
... ... @@ -1032,7 +1048,7 @@ msgstr &quot;UTF-8&quot;
1032 1048 msgid "Uknown DFT Open type from host"
1033 1049 msgstr "Servidor enviou código de abertura DFT desconhecido"
1034 1050  
1035   -#: host.c:302
  1051 +#: host.c:303
1036 1052 msgid "Unable to connect to secure hosts"
1037 1053 msgstr "Não é possível conectar em servidores seguros"
1038 1054  
... ... @@ -1116,7 +1132,7 @@ msgstr &quot;&quot;
1116 1132 "Servidor desconhecido:\n"
1117 1133 "%s"
1118 1134  
1119   -#: telnet.c:576
  1135 +#: telnet.c:577
1120 1136 #, c-format
1121 1137 msgid "Unknown passthru host: %s"
1122 1138 msgstr ""
... ... @@ -1128,12 +1144,12 @@ msgstr &quot;&quot;
1128 1144 msgid "Unknown popup type \"%s\""
1129 1145 msgstr "Tipo de popup \"%s\" não é conhecido"
1130 1146  
1131   -#: telnet.c:605 resolver.c:147
  1147 +#: telnet.c:606 resolver.c:147
1132 1148 #, c-format
1133 1149 msgid "Unknown port number or service: %s"
1134 1150 msgstr "Número de porta ou serviço desconhecido: %s"
1135 1151  
1136   -#: telnet.c:561
  1152 +#: telnet.c:562
1137 1153 msgid "Unsupported passthru host session"
1138 1154 msgstr "Unsupported passthru host session"
1139 1155  
... ... @@ -1158,11 +1174,11 @@ msgstr &quot;Versão %s - Revisão %s&quot;
1158 1174 msgid "View Field Delimiters"
1159 1175 msgstr "View Field Delimiters"
1160 1176  
1161   -#: telnet.c:744
  1177 +#: telnet.c:745
1162 1178 msgid "WSAEventSelect failed"
1163 1179 msgstr "WSAEventSelect falhou"
1164 1180  
1165   -#: telnet.c:406
  1181 +#: telnet.c:407
1166 1182 msgid "WSAStartup failed"
1167 1183 msgstr "WSAStartup falhou"
1168 1184  
... ... @@ -1330,22 +1346,22 @@ msgstr &quot;um atributo \&quot;type\&quot; ou \&quot;group\&quot;&quot;
1330 1346 msgid "an action attribute"
1331 1347 msgstr "um atributo \"action\""
1332 1348  
1333   -#: telnet.c:3196 telnet.c:3207
  1349 +#: telnet.c:3175 telnet.c:3186
1334 1350 #, c-format
1335 1351 msgid "fcntl(%s)"
1336 1352 msgstr "fcntl(%s)"
1337 1353  
1338   -#: telnet.c:3186
  1354 +#: telnet.c:3165
1339 1355 #, c-format
1340 1356 msgid "ioctl(%s)"
1341 1357 msgstr "ioctl(%s)"
1342 1358  
1343   -#: telnet.c:654 telnet.c:660 telnet.c:667
  1359 +#: telnet.c:655 telnet.c:661 telnet.c:668
1344 1360 #, c-format
1345 1361 msgid "setsockopt(%s)"
1346 1362 msgstr "setsockopt(%s)"
1347 1363  
1348   -#: telnet.c:647
  1364 +#: telnet.c:648
1349 1365 msgid "socket"
1350 1366 msgstr "socket"
1351 1367  
... ... @@ -1353,7 +1369,7 @@ msgstr &quot;socket&quot;
1353 1369 msgid "translator-credits"
1354 1370 msgstr ""
1355 1371  
1356   -#: telnet.c:1046
  1372 +#: telnet.c:1062
1357 1373 msgid "unknown error"
1358 1374 msgstr "Erro desconhecido"
1359 1375  
... ... @@ -1387,15 +1403,8 @@ msgstr &quot;Erro desconhecido&quot;
1387 1403 #~ msgid "The name of the default TCP port to connect"
1388 1404 #~ msgstr "Nome da porta TCP para conectar"
1389 1405  
1390   -#, fuzzy
1391   -#~ msgid "Connection failed error"
1392   -#~ msgstr "Ação falhou"
1393   -
1394 1406 #~ msgid "Error \"%s\" reading local file (rc=%d)"
1395 1407 #~ msgstr "Error \"%s\" reading local file (rc=%d)"
1396 1408  
1397 1409 #~ msgid "Error \"%s\" writing to file (rc=%d)"
1398 1410 #~ msgstr "Error \"%s\" writing to file (rc=%d)"
1399   -
1400   -#~ msgid "write(%s): %s"
1401   -#~ msgstr "write(%s): %s"
... ...
src/include/lib3270/session.h
... ... @@ -274,7 +274,7 @@
274 274  
275 275 // Session based callbacks
276 276 int (*write)(H3270 *hSession, unsigned const char *buf, int len);
277   - int (*disconnect)(H3270 *hSession);
  277 + void (*disconnect)(H3270 *hSession);
278 278  
279 279 void (*configure)(H3270 *session, unsigned short rows, unsigned short cols);
280 280 void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor);
... ...
src/lib3270/host.c
... ... @@ -772,7 +772,7 @@ void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode)
772 772  
773 773 for (st = h->st_callbacks[tx];st;st = st->next)
774 774 {
775   - trace("st=%p func=%p",st,st->func);
  775 +// trace("st=%p func=%p",st,st->func);
776 776 st->func(h,mode,st->data);
777 777 }
778 778  
... ...
src/lib3270/kybd.c
... ... @@ -171,7 +171,12 @@ static struct ta
171 171 } *ta_head = (struct ta *) NULL,
172 172 *ta_tail = (struct ta *) NULL;
173 173  
174   -#define ENQUEUE_ACTION(x) enq_ta(hSession, (void (*)(H3270 *, const char *, const char *)) x, NULL, NULL)
  174 +
  175 +#if defined(DEBUG) || defined(ANDROID)
  176 + #define ENQUEUE_ACTION(x) enq_ta(hSession, (void (*)(H3270 *, const char *, const char *)) x, NULL, NULL, #x)
  177 +#else
  178 + #define ENQUEUE_ACTION(x) enq_ta(hSession, (void (*)(H3270 *, const char *, const char *)) x, NULL, NULL)
  179 +#endif // DEBUG
175 180  
176 181 static const char dxl[] = "0123456789abcdef";
177 182 #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl)
... ... @@ -250,15 +255,21 @@ static int enq_chk(H3270 *session)
250 255 /*
251 256 * Put an action on the typeahead queue.
252 257 */
  258 +#if defined(DEBUG) || defined(ANDROID)
  259 +static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char *), const char *parm1, const char *parm2, const char *name)
  260 +#else
253 261 static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char *), const char *parm1, const char *parm2)
  262 +#endif // DEBUG
254 263 {
255 264 struct ta *ta;
256 265  
  266 + CHECK_SESSION_HANDLE(hSession);
  267 +
  268 + trace("%s: %s",__FUNCTION__,name);
  269 +
257 270 if(enq_chk(hSession))
258 271 return;
259 272  
260   - CHECK_SESSION_HANDLE(hSession);
261   -
262 273 ta = (struct ta *) lib3270_malloc(sizeof(*ta));
263 274 ta->session = hSession;
264 275 ta->next = (struct ta *) NULL;
... ... @@ -773,7 +784,13 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
773 784 char codename[64];
774 785  
775 786 (void) sprintf(codename, "%d", code |(with_ge ? GE_WFLAG : 0) | (pasting ? PASTE_WFLAG : 0));
  787 +
  788 +#if defined(DEBUG) || defined(ANDROID)
  789 + enq_ta(&h3270,key_Character_wrapper, codename, CN, "key_Character_wrapper");
  790 +#else
776 791 enq_ta(&h3270,key_Character_wrapper, codename, CN);
  792 +#endif // DEBUG
  793 +
777 794 return False;
778 795 }
779 796 baddr = h3270.cursor_addr;
... ... @@ -1453,9 +1470,10 @@ LIB3270_KEY_ACTION( backtab )
1453 1470  
1454 1471 static void defer_unlock(H3270 *session)
1455 1472 {
  1473 + trace("%s",__FUNCTION__);
1456 1474 kybdlock_clr(session,KL_DEFERRED_UNLOCK, "defer_unlock");
1457 1475 status_reset(session);
1458   - if (CONNECTED)
  1476 + if(CONNECTED)
1459 1477 ps_process();
1460 1478 }
1461 1479  
... ...
src/pw3270/v3270/iocallback.c
... ... @@ -142,6 +142,7 @@ static void * static_AddTimeOut(unsigned long interval, H3270 *session, void (*p
142 142 t->fn = proc;
143 143 t->session = session;
144 144  
  145 + trace("Adding timeout with %ld ms",interval);
145 146 g_timeout_add_full(G_PRIORITY_DEFAULT, (guint) interval, (GSourceFunc) do_timer, t, g_free);
146 147  
147 148 return t;
... ...