Commit 30b1c5d8ec3e534a3819f25a02f3427d9942c097

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

Incluindo ring daemon

@@ -94,9 +94,14 @@ static void DefaultRemoveInput(unsigned long id); @@ -94,9 +94,14 @@ static void DefaultRemoveInput(unsigned long id);
94 94
95 static int DefaultProcessEvents(int block); 95 static int DefaultProcessEvents(int block);
96 96
97 -static const struct lib3270_io_callbacks default_io_callbacks = 97 +static void dunno(void)
98 { 98 {
99 - sizeof(struct lib3270_io_callbacks), 99 +
  100 +}
  101 +
  102 +static const struct lib3270_callbacks default_callbacks =
  103 +{
  104 + sizeof(struct lib3270_callbacks),
100 105
101 DefaultAddTimeOut, // unsigned long (*AddTimeOut)(unsigned long interval_ms, void (*proc)(void)); 106 DefaultAddTimeOut, // unsigned long (*AddTimeOut)(unsigned long interval_ms, void (*proc)(void));
102 DefaultRemoveTimeOut, // void (*RemoveTimeOut)(unsigned long timer); 107 DefaultRemoveTimeOut, // void (*RemoveTimeOut)(unsigned long timer);
@@ -114,10 +119,12 @@ static const struct lib3270_io_callbacks default_io_callbacks = @@ -114,10 +119,12 @@ static const struct lib3270_io_callbacks default_io_callbacks =
114 119
115 NULL, // int (*Wait)(int seconds); 120 NULL, // int (*Wait)(int seconds);
116 DefaultProcessEvents, // int (*RunPendingEvents)(int wait); 121 DefaultProcessEvents, // int (*RunPendingEvents)(int wait);
  122 + dunno
  123 +
117 124
118 }; 125 };
119 126
120 -static const struct lib3270_io_callbacks *callbacks = &default_io_callbacks; 127 +static const struct lib3270_callbacks *callbacks = &default_callbacks;
121 128
122 /*---[ Implement default calls ]----------------------------------------------------------------------------*/ 129 /*---[ Implement default calls ]----------------------------------------------------------------------------*/
123 130
@@ -870,14 +877,12 @@ void RemoveInput(unsigned long id) @@ -870,14 +877,12 @@ void RemoveInput(unsigned long id)
870 callbacks->RemoveInput(id); 877 callbacks->RemoveInput(id);
871 } 878 }
872 879
873 -#define Register3270IOCallbacks(x) lib3270_register_io_handlers(x)  
874 -  
875 -int LIB3270_EXPORT lib3270_register_io_handlers(const struct lib3270_io_callbacks *cbk) 880 +int LIB3270_EXPORT lib3270_register_handlers(const struct lib3270_callbacks *cbk)
876 { 881 {
877 if(!cbk) 882 if(!cbk)
878 return EINVAL; 883 return EINVAL;
879 884
880 - if(cbk->sz != sizeof(struct lib3270_io_callbacks)) 885 + if(cbk->sz != sizeof(struct lib3270_callbacks))
881 return EINVAL; 886 return EINVAL;
882 887
883 callbacks = cbk; 888 callbacks = cbk;
@@ -993,3 +998,10 @@ LIB3270_EXPORT int lib3270_wait(seconds) @@ -993,3 +998,10 @@ LIB3270_EXPORT int lib3270_wait(seconds)
993 998
994 return 0; 999 return 0;
995 } 1000 }
  1001 +
  1002 +LIB3270_EXPORT void lib3270_ring_bell(void)
  1003 +{
  1004 + callbacks->ring_bell();
  1005 +}
  1006 +
  1007 +
@@ -917,7 +917,7 @@ ansi_sgr(int ig1 unused, int ig2 unused) @@ -917,7 +917,7 @@ ansi_sgr(int ig1 unused, int ig2 unused)
917 static enum state 917 static enum state
918 ansi_bell(int ig1 unused, int ig2 unused) 918 ansi_bell(int ig1 unused, int ig2 unused)
919 { 919 {
920 - ring_bell(); 920 + lib3270_ring_bell();
921 return DATA; 921 return DATA;
922 } 922 }
923 923
@@ -285,8 +285,6 @@ @@ -285,8 +285,6 @@
285 285
286 #endif 286 #endif
287 287
288 - #define Register3270IOCallbacks(x) lib3270_register_io_handlers(x)  
289 -  
290 288
291 /* Screen processing */ 289 /* Screen processing */
292 290
@@ -327,6 +325,7 @@ @@ -327,6 +325,7 @@
327 325
328 #define CHAR_ATTR_UNCONVERTED CHAR_ATTR_CG 326 #define CHAR_ATTR_UNCONVERTED CHAR_ATTR_CG
329 327
  328 +/*
330 struct lib3270_screen_callbacks 329 struct lib3270_screen_callbacks
331 { 330 {
332 unsigned short sz; 331 unsigned short sz;
@@ -363,6 +362,7 @@ @@ -363,6 +362,7 @@
363 char * (*console_entry)(HCONSOLE hwnd); 362 char * (*console_entry)(HCONSOLE hwnd);
364 363
365 }; 364 };
  365 +*/
366 366
367 struct lib3270_option 367 struct lib3270_option
368 { 368 {
@@ -383,8 +383,7 @@ @@ -383,8 +383,7 @@
383 const char *description; 383 const char *description;
384 }; 384 };
385 385
386 - // LOCAL_EXTERN int Register3270ScreenCallbacks(const struct lib3270_screen_callbacks *cbk);  
387 - LOCAL_EXTERN void ring_bell(void); 386 + LIB3270_EXPORT void lib3270_ring_bell(void);
388 387
389 #define new_3270_session(m) lib3270_session_new(m) 388 #define new_3270_session(m) lib3270_session_new(m)
390 389
@@ -1871,7 +1871,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1871,7 +1871,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1871 status_syswait(); 1871 status_syswait();
1872 } 1872 }
1873 if (wcc_sound_alarm) 1873 if (wcc_sound_alarm)
1874 - ring_bell(); 1874 + lib3270_ring_bell();
1875 1875
1876 /* Set up the DBCS state. */ 1876 /* Set up the DBCS state. */
1877 if (ctlr_dbcs_postprocess() < 0 && rv == PDS_OKAY_NO_OUTPUT) 1877 if (ctlr_dbcs_postprocess() < 0 && rv == PDS_OKAY_NO_OUTPUT)
@@ -182,7 +182,7 @@ static int enq_chk(void) @@ -182,7 +182,7 @@ static int enq_chk(void)
182 /* If operator error, complain and drop it. */ 182 /* If operator error, complain and drop it. */
183 if (kybdlock & KL_OERR_MASK) 183 if (kybdlock & KL_OERR_MASK)
184 { 184 {
185 - ring_bell(); 185 + lib3270_ring_bell();
186 trace_event(" dropped (operator error)\n"); 186 trace_event(" dropped (operator error)\n");
187 return -1; 187 return -1;
188 } 188 }
@@ -190,7 +190,7 @@ static int enq_chk(void) @@ -190,7 +190,7 @@ static int enq_chk(void)
190 /* If scroll lock, complain and drop it. */ 190 /* If scroll lock, complain and drop it. */
191 if (kybdlock & KL_SCROLLED) 191 if (kybdlock & KL_SCROLLED)
192 { 192 {
193 - ring_bell(); 193 + lib3270_ring_bell();
194 trace_event(" dropped (scrolled)\n"); 194 trace_event(" dropped (scrolled)\n");
195 return -1; 195 return -1;
196 } 196 }
@@ -471,7 +471,7 @@ operator_error(int error_type) @@ -471,7 +471,7 @@ operator_error(int error_type)
471 kybdlock_set((unsigned int)error_type, "operator_error"); 471 kybdlock_set((unsigned int)error_type, "operator_error");
472 (void) flush_ta(); 472 (void) flush_ta();
473 } else { 473 } else {
474 - ring_bell(); 474 + lib3270_ring_bell();
475 } 475 }
476 } 476 }
477 477
@@ -1317,7 +1317,7 @@ void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Bo @@ -1317,7 +1317,7 @@ void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Bo
1317 composing = FIRST; 1317 composing = FIRST;
1318 status_compose(True, c, keytype); 1318 status_compose(True, c, keytype);
1319 } else { 1319 } else {
1320 - ring_bell(); 1320 + lib3270_ring_bell();
1321 composing = NONE; 1321 composing = NONE;
1322 status_compose(False, 0, KT_STD); 1322 status_compose(False, 0, KT_STD);
1323 } 1323 }
@@ -1335,7 +1335,7 @@ void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Bo @@ -1335,7 +1335,7 @@ void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Bo
1335 c = composites[i].translation.keysym; 1335 c = composites[i].translation.keysym;
1336 keytype = composites[i].translation.keytype; 1336 keytype = composites[i].translation.keytype;
1337 } else { 1337 } else {
1338 - ring_bell(); 1338 + lib3270_ring_bell();
1339 return; 1339 return;
1340 } 1340 }
1341 break; 1341 break;
@@ -2449,7 +2449,7 @@ lightpen_select(int baddr) @@ -2449,7 +2449,7 @@ lightpen_select(int baddr)
2449 faddr = find_field_attribute(baddr); 2449 faddr = find_field_attribute(baddr);
2450 fa = ea_buf[faddr].fa; 2450 fa = ea_buf[faddr].fa;
2451 if (!FA_IS_SELECTABLE(fa)) { 2451 if (!FA_IS_SELECTABLE(fa)) {
2452 - ring_bell(); 2452 + lib3270_ring_bell();
2453 return; 2453 return;
2454 } 2454 }
2455 designator = faddr; 2455 designator = faddr;
@@ -2464,7 +2464,7 @@ lightpen_select(int baddr) @@ -2464,7 +2464,7 @@ lightpen_select(int baddr)
2464 ea_buf[designator].db != DBCS_LEFT_WRAP) && 2464 ea_buf[designator].db != DBCS_LEFT_WRAP) &&
2465 (ea_buf[designator2].db != DBCS_RIGHT && 2465 (ea_buf[designator2].db != DBCS_RIGHT &&
2466 ea_buf[designator2].db != DBCS_RIGHT_WRAP)) { 2466 ea_buf[designator2].db != DBCS_RIGHT_WRAP)) {
2467 - ring_bell(); 2467 + lib3270_ring_bell();
2468 return; 2468 return;
2469 } 2469 }
2470 if (ea_buf[designator].cc == 0x42 && 2470 if (ea_buf[designator].cc == 0x42 &&
@@ -2487,7 +2487,7 @@ lightpen_select(int baddr) @@ -2487,7 +2487,7 @@ lightpen_select(int baddr)
2487 mdt_set(faddr); 2487 mdt_set(faddr);
2488 key_AID(AID_ENTER); 2488 key_AID(AID_ENTER);
2489 } else { 2489 } else {
2490 - ring_bell(); 2490 + lib3270_ring_bell();
2491 } 2491 }
2492 return; 2492 return;
2493 } 2493 }
@@ -2513,7 +2513,7 @@ lightpen_select(int baddr) @@ -2513,7 +2513,7 @@ lightpen_select(int baddr)
2513 key_AID(AID_ENTER); 2513 key_AID(AID_ENTER);
2514 break; 2514 break;
2515 default: 2515 default:
2516 - ring_bell(); 2516 + lib3270_ring_bell();
2517 break; 2517 break;
2518 } 2518 }
2519 } 2519 }
@@ -632,10 +632,6 @@ void status_untiming(H3270 *session) @@ -632,10 +632,6 @@ void status_untiming(H3270 *session)
632 session->set_timer(session,0); 632 session->set_timer(session,0);
633 } 633 }
634 634
635 -void ring_bell(void)  
636 -{  
637 -}  
638 -  
639 /* Set the window title. */ /* 635 /* Set the window title. */ /*
640 void screen_title(char *text) 636 void screen_title(char *text)
641 { 637 {
@@ -205,7 +205,7 @@ LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr) @@ -205,7 +205,7 @@ LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr)
205 205
206 if(!lib3270_connected(session) || isspace(ea_buf[baddr].chr)) 206 if(!lib3270_connected(session) || isspace(ea_buf[baddr].chr))
207 { 207 {
208 - ring_bell(); 208 + lib3270_ring_bell();
209 return; 209 return;
210 } 210 }
211 211
@@ -227,7 +227,7 @@ LIB3270_EXPORT int lib3270_select_field(H3270 *session, int baddr) @@ -227,7 +227,7 @@ LIB3270_EXPORT int lib3270_select_field(H3270 *session, int baddr)
227 227
228 if(!lib3270_connected(session)) 228 if(!lib3270_connected(session))
229 { 229 {
230 - ring_bell(); 230 + lib3270_ring_bell();
231 return; 231 return;
232 } 232 }
233 233
@@ -235,7 +235,7 @@ LIB3270_EXPORT int lib3270_select_field(H3270 *session, int baddr) @@ -235,7 +235,7 @@ LIB3270_EXPORT int lib3270_select_field(H3270 *session, int baddr)
235 235
236 if(start < 0) 236 if(start < 0)
237 { 237 {
238 - ring_bell(); 238 + lib3270_ring_bell();
239 return -1; 239 return -1;
240 } 240 }
241 241