[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5821] debugging messages and error message handling moved between files
From: |
Gavin D. Smith |
Subject: |
[5821] debugging messages and error message handling moved between files |
Date: |
Fri, 12 Sep 2014 12:38:48 +0000 |
Revision: 5821
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5821
Author: gavin
Date: 2014-09-12 12:38:47 +0000 (Fri, 12 Sep 2014)
Log Message:
-----------
debugging messages and error message handling moved between files
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info.c
trunk/info/info.h
trunk/info/session.c
trunk/info/session.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-09-12 11:27:11 UTC (rev 5820)
+++ trunk/ChangeLog 2014-09-12 12:38:47 UTC (rev 5821)
@@ -17,6 +17,15 @@
* info/info.h, info/nodes.h (strict_node_location_p): Declaration
moved.
+ * info/info.c, info/session.c (debug_file, close_debugfile)
+ (debug_level, vinfo_debug)
+ (info_debug, info_error_rings_bell_p, info_error, show_error_node)
+ Moved between files.
+ (vinfo_debug, vinfo_error): Declared static.
+ * info/info.h (program_name): Declaration added.
+ (info_error_rings_bell_p): Declaration removed.
+ * info/info.h, info/session.h (debug): Macro definition moved.
+
2014-09-10 Gavin Smith <address@hidden>
* info/display.c (display_scroll_region): New function.
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2014-09-12 11:27:11 UTC (rev 5820)
+++ trunk/info/info.c 2014-09-12 12:38:47 UTC (rev 5821)
@@ -96,9 +96,6 @@
/* Non-zero means print the absolute location of the file to be loaded. */
static int print_where_p = 0;
-/* Debugging level */
-unsigned debug_level;
-
/* Non-zero means don't try to be smart when searching for nodes. */
int strict_node_location_p = 0;
@@ -918,128 +915,6 @@
}
-/* Error handling. */
-
-/* Non-zero means ring terminal bell on errors. */
-int info_error_rings_bell_p = 1;
-
-static FILE *debug_file;
-
-static void
-close_debugfile (void)
-{
- fclose (debug_file);
-}
-
-#define INFODEBUG_FILE "infodebug"
-
-void
-vinfo_debug (const char *format, va_list ap)
-{
- FILE *fp;
-
- if (!debug_file)
- {
- if (!info_windows_initialized_p || display_inhibited)
- fp = stderr;
- else
- {
- debug_file = fopen (INFODEBUG_FILE, "w");
- if (!debug_file)
- {
- info_error (_("can't open %s: %s"), INFODEBUG_FILE,
- strerror (errno));
- exit (EXIT_FAILURE);
- }
- atexit (close_debugfile);
- fp = debug_file;
- info_error (_("debugging output diverted to \"%s\""),
- INFODEBUG_FILE);
- }
- }
- else
- fp = debug_file;
-
- fprintf (fp, "%s: ", program_name);
- vfprintf (fp, format, ap);
- fprintf (fp, "\n");
- fflush (stderr);
-}
-
-void
-info_debug (const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- vinfo_debug (format, ap);
- va_end (ap);
-}
-
-/* Print AP according to FORMAT. If the window system was initialized,
- then the message is printed in the echo area. Otherwise, a message is
- output to stderr. */
-void
-vinfo_error (const char *format, va_list ap)
-{
- if (!info_windows_initialized_p || display_inhibited)
- {
- fprintf (stderr, "%s: ", program_name);
- vfprintf (stderr, format, ap);
- fprintf (stderr, "\n");
- fflush (stderr);
- }
- else
- {
- if (!echo_area_is_active)
- {
- if (info_error_rings_bell_p)
- terminal_ring_bell ();
- vwindow_message_in_echo_area (format, ap);
- }
- else
- {
- NODE *temp = build_message_node (format, ap);
- if (info_error_rings_bell_p)
- terminal_ring_bell ();
- inform_in_echo_area (temp->contents);
- free (temp->contents);
- free (temp);
- }
- }
-}
-
-void
-info_error (const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- vinfo_error (format, ap);
- va_end (ap);
-}
-
-void
-show_error_node (char *error)
-{
- if (info_error_rings_bell_p)
- terminal_ring_bell ();
- if (!info_windows_initialized_p)
- {
- info_error ("%s", error);
- }
- else if (!echo_area_is_active)
- {
- NODE *error_node;
-
- error_node = format_message_node ("%s", error);
- free_echo_area ();
- window_set_node_of_window (the_echo_area, error_node);
- display_update_one_window (the_echo_area);
- }
- else
- inform_in_echo_area (error);
-}
-
-
/* Produce a scaled down description of the available options to Info. */
static void
info_short_help (void)
Modified: trunk/info/info.h
===================================================================
--- trunk/info/info.h 2014-09-12 11:27:11 UTC (rev 5820)
+++ trunk/info/info.h 2014-09-12 12:38:47 UTC (rev 5821)
@@ -41,6 +41,8 @@
#include "mbiter.h"
#include "mbchar.h"
+extern char *program_name;
+
#if !defined (whitespace)
# define whitespace(c) ((c == ' ') || (c == '\t'))
#endif /* !whitespace */
@@ -75,35 +77,12 @@
info_error () function to determine how to format and output errors. */
extern int info_windows_initialized_p;
-/* Non-zero means ring terminal bell on errors. */
-extern int info_error_rings_bell_p;
-
/* Non-zero means default keybindings are loosely modeled on vi(1). */
extern int vi_keys_p;
/* Non-zero means don't remove ANSI escape sequences from man pages. */
extern int raw_escapes_p;
-extern unsigned debug_level;
-
-#define debug(n,c) \
- do \
- { \
- if (debug_level >= (n)) \
- info_debug c; \
- } \
- while (0)
-
-extern void vinfo_debug (const char *format, va_list ap);
-extern void info_debug (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);
-
-/* Print args as per FORMAT. If the window system was initialized,
- then the message is printed in the echo area. Otherwise, a message is
- output to stderr. */
-extern void info_error (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);
-
-extern void vinfo_error (const char *format, va_list ap);
-
extern void add_file_directory_to_path (char *filename);
/* Error message defines. */
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-09-12 11:27:11 UTC (rev 5820)
+++ trunk/info/session.c 2014-09-12 12:38:47 UTC (rev 5821)
@@ -736,6 +736,135 @@
/* **************************************************************** */
/* */
+/* Error handling */
+/* */
+/* **************************************************************** */
+
+/* Debugging level */
+unsigned debug_level;
+
+static FILE *debug_file;
+
+static void
+close_debugfile (void)
+{
+ fclose (debug_file);
+}
+
+#define INFODEBUG_FILE "infodebug"
+
+static void
+vinfo_debug (const char *format, va_list ap)
+{
+ FILE *fp;
+
+ if (!debug_file)
+ {
+ if (!info_windows_initialized_p || display_inhibited)
+ fp = stderr;
+ else
+ {
+ debug_file = fopen (INFODEBUG_FILE, "w");
+ if (!debug_file)
+ {
+ info_error (_("can't open %s: %s"), INFODEBUG_FILE,
+ strerror (errno));
+ exit (EXIT_FAILURE);
+ }
+ atexit (close_debugfile);
+ fp = debug_file;
+ info_error (_("debugging output diverted to \"%s\""),
+ INFODEBUG_FILE);
+ }
+ }
+ else
+ fp = debug_file;
+
+ fprintf (fp, "%s: ", program_name);
+ vfprintf (fp, format, ap);
+ fprintf (fp, "\n");
+ fflush (stderr);
+}
+
+void
+info_debug (const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ vinfo_debug (format, ap);
+ va_end (ap);
+}
+
+/* Non-zero means ring terminal bell on errors. */
+int info_error_rings_bell_p = 1;
+
+/* Print AP according to FORMAT. If the window system was initialized,
+ then the message is printed in the echo area. Otherwise, a message is
+ output to stderr. */
+static void
+vinfo_error (const char *format, va_list ap)
+{
+ if (!info_windows_initialized_p || display_inhibited)
+ {
+ fprintf (stderr, "%s: ", program_name);
+ vfprintf (stderr, format, ap);
+ fprintf (stderr, "\n");
+ fflush (stderr);
+ }
+ else
+ {
+ if (!echo_area_is_active)
+ {
+ if (info_error_rings_bell_p)
+ terminal_ring_bell ();
+ vwindow_message_in_echo_area (format, ap);
+ }
+ else
+ {
+ NODE *temp = build_message_node (format, ap);
+ if (info_error_rings_bell_p)
+ terminal_ring_bell ();
+ inform_in_echo_area (temp->contents);
+ free (temp->contents);
+ free (temp);
+ }
+ }
+}
+
+void
+info_error (const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ vinfo_error (format, ap);
+ va_end (ap);
+}
+
+void
+show_error_node (char *error)
+{
+ if (info_error_rings_bell_p)
+ terminal_ring_bell ();
+ if (!info_windows_initialized_p)
+ {
+ info_error ("%s", error);
+ }
+ else if (!echo_area_is_active)
+ {
+ NODE *error_node;
+
+ error_node = format_message_node ("%s", error);
+ free_echo_area ();
+ window_set_node_of_window (the_echo_area, error_node);
+ display_update_one_window (the_echo_area);
+ }
+ else
+ inform_in_echo_area (error);
+}
+
+
+/* **************************************************************** */
+/* */
/* Window node history */
/* */
/* **************************************************************** */
Modified: trunk/info/session.h
===================================================================
--- trunk/info/session.h 2014-09-12 11:27:11 UTC (rev 5820)
+++ trunk/info/session.h 2014-09-12 12:38:47 UTC (rev 5821)
@@ -102,6 +102,24 @@
/* Tell Info that input is coming from the file FILENAME. */
extern void info_set_input_from_file (char *filename);
+/* Error and debugging messages */
+extern unsigned debug_level;
+
+#define debug(n,c) \
+ do \
+ { \
+ if (debug_level >= (n)) \
+ info_debug c; \
+ } \
+ while (0)
+
+extern void info_debug (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);
+
+/* Print args as per FORMAT. If the window system was initialized,
+ then the message is printed in the echo area. Otherwise, a message is
+ output to stderr. */
+extern void info_error (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);
+
/* The names of the functions that run an info session. */
/* Starting an info session. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5821] debugging messages and error message handling moved between files,
Gavin D. Smith <=