Commit 3a4fbc2b895429811e40c4734ea48cbce4213b9d

Authored by Perry Werneck
1 parent 2fe9d17a

Updating tracep API.

src/core/actions/actions.c
@@ -77,11 +77,11 @@ LIB3270_EXPORT int lib3270_action_activate(const LIB3270_ACTION *action, H3270 * @@ -77,11 +77,11 @@ LIB3270_EXPORT int lib3270_action_activate(const LIB3270_ACTION *action, H3270 *
77 77
78 if(!action->activatable(hSession)) 78 if(!action->activatable(hSession))
79 { 79 {
80 - lib3270_trace_event(hSession,"Action \"%s\" is disabled\n",action->name); 80 + lib3270_write_event_trace(hSession,"Action \"%s\" is disabled\n",action->name);
81 return errno = EPERM; 81 return errno = EPERM;
82 } 82 }
83 83
84 - lib3270_trace_event(hSession,"Activating action \"%s\"\n",action->name); 84 + lib3270_write_event_trace(hSession,"Activating action \"%s\"\n",action->name);
85 85
86 return action->activate(hSession); 86 return action->activate(hSession);
87 87
@@ -93,7 +93,7 @@ LIB3270_EXPORT int lib3270_action_activate_by_name(const char *name, H3270 *hSes @@ -93,7 +93,7 @@ LIB3270_EXPORT int lib3270_action_activate_by_name(const char *name, H3270 *hSes
93 93
94 if(!action) 94 if(!action)
95 { 95 {
96 - lib3270_trace_event(hSession,"Can't find action \"%s\"\n",name); 96 + lib3270_write_event_trace(hSession,"Can't find action \"%s\"\n",name);
97 return errno; 97 return errno;
98 } 98 }
99 99
src/core/connect.c
@@ -92,7 +92,7 @@ @@ -92,7 +92,7 @@
92 if(lib3270_set_url(hSession,NULL)) 92 if(lib3270_set_url(hSession,NULL))
93 { 93 {
94 int err = errno; 94 int err = errno;
95 - lib3270_trace_event(hSession,"Can't set default URL (%s)\n",strerror(err)); 95 + lib3270_write_event_trace(hSession,"Can't set default URL (%s)\n",strerror(err));
96 return errno = err; 96 return errno = err;
97 } 97 }
98 98
@@ -120,7 +120,7 @@ @@ -120,7 +120,7 @@
120 120
121 snprintf(hSession->full_model_name,LIB3270_FULL_MODEL_NAME_LENGTH,"IBM-327%c-%d",hSession->m3279 ? '9' : '8', hSession->model_num); 121 snprintf(hSession->full_model_name,LIB3270_FULL_MODEL_NAME_LENGTH,"IBM-327%c-%d",hSession->m3279 ? '9' : '8', hSession->model_num);
122 122
123 - lib3270_trace_event(hSession,"Reconnecting to %s\n",lib3270_get_url(hSession)); 123 + lib3270_write_event_trace(hSession,"Reconnecting to %s\n",lib3270_get_url(hSession));
124 124
125 hSession->ever_3270 = False; 125 hSession->ever_3270 = False;
126 126
src/core/ctlr.c
@@ -564,13 +564,13 @@ void ctlr_erase(H3270 *session, int alt) @@ -564,13 +564,13 @@ void ctlr_erase(H3270 *session, int alt)
564 if (alt) 564 if (alt)
565 { 565 {
566 // Going from 24x80 to maximum. 566 // Going from 24x80 to maximum.
567 - lib3270_write_screen_trace(session,"Going from 24x80 to %dx%d",session->max.rows,session->max.cols); 567 + lib3270_write_screen_trace(session,"Going from 24x80 to %dx%d\n",session->max.rows,session->max.cols);
568 set_viewsize(session,session->max.rows,session->max.cols); 568 set_viewsize(session,session->max.rows,session->max.cols);
569 } 569 }
570 else 570 else
571 { 571 {
572 // Going from maximum to 24x80. 572 // Going from maximum to 24x80.
573 - lib3270_write_screen_trace(session,"Going from %dx%d to 24x80",session->max.rows,session->max.cols); 573 + lib3270_write_screen_trace(session,"Going from %dx%d to 24x80\n",session->max.rows,session->max.cols);
574 if (session->max.rows > 24 || session->max.cols > 80) 574 if (session->max.rows > 24 || session->max.cols > 80)
575 { 575 {
576 if(session->vcontrol) 576 if(session->vcontrol)
src/core/ft/ft.c
@@ -530,7 +530,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -530,7 +530,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
530 return errno = EINVAL; 530 return errno = EINVAL;
531 } 531 }
532 532
533 - lib3270_trace_event(hSession,"Sending FT request:\n%s\n",buffer); 533 + lib3270_write_event_trace(hSession,"Sending FT request:\n%s\n",buffer);
534 534
535 lib3270_emulate_input(ft->host, buffer, strlen(buffer), False); 535 lib3270_emulate_input(ft->host, buffer, strlen(buffer), False);
536 536
@@ -547,7 +547,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -547,7 +547,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
547 /* External entry points called by ft_dft and ft_cut. */ 547 /* External entry points called by ft_dft and ft_cut. */
548 void ft_message(H3270FT *ft, const char *msg) 548 void ft_message(H3270FT *ft, const char *msg)
549 { 549 {
550 - lib3270_trace_event(ft->host,"%s\n",msg); 550 + lib3270_write_event_trace(ft->host,"%s\n",msg);
551 ft->cbk.message(ft->host,msg,ft->user_data); 551 ft->cbk.message(ft->host,msg,ft->user_data);
552 } 552 }
553 553
src/core/keyboard/kybd.c
@@ -138,7 +138,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) @@ -138,7 +138,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type)
138 if (!lib3270_is_connected(hSession)) 138 if (!lib3270_is_connected(hSession))
139 { 139 {
140 lib3270_ring_bell(hSession); 140 lib3270_ring_bell(hSession);
141 - lib3270_trace_event(hSession,"typeahead action dropped (not connected)\n"); 141 + lib3270_write_event_trace(hSession,"typeahead action dropped (not connected)\n");
142 return NULL; 142 return NULL;
143 } 143 }
144 144
@@ -146,7 +146,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) @@ -146,7 +146,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type)
146 if (hSession->kybdlock & KL_OERR_MASK) 146 if (hSession->kybdlock & KL_OERR_MASK)
147 { 147 {
148 lib3270_ring_bell(hSession); 148 lib3270_ring_bell(hSession);
149 - lib3270_trace_event(hSession,"typeahead action dropped (operator error)\n"); 149 + lib3270_write_event_trace(hSession,"typeahead action dropped (operator error)\n");
150 return NULL; 150 return NULL;
151 } 151 }
152 152
@@ -154,7 +154,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) @@ -154,7 +154,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type)
154 if (hSession->kybdlock & KL_SCROLLED) 154 if (hSession->kybdlock & KL_SCROLLED)
155 { 155 {
156 lib3270_ring_bell(hSession); 156 lib3270_ring_bell(hSession);
157 - lib3270_trace_event(hSession,"typeahead action dropped (scrolled)\n"); 157 + lib3270_write_event_trace(hSession,"typeahead action dropped (scrolled)\n");
158 return NULL; 158 return NULL;
159 } 159 }
160 160
@@ -162,7 +162,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) @@ -162,7 +162,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type)
162 if (!hSession->typeahead) 162 if (!hSession->typeahead)
163 { 163 {
164 lib3270_ring_bell(hSession); 164 lib3270_ring_bell(hSession);
165 - lib3270_trace_event(hSession,"typeahead action dropped (no typeahead)\n"); 165 + lib3270_write_event_trace(hSession,"typeahead action dropped (no typeahead)\n");
166 return NULL; 166 return NULL;
167 } 167 }
168 168
@@ -201,7 +201,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type) @@ -201,7 +201,7 @@ struct ta * new_ta(H3270 *hSession, enum _ta_type type)
201 201
202 ta->args.aid_code = aid_code; 202 ta->args.aid_code = aid_code;
203 203
204 - lib3270_trace_event(hSession,"typeahead action Key-aid queued (kybdlock 0x%x)\n", hSession->kybdlock); 204 + lib3270_write_event_trace(hSession,"typeahead action Key-aid queued (kybdlock 0x%x)\n", hSession->kybdlock);
205 } 205 }
206 206
207 207
@@ -224,7 +224,7 @@ void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char *), co @@ -224,7 +224,7 @@ void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char *), co
224 ta->args.def.parm[1] = NewString(parm2); 224 ta->args.def.parm[1] = NewString(parm2);
225 225
226 226
227 - lib3270_trace_event(hSession,"typeahead action queued (kybdlock 0x%x)\n", hSession->kybdlock); 227 + lib3270_write_event_trace(hSession,"typeahead action queued (kybdlock 0x%x)\n", hSession->kybdlock);
228 } 228 }
229 229
230 void enq_action(H3270 *hSession, int (*fn)(H3270 *)) 230 void enq_action(H3270 *hSession, int (*fn)(H3270 *))
@@ -235,7 +235,7 @@ void enq_action(H3270 *hSession, int (*fn)(H3270 *)) @@ -235,7 +235,7 @@ void enq_action(H3270 *hSession, int (*fn)(H3270 *))
235 return; 235 return;
236 236
237 ta->args.action = fn; 237 ta->args.action = fn;
238 - lib3270_trace_event(hSession,"single action queued (kybdlock 0x%x)\n", hSession->kybdlock); 238 + lib3270_write_event_trace(hSession,"single action queued (kybdlock 0x%x)\n", hSession->kybdlock);
239 239
240 } 240 }
241 241
@@ -321,7 +321,7 @@ static void kybdlock_set(H3270 *hSession, unsigned int bits) @@ -321,7 +321,7 @@ static void kybdlock_set(H3270 *hSession, unsigned int bits)
321 if (n != hSession->kybdlock) 321 if (n != hSession->kybdlock)
322 { 322 {
323 #if defined(KYBDLOCK_TRACE) 323 #if defined(KYBDLOCK_TRACE)
324 - lib3270_trace_event(hSession," %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n", "set", bits, hSession->kybdlock, n); 324 + lib3270_write_event_trace(hSession," %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n", "set", bits, hSession->kybdlock, n);
325 #endif 325 #endif
326 if ((hSession->kybdlock ^ bits) & KL_DEFERRED_UNLOCK) 326 if ((hSession->kybdlock ^ bits) & KL_DEFERRED_UNLOCK)
327 { 327 {
@@ -346,7 +346,7 @@ void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KEYBOARD_LOCK_STATE bits) @@ -346,7 +346,7 @@ void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KEYBOARD_LOCK_STATE bits)
346 if (n != hSession->kybdlock) 346 if (n != hSession->kybdlock)
347 { 347 {
348 #if defined(KYBDLOCK_TRACE) 348 #if defined(KYBDLOCK_TRACE)
349 - lib3270_trace_event(hSession," %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n", "clear", bits, hSession->kybdlock, n); 349 + lib3270_write_event_trace(hSession," %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n", "clear", bits, hSession->kybdlock, n);
350 #endif 350 #endif
351 if ((hSession->kybdlock ^ n) & KL_DEFERRED_UNLOCK) 351 if ((hSession->kybdlock ^ n) & KL_DEFERRED_UNLOCK)
352 { 352 {
@@ -967,13 +967,13 @@ int key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum @@ -967,13 +967,13 @@ int key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum
967 if (skipped != NULL) 967 if (skipped != NULL)
968 *skipped = False; 968 *skipped = False;
969 969
970 - lib3270_trace_event(hSession," %s -> Key(\"%s\") Hex(%02x)\n",ia_name[(int) cause], ctl_see((int) c), (int) c); 970 + lib3270_write_event_trace(hSession," %s -> Key(\"%s\") Hex(%02x)\n",ia_name[(int) cause], ctl_see((int) c), (int) c);
971 971
972 if (IN_3270) 972 if (IN_3270)
973 { 973 {
974 if (c < ' ') 974 if (c < ' ')
975 { 975 {
976 - lib3270_trace_event(hSession," dropped (control char)\n"); 976 + lib3270_write_event_trace(hSession," dropped (control char)\n");
977 return errno = EINVAL; 977 return errno = EINVAL;
978 } 978 }
979 (void) key_Character(hSession, (int) hSession->charset.asc2ebc[c], keytype == KT_GE, False, skipped); 979 (void) key_Character(hSession, (int) hSession->charset.asc2ebc[c], keytype == KT_GE, False, skipped);
@@ -986,7 +986,7 @@ int key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum @@ -986,7 +986,7 @@ int key_ACharacter(H3270 *hSession, unsigned char c, enum keytype keytype, enum
986 #endif /*]*/ 986 #endif /*]*/
987 else 987 else
988 { 988 {
989 - lib3270_trace_event(hSession," dropped (not connected)\n"); 989 + lib3270_write_event_trace(hSession," dropped (not connected)\n");
990 return errno = ENOTCONN; 990 return errno = ENOTCONN;
991 } 991 }
992 return 0; 992 return 0;
@@ -1802,7 +1802,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len @@ -1802,7 +1802,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len
1802 */ 1802 */
1803 if (hSession->kybdlock) 1803 if (hSession->kybdlock)
1804 { 1804 {
1805 - lib3270_trace_event(hSession," keyboard locked, string dropped\n"); 1805 + lib3270_write_event_trace(hSession," keyboard locked, string dropped\n");
1806 return errno = EPERM; 1806 return errno = EPERM;
1807 } 1807 }
1808 1808
@@ -1906,7 +1906,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len @@ -1906,7 +1906,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len
1906 (void) key_WCharacter(ebc, &skipped); 1906 (void) key_WCharacter(ebc, &skipped);
1907 break; 1907 break;
1908 } else { 1908 } else {
1909 - lib3270_trace_event(hSession,"Cannot convert U+%04x to " 1909 + lib3270_write_event_trace(hSession,"Cannot convert U+%04x to "
1910 "EBCDIC\n", c & 0xffff); 1910 "EBCDIC\n", c & 0xffff);
1911 break; 1911 break;
1912 } 1912 }
src/core/linux/curl.c
@@ -165,7 +165,7 @@ static int internal_curl_trace_callback(CURL GNUC_UNUSED(*handle), curl_infotype @@ -165,7 +165,7 @@ static int internal_curl_trace_callback(CURL GNUC_UNUSED(*handle), curl_infotype
165 165
166 char * lib3270_get_from_url(H3270 *hSession, const char *url, size_t *length, const char **error_message) 166 char * lib3270_get_from_url(H3270 *hSession, const char *url, size_t *length, const char **error_message)
167 { 167 {
168 - lib3270_trace_event(hSession,"Getting data from %s",url); 168 + lib3270_write_event_trace(hSession,"Getting data from %s",url);
169 169
170 // Use CURL to download the CRL 170 // Use CURL to download the CRL
171 lib3270_autoptr(CURLDATA) crl_data = lib3270_malloc(sizeof(CURLDATA)); 171 lib3270_autoptr(CURLDATA) crl_data = lib3270_malloc(sizeof(CURLDATA));
src/core/trace_ds.c
@@ -248,7 +248,7 @@ LIB3270_EXPORT void lib3270_write_screen_trace(H3270 *session, const char *fmt, @@ -248,7 +248,7 @@ LIB3270_EXPORT void lib3270_write_screen_trace(H3270 *session, const char *fmt,
248 va_end(args); 248 va_end(args);
249 } 249 }
250 250
251 -LIB3270_EXPORT void lib3270_trace_event(H3270 *session, const char *fmt, ...) 251 +LIB3270_EXPORT void lib3270_write_event_trace(H3270 *session, const char *fmt, ...)
252 { 252 {
253 va_list args; 253 va_list args;
254 254
src/include/lib3270/trace.h
@@ -117,8 +117,9 @@ @@ -117,8 +117,9 @@
117 * @param ... Arguments. 117 * @param ... Arguments.
118 * 118 *
119 */ 119 */
120 - LIB3270_EXPORT void lib3270_trace_event(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3); 120 + LIB3270_EXPORT void lib3270_write_event_trace(H3270 *session, const char *fmt, ...) LIB3270_AS_PRINTF(2,3);
121 121
  122 + LIB3270_EXPORT void LIB3270_DEPRECATED(lib3270_trace_event(H3270 *session, const char *fmt, ...)) LIB3270_AS_PRINTF(2,3);
122 123
123 /** 124 /**
124 * @brief Write datablock on trace file. 125 * @brief Write datablock on trace file.