Commit d088caa04b006655ce16202f04556b2939391c60
1 parent
00e3b6b5
Exists in
master
and in
5 other branches
Mudando processo de trace para um único callback
Showing
19 changed files
with
345 additions
and
282 deletions
Show diff stats
Makefile.in
| ... | ... | @@ -153,6 +153,9 @@ install-sdk: |
| 153 | 153 | @$(INSTALL_DATA) src/include/lib3270.h $(DESTDIR)/$(includedir) |
| 154 | 154 | @$(INSTALL_DATA) src/include/lib3270/config.h $(DESTDIR)/$(includedir)/lib3270 |
| 155 | 155 | @$(INSTALL_DATA) src/include/lib3270/selection.h $(DESTDIR)/$(includedir)/lib3270 |
| 156 | + @$(INSTALL_DATA) src/include/lib3270/popup.h $(DESTDIR)/$(includedir)/lib3270 | |
| 157 | + @$(MKDIR) $(DESTDIR)/$(libdir)/pkgconfig | |
| 158 | + @$(INSTALL_DATA) lib3270.pc $(DESTDIR)/$(libdir)/pkgconfig | |
| 156 | 159 | |
| 157 | 160 | clean: |
| 158 | 161 | @rm -fr .obj | ... | ... |
pw3270.cbp
| ... | ... | @@ -151,6 +151,7 @@ |
| 151 | 151 | <Unit filename="src/include/lib3270/popup.h" /> |
| 152 | 152 | <Unit filename="src/include/lib3270/selection.h" /> |
| 153 | 153 | <Unit filename="src/include/lib3270/session.h" /> |
| 154 | + <Unit filename="src/include/lib3270/trace.h" /> | |
| 154 | 155 | <Unit filename="src/include/pw3270.h" /> |
| 155 | 156 | <Unit filename="src/include/rules.mak.in" /> |
| 156 | 157 | <Unit filename="src/lib3270/3270ds.h" /> | ... | ... |
pw3270.spec.in
| ... | ... | @@ -146,6 +146,7 @@ rm -rf $RPM_BUILD_ROOT |
| 146 | 146 | %{_includedir}/lib3270.h |
| 147 | 147 | %{_includedir}/lib3270 |
| 148 | 148 | %{_datadir}/@PACKAGE_NAME@/ui/99debug.xml |
| 149 | +%{_libdir}/pkgconfig/*.pc | |
| 149 | 150 | |
| 150 | 151 | #---[ Scripts ]------------------------------------------------------------------------------------------------------- |
| 151 | 152 | ... | ... |
src/gtk/main.c
| ... | ... | @@ -32,7 +32,6 @@ |
| 32 | 32 | #include "globals.h" |
| 33 | 33 | #include "v3270/v3270.h" |
| 34 | 34 | #include "v3270/accessible.h" |
| 35 | -#include <lib3270/popup.h> | |
| 36 | 35 | #include <stdlib.h> |
| 37 | 36 | |
| 38 | 37 | /*--[ Statics ]--------------------------------------------------------------------------------------*/ |
| ... | ... | @@ -41,39 +40,6 @@ |
| 41 | 40 | |
| 42 | 41 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 43 | 42 | |
| 44 | -static int popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) | |
| 45 | -{ | |
| 46 | - GtkWidget * dialog; | |
| 47 | - GtkMessageType msgtype = GTK_MESSAGE_WARNING; | |
| 48 | - GtkButtonsType buttons = GTK_BUTTONS_OK; | |
| 49 | - gchar * text = g_strdup_vprintf(fmt,args); | |
| 50 | - | |
| 51 | - if(type == LIB3270_NOTIFY_CRITICAL) | |
| 52 | - { | |
| 53 | - msgtype = GTK_MESSAGE_ERROR; | |
| 54 | - buttons = GTK_BUTTONS_CLOSE; | |
| 55 | - } | |
| 56 | - | |
| 57 | - if(msg) | |
| 58 | - { | |
| 59 | - dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",msg); | |
| 60 | - gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",text); | |
| 61 | - } | |
| 62 | - else | |
| 63 | - { | |
| 64 | - dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",text); | |
| 65 | - } | |
| 66 | - | |
| 67 | - g_free(text); | |
| 68 | - | |
| 69 | - gtk_window_set_title(GTK_WINDOW(dialog),title ? title : "Error"); | |
| 70 | - | |
| 71 | - gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 72 | - gtk_widget_destroy(dialog); | |
| 73 | - | |
| 74 | - return 0; | |
| 75 | -} | |
| 76 | - | |
| 77 | 43 | static int initialize(void) |
| 78 | 44 | { |
| 79 | 45 | const gchar * msg = gtk_check_version(GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); |
| ... | ... | @@ -104,6 +70,33 @@ static int initialize(void) |
| 104 | 70 | return 0; |
| 105 | 71 | } |
| 106 | 72 | |
| 73 | +static void toplevel_setup(GtkWindow *window) | |
| 74 | +{ | |
| 75 | + gchar * name = g_strdup_printf("%s.png",g_get_application_name()); | |
| 76 | + gchar * filename = build_data_filename(name,NULL); | |
| 77 | + | |
| 78 | + gtk_window_set_type_hint(window,GDK_WINDOW_TYPE_HINT_NORMAL); | |
| 79 | + gtk_window_set_position(window,GTK_WIN_POS_CENTER); | |
| 80 | + gtk_window_set_role(window,"toplevel"); | |
| 81 | + | |
| 82 | + // Set default icon | |
| 83 | + if(g_file_test(filename,G_FILE_TEST_EXISTS)) | |
| 84 | + { | |
| 85 | + GError * error = NULL; | |
| 86 | + | |
| 87 | + trace("Loading default icon from %s",filename); | |
| 88 | + | |
| 89 | + if(!gtk_window_set_default_icon_from_file(filename,&error)) | |
| 90 | + { | |
| 91 | + g_warning("Error %s loading default icon from %s",error->message,filename); | |
| 92 | + g_error_free(error); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + g_free(filename); | |
| 97 | + g_free(name); | |
| 98 | +} | |
| 99 | + | |
| 107 | 100 | int main(int argc, char *argv[]) |
| 108 | 101 | { |
| 109 | 102 | static const gchar * appname = PACKAGE_NAME; |
| ... | ... | @@ -147,7 +140,6 @@ int main(int argc, char *argv[]) |
| 147 | 140 | } |
| 148 | 141 | |
| 149 | 142 | g_set_application_name(appname); |
| 150 | - lib3270_set_popup_handler(popup_handler); | |
| 151 | 143 | |
| 152 | 144 | rc = initialize(); |
| 153 | 145 | if(!rc) |
| ... | ... | @@ -156,9 +148,7 @@ int main(int argc, char *argv[]) |
| 156 | 148 | |
| 157 | 149 | toplevel = pw3270_new(host); |
| 158 | 150 | |
| 159 | - gtk_window_set_type_hint(GTK_WINDOW(toplevel),GDK_WINDOW_TYPE_HINT_NORMAL); | |
| 160 | - gtk_window_set_position(GTK_WINDOW(toplevel),GTK_WIN_POS_CENTER); | |
| 161 | - gtk_window_set_role(GTK_WINDOW(toplevel),"toplevel"); | |
| 151 | + toplevel_setup(GTK_WINDOW(toplevel)); | |
| 162 | 152 | |
| 163 | 153 | gtk_window_present(GTK_WINDOW(toplevel)); |
| 164 | 154 | ... | ... |
src/gtk/window.c
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | |
| 32 | 32 | #include "globals.h" |
| 33 | 33 | #include "uiparser/parser.h" |
| 34 | - | |
| 34 | +#include <lib3270/popup.h> | |
| 35 | 35 | |
| 36 | 36 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ |
| 37 | 37 | |
| ... | ... | @@ -126,14 +126,50 @@ |
| 126 | 126 | return 0; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + static int popup_handler(H3270 *session, void *widget, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) | |
| 130 | + { | |
| 131 | + GtkWidget * dialog; | |
| 132 | + GtkWidget * toplevel = NULL; | |
| 133 | + GtkMessageType msgtype = GTK_MESSAGE_WARNING; | |
| 134 | + GtkButtonsType buttons = GTK_BUTTONS_OK; | |
| 135 | + gchar * text = g_strdup_vprintf(fmt,args); | |
| 136 | + | |
| 137 | + if(widget && GTK_IS_WIDGET(widget)) | |
| 138 | + toplevel = gtk_widget_get_toplevel(GTK_WIDGET(widget)); | |
| 139 | + | |
| 140 | + if(type == LIB3270_NOTIFY_CRITICAL) | |
| 141 | + { | |
| 142 | + msgtype = GTK_MESSAGE_ERROR; | |
| 143 | + buttons = GTK_BUTTONS_CLOSE; | |
| 144 | + } | |
| 145 | + | |
| 146 | + if(msg) | |
| 147 | + { | |
| 148 | + dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",msg); | |
| 149 | + gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",text); | |
| 150 | + } | |
| 151 | + else | |
| 152 | + { | |
| 153 | + dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",text); | |
| 154 | + } | |
| 155 | + | |
| 156 | + g_free(text); | |
| 157 | + | |
| 158 | + gtk_window_set_title(GTK_WINDOW(dialog),title ? title : "Error"); | |
| 159 | + | |
| 160 | + gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 161 | + gtk_widget_destroy(dialog); | |
| 162 | + | |
| 163 | + return 0; | |
| 164 | + } | |
| 165 | + | |
| 129 | 166 | static void pw3270_class_init(pw3270Class *klass) |
| 130 | 167 | { |
| 131 | 168 | GObjectClass * gobject_class = G_OBJECT_CLASS(klass); |
| 132 | 169 | GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass); |
| 133 | -// GtkWindowClass * window_class = GTK_WINDOW_CLASS(klass); | |
| 134 | 170 | |
| 135 | 171 | #if GTK_CHECK_VERSION(3,0,0) |
| 136 | - widget_class->destroy = pw3270_destroy; | |
| 172 | + widget_class->destroy = pw3270_destroy; | |
| 137 | 173 | #else |
| 138 | 174 | { |
| 139 | 175 | GtkObjectClass *object_class = (GtkObjectClass*) klass; |
| ... | ... | @@ -141,6 +177,8 @@ |
| 141 | 177 | } |
| 142 | 178 | #endif // GTK3 |
| 143 | 179 | |
| 180 | + lib3270_set_popup_handler(popup_handler); | |
| 181 | + | |
| 144 | 182 | } |
| 145 | 183 | |
| 146 | 184 | GtkWidget * pw3270_new(const gchar *host) | ... | ... |
src/include/lib3270/config.h.in
src/include/lib3270/popup.h
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | LIB3270_NOTIFY_USER /**< Reserver, always the last one */ |
| 44 | 44 | } LIB3270_NOTIFY; |
| 45 | 45 | |
| 46 | - LIB3270_EXPORT void lib3270_set_popup_handler(int (*popup_handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)); | |
| 46 | + LIB3270_EXPORT void lib3270_set_popup_handler(int (*popup_handler)(H3270 *, void *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)); | |
| 47 | 47 | LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
| 48 | 48 | |
| 49 | 49 | #endif // LIB3270_POPUP_INCLUDED | ... | ... |
| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | +/* | |
| 2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
| 3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
| 4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
| 5 | + * | |
| 6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
| 7 | + * | |
| 8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
| 9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
| 10 | + * Free Software Foundation. | |
| 11 | + * | |
| 12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
| 13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
| 14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
| 15 | + * obter mais detalhes. | |
| 16 | + * | |
| 17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
| 18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | |
| 19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como session.h e possui - linhas de código. | |
| 22 | + * | |
| 23 | + * Contatos: | |
| 24 | + * | |
| 25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
| 26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
| 27 | + * licinio@bb.com.br (Licínio Luis Branco) | |
| 28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
| 29 | + * | |
| 30 | + */ | |
| 31 | + | |
| 32 | +#ifndef LIB3270_TRACE_H_INCLUDED | |
| 33 | + | |
| 34 | + #define LIB3270_TRACE_H_INCLUDED 1 | |
| 35 | + | |
| 36 | + | |
| 37 | +#endif // LIB3270_TRACE_H_INCLUDED | ... | ... |
src/lib3270/api.h
| ... | ... | @@ -407,10 +407,10 @@ |
| 407 | 407 | #define register_schange(tx,func) lib3270_register_schange(NULL,tx,func,NULL) |
| 408 | 408 | |
| 409 | 409 | /* Console/Trace window */ |
| 410 | - LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label); | |
| 411 | - LOCAL_EXTERN void console_window_delete(HCONSOLE hwnd); | |
| 412 | - LOCAL_EXTERN int console_window_append(HCONSOLE hwnd, const char *fmt, ...); | |
| 413 | - LOCAL_EXTERN char * console_window_wait_for_user_entry(HCONSOLE hwnd); | |
| 410 | +// LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label); | |
| 411 | +// LOCAL_EXTERN void console_window_delete(HCONSOLE hwnd); | |
| 412 | +// LOCAL_EXTERN int console_window_append(HCONSOLE hwnd, const char *fmt, ...); | |
| 413 | +// LOCAL_EXTERN char * console_window_wait_for_user_entry(HCONSOLE hwnd); | |
| 414 | 414 | |
| 415 | 415 | #ifdef __cplusplus |
| 416 | 416 | } | ... | ... |
src/lib3270/ctlr.c
| ... | ... | @@ -737,8 +737,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) |
| 737 | 737 | *obptr++ = h3270.ea_buf[baddr].cc; |
| 738 | 738 | if (!any) |
| 739 | 739 | trace_ds(" '"); |
| 740 | - trace_ds("%s", | |
| 741 | - see_ebc(ea_buf[baddr].cc)); | |
| 740 | + trace_ds("%s",see_ebc(h3270.ea_buf[baddr].cc)); | |
| 742 | 741 | any = True; |
| 743 | 742 | } |
| 744 | 743 | INC_BA(baddr); |
| ... | ... | @@ -783,7 +782,7 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) |
| 783 | 782 | *obptr++ = h3270.ea_buf[baddr].cc; |
| 784 | 783 | if (!any) |
| 785 | 784 | trace_ds("%s","'"); |
| 786 | - trace_ds("%s",see_ebc(ea_buf[baddr].cc)); | |
| 785 | + trace_ds("%s",see_ebc(h3270.ea_buf[baddr].cc)); | |
| 787 | 786 | any = True; |
| 788 | 787 | nbytes++; |
| 789 | 788 | } |
| ... | ... | @@ -861,16 +860,14 @@ ctlr_read_buffer(unsigned char aid_byte) |
| 861 | 860 | space3270out(2); |
| 862 | 861 | *obptr++ = XA_FOREGROUND; |
| 863 | 862 | *obptr++ = h3270.ea_buf[baddr].fg; |
| 864 | - trace_ds("%s", see_efa(XA_FOREGROUND, | |
| 865 | - ea_buf[baddr].fg)); | |
| 863 | + trace_ds("%s", see_efa(XA_FOREGROUND, h3270.ea_buf[baddr].fg)); | |
| 866 | 864 | (*(obuf + attr_count))++; |
| 867 | 865 | } |
| 868 | 866 | if (h3270.ea_buf[baddr].bg) { |
| 869 | 867 | space3270out(2); |
| 870 | 868 | *obptr++ = XA_BACKGROUND; |
| 871 | 869 | *obptr++ = h3270.ea_buf[baddr].bg; |
| 872 | - trace_ds("%s", see_efa(XA_BACKGROUND, | |
| 873 | - ea_buf[baddr].bg)); | |
| 870 | + trace_ds("%s", see_efa(XA_BACKGROUND, h3270.ea_buf[baddr].bg)); | |
| 874 | 871 | (*(obuf + attr_count))++; |
| 875 | 872 | } |
| 876 | 873 | if (h3270.ea_buf[baddr].gr) { |
| ... | ... | @@ -885,8 +882,7 @@ ctlr_read_buffer(unsigned char aid_byte) |
| 885 | 882 | space3270out(2); |
| 886 | 883 | *obptr++ = XA_CHARSET; |
| 887 | 884 | *obptr++ = host_cs(h3270.ea_buf[baddr].cs); |
| 888 | - trace_ds("%s", see_efa(XA_CHARSET, | |
| 889 | - host_cs(ea_buf[baddr].cs))); | |
| 885 | + trace_ds("%s", see_efa(XA_CHARSET,host_cs(h3270.ea_buf[baddr].cs))); | |
| 890 | 886 | (*(obuf + attr_count))++; |
| 891 | 887 | } |
| 892 | 888 | } |
| ... | ... | @@ -913,12 +909,12 @@ ctlr_read_buffer(unsigned char aid_byte) |
| 913 | 909 | if (any) |
| 914 | 910 | trace_ds("'"); |
| 915 | 911 | |
| 916 | - trace_ds(" %s", see_ebc(ea_buf[baddr].cc)); | |
| 912 | + trace_ds(" %s", see_ebc(h3270.ea_buf[baddr].cc)); | |
| 917 | 913 | any = False; |
| 918 | 914 | } else { |
| 919 | 915 | if (!any) |
| 920 | 916 | trace_ds(" '"); |
| 921 | - trace_ds("%s", see_ebc(ea_buf[baddr].cc)); | |
| 917 | + trace_ds("%s", see_ebc(h3270.ea_buf[baddr].cc)); | |
| 922 | 918 | any = True; |
| 923 | 919 | } |
| 924 | 920 | } |
| ... | ... | @@ -951,39 +947,39 @@ ctlr_snap_buffer(void) |
| 951 | 947 | *obptr++ = code_table[0]; |
| 952 | 948 | |
| 953 | 949 | do { |
| 954 | - if (ea_buf[baddr].fa) { | |
| 950 | + if (h3270.ea_buf[baddr].fa) { | |
| 955 | 951 | space3270out(4); |
| 956 | 952 | *obptr++ = ORDER_SFE; |
| 957 | 953 | attr_count = obptr - obuf; |
| 958 | 954 | *obptr++ = 1; /* for now */ |
| 959 | 955 | *obptr++ = XA_3270; |
| 960 | - *obptr++ = code_table[ea_buf[baddr].fa & ~FA_PRINTABLE]; | |
| 961 | - if (ea_buf[baddr].fg) { | |
| 956 | + *obptr++ = code_table[h3270.ea_buf[baddr].fa & ~FA_PRINTABLE]; | |
| 957 | + if (h3270.ea_buf[baddr].fg) { | |
| 962 | 958 | space3270out(2); |
| 963 | 959 | *obptr++ = XA_FOREGROUND; |
| 964 | - *obptr++ = ea_buf[baddr].fg; | |
| 960 | + *obptr++ = h3270.ea_buf[baddr].fg; | |
| 965 | 961 | (*(obuf + attr_count))++; |
| 966 | 962 | } |
| 967 | - if (ea_buf[baddr].bg) { | |
| 963 | + if (h3270.ea_buf[baddr].bg) { | |
| 968 | 964 | space3270out(2); |
| 969 | 965 | *obptr++ = XA_BACKGROUND; |
| 970 | - *obptr++ = ea_buf[baddr].fg; | |
| 966 | + *obptr++ = h3270.ea_buf[baddr].fg; | |
| 971 | 967 | (*(obuf + attr_count))++; |
| 972 | 968 | } |
| 973 | - if (ea_buf[baddr].gr) { | |
| 969 | + if (h3270.ea_buf[baddr].gr) { | |
| 974 | 970 | space3270out(2); |
| 975 | 971 | *obptr++ = XA_HIGHLIGHTING; |
| 976 | - *obptr++ = ea_buf[baddr].gr | 0xf0; | |
| 972 | + *obptr++ = h3270.ea_buf[baddr].gr | 0xf0; | |
| 977 | 973 | (*(obuf + attr_count))++; |
| 978 | 974 | } |
| 979 | - if (ea_buf[baddr].cs & CS_MASK) { | |
| 975 | + if (h3270.ea_buf[baddr].cs & CS_MASK) { | |
| 980 | 976 | space3270out(2); |
| 981 | 977 | *obptr++ = XA_CHARSET; |
| 982 | - *obptr++ = host_cs(ea_buf[baddr].cs); | |
| 978 | + *obptr++ = host_cs(h3270.ea_buf[baddr].cs); | |
| 983 | 979 | (*(obuf + attr_count))++; |
| 984 | 980 | } |
| 985 | 981 | } else { |
| 986 | - av = ea_buf[baddr].fg; | |
| 982 | + av = h3270.ea_buf[baddr].fg; | |
| 987 | 983 | if (current_fg != av) { |
| 988 | 984 | current_fg = av; |
| 989 | 985 | space3270out(3); |
| ... | ... | @@ -991,7 +987,7 @@ ctlr_snap_buffer(void) |
| 991 | 987 | *obptr++ = XA_FOREGROUND; |
| 992 | 988 | *obptr++ = av; |
| 993 | 989 | } |
| 994 | - av = ea_buf[baddr].bg; | |
| 990 | + av = h3270.ea_buf[baddr].bg; | |
| 995 | 991 | if (current_bg != av) { |
| 996 | 992 | current_bg = av; |
| 997 | 993 | space3270out(3); |
| ... | ... | @@ -999,7 +995,7 @@ ctlr_snap_buffer(void) |
| 999 | 995 | *obptr++ = XA_BACKGROUND; |
| 1000 | 996 | *obptr++ = av; |
| 1001 | 997 | } |
| 1002 | - av = ea_buf[baddr].gr; | |
| 998 | + av = h3270.ea_buf[baddr].gr; | |
| 1003 | 999 | if (av) |
| 1004 | 1000 | av |= 0xf0; |
| 1005 | 1001 | if (current_gr != av) { |
| ... | ... | @@ -1009,7 +1005,7 @@ ctlr_snap_buffer(void) |
| 1009 | 1005 | *obptr++ = XA_HIGHLIGHTING; |
| 1010 | 1006 | *obptr++ = av; |
| 1011 | 1007 | } |
| 1012 | - av = ea_buf[baddr].cs & CS_MASK; | |
| 1008 | + av = h3270.ea_buf[baddr].cs & CS_MASK; | |
| 1013 | 1009 | if (av) |
| 1014 | 1010 | av = host_cs(av); |
| 1015 | 1011 | if (current_cs != av) { |
| ... | ... | @@ -1019,12 +1015,12 @@ ctlr_snap_buffer(void) |
| 1019 | 1015 | *obptr++ = XA_CHARSET; |
| 1020 | 1016 | *obptr++ = av; |
| 1021 | 1017 | } |
| 1022 | - if (ea_buf[baddr].cs & CS_GE) { | |
| 1018 | + if (h3270.ea_buf[baddr].cs & CS_GE) { | |
| 1023 | 1019 | space3270out(1); |
| 1024 | 1020 | *obptr++ = ORDER_GE; |
| 1025 | 1021 | } |
| 1026 | 1022 | space3270out(1); |
| 1027 | - *obptr++ = ea_buf[baddr].cc; | |
| 1023 | + *obptr++ = h3270.ea_buf[baddr].cc; | |
| 1028 | 1024 | } |
| 1029 | 1025 | INC_BA(baddr); |
| 1030 | 1026 | } while (baddr != 0); |
| ... | ... | @@ -1233,7 +1229,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
| 1233 | 1229 | case ORDER_SF: /* start field */ |
| 1234 | 1230 | END_TEXT("StartField"); |
| 1235 | 1231 | if (previous != SBA) |
| 1236 | - trace_ds("%s",rcba(buffer_addr)); | |
| 1232 | + trace_ds("%s",rcba(h3270.buffer_addr)); | |
| 1237 | 1233 | previous = ORDER; |
| 1238 | 1234 | cp++; /* skip field attribute */ |
| 1239 | 1235 | START_FIELD(*cp); |
| ... | ... | @@ -1260,7 +1256,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
| 1260 | 1256 | case ORDER_IC: /* insert cursor */ |
| 1261 | 1257 | END_TEXT("InsertCursor"); |
| 1262 | 1258 | if (previous != SBA) |
| 1263 | - trace_ds("%s",rcba(buffer_addr)); | |
| 1259 | + trace_ds("%s",rcba(h3270.buffer_addr)); | |
| 1264 | 1260 | previous = ORDER; |
| 1265 | 1261 | cursor_move(&h3270,h3270.buffer_addr); |
| 1266 | 1262 | last_cmd = True; |
| ... | ... | @@ -1471,7 +1467,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
| 1471 | 1467 | case ORDER_MF: /* modify field */ |
| 1472 | 1468 | END_TEXT("ModifyField"); |
| 1473 | 1469 | if (previous != SBA) |
| 1474 | - trace_ds("%s",rcba(buffer_addr)); | |
| 1470 | + trace_ds("%s",rcba(h3270.buffer_addr)); | |
| 1475 | 1471 | previous = ORDER; |
| 1476 | 1472 | cp++; |
| 1477 | 1473 | na = *cp; |
| ... | ... | @@ -1542,7 +1538,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) |
| 1542 | 1538 | case ORDER_SFE: /* start field extended */ |
| 1543 | 1539 | END_TEXT("StartFieldExtended"); |
| 1544 | 1540 | if (previous != SBA) |
| 1545 | - trace_ds("%s",rcba(buffer_addr)); | |
| 1541 | + trace_ds("%s",rcba(h3270.buffer_addr)); | |
| 1546 | 1542 | previous = ORDER; |
| 1547 | 1543 | cp++; /* skip order */ |
| 1548 | 1544 | na = *cp; | ... | ... |
src/lib3270/ft_cut.c
| ... | ... | @@ -288,7 +288,7 @@ ft_cut_data(void) |
| 288 | 288 | cut_data(); |
| 289 | 289 | break; |
| 290 | 290 | default: |
| 291 | - trace_ds("< FT unknown 0x%02x\n", ea_buf[O_FRAME_TYPE].cc); | |
| 291 | + trace_ds("< FT unknown 0x%02x\n", h3270.ea_buf[O_FRAME_TYPE].cc); | |
| 292 | 292 | cut_abort(_(" Unknown frame type from host"), SC_ABORT_XMIT); |
| 293 | 293 | break; |
| 294 | 294 | } | ... | ... |
src/lib3270/glue.c
| ... | ... | @@ -311,9 +311,9 @@ static const struct lib3270_option options[] = |
| 311 | 311 | { OptCharset, OPT_STRING, False, ResCharset, offset(charset), NULL }, |
| 312 | 312 | { OptClear, OPT_SKIP2, False, NULL, NULL, NULL }, |
| 313 | 313 | // { OptDefScreen,OPT_STRING, False, ResDefScreen, offset(defscreen), NULL }, |
| 314 | -#if defined(X3270_TRACE) /*[*/ | |
| 315 | - { OptDsTrace, OPT_BOOLEAN, True, ResDsTrace, toggle_offset(DS_TRACE), NULL }, | |
| 316 | -#endif /*]*/ | |
| 314 | +//#if defined(X3270_TRACE) | |
| 315 | +// { OptDsTrace, OPT_BOOLEAN, True, ResDsTrace, toggle_offset(DS_TRACE), NULL }, | |
| 316 | +//#endif /*]*/ | |
| 317 | 317 | // { OptHostsFile,OPT_STRING, False, ResHostsFile, offset(hostsfile), NULL }, |
| 318 | 318 | //#if defined(C3270) |
| 319 | 319 | // { OptKeymap, OPT_STRING, False, ResKeymap, offset(key_map), N_( "Specifies a keymap name and optional modifiers." ) }, | ... | ... |
src/lib3270/screen.c
| ... | ... | @@ -74,9 +74,9 @@ |
| 74 | 74 | |
| 75 | 75 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 76 | 76 | |
| 77 | -static int logpopup(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg); | |
| 77 | +static int logpopup(H3270 *session, void *widget, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg); | |
| 78 | 78 | |
| 79 | -static int (*popup_handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list) = logpopup; | |
| 79 | +static int (*popup_handler)(H3270 *, void *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list) = logpopup; | |
| 80 | 80 | |
| 81 | 81 | enum ts { TS_AUTO, TS_ON, TS_OFF }; |
| 82 | 82 | |
| ... | ... | @@ -601,12 +601,12 @@ void show_3270_popup_dialog(H3270 *session, LIB3270_NOTIFY type, const char *tit |
| 601 | 601 | |
| 602 | 602 | va_list arg_ptr; |
| 603 | 603 | va_start(arg_ptr, fmt); |
| 604 | - popup_handler(session,type,title,msg,fmt,arg_ptr); | |
| 604 | + popup_handler(session,session->widget,type,title,msg,fmt,arg_ptr); | |
| 605 | 605 | va_end(arg_ptr); |
| 606 | 606 | |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | -static int logpopup(H3270 *session, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) | |
| 609 | +static int logpopup(H3270 *session, void *widget, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) | |
| 610 | 610 | { |
| 611 | 611 | lib3270_write_va_log(session,"lib3270",fmt,arg); |
| 612 | 612 | return 0; |
| ... | ... | @@ -619,7 +619,7 @@ void Error(H3270 *session, const char *fmt, ...) |
| 619 | 619 | CHECK_SESSION_HANDLE(session); |
| 620 | 620 | |
| 621 | 621 | va_start(arg_ptr, fmt); |
| 622 | - popup_handler(session,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); | |
| 622 | + popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); | |
| 623 | 623 | va_end(arg_ptr); |
| 624 | 624 | |
| 625 | 625 | } |
| ... | ... | @@ -631,7 +631,7 @@ void Warning(H3270 *session, const char *fmt, ...) |
| 631 | 631 | CHECK_SESSION_HANDLE(session); |
| 632 | 632 | |
| 633 | 633 | va_start(arg_ptr, fmt); |
| 634 | - popup_handler(session,LIB3270_NOTIFY_WARNING, _( "3270 Warning" ),NULL,fmt,arg_ptr); | |
| 634 | + popup_handler(session,session->widget,LIB3270_NOTIFY_WARNING, _( "3270 Warning" ),NULL,fmt,arg_ptr); | |
| 635 | 635 | va_end(arg_ptr); |
| 636 | 636 | |
| 637 | 637 | } |
| ... | ... | @@ -644,7 +644,7 @@ extern void popup_an_error(H3270 *session, const char *fmt, ...) |
| 644 | 644 | CHECK_SESSION_HANDLE(session); |
| 645 | 645 | |
| 646 | 646 | va_start(args, fmt); |
| 647 | - popup_handler(session,LIB3270_NOTIFY_ERROR,_( "3270 Error" ),NULL,fmt,args); | |
| 647 | + popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR,_( "3270 Error" ),NULL,fmt,args); | |
| 648 | 648 | va_end(args); |
| 649 | 649 | |
| 650 | 650 | } |
| ... | ... | @@ -656,7 +656,7 @@ void popup_system_error(H3270 *session, const char *title, const char *message, |
| 656 | 656 | CHECK_SESSION_HANDLE(session); |
| 657 | 657 | |
| 658 | 658 | va_start(args, fmt); |
| 659 | - popup_handler(session,LIB3270_NOTIFY_ERROR,title ? title : _( "3270 Error" ), message,fmt,args); | |
| 659 | + popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR,title ? title : _( "3270 Error" ), message,fmt,args); | |
| 660 | 660 | va_end(args); |
| 661 | 661 | } |
| 662 | 662 | |
| ... | ... | @@ -753,7 +753,7 @@ LIB3270_ACTION( testpattern ) |
| 753 | 753 | return 0; |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | -LIB3270_EXPORT void lib3270_set_popup_handler(int (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)) | |
| 756 | +LIB3270_EXPORT void lib3270_set_popup_handler(int (*handler)(H3270 *, void *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)) | |
| 757 | 757 | { |
| 758 | 758 | popup_handler = handler ? handler : logpopup; |
| 759 | 759 | } |
| ... | ... | @@ -765,7 +765,7 @@ LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , con |
| 765 | 765 | CHECK_SESSION_HANDLE(session); |
| 766 | 766 | |
| 767 | 767 | va_start(args, fmt); |
| 768 | - popup_handler(session,id,title ? title : _( "3270 Error" ), message,fmt,args); | |
| 768 | + popup_handler(session,session->widget,id,title ? title : _( "3270 Error" ), message,fmt,args); | |
| 769 | 769 | va_end(args); |
| 770 | 770 | } |
| 771 | 771 | ... | ... |
src/lib3270/telnet.c
| ... | ... | @@ -1110,11 +1110,6 @@ void net_input(H3270 *session) |
| 1110 | 1110 | } |
| 1111 | 1111 | #endif /*]*/ |
| 1112 | 1112 | |
| 1113 | -#if defined(X3270_TRACE) /*[*/ | |
| 1114 | - /* See if it's time to roll over the trace file. */ | |
| 1115 | - trace_rollover_check(); | |
| 1116 | -#endif /*]*/ | |
| 1117 | - | |
| 1118 | 1113 | } |
| 1119 | 1114 | |
| 1120 | 1115 | } | ... | ... |
src/lib3270/toggles.c
| ... | ... | @@ -155,11 +155,13 @@ void initialize_toggles(H3270 *session) |
| 155 | 155 | session->toggle[LIB3270_TOGGLE_RECTANGLE_SELECT].upcall = toggle_rectselect; |
| 156 | 156 | session->toggle[LIB3270_TOGGLE_MONOCASE].upcall = toggle_monocase; |
| 157 | 157 | |
| 158 | +/* | |
| 158 | 159 | #if defined(X3270_TRACE) |
| 159 | 160 | session->toggle[LIB3270_TOGGLE_DS_TRACE].upcall = toggle_dsTrace; |
| 160 | 161 | session->toggle[LIB3270_TOGGLE_SCREEN_TRACE].upcall = toggle_screenTrace; |
| 161 | 162 | session->toggle[LIB3270_TOGGLE_EVENT_TRACE].upcall = toggle_eventTrace; |
| 162 | 163 | #endif |
| 164 | +*/ | |
| 163 | 165 | |
| 164 | 166 | #if defined(X3270_ANSI) |
| 165 | 167 | session->toggle[LIB3270_TOGGLE_LINE_WRAP].upcall = toggle_lineWrap; |
| ... | ... | @@ -197,19 +199,8 @@ void shutdown_toggles(H3270 *session) |
| 197 | 199 | int f; |
| 198 | 200 | |
| 199 | 201 | for(f=0;f< (sizeof(disable_on_shutdown)/sizeof(disable_on_shutdown[0])); f++) |
| 200 | - { | |
| 201 | - LIB3270_TOGGLE ix = disable_on_shutdown[f]; | |
| 202 | - struct toggle * t = &session->toggle[ix]; | |
| 203 | - | |
| 204 | - if(t->value) | |
| 205 | - { | |
| 206 | - t->value = False; | |
| 207 | - t->upcall(session,&toggle[f],TT_FINAL); | |
| 202 | + lib3270_set_toggle(session,disable_on_shutdown[f],0); | |
| 208 | 203 | |
| 209 | - if(session->update_toggle) | |
| 210 | - session->update_toggle(session,ix,t->value,TT_FINAL,toggle_names[ix]); | |
| 211 | - } | |
| 212 | - } | |
| 213 | 204 | #endif |
| 214 | 205 | } |
| 215 | 206 | ... | ... |
src/lib3270/trace_ds.c
| ... | ... | @@ -83,33 +83,37 @@ |
| 83 | 83 | #define ftello(s) (off_t)ftell(s) |
| 84 | 84 | #endif /*]*/ |
| 85 | 85 | |
| 86 | -#include <lib3270/api.h> | |
| 86 | +// #include <lib3270/api.h> | |
| 87 | 87 | |
| 88 | 88 | /* Statics */ |
| 89 | 89 | static int dscnt = 0; |
| 90 | 90 | |
| 91 | +/* | |
| 91 | 92 | #if defined (LIB3270) |
| 92 | 93 | HCONSOLE tracewindow_handle = 0; |
| 93 | -#elif defined(_WIN32) /*[*/ | |
| 94 | +#elif defined(_WIN32) | |
| 94 | 95 | static HANDLE tracewindow_handle = NULL; |
| 95 | -#else /*][*/ | |
| 96 | +#else | |
| 96 | 97 | static int tracewindow_pid = -1; |
| 97 | -#endif /*]*/ | |
| 98 | +#endif | |
| 99 | +*/ | |
| 98 | 100 | |
| 99 | -static FILE *tracef = NULL; | |
| 100 | -static FILE *tracef_pipe = NULL; | |
| 101 | -static char *tracef_bufptr = CN; | |
| 102 | -static off_t tracef_size = 0; | |
| 103 | -static off_t tracef_max = 0; | |
| 104 | -static char *tracef_midpoint_header = CN; | |
| 105 | -static off_t tracef_midpoint = 0; | |
| 106 | -static void vwtrace(const char *fmt, va_list args); | |
| 101 | +// static FILE *tracef = NULL; | |
| 102 | +// static FILE *tracef_pipe = NULL; | |
| 103 | +// static char *tracef_bufptr = CN; | |
| 104 | +// static off_t tracef_size = 0; | |
| 105 | +// static off_t tracef_max = 0; | |
| 106 | +// static char *tracef_midpoint_header = CN; | |
| 107 | +// static off_t tracef_midpoint = 0; | |
| 108 | + | |
| 109 | +static void __vwtrace(const char *fmt, va_list args); | |
| 107 | 110 | static void wtrace(const char *fmt, ...); |
| 108 | -static char *create_tracefile_header(const char *mode); | |
| 111 | +// static char *create_tracefile_header(const char *mode); | |
| 109 | 112 | static void stop_tracing(void); |
| 110 | 113 | |
| 111 | 114 | /* Globals */ |
| 112 | 115 | struct timeval ds_ts; |
| 116 | +static void (*vwtrace)(const char *fmt, va_list args) = __vwtrace; | |
| 113 | 117 | Boolean trace_skipping = False; |
| 114 | 118 | |
| 115 | 119 | /* display a (row,col) */ |
| ... | ... | @@ -133,7 +137,7 @@ trace_ds_s(char *s, Boolean can_break) |
| 133 | 137 | int len = strlen(s); |
| 134 | 138 | Boolean nl = False; |
| 135 | 139 | |
| 136 | - if (!toggled(DS_TRACE) || tracef == NULL || !len) | |
| 140 | + if (!toggled(DS_TRACE) || !len) | |
| 137 | 141 | return; |
| 138 | 142 | |
| 139 | 143 | if (s && s[len-1] == '\n') { |
| ... | ... | @@ -167,7 +171,7 @@ trace_ds(const char *fmt, ...) |
| 167 | 171 | { |
| 168 | 172 | va_list args; |
| 169 | 173 | |
| 170 | - if (!toggled(DS_TRACE) || tracef == NULL) | |
| 174 | + if (!toggled(DS_TRACE)) | |
| 171 | 175 | return; |
| 172 | 176 | |
| 173 | 177 | va_start(args, fmt); |
| ... | ... | @@ -187,7 +191,7 @@ trace_ds_nb(const char *fmt, ...) |
| 187 | 191 | { |
| 188 | 192 | va_list args; |
| 189 | 193 | |
| 190 | - if (!toggled(DS_TRACE) || tracef == NULL) | |
| 194 | + if (!toggled(DS_TRACE)) | |
| 191 | 195 | return; |
| 192 | 196 | |
| 193 | 197 | va_start(args, fmt); |
| ... | ... | @@ -208,7 +212,7 @@ trace_event(const char *fmt, ...) |
| 208 | 212 | { |
| 209 | 213 | va_list args; |
| 210 | 214 | |
| 211 | - if (!toggled(EVENT_TRACE) || tracef == NULL) | |
| 215 | + if (!toggled(EVENT_TRACE)) | |
| 212 | 216 | return; |
| 213 | 217 | |
| 214 | 218 | /* print out message */ |
| ... | ... | @@ -223,7 +227,7 @@ trace_dsn(const char *fmt, ...) |
| 223 | 227 | { |
| 224 | 228 | va_list args; |
| 225 | 229 | |
| 226 | - if (!toggled(DS_TRACE) || tracef == NULL) | |
| 230 | + if (!toggled(DS_TRACE)) | |
| 227 | 231 | return; |
| 228 | 232 | |
| 229 | 233 | /* print out message */ |
| ... | ... | @@ -237,6 +241,12 @@ trace_dsn(const char *fmt, ...) |
| 237 | 241 | * This is the only function that actually does output to the trace file -- |
| 238 | 242 | * all others are wrappers around this function. |
| 239 | 243 | */ |
| 244 | +static void __vwtrace(const char *fmt, va_list args) | |
| 245 | +{ | |
| 246 | + vfprintf(stdout,fmt,args); | |
| 247 | +} | |
| 248 | + | |
| 249 | +/* | |
| 240 | 250 | static void vwtrace(const char *fmt, va_list args) |
| 241 | 251 | { |
| 242 | 252 | char buf[16384]; |
| ... | ... | @@ -255,20 +265,18 @@ static void vwtrace(const char *fmt, va_list args) |
| 255 | 265 | popup_an_errno(errno,_( "Write to trace file failed\n%s" ),strerror(errno)); |
| 256 | 266 | } |
| 257 | 267 | } |
| 268 | +*/ | |
| 258 | 269 | |
| 259 | 270 | /* Write to the trace file. */ |
| 260 | -static void | |
| 261 | -wtrace(const char *fmt, ...) | |
| 271 | +static void wtrace(const char *fmt, ...) | |
| 262 | 272 | { |
| 263 | - if (tracef != NULL) { | |
| 264 | - va_list args; | |
| 265 | - | |
| 266 | - va_start(args, fmt); | |
| 267 | - vwtrace(fmt, args); | |
| 268 | - va_end(args); | |
| 269 | - } | |
| 273 | + va_list args; | |
| 274 | + va_start(args, fmt); | |
| 275 | + vwtrace(fmt, args); | |
| 276 | + va_end(args); | |
| 270 | 277 | } |
| 271 | 278 | |
| 279 | +/* | |
| 272 | 280 | static void stop_tracing(void) |
| 273 | 281 | { |
| 274 | 282 | if (tracef != NULL && tracef != stdout) |
| ... | ... | @@ -282,39 +290,30 @@ static void stop_tracing(void) |
| 282 | 290 | lib3270_set_toggle(&h3270,DS_TRACE,0); |
| 283 | 291 | lib3270_set_toggle(&h3270,EVENT_TRACE,0); |
| 284 | 292 | |
| 285 | -/* | |
| 286 | - if (toggled(DS_TRACE)) { | |
| 287 | - toggle_toggle(&appres.toggle[DS_TRACE]); | |
| 288 | -// menubar_retoggle(&appres.toggle[DS_TRACE]); | |
| 289 | - } | |
| 290 | - if (toggled(EVENT_TRACE)) { | |
| 291 | - toggle_toggle(&appres.toggle[EVENT_TRACE]); | |
| 292 | -// menubar_retoggle(&appres.toggle[EVENT_TRACE]); | |
| 293 | - } | |
| 294 | -*/ | |
| 295 | 293 | } |
| 294 | +*/ | |
| 296 | 295 | |
| 297 | -/* Check for a trace file rollover event. */ | |
| 296 | +/* Check for a trace file rollover event. | |
| 298 | 297 | void |
| 299 | 298 | trace_rollover_check(void) |
| 300 | 299 | { |
| 301 | 300 | if (tracef == NULL || tracef_max == 0) |
| 302 | 301 | return; |
| 303 | 302 | |
| 304 | - /* See if we've reached the midpoint. */ | |
| 303 | + // See if we've reached the midpoint. | |
| 305 | 304 | if (!tracef_midpoint) { |
| 306 | 305 | if (tracef_size >= tracef_max / 2) { |
| 307 | 306 | tracef_midpoint = ftello(tracef); |
| 308 | -#if defined(ROLLOVER_DEBUG) /*[*/ | |
| 307 | +#if defined(ROLLOVER_DEBUG) | |
| 309 | 308 | printf("midpoint is %lld\n", tracef_midpoint); |
| 310 | -#endif /*]*/ | |
| 309 | +#endif | |
| 311 | 310 | tracef_midpoint_header = |
| 312 | 311 | create_tracefile_header("rolled over"); |
| 313 | 312 | } |
| 314 | 313 | return; |
| 315 | 314 | } |
| 316 | 315 | |
| 317 | - /* See if we've reached a rollover point. */ | |
| 316 | + // See if we've reached a rollover point. | |
| 318 | 317 | if (tracef_size >= tracef_max) { |
| 319 | 318 | char buf[8*1024]; |
| 320 | 319 | int nr; |
| ... | ... | @@ -322,13 +321,13 @@ trace_rollover_check(void) |
| 322 | 321 | |
| 323 | 322 | if (!tracef_midpoint) |
| 324 | 323 | Error("Tracefile rollover logic error"); |
| 325 | -#if defined(ROLLOVER_DEBUG) /*[*/ | |
| 324 | +#if defined(ROLLOVER_DEBUG) | |
| 326 | 325 | printf("rolling over at %lld\n", tracef_size); |
| 327 | -#endif /*]*/ | |
| 328 | - /* | |
| 329 | - * Overwrite the file with the midpoint header, and the data | |
| 330 | - * which follows the midpoint. | |
| 331 | - */ | |
| 326 | +#endif | |
| 327 | + // | |
| 328 | + // Overwrite the file with the midpoint header, and the data | |
| 329 | + // which follows the midpoint. | |
| 330 | + // | |
| 332 | 331 | if (fseeko(tracef, 0, SEEK_SET) < 0) { |
| 333 | 332 | popup_an_errno(errno, "trace file fseeko(0) failed"); |
| 334 | 333 | stop_tracing(); |
| ... | ... | @@ -347,9 +346,9 @@ trace_rollover_check(void) |
| 347 | 346 | stop_tracing(); |
| 348 | 347 | return; |
| 349 | 348 | } |
| 350 | -#if defined(ROLLOVER_DEBUG) /*[*/ | |
| 349 | +#if defined(ROLLOVER_DEBUG) | |
| 351 | 350 | printf("rpos = %lld, wpos = %lld\n", rpos, wpos); |
| 352 | -#endif /*]*/ | |
| 351 | +#endif | |
| 353 | 352 | while ((nr = fread(buf, 1, sizeof(buf), tracef)) > 0) { |
| 354 | 353 | rpos = ftello(tracef); |
| 355 | 354 | if (fseeko(tracef, wpos, SEEK_SET) < 0) { |
| ... | ... | @@ -380,9 +379,9 @@ trace_rollover_check(void) |
| 380 | 379 | stop_tracing(); |
| 381 | 380 | return; |
| 382 | 381 | } |
| 383 | -#if defined(ROLLOVER_DEBUG) /*[*/ | |
| 382 | +#if defined(ROLLOVER_DEBUG) | |
| 384 | 383 | printf("final wpos = %lld\n", wpos); |
| 385 | -#endif /*]*/ | |
| 384 | +#endif | |
| 386 | 385 | if (ftruncate(fileno(tracef), wpos) < 0) { |
| 387 | 386 | popup_an_errno(errno, "trace file ftruncate(%ld) " |
| 388 | 387 | "failed", (long)wpos); |
| ... | ... | @@ -401,29 +400,29 @@ trace_rollover_check(void) |
| 401 | 400 | create_tracefile_header("rolled over")); |
| 402 | 401 | } |
| 403 | 402 | } |
| 403 | +*/ | |
| 404 | 404 | |
| 405 | -#if defined(X3270_DISPLAY) /*[*/ | |
| 405 | +/* | |
| 406 | +#if defined(X3270_DISPLAY) | |
| 406 | 407 | static Widget trace_shell = (Widget)NULL; |
| 407 | -#endif /*]*/ | |
| 408 | +#endif | |
| 408 | 409 | static int trace_reason; |
| 410 | +*/ | |
| 409 | 411 | |
| 410 | -/* Create a trace file header. */ | |
| 411 | -static char * | |
| 412 | -create_tracefile_header(const char *mode) | |
| 412 | +/* Create a trace file header. */ /* | |
| 413 | +static char * create_tracefile_header(const char *mode) | |
| 413 | 414 | { |
| 414 | 415 | char *buf; |
| 415 | 416 | time_t clk; |
| 416 | 417 | |
| 417 | - /* Create a buffer and redirect output. */ | |
| 418 | + // Create a buffer and redirect output. | |
| 418 | 419 | buf = Malloc(MAX_HEADER_SIZE); |
| 419 | 420 | tracef_bufptr = buf; |
| 420 | 421 | |
| 421 | - /* Display current status */ | |
| 422 | + // Display current status | |
| 422 | 423 | clk = time((time_t *)0); |
| 423 | 424 | wtrace("Trace %s %s", mode, ctime(&clk)); |
| 424 | 425 | wtrace(" Version: %s\n", build); |
| 425 | -// save_yourself(); | |
| 426 | -// wtrace(" Command: %s\n", command_string); | |
| 427 | 426 | wtrace(" Model %s", h3270.model_name); |
| 428 | 427 | wtrace(", %s display", appres.mono ? "monochrome" : "color"); |
| 429 | 428 | if (appres.extended) |
| ... | ... | @@ -436,27 +435,27 @@ create_tracefile_header(const char *mode) |
| 436 | 435 | if (CONNECTED) |
| 437 | 436 | wtrace(" Connected to %s, port %u\n",h3270.current_host, h3270.current_port); |
| 438 | 437 | |
| 439 | - /* Snap the current TELNET options. */ | |
| 438 | + // Snap the current TELNET options. | |
| 440 | 439 | if (net_snap_options()) { |
| 441 | 440 | wtrace(" TELNET state:\n"); |
| 442 | 441 | trace_netdata('<', obuf, obptr - obuf); |
| 443 | 442 | } |
| 444 | 443 | |
| 445 | - /* Dump the screen contents and modes into the trace file. */ | |
| 444 | + // Dump the screen contents and modes into the trace file. | |
| 446 | 445 | if (CONNECTED) { |
| 447 | - /* | |
| 448 | - * Note that if the screen is not formatted, we do not | |
| 449 | - * attempt to save what's on it. However, if we're in | |
| 450 | - * 3270 SSCP-LU or NVT mode, we'll do a dummy, empty | |
| 451 | - * write to ensure that the display is in the right | |
| 452 | - * mode. | |
| 453 | - */ | |
| 446 | + // | |
| 447 | + // Note that if the screen is not formatted, we do not | |
| 448 | + // attempt to save what's on it. However, if we're in | |
| 449 | + // 3270 SSCP-LU or NVT mode, we'll do a dummy, empty | |
| 450 | + // write to ensure that the display is in the right | |
| 451 | + // mode. | |
| 452 | + // | |
| 454 | 453 | if (h3270.formatted) { |
| 455 | 454 | wtrace(" Screen contents:\n"); |
| 456 | 455 | obptr = obuf; |
| 457 | -#if defined(X3270_TN3270E) /*[*/ | |
| 456 | +#if defined(X3270_TN3270E) | |
| 458 | 457 | (void) net_add_dummy_tn3270e(); |
| 459 | -#endif /*]*/ | |
| 458 | +#endif | |
| 460 | 459 | ctlr_snap_buffer(); |
| 461 | 460 | space3270out(2); |
| 462 | 461 | net_add_eor(obuf, obptr - obuf); |
| ... | ... | @@ -464,9 +463,9 @@ create_tracefile_header(const char *mode) |
| 464 | 463 | trace_netdata('<', obuf, obptr - obuf); |
| 465 | 464 | |
| 466 | 465 | obptr = obuf; |
| 467 | -#if defined(X3270_TN3270E) /*[*/ | |
| 466 | +#if defined(X3270_TN3270E) | |
| 468 | 467 | (void) net_add_dummy_tn3270e(); |
| 469 | -#endif /*]*/ | |
| 468 | +#endif | |
| 470 | 469 | if (ctlr_snap_modes()) { |
| 471 | 470 | wtrace(" 3270 modes:\n"); |
| 472 | 471 | space3270out(2); |
| ... | ... | @@ -475,7 +474,7 @@ create_tracefile_header(const char *mode) |
| 475 | 474 | trace_netdata('<', obuf, obptr - obuf); |
| 476 | 475 | } |
| 477 | 476 | } |
| 478 | -#if defined(X3270_TN3270E) /*[*/ | |
| 477 | +#if defined(X3270_TN3270E) | |
| 479 | 478 | else if (IN_E) { |
| 480 | 479 | obptr = obuf; |
| 481 | 480 | if (net_add_dummy_tn3270e()) { |
| ... | ... | @@ -486,17 +485,18 @@ create_tracefile_header(const char *mode) |
| 486 | 485 | trace_netdata('<', obuf, obptr - obuf); |
| 487 | 486 | } |
| 488 | 487 | } |
| 489 | -#endif /*]*/ | |
| 488 | +#endif | |
| 490 | 489 | } |
| 491 | 490 | |
| 492 | 491 | wtrace(" Data stream:\n"); |
| 493 | 492 | |
| 494 | - /* Return the buffer. */ | |
| 493 | + // Return the buffer. | |
| 495 | 494 | tracef_bufptr = CN; |
| 496 | 495 | return buf; |
| 497 | 496 | } |
| 497 | +*/ | |
| 498 | 498 | |
| 499 | -/* Calculate the tracefile maximum size. */ | |
| 499 | +/* Calculate the tracefile maximum size. */ /* | |
| 500 | 500 | static void |
| 501 | 501 | get_tracef_max(void) |
| 502 | 502 | { |
| ... | ... | @@ -538,16 +538,17 @@ get_tracef_max(void) |
| 538 | 538 | |
| 539 | 539 | if (bad) { |
| 540 | 540 | tracef_max = MIN_TRACEFILE_SIZE; |
| 541 | -#if defined(X3270_DISPLAY) /*[*/ | |
| 541 | +#if defined(X3270_DISPLAY) | |
| 542 | 542 | popup_an_info("Invalid %s '%s', assuming " |
| 543 | 543 | MIN_TRACEFILE_SIZE_NAME, |
| 544 | 544 | ResTraceFileSize, |
| 545 | 545 | appres.trace_file_size); |
| 546 | -#endif /*]*/ | |
| 546 | +#endif | |
| 547 | 547 | } else if (tracef_max < MIN_TRACEFILE_SIZE) { |
| 548 | 548 | tracef_max = MIN_TRACEFILE_SIZE; |
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | +*/ | |
| 551 | 552 | |
| 552 | 553 | /* Parse the name '/dev/fd<n>', so we can simulate it. */ |
| 553 | 554 | static int |
| ... | ... | @@ -564,7 +565,7 @@ get_devfd(const char *pathname) |
| 564 | 565 | return fd; |
| 565 | 566 | } |
| 566 | 567 | |
| 567 | -/* Callback for "OK" button on trace popup */ | |
| 568 | +/* Callback for "OK" button on trace popup */ /* | |
| 568 | 569 | static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_data unused) |
| 569 | 570 | { |
| 570 | 571 | char *tfn = CN; |
| ... | ... | @@ -590,10 +591,10 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d |
| 590 | 591 | } |
| 591 | 592 | else |
| 592 | 593 | { |
| 593 | - /* Get the trace file maximum. */ | |
| 594 | + // Get the trace file maximum. | |
| 594 | 595 | get_tracef_max(); |
| 595 | 596 | |
| 596 | - /* If there's a limit, the file can't exist. */ | |
| 597 | + // If there's a limit, the file can't exist. | |
| 597 | 598 | if (tracef_max && !access(tfn, R_OK)) |
| 598 | 599 | { |
| 599 | 600 | popup_an_error("Trace file '%s' already exists",tfn); |
| ... | ... | @@ -601,7 +602,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d |
| 601 | 602 | return; |
| 602 | 603 | } |
| 603 | 604 | |
| 604 | - /* Open and configure the file. */ | |
| 605 | + // Open and configure the file. | |
| 605 | 606 | if ((devfd = get_devfd(tfn)) >= 0) |
| 606 | 607 | tracef = fdopen(dup(devfd), "a"); |
| 607 | 608 | else |
| ... | ... | @@ -613,31 +614,31 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d |
| 613 | 614 | return; |
| 614 | 615 | } |
| 615 | 616 | (void) SETLINEBUF(tracef); |
| 616 | -#if !defined(_WIN32) /*[*/ | |
| 617 | +#if !defined(_WIN32) | |
| 617 | 618 | (void) fcntl(fileno(tracef), F_SETFD, 1); |
| 618 | -#endif /*]*/ | |
| 619 | +#endif | |
| 619 | 620 | } |
| 620 | 621 | |
| 621 | - /* Open pw3270's console window */ | |
| 622 | + // Open pw3270's console window | |
| 622 | 623 | if(!tracewindow_handle) |
| 623 | 624 | tracewindow_handle = console_window_new( tfn, NULL ); |
| 624 | 625 | |
| 625 | 626 | Free(tfn); |
| 626 | 627 | |
| 627 | - /* We're really tracing, turn the flag on. */ | |
| 628 | + // We're really tracing, turn the flag on. | |
| 628 | 629 | appres.toggle[trace_reason].value = True; |
| 629 | 630 | // appres.toggle[trace_reason].changed = True; |
| 630 | 631 | // menubar_retoggle(&appres.toggle[trace_reason]); |
| 631 | 632 | |
| 632 | - /* Display current status. */ | |
| 633 | + // Display current status | |
| 633 | 634 | buf = create_tracefile_header("started"); |
| 634 | 635 | wtrace("%s", buf); |
| 635 | 636 | Free(buf); |
| 636 | 637 | |
| 637 | 638 | } |
| 638 | 639 | |
| 639 | -#if defined(X3270_DISPLAY) /*[*/ | |
| 640 | -/* Callback for "No File" button on trace popup */ | |
| 640 | +#if defined(X3270_DISPLAY) | |
| 641 | +// Callback for "No File" button on trace popup | |
| 641 | 642 | static void |
| 642 | 643 | no_tracefile_callback(Widget w, XtPointer client_data, |
| 643 | 644 | XtPointer call_data unused) |
| ... | ... | @@ -645,9 +646,10 @@ no_tracefile_callback(Widget w, XtPointer client_data, |
| 645 | 646 | tracefile_callback((Widget)NULL, "", PN); |
| 646 | 647 | XtPopdown(trace_shell); |
| 647 | 648 | } |
| 648 | -#endif /*]*/ | |
| 649 | +#endif | |
| 650 | +*/ | |
| 649 | 651 | |
| 650 | -/* Open the trace file. */ | |
| 652 | +/* Open the trace file. | |
| 651 | 653 | static void |
| 652 | 654 | tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt) |
| 653 | 655 | { |
| ... | ... | @@ -668,30 +670,30 @@ tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt) |
| 668 | 670 | } |
| 669 | 671 | else |
| 670 | 672 | { |
| 671 | -#if defined(_WIN32) /*[*/ | |
| 673 | +#if defined(_WIN32) | |
| 672 | 674 | tracefile_buf = xs_buffer("%sx3trc.%u.txt", PROGRAM_DATA,getpid()); |
| 673 | -#else /*][*/ | |
| 675 | +#else | |
| 674 | 676 | |
| 675 | 677 | if(appres.trace_dir) |
| 676 | 678 | tracefile_buf = xs_buffer("%s/x3trc.%u", appres.trace_dir,getpid()); |
| 677 | 679 | else |
| 678 | 680 | tracefile_buf = xs_buffer("%s/x3trc.%u", ".",getpid()); |
| 679 | 681 | |
| 680 | -#endif /*]*/ | |
| 682 | +#endif | |
| 681 | 683 | tracefile = tracefile_buf; |
| 682 | 684 | } |
| 683 | 685 | |
| 684 | 686 | |
| 685 | -#if defined(X3270_DISPLAY) /*[*/ | |
| 687 | +#if defined(X3270_DISPLAY) | |
| 686 | 688 | if (tt == TT_INITIAL || tt == TT_ACTION) |
| 687 | -#endif /*]*/ | |
| 689 | +#endif | |
| 688 | 690 | { |
| 689 | 691 | tracefile_callback((Widget)NULL, tracefile, PN); |
| 690 | 692 | if (tracefile_buf != NULL) |
| 691 | 693 | Free(tracefile_buf); |
| 692 | 694 | return; |
| 693 | 695 | } |
| 694 | -#if defined(X3270_DISPLAY) /*[*/ | |
| 696 | +#if defined(X3270_DISPLAY) | |
| 695 | 697 | if (trace_shell == NULL) { |
| 696 | 698 | trace_shell = create_form_popup("trace", |
| 697 | 699 | tracefile_callback, |
| ... | ... | @@ -702,18 +704,18 @@ tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt) |
| 702 | 704 | NULL); |
| 703 | 705 | } |
| 704 | 706 | |
| 705 | - /* Turn the toggle _off_ until the popup succeeds. */ | |
| 707 | + // Turn the toggle _off_ until the popup succeeds. | |
| 706 | 708 | appres.toggle[reason].value = False; |
| 707 | 709 | appres.toggle[reason].changed = True; |
| 708 | 710 | |
| 709 | 711 | popup_popup(trace_shell, XtGrabExclusive); |
| 710 | -#endif /*]*/ | |
| 712 | +#endif | |
| 711 | 713 | |
| 712 | 714 | if (tracefile_buf != NULL) |
| 713 | 715 | Free(tracefile_buf); |
| 714 | 716 | } |
| 715 | 717 | |
| 716 | -/* Close the trace file. */ | |
| 718 | +// Close the trace file. | |
| 717 | 719 | static void tracefile_off(void) |
| 718 | 720 | { |
| 719 | 721 | time_t clk; |
| ... | ... | @@ -729,13 +731,13 @@ static void tracefile_off(void) |
| 729 | 731 | tracewindow_handle = NULL; |
| 730 | 732 | } |
| 731 | 733 | |
| 732 | -#elif !defined(_WIN32) /*[*/ | |
| 734 | +#elif !defined(_WIN32) | |
| 733 | 735 | |
| 734 | 736 | if (tracewindow_pid != -1) |
| 735 | 737 | (void) kill(tracewindow_pid, SIGKILL); |
| 736 | 738 | tracewindow_pid = -1; |
| 737 | 739 | |
| 738 | -#else /*][*/ | |
| 740 | +#else | |
| 739 | 741 | |
| 740 | 742 | if (tracewindow_handle != NULL) |
| 741 | 743 | { |
| ... | ... | @@ -744,56 +746,57 @@ static void tracefile_off(void) |
| 744 | 746 | tracewindow_handle = NULL; |
| 745 | 747 | } |
| 746 | 748 | |
| 747 | -#endif /*]*/ | |
| 749 | +#endif | |
| 748 | 750 | |
| 749 | 751 | stop_tracing(); |
| 750 | 752 | } |
| 751 | 753 | |
| 754 | + | |
| 752 | 755 | void toggle_dsTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt) |
| 753 | 756 | { |
| 754 | - /* If turning on trace and no trace file, open one. */ | |
| 755 | - | |
| 756 | 757 | if (toggled(DS_TRACE) && tracef == NULL) |
| 757 | 758 | tracefile_on(DS_TRACE, tt); |
| 758 | 759 | |
| 759 | - /* If turning off trace and not still tracing events, close the | |
| 760 | - trace file. */ | |
| 760 | + // If turning off trace and not still tracing events, close the trace file. | |
| 761 | 761 | else if (!toggled(DS_TRACE) && !toggled(EVENT_TRACE)) |
| 762 | 762 | tracefile_off(); |
| 763 | 763 | |
| 764 | 764 | if (toggled(DS_TRACE)) |
| 765 | 765 | (void) gettimeofday(&ds_ts, (struct timezone *)NULL); |
| 766 | 766 | } |
| 767 | +*/ | |
| 767 | 768 | |
| 769 | +/* | |
| 768 | 770 | void toggle_eventTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt) |
| 769 | 771 | { |
| 770 | - /* If turning on event debug, and no trace file, open one. */ | |
| 772 | + // If turning on event debug, and no trace file, open one. | |
| 771 | 773 | |
| 772 | 774 | if (toggled(EVENT_TRACE) && tracef == NULL) |
| 773 | 775 | tracefile_on(EVENT_TRACE, tt); |
| 774 | 776 | |
| 775 | - /* If turning off event debug, and not tracing the data stream, | |
| 776 | - close the trace file. */ | |
| 777 | + // If turning off event debug, and not tracing the data stream, close the trace file. | |
| 777 | 778 | else if (!toggled(EVENT_TRACE) && !toggled(DS_TRACE)) |
| 778 | 779 | tracefile_off(); |
| 779 | 780 | } |
| 781 | +*/ | |
| 780 | 782 | |
| 781 | 783 | /* Screen trace file support. */ |
| 782 | 784 | |
| 783 | -#if defined(X3270_DISPLAY) /*[*/ | |
| 785 | +/* | |
| 786 | +#if defined(X3270_DISPLAY) | |
| 784 | 787 | static Widget screentrace_shell = (Widget)NULL; |
| 785 | -#endif /*]*/ | |
| 788 | +#endif | |
| 786 | 789 | static FILE *screentracef = (FILE *)0; |
| 787 | - | |
| 790 | +*/ | |
| 788 | 791 | /* |
| 789 | 792 | * Screen trace function, called when the host clears the screen. |
| 790 | 793 | */ |
| 791 | -static void | |
| 792 | -do_screentrace(void) | |
| 794 | +static void do_screentrace(void) | |
| 793 | 795 | { |
| 796 | + wtrace("\n%s - Not implemented\n",__FUNCTION__); | |
| 797 | +/* | |
| 794 | 798 | register int i; |
| 795 | 799 | |
| 796 | -/* | |
| 797 | 800 | if (fprint_screen(screentracef, False, False)) { |
| 798 | 801 | for (i = 0; i < h3270.cols; i++) |
| 799 | 802 | (void) fputc('=', screentracef); |
| ... | ... | @@ -802,23 +805,20 @@ do_screentrace(void) |
| 802 | 805 | */ |
| 803 | 806 | } |
| 804 | 807 | |
| 805 | -void | |
| 806 | -trace_screen(void) | |
| 808 | +void trace_screen(void) | |
| 807 | 809 | { |
| 808 | 810 | trace_skipping = False; |
| 809 | 811 | |
| 810 | - if (!toggled(SCREEN_TRACE) || !screentracef) | |
| 811 | - return; | |
| 812 | - do_screentrace(); | |
| 812 | + if (!toggled(SCREEN_TRACE)) | |
| 813 | + do_screentrace(); | |
| 813 | 814 | } |
| 814 | 815 | |
| 815 | 816 | /* Called from ANSI emulation code to log a single character. */ |
| 816 | -void | |
| 817 | -trace_char(char c) | |
| 817 | +void trace_char(char c) | |
| 818 | 818 | { |
| 819 | - if (!toggled(SCREEN_TRACE) || !screentracef) | |
| 820 | - return; | |
| 821 | - (void) fputc(c, screentracef); | |
| 819 | + if (toggled(SCREEN_TRACE)) | |
| 820 | + wtrace("%c",c); | |
| 821 | + return; | |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | /* |
| ... | ... | @@ -827,15 +827,14 @@ trace_char(char c) |
| 827 | 827 | * (In a gross violation of data hiding and modularity, trace_skipping is |
| 828 | 828 | * manipulated directly in ctlr_clear()). |
| 829 | 829 | */ |
| 830 | -void | |
| 831 | -trace_ansi_disc(void) | |
| 830 | +void trace_ansi_disc(void) | |
| 832 | 831 | { |
| 833 | 832 | int i; |
| 834 | 833 | |
| 835 | - (void) fputc('\n', screentracef); | |
| 834 | + wtrace("%c",'\n'); | |
| 836 | 835 | for (i = 0; i < h3270.cols; i++) |
| 837 | - (void) fputc('=', screentracef); | |
| 838 | - (void) fputc('\n', screentracef); | |
| 836 | + wtrace("%c",'='); | |
| 837 | + wtrace("%c",'\n'); | |
| 839 | 838 | |
| 840 | 839 | trace_skipping = True; |
| 841 | 840 | } |
| ... | ... | @@ -843,7 +842,7 @@ trace_ansi_disc(void) |
| 843 | 842 | /* |
| 844 | 843 | * Screen tracing callback. |
| 845 | 844 | * Returns True for success, False for failure. |
| 846 | - */ | |
| 845 | + */ /* | |
| 847 | 846 | static Boolean |
| 848 | 847 | screentrace_cb(char *tfn) |
| 849 | 848 | { |
| ... | ... | @@ -856,16 +855,17 @@ screentrace_cb(char *tfn) |
| 856 | 855 | } |
| 857 | 856 | Free(tfn); |
| 858 | 857 | (void) SETLINEBUF(screentracef); |
| 859 | -#if !defined(_WIN32) /*[*/ | |
| 858 | +#if !defined(_WIN32) | |
| 860 | 859 | (void) fcntl(fileno(screentracef), F_SETFD, 1); |
| 861 | -#endif /*]*/ | |
| 860 | +#endif | |
| 862 | 861 | |
| 863 | - /* We're really tracing, turn the flag on. */ | |
| 862 | + // We're really tracing, turn the flag on. | |
| 864 | 863 | appres.toggle[SCREEN_TRACE].value = True; |
| 865 | 864 | // appres.toggle[SCREEN_TRACE].changed = True; |
| 866 | 865 | // menubar_retoggle(&appres.toggle[SCREEN_TRACE]); |
| 867 | 866 | return True; |
| 868 | 867 | } |
| 868 | +*/ | |
| 869 | 869 | |
| 870 | 870 | /* |
| 871 | 871 | #if defined(X3270_DISPLAY) |
| ... | ... | @@ -910,8 +910,11 @@ onescreen_callback(Widget w, XtPointer client_data, XtPointer call_data unused) |
| 910 | 910 | } |
| 911 | 911 | #endif */ |
| 912 | 912 | |
| 913 | +/* | |
| 913 | 914 | void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt) |
| 914 | 915 | { |
| 916 | + wtrace("Screen trace is %s\n",toggled(SCREEN_TRACE),"Enabled" : "Disabled"); | |
| 917 | + | |
| 915 | 918 | char *tracefile_buf = NULL; |
| 916 | 919 | char *tracefile; |
| 917 | 920 | |
| ... | ... | @@ -919,14 +922,14 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ |
| 919 | 922 | if (appres.screentrace_file) |
| 920 | 923 | tracefile = appres.screentrace_file; |
| 921 | 924 | else { |
| 922 | -#if defined(_WIN32) /*[*/ | |
| 925 | +#if defined(_WIN32) | |
| 923 | 926 | tracefile_buf = xs_buffer("%sx3scr.%u.txt",PROGRAM_DATA, getpid()); |
| 924 | -#else /*][*/ | |
| 927 | +#else | |
| 925 | 928 | if(appres.trace_dir) |
| 926 | 929 | tracefile_buf = xs_buffer("%s/x3scr.%u",appres.trace_dir, getpid()); |
| 927 | 930 | else |
| 928 | 931 | tracefile_buf = xs_buffer("%s/x3scr.%u",".", getpid()); |
| 929 | -#endif /*]*/ | |
| 932 | +#endif | |
| 930 | 933 | tracefile = tracefile_buf; |
| 931 | 934 | } |
| 932 | 935 | if (tt == TT_INITIAL || tt == TT_ACTION) { |
| ... | ... | @@ -935,7 +938,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ |
| 935 | 938 | Free(tracefile_buf); |
| 936 | 939 | return; |
| 937 | 940 | } |
| 938 | -#if defined(X3270_DISPLAY) /*[*/ | |
| 941 | +#if defined(X3270_DISPLAY) | |
| 939 | 942 | if (screentrace_shell == NULL) { |
| 940 | 943 | screentrace_shell = create_form_popup("screentrace", |
| 941 | 944 | screentrace_callback, onescreen_callback, |
| ... | ... | @@ -948,7 +951,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ |
| 948 | 951 | appres.toggle[SCREEN_TRACE].value = False; |
| 949 | 952 | appres.toggle[SCREEN_TRACE].changed = True; |
| 950 | 953 | popup_popup(screentrace_shell, XtGrabExclusive); |
| 951 | -#endif /*]*/ | |
| 954 | +#endif | |
| 952 | 955 | } else { |
| 953 | 956 | if (ctlr_any_data() && !trace_skipping) |
| 954 | 957 | do_screentrace(); |
| ... | ... | @@ -958,5 +961,6 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ |
| 958 | 961 | if (tracefile_buf != NULL) |
| 959 | 962 | Free(tracefile_buf); |
| 960 | 963 | } |
| 964 | +*/ | |
| 961 | 965 | |
| 962 | 966 | #endif /*]*/ | ... | ... |
src/lib3270/trace_dsc.h
| ... | ... | @@ -32,37 +32,38 @@ |
| 32 | 32 | * Global declarations for trace_ds.c. |
| 33 | 33 | */ |
| 34 | 34 | |
| 35 | -#if defined(X3270_TRACE) /*[*/ | |
| 35 | +#if defined(X3270_TRACE) | |
| 36 | 36 | |
| 37 | -LIB3270_INTERNAL Boolean trace_skipping; | |
| 37 | + LIB3270_INTERNAL Boolean trace_skipping; | |
| 38 | 38 | |
| 39 | -const char *rcba(int baddr); | |
| 40 | -void toggle_dsTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt); | |
| 41 | -void toggle_eventTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt); | |
| 42 | -void toggle_screenTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt); | |
| 43 | -void trace_ansi_disc(void); | |
| 44 | -void trace_char(char c); | |
| 45 | -void trace_ds(const char *fmt, ...) printflike(1, 2); | |
| 46 | -void trace_ds_nb(const char *fmt, ...) printflike(1, 2); | |
| 47 | -void trace_dsn(const char *fmt, ...) printflike(1, 2); | |
| 48 | -void trace_event(const char *fmt, ...) printflike(1, 2); | |
| 49 | -void trace_screen(void); | |
| 50 | -void trace_rollover_check(void); | |
| 39 | + const char *rcba(int baddr); | |
| 51 | 40 | |
| 52 | -#else /*][*/ | |
| 41 | +// void toggle_dsTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt); | |
| 42 | +// void toggle_eventTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt); | |
| 43 | +// void toggle_screenTrace(H3270 *h, struct toggle *t, LIB3270_TOGGLE_TYPE tt); | |
| 53 | 44 | |
| 54 | -#define rcba 0 && | |
| 55 | -#if defined(__GNUC__) /*[*/ | |
| 56 | -#define trace_ds(format, args...) | |
| 57 | -#define trace_dsn(format, args...) | |
| 58 | -#define trace_ds_nb(format, args...) | |
| 59 | -#define trace_event(format, args...) | |
| 60 | -#else /*][*/ | |
| 61 | -#define trace_ds 0 && | |
| 62 | -#define trace_ds_nb 0 && | |
| 63 | -#define trace_dsn 0 && | |
| 64 | -#define trace_event 0 && | |
| 65 | -#define rcba 0 && | |
| 66 | -#endif /*]*/ | |
| 45 | + void trace_ansi_disc(void); | |
| 46 | + void trace_char(char c); | |
| 47 | + void trace_ds(const char *fmt, ...) printflike(1, 2); | |
| 48 | + void trace_ds_nb(const char *fmt, ...) printflike(1, 2); | |
| 49 | + void trace_dsn(const char *fmt, ...) printflike(1, 2); | |
| 50 | + void trace_event(const char *fmt, ...) printflike(1, 2); | |
| 51 | + void trace_screen(void); | |
| 52 | +// void trace_rollover_check(void); | |
| 67 | 53 | |
| 68 | -#endif /*]*/ | |
| 54 | +#elif defined(__GNUC__) | |
| 55 | + | |
| 56 | + #define trace_ds(format, args...) | |
| 57 | + #define trace_dsn(format, args...) | |
| 58 | + #define trace_ds_nb(format, args...) | |
| 59 | + #define trace_event(format, args...) | |
| 60 | + | |
| 61 | +#else | |
| 62 | + | |
| 63 | + #define trace_ds 0 && | |
| 64 | + #define trace_ds_nb 0 && | |
| 65 | + #define trace_dsn 0 && | |
| 66 | + #define trace_event 0 && | |
| 67 | + #define rcba 0 && | |
| 68 | + | |
| 69 | +#endif | ... | ... |
ui/00default.xml
| ... | ... | @@ -40,12 +40,12 @@ |
| 40 | 40 | * filename='PATH' to save to a predefined file whithout user interaction |
| 41 | 41 | |
| 42 | 42 | ---> |
| 43 | - <menuitem action='save' src='all' label='Save screen' /> | |
| 43 | + <menuitem action='save' src='all' group='online' label='Save screen' /> | |
| 44 | 44 | <menuitem action='save' src='selected' group='selection' label='Save selected' /> |
| 45 | 45 | <menuitem action='save' src='copy' group='clipboard' label='Save copy' /> |
| 46 | 46 | |
| 47 | 47 | <separator/> |
| 48 | - <menuitem action='print' src='all' key='Print' icon='print' label='Print' /> | |
| 48 | + <menuitem action='print' src='all' key='Print' group='online' icon='print' label='Print' /> | |
| 49 | 49 | <menuitem action='print' src='selected' group='selection' label='Print selected' /> |
| 50 | 50 | <menuitem action='print' src='copy' group='clipboard' label='Print copy' /> |
| 51 | 51 | <separator/> | ... | ... |
ui/99debug.xml
| ... | ... | @@ -38,6 +38,12 @@ |
| 38 | 38 | </menu> |
| 39 | 39 | --> |
| 40 | 40 | |
| 41 | + <menu name='SettingsMenu' label='Settings' sysmenu='yes' > | |
| 42 | + <menu name='OptionsMenu' label='_Options' > | |
| 43 | + <menuitem action='toggle' id='dstrace' label='DS Trace' /> | |
| 44 | + </menu> | |
| 45 | + </menu> | |
| 46 | + | |
| 41 | 47 | <menu name='debugmenu' label='Debug' > |
| 42 | 48 | <menuitem action='testpattern' group='offline' label='Show test pattern' /> |
| 43 | 49 | <menuitem action='reload' label='Reload buffer contents' /> | ... | ... |