GLOBAL 6.5.2 Patches

Jason Hood <[email protected]>
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <[email protected]>
In addition to Windows patches, there's also tweaks for the manuals.

convert.pl

  Strip @begin_verbatim & @end_verbatim from the c converter
  - remove from global's help message.

  Escape an initial '.' in the man converter
  - I've added an ellipsis (...) to the global nearness table.

  Remove leading white space in info examples
  - the nearness table was indented too much.

*/manual.in

  Wrapped lines to keep the help messages to 80 columns.
  Fixed typos.

gtags-cscope

  Finally fixed Ctrl+C (and properly restore the screen on exit, via a
  PDCurses patch).

gtags.conf.in

  The language is "CoffeeScript" for Universal Ctags.  It might be better
  to create a separate section for Exuberant Ctags, to avoid its unknown
  language warning.

htags-server

  Change "access to" to "access at".  This just seems like a duplicate of
  the "Serving..." line - easier to copy?  It also seems out of place,
  perhaps it might be better on the server line (e.g. "Python2 http/cgi
  server at http://...") or after it instead of before.

libutil/makepath.c

  Implement "~/" for Windows ("~user/" won't work).

libutil/nearsort.c

  Include "path.h" to get the prototype of realpath.

plugin-factor/exuberant-ctags.c

  String concatenation doesn't work with commas getting in the way. :)

-- 
Jason.

_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global
global-6.5.2.txt (text/plain, 11.1 KB)
diff -urp global-6.5.2/convert.pl global-6.5-2/convert.pl
--- global-6.5.2/convert.pl	2015-12-16 15:02:48 +1000
+++ global-6.5-2/convert.pl	2015-12-29 16:44:51 +1000
@@ -170,6 +170,9 @@ sub convert {
 	while (s/\@xref\{($arg),($arg)\}/$1($2)/) {
 		;
 	}
+	while (s/\@(begin|end)_verbatim//) {
+		;
+	}
 }
 sub gen {
 	local($help_const) = 0;
@@ -266,6 +269,7 @@ sub convert {
 	s/\@{/{/g;
 	s/\@}/}/g;
 	s/\@br$/\n.br/;
+	s/^\./\\&./;
 }
 sub gen {
 	local($arg) = '[^,]+';
@@ -391,6 +395,7 @@ sub gen {
 				} elsif ($verbatim) {
 					s/\{/@\{/g;
 					s/\}/@\}/g;
+					s/^\s+//;
 					print;
 					next;
 				} elsif (/^\@/) {
diff -urp global-6.5.2/global/manual.in global-6.5-2/global/manual.in
--- global-6.5.2/global/manual.in	2015-12-16 15:02:48 +1000
+++ global-6.5-2/global/manual.in	2015-12-29 15:56:22 +1000
@@ -100,7 +100,7 @@
 		Use color to highlight the pattern within the line; @arg{when} may be one of:
 		@arg{never}, @arg{always} or @arg{auto} (default).
 		The default color is bold red text on current background; the environment
-		variable @var{GREP_COLORS}(only @var{mt} and @var{ms} are effective at present)
+		variable @var{GREP_COLORS} (only @var{mt} and @var{ms} are effective at present)
 		or @var{GREP_COLOR} defines it.
 		This option is effective to the following commands:
 		<no command>, -f, -g, -I, -P.
@@ -116,8 +116,8 @@
 		two-digit hexadecimal representation of the character.
 		A blank will be converted to @samp{%20}.
 	@item{@option{-F}, @option{--first-match}}
-		End the search without go through all the tag files listed in @var{GTAGSLIBPATH}
-		when tags are found in a tag file. This is the default.
+		End the search without going through all the tag files listed in
+		@var{GTAGSLIBPATH} when tags are found in a tag file. This is the default.
 	@item{@option{--from-here} @arg{context}}
 		Decide tag type by @arg{context}, which must be @samp{lineno:path}.
 		If this option is specified then @option{-s} and @option{-r} are ignored.
@@ -157,14 +157,14 @@
 		This option is effective for the tag search command, @option{-P} command
 		and @option{-g} command. As an exception, @option{-g} command ignores this
 		option when files are specified by arguments.
-		The nearness is defined by how many parent directories to go up to rearch
-		the target. The result of nearness sort is concatenation of the followings
+		The nearness is defined by how many parent directories to go up to reach
+		the target. The result of nearness sort is concatenation of the following
 		([1]-[n]) in this order. The default of @arg{start} is the current directory.
 		@begin_verbatim
 		[1] Output of local search in the start directory.
 		[2] Output of local search in the parent directory except for [1].
 		[3] Output of local search in the grandparent directory except for [1]-[2].
-		(repeat until the project root directory)
+		... (repeat until the project root directory)
 		[n] Output of local search in the project root directory except for [1]-[n-1].
 		@end_verbatim
 		In each directory, they are sorted by alphabetical order.
@@ -235,9 +235,9 @@
 	main              10 src/main.c  main (argc, argv) {
 	$ global -f src/main.c
 	main              10 src/main.c  main (argc, argv) {
-	func1		  55 src/main.c  func1() {		  
-	func2		  72 src/main.c  func2() {		  
-	func3		 120 src/main.c  func3() {		  
+	func1             55 src/main.c  func1() {
+	func2             72 src/main.c  func2() {
+	func3            120 src/main.c  func3() {
 	$ global -x '^[sg]et'
 	set_num           20 lib/util.c  set_num(values) {
 	get_num           30 lib/util.c  get_num() {
diff -urp global-6.5.2/gtags/manual.in global-6.5-2/gtags/manual.in
--- global-6.5.2/gtags/manual.in	2015-12-16 15:02:48 +1000
+++ global-6.5-2/gtags/manual.in	2015-12-29 12:56:05 +1000
@@ -54,12 +54,11 @@
 		Print the value of config variable @arg{name}.
 		If @arg{name} is not specified then print all names and values.
 		In addition to the variables listed in the ENVIRONMENT section,
-		you can refer install directories by read only variables:
-		@var{bindir}, @var{libdir}, @var{datadir}, @var{localstatedir}
-		and @var{sysconfdir}.
+		you can refer to install directories by read only variables:
+		@var{bindir}, @var{libdir}, @var{datadir}, @var{localstatedir} and @var{sysconfdir}.
 	@item{@option{-d}, @option{--dump} @arg{tag-file}}
-		Dump a tag file as text to the standard output. Output format is 'key<tab>data'.
-		This is for debugging.
+		Dump a tag file as text to the standard output. Output format is
+		'key<tab>data'. This is for debugging.
 	@item{@option{--explain}}
 		Explain handling files.
 	@item{@option{-f}, @option{--file} @arg{file}}
diff -urp global-6.5.2/gtags-cscope/input.c global-6.5-2/gtags-cscope/input.c
--- global-6.5.2/gtags-cscope/input.c	2015-12-16 15:02:48 +1000
+++ global-6.5-2/gtags-cscope/input.c	2016-01-01 16:00:49 +1000
@@ -48,6 +48,11 @@
 #if HAVE_SYS_TERMIOS_H
 #include <sys/termios.h>
 #endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define WIN32_LEAN_AND_MEAN
+#define __OBJC__	/* work around BOOL redefinition */
+#include <windows.h>
+#endif
 
 static	jmp_buf	env;		/**< setjmp/longjmp buffer */
 static	int	prevchar;	/**< previous, ungotten character */
@@ -78,12 +83,21 @@ myungetch(int c)
 int
 mygetch(void)
 {
+#if !defined(_WIN32) || !defined(__CYGWIN__)
+    /* longjmp won't work, it's in a different thread */
     sighandler_t savesig; /* old value of signal */
+#endif
     int c;
 
     /* change an interrupt signal to a break key character */
     if (setjmp(env) == 0) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+	/* turn off Ctrl+C handling (PDCurses does this, but it gets turned on
+	   again by CMD during system) */
+	SetConsoleMode( GetStdHandle( STD_INPUT_HANDLE ), 0 );
+#else
 	savesig = signal(SIGINT, catchint);
+#endif
 	refresh();	/* update the display */
 	mousereinit();	/* curses can change the menu number */
 	if(prevchar) {
@@ -101,7 +115,9 @@ mygetch(void)
     } else {	/* longjmp to here from signal handler */
 	c = KEY_BREAK;
     }
+#if !defined(_WIN32) || !defined(__CYGWIN__)
     signal(SIGINT, savesig);
+#endif
     return(c);
 }
 
diff -urp global-6.5.2/gtags.conf.in global-6.5-2/gtags.conf.in
--- global-6.5.2/gtags.conf.in	2015-12-16 15:02:48 +1000
+++ global-6.5-2/gtags.conf.in	2016-01-01 18:33:25 +1000
@@ -120,7 +120,7 @@ universal-ctags|exuberant-ctags|plugin-e
 	:langmap=WindRes\:.rc:\
 	:langmap=YACC\:.y:\
 	:langmap=Zephir\:.zep:\
-	:langmap=coffee\:.coffee:\
+	:langmap=CoffeeScript\:.coffee:\
 	:langmap=ctags\:.ctags:\
 	:langmap=gdbinit\:.gdb.gdbinit:\
 	:langmap=m4\:.m4.spt:\
@@ -182,7 +182,7 @@ universal-ctags|exuberant-ctags|plugin-e
 	:gtags_parser=WindRes\:$ctagslib:\
 	:gtags_parser=YACC\:$ctagslib:\
 	:gtags_parser=Zephir\:$ctagslib:\
-	:gtags_parser=coffee\:$ctagslib:\
+	:gtags_parser=CoffeeScript\:$ctagslib:\
 	:gtags_parser=ctags\:$ctagslib:\
 	:gtags_parser=gdbinit\:$ctagslib:\
 	:gtags_parser=m4\:$ctagslib:
diff -urp global-6.5.2/htags/manual.in global-6.5-2/htags/manual.in
--- global-6.5.2/htags/manual.in	2015-12-16 15:02:48 +1000
+++ global-6.5-2/htags/manual.in	2015-12-29 12:58:25 +1000
@@ -112,7 +112,8 @@
 		You can choose the position using @arg{position},
 		which allows one of @val{before}, @val{right} or @val{after} (default).
 	@item{@option{--html-header} @arg{file}}
-		Insert a header record derived from @arg{file} into the HTML header of each file.
+		Insert a header record derived from @arg{file}
+		into the HTML header of each file.
 	@item{@option{-I}, @option{--icon}}
 		Use icons instead of text for some links.
 	@item{@option{--insert-footer} @arg{file}}
@@ -141,8 +142,8 @@
 		Make anchors not only for definitions and references
 		but also other symbols.
 	@item{@option{--show-position}}
-		Print the position string per function definition. The string can be interpreted
-		by general editors in UNIX. The default is false.
+		Print the position string per function definition. The string can be
+		interpreted by general editors in UNIX. The default is false.
 	@item{@option{--statistics}}
 		Print statistics information.
 	@item{@option{--suggest}}
diff -urp global-6.5.2/htags-server/htags-server global-6.5-2/htags-server/htags-server
--- global-6.5.2/htags-server/htags-server	2015-12-16 15:02:48 +1000
+++ global-6.5-2/htags-server/htags-server	2015-12-29 10:42:29 +1000
@@ -25,7 +25,7 @@ name=htags-server
 # HTTP/CGI servers
 #
 python2_server() {
-	echo "Please access to 'http://$2:$3'"
+	echo "Please access at 'http://$2:$3'"
 	echo "Python2 http/cgi server"
 	echo "Serving HTTP on $2 port $3 ..."
 	"$1" <<-!
@@ -36,12 +36,12 @@ python2_server() {
 	!
 }
 python3_server() {
-	echo "Please access to 'http://$2:$3'"
+	echo "Please access at 'http://$2:$3'"
 	echo "Python3 http/cgi server"
 	"$1" -m http.server --cgi --bind $2 $3
 }
 ruby_server() {
-	echo "Please access to 'http://$2:$3'"
+	echo "Please access at 'http://$2:$3'"
 	echo "Ruby WEBrick http/cgi server"
 	echo "Serving HTTP on $2 port $3 ..."
 	"$1" <<-!
diff -urp global-6.5.2/libutil/makepath.c global-6.5-2/libutil/makepath.c
--- global-6.5.2/libutil/makepath.c	2015-12-16 15:02:48 +1000
+++ global-6.5-2/libutil/makepath.c	2015-12-29 12:15:13 +1000
@@ -95,6 +95,7 @@ makepath(const char *dir, const char *fi
 		die("path name too long. '%s'\n", strbuf_value(sb));
 	return strbuf_value(sb);
 }
+#if !defined(_WIN32) || defined(__CYGWIN__)
 #include <sys/types.h>
 #include <pwd.h>
 #include <limits.h>
@@ -157,6 +158,29 @@ makepath_with_tilde(const char *file)
 	case '/':
 		return file;
 	default:
+#if defined(_WIN32) || defined(__DJGPP__)
+		if (isabspath(file))
+			return file;
+#endif
 		return NULL;	/* cannot accept */
 	}
 }
+#else /* Win32 */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+const char *
+makepath_with_tilde(const char *file)
+{
+	if (isabspath(file))
+		return file;
+
+	if (*file == '~' && (file[1] == '/' || file[1] == '\\')) {
+		char home[MAX_PATH];
+		if (GetEnvironmentVariable("HOME", home, sizeof(home)) ||
+		    GetEnvironmentVariable("USERPROFILE", home, sizeof(home)))
+			return makepath(home, file + 2, NULL);
+	}
+
+	return NULL;	/* cannot accept */
+}
+#endif
diff -urp global-6.5.2/libutil/nearsort.c global-6.5-2/libutil/nearsort.c
--- global-6.5.2/libutil/nearsort.c	2015-12-16 15:02:48 +1000
+++ global-6.5-2/libutil/nearsort.c	2015-12-29 12:20:29 +1000
@@ -32,6 +32,7 @@
 
 #include "getdbpath.h"
 #include "gparam.h"
+#include "path.h"
 #include "locatestring.h"
 #include "nearsort.h"
 
diff -urp global-6.5.2/plugin-factory/exuberant-ctags.c global-6.5-2/plugin-factory/exuberant-ctags.c
--- global-6.5.2/plugin-factory/exuberant-ctags.c	2015-12-16 15:02:48 +1000
+++ global-6.5-2/plugin-factory/exuberant-ctags.c	2015-12-31 17:39:33 +1000
@@ -84,15 +84,15 @@ copy_langmap_converting_cpp(char *dst, c
 static HANDLE pid;
 static char argv[] = "ctags "
 #if defined(USE_EXTRA_FIELDS)
-	"--_xformat=%R %-16N %4n %-16F %C",
-	"--extra=+r",
-	"--fields=+r",
+	"\"--_xformat=%R %-16N %4n %-16F %C\" "
+	"--extra=+r "
+	"--fields=+r "
 #else
-	"--format=1",
+	"--format=1 "
 #endif
-	"-xu",
-	"--filter",
-	"--filter-terminator=" TERMINATOR "\n",
+	"-xu "
+	"--filter "
+	"\"--filter-terminator=" TERMINATOR "\n\" "
 	LANGMAP_OPTION;
 static void
 start_ctags(const struct parser_param *param)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.