diff options
Diffstat (limited to 'runtime/tools')
-rw-r--r-- | runtime/tools/README.txt | 37 | ||||
-rw-r--r-- | runtime/tools/blink.c | 21 | ||||
-rw-r--r-- | runtime/tools/ccfilter.1 | 93 | ||||
-rw-r--r-- | runtime/tools/ccfilter.c | 326 | ||||
-rw-r--r-- | runtime/tools/ccfilter_README.txt | 91 | ||||
-rwxr-xr-x | runtime/tools/efm_filter.pl | 39 | ||||
-rw-r--r-- | runtime/tools/efm_filter.txt | 31 | ||||
-rwxr-xr-x | runtime/tools/efm_perl.pl | 153 | ||||
-rwxr-xr-x | runtime/tools/mve.awk | 23 | ||||
-rw-r--r-- | runtime/tools/mve.txt | 20 | ||||
-rwxr-xr-x | runtime/tools/pltags.pl | 300 | ||||
-rwxr-xr-x | runtime/tools/ref | 11 | ||||
-rw-r--r-- | runtime/tools/shtags.1 | 61 | ||||
-rwxr-xr-x | runtime/tools/shtags.pl | 144 | ||||
-rwxr-xr-x | runtime/tools/tcltags | 159 | ||||
-rwxr-xr-x | runtime/tools/vim132 | 13 | ||||
-rw-r--r-- | runtime/tools/vim_vs_net.cmd | 24 | ||||
-rwxr-xr-x | runtime/tools/vimm | 6 | ||||
-rwxr-xr-x | runtime/tools/vimspell.sh | 41 | ||||
-rw-r--r-- | runtime/tools/vimspell.txt | 22 | ||||
-rw-r--r-- | runtime/tools/xcmdsrv_client.c | 584 |
21 files changed, 2199 insertions, 0 deletions
diff --git a/runtime/tools/README.txt b/runtime/tools/README.txt new file mode 100644 index 0000000000..3133f13caa --- /dev/null +++ b/runtime/tools/README.txt @@ -0,0 +1,37 @@ +Some tools that can be used with Vim: + +blink.c: C program to make the cursor blink in an xterm. + +ccfilter*: C program to filter the output of a few compilers to a common + QuickFix format. + +efm_filter.*: Perl script to filter compiler messages to QuickFix format. + +efm_perl.pl: Perl script to filter error messages from the Perl interpreter + for use with Vim quickfix mode. + +mve.* Awk script to filter error messages to QuickFix format. + +pltags.pl: Perl script to create a tags file from Perl scripts. + +ref: Shell script for the K command. + +shtags.*: Perl script to create a tags file from a shell script. + +tcltags: Shell + Awk script to create a tags file from a TCL file. + +vim132: Shell script to edit in 132 column mode on vt100 compatible + terminals. + +vimm: Shell script to start Vim on a DEC terminal with mouse + enabled. + +vimspell.*: Shell script for highlighting spelling mistakes. + +vim_vs_net.cmd: MS-Windows command file to use Vim with MS Visual Studio 7 and + later. + +xcmdsrv_client.c: Example for a client program that communicates with a Vim + server through the X-Windows interface. + +[xxd (and tee for OS/2) can be found in the src directory] diff --git a/runtime/tools/blink.c b/runtime/tools/blink.c new file mode 100644 index 0000000000..1ffd848edc --- /dev/null +++ b/runtime/tools/blink.c @@ -0,0 +1,21 @@ +/* + * An extremely simple program to make the cursor blink in an xterm. + * This is useful when the cursor is hard to spot in a highlighted file. + * Start in the background: "blink&" Stop by killing it. + * Bram Moolenaar 980109 (based on an idea from John Lange). + */ + +#include <stdio.h> + +main() +{ + while (1) + { + printf("\e[?25h"); + fflush(stdout); + usleep(400000); /* on time */ + printf("\e[?25l"); + fflush(stdout); + usleep(250000); /* off time */ + } +} diff --git a/runtime/tools/ccfilter.1 b/runtime/tools/ccfilter.1 new file mode 100644 index 0000000000..e3de38da1f --- /dev/null +++ b/runtime/tools/ccfilter.1 @@ -0,0 +1,93 @@ +.TH ccfilter 1 "01-Apr-97" +.SH NAME +ccfilter \- a compiler's output filter for vim quickfix +.SH SYNOPSIS +ccfilter [ +.B <options> +] +.SH DESCRIPTION +The ccfilter utility "filters" the output of several compilers +and makers (make/gmake) from several platforms (see NOTES below) +to a standardized format which easily fits in vim's quickfix +feature. For further details, see in vim ":help quickfix". +.PP +ccfilter reads +.B 'stdin' +and outputs to +.B 'stdout' +\. +.PP +The need for ccfilter is clear, as some compilers have irregular +and/or multiple line error messages (with the relevant information on +line 2), which makes it impossible for the errorformat to correctly +display them ! + +When working on different platforms, and with different compilers, +ccfilter eases the utilization of quickfix, due to it's standardized +output, allowing to have in .vimrc a plain +.br +.B \ \ \ \ :set\ errorformat=%f:%l:%c:%t:%m + +.SH USAGE +When using ccfilter, one would include the following lines in .vimrc: +.br +.B \ \ \ \ :set shellpipe=\\\\|&ccfilter\\\\> +.br +.B \ \ \ \ :set errorformat=%f:%l:%c:%t:%m + +.SH OPTIONS +.TP 16 +-c +Decrement column by one. This may be needed, depending on +the compiler being used. +.TP +-r +Decrement row by one. This may be needed, depending on +the compiler being used. +.TP +-v +Verbose (Outputs also invalid lines). +This option makes ccfilter output also the lines that +couldn't be correctly parsed. This is used mostly for +ccfilter debugging. +.TP +-o <COMPILER> +Treat input as <COMPILER>'s output. +Even when configuring ccfilter to assume a default +COMPILER, sometimes it's helpful to be able to specify +the COMPILER used to generate ccfilter's input. +For example, when cross-compiling on a network from a +single machine. +.TP +-h +Shows a brief help, describing the configured default COMPILER +and the valid parameters for COMPILER. + +.SH NOTES +Currently, ccfilter accepts output from several compilers, as +described below: +.TP 10 +GCC +GCC compiler +.TP +AIX +AIX's C compiler +.TP +ATT +AT&T/NCR's High Performance C Compiler +.TP +IRIX +IRIX's MIPS/MIPSpro C compiler +.TP +SOLARIS +SOLARIS's SparcWorks C compiler +.TP +HPUX +HPUX's C compiler + +.SH AUTHOR +.B ccfilter +was developed by +.B Pablo Ariel Kohan +.BR +.B mailto:pablo@memco.co.il diff --git a/runtime/tools/ccfilter.c b/runtime/tools/ccfilter.c new file mode 100644 index 0000000000..270333910f --- /dev/null +++ b/runtime/tools/ccfilter.c @@ -0,0 +1,326 @@ +/* ======================================================================= */ +/* Project : VIM */ +/* Module : ccfilter Version: 02.01.01 */ +/* File : ccfilter.c */ +/* Purpose : Filter gmake/cc output into a standardized form */ +/* ======================================================================= */ +/* Created On: 12-Sep-95 20:32 */ +/* Last modification: 03-Feb-98 */ +/* -e option added by Bernd Feige */ +/* ======================================================================= */ +/* Copyright : */ +/* This source file is copyright (c) to Pablo Ariel Kohan */ +/* ======================================================================= */ +#define __CCFILTER_C__ + +#include <ctype.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#define LINELENGTH 2048 + +/* Collector(s) */ +char Line[LINELENGTH]; +char Line2[LINELENGTH]; +/* Components */ +char FileName[1024]; +char BasePath[1024]; +char CWD[1024]; +unsigned long Row; +unsigned long Col; +char Severity; +char Reason[LINELENGTH]; + +#define COMPILER_UNKNOWN 0 +#define COMPILER_GCC 1 +#define COMPILER_AIX 2 +#define COMPILER_ATT 3 +#define COMPILER_IRIX 4 +#define COMPILER_SOLARIS 5 +#define COMPILER_HPUX 6 + +char *COMPILER_Names[][2] = + { + /* Name Description */ + { "N/A", "" }, + { "GCC", "GCC compiler" }, + { "AIX", "AIX's C compiler" }, + { "ATT", "AT&T/NCR's High Performance C Compiler" }, + { "IRIX", "IRIX's MIPS/MIPSpro C compiler" }, + { "SOLARIS", "SOLARIS's SparcWorks C compiler" }, + { "HPUX", "HPUX's C compiler" } + }; +#define COMPILER_QTY (sizeof(COMPILER_Names)/sizeof(COMPILER_Names[0])) + +#if defined(_GCC) +# define COMPILER_DEFAULT COMPILER_GCC +#elif defined(_AIX) +# define COMPILER_DEFAULT COMPILER_AIX +#elif defined(_ATT) +# define COMPILER_DEFAULT COMPILER_ATT +#elif defined(_IRIX) +# define COMPILER_DEFAULT COMPILER_IRIX +#elif defined(_SOLARIS) +# define COMPILER_DEFAULT COMPILER_SOLARIS +#elif defined(_HPUX) +# define COMPILER_DEFAULT COMPILER_HPUX +#else +# define COMPILER_DEFAULT COMPILER_UNKNOWN +#endif + +const char USAGE[] = +"ccfilter v2.1 (c)1994-1997 by Pablo Ariel Kohan\n" +"Filter Out compiler's output, and converts it to fit VIM\n\n" +"Usage:\n" +" ccfilter [<options>]\n" +"Where: <options> is one or more of:\n" +" -c Decrement column by one\n" +" -r Decrement row by one\n" +" -e Echo stdin to stderr\n" +" -v Verbose (Outputs also invalid lines)\n" +" -o <COMPILER> Treat input as <COMPILER>'s output\n" +" Note: COMPILER may be preceded by an _\n" +" -h This usage.\n"; + + +int ShowUsage( char *szError ) +{ int i; + + fprintf( stderr, USAGE ); + + fprintf( stderr, "Current default <COMPILER>: %s\n", + COMPILER_Names[COMPILER_DEFAULT][0] ); + + fprintf( stderr, "Acceptable parameters for <COMPILER> are:\n" ); + for (i=1; i < COMPILER_QTY; i++) + fprintf( stderr, " %-15.15s %s\n", + COMPILER_Names[i][0], + COMPILER_Names[i][1] ); + fprintf(stderr, szError); + return 0; +} + +char *echogets(char *s, int echo) { + char * const retval=fgets(s, LINELENGTH, stdin); + if (echo!=0 && retval!=NULL) { + fputs(retval, stderr); + } + return retval; +} + +int main( int argc, char *argv[] ) +{ int rv, i, j, ok; + int stay; + int prefetch; + char *p; + int dec_col = 0; /* Decrement column value by 1 */ + int dec_row = 0; /* Decrement row value by 1 */ + int echo = 0; /* Echo stdin to stderr */ + int verbose = 0; /* Include Bad Formatted Lines */ + int CWDlen; + int COMPILER = COMPILER_DEFAULT; + + getcwd( CWD, sizeof(CWD) ); + CWDlen = strlen(CWD); + + for (i=1; i<argc; i++) + { + if (argv[i][0] != '-') + return ShowUsage(""); + switch ( argv[i][1] ) + { + case 'c': + dec_col = 1; + break; + case 'r': + dec_row = 1; + break; + case 'e': + echo = 1; + break; + case 'v': + verbose = 1; + break; + case 'o': + { + if (i+1 >= argc) + return ShowUsage("Error: Missing parameter for -o\n"); + i++; + COMPILER = -1; + for (j=1; j<COMPILER_QTY; j++) + if ( (strcmp(argv[i], COMPILER_Names[j][0]) == 0) || + ( (argv[i][0] == '_') && + (strcmp(&argv[i][1], COMPILER_Names[j][0]) == 0) ) ) + COMPILER = j; + if (COMPILER == -1) + return ShowUsage("Error: Invalid COMPILER specified\n"); + } + break; + case 'h': + return ShowUsage(""); + default: + return ShowUsage("Error: Invalid option\n"); + } + } + if (COMPILER == 0) + return ShowUsage("Error: COMPILER must be specified in this system\n"); + + stay = ( echogets(Line, echo) != NULL ); + prefetch = 0; + + while( stay ) + { + *FileName = 0; + Row = 0; + Col = 0; + Severity = ' '; + *Reason = 0; + ok = 0; + switch (COMPILER) + { + case COMPILER_GCC: + Severity = 'e'; +#ifdef GOTO_FROM_WHERE_INCLUDED + rv = sscanf( Line, "In file included from %[^:]:%u:", + FileName, &Row ); + if ( rv == 2 ) + { + ok = (echogets(Reason, echo) != NULL); + } + else +#endif + { + if ((rv = sscanf( Line, "%[^:]:%u: warning: %[^\n]", + FileName, &Row, Reason ))==3) { + Severity = 'w'; + } else { + rv = sscanf( Line, "%[^:]:%u: %[^\n]", + FileName, &Row, Reason ); + } + ok = ( rv == 3 ); + } + Col = (dec_col ? 1 : 0 ); + break; + case COMPILER_AIX: + rv = sscanf( Line, "\"%[^\"]\", line %u.%u: %*s (%c) %[^\n]", + FileName, &Row, &Col, &Severity, Reason ); + ok = ( rv == 5 ); + break; + case COMPILER_HPUX: + rv = sscanf( Line, "cc: \"%[^\"]\", line %u: %c%*[^:]: %[^\n]", + FileName, &Row, &Severity, Reason ); + ok = ( rv == 4 ); + Col = (dec_col ? 1 : 0 ); + break; + case COMPILER_SOLARIS: + rv = sscanf( Line, "\"%[^\"]\", line %u: warning: %[^\n]", + FileName, &Row, Reason ); + Severity = 'w'; + ok = ( rv == 3 ); + if ( rv != 3 ) + { + rv = sscanf( Line, "\"%[^\"]\", line %u: %[^\n]", + FileName, &Row, Reason ); + Severity = 'e'; + ok = ( rv == 3 ); + } + Col = (dec_col ? 1 : 0 ); + break; + case COMPILER_ATT: + rv = sscanf( Line, "%c \"%[^\"]\",L%u/C%u%*[^:]:%[^\n]", + &Severity, FileName, &Row, &Col, Reason ); + ok = ( rv == 5 ); + + if (rv != 5) + { rv = sscanf( Line, "%c \"%[^\"]\",L%u/C%u: %[^\n]", + &Severity, FileName, &Row, &Col, Reason ); + ok = ( rv == 5 ); + } + + if (rv != 5) + { rv = sscanf( Line, "%c \"%[^\"]\",L%u: %[^\n]", + &Severity, FileName, &Row, Reason ); + ok = ( rv == 4 ); + Col = (dec_col ? 1 : 0 ); + } + + stay = (echogets(Line2, echo) != NULL); + while ( stay && (Line2[0] == '|') ) + { for (p=&Line2[2]; (*p) && (isspace(*p)); p++); + strcat( Reason, ": " ); + strcat( Reason, p ); + Line2[0] = 0; + stay = (echogets(Line2, echo) != NULL); + } + prefetch = 1; + strcpy( Line, Line2 ); + break; + case COMPILER_IRIX: + Col = 1; + prefetch = 0; + rv = 0; + ok = 0; + if ( !strncmp(Line, "cfe: ", 5) ) + { p = &Line[5]; + Severity = tolower(*p); + p = strchr( &Line[5], ':' ); + if (p == NULL) + { ok = 0; + } + else + { + rv = sscanf( p+2, "%[^:]: %u: %[^\n]", + FileName, &Row, Reason ); + if (rv != 3) + rv = sscanf( p+2, "%[^,], line %u: %[^\n]", + FileName, &Row, Reason ); + ok = ( rv == 3 ); + } + + if (ok) + { prefetch = 1; + stay = (echogets(Line, echo) != NULL); + if (Line[0] == ' ') + stay = (echogets(Line2, echo) != NULL); + if ( (Line2[0] == ' ') && + ( (Line2[1] == '-') || (Line2[1] == '^') ) ) + { Col = strlen(Line2)-1; + prefetch = 0; + } + else + { strcat( Line, "\n" ); + strcat( Line, Line2 ); + } + } + } + break; + } + if (dec_col) Col--; + if (dec_row) Row--; + if (!ok) + { + if ( Line[0] == 'g' ) + p = &Line[1]; + else + p = &Line[0]; + ok = sscanf( p, "make[%*d]: Entering directory `%[^']", + BasePath ); + if (verbose) + printf( "[%u]?%s\n", ok, Line ); + } + else + { + for (p=Reason; (*p) && (isspace(*p)); p++); + if ( BasePath[CWDlen] == 0 ) + printf( "%s:%u:%u:%c:%s\n", FileName, Row, Col, Severity, p ); + else + { + printf( "%s/%s:%u:%u:%c:%s\n", &BasePath[CWDlen+1], FileName, Row, Col, Severity, p ); + } + } + if (!prefetch) + stay = ( echogets(Line, echo) != NULL ); + } + return 0; +} diff --git a/runtime/tools/ccfilter_README.txt b/runtime/tools/ccfilter_README.txt new file mode 100644 index 0000000000..ff658c92fa --- /dev/null +++ b/runtime/tools/ccfilter_README.txt @@ -0,0 +1,91 @@ +COMPILING AND INSTALLING: +========================= + +To compile ccfilter, you can just do a plain: + cc ccfilter.c -o ccfilter +Though, it may be wise to have your default compiler defined, +so you would normally compile it with one of the following: + cc -D_GCC ccfilter.c -o ccfilter + cc -D_AIX ccfilter.c -o ccfilter + cc -D_ATT ccfilter.c -o ccfilter + cc -D_IRIX ccfilter.c -o ccfilter + cc -D_SOLARIS ccfilter.c -o ccfilter + cc -D_HPUX ccfilter.c -o ccfilter +You can then copy ccfilter to it's target destination (i.e: /usr/local/bin). +The man page ccfilter.1 has to be copied to somewhere in your MANPATH, +under a man1 directory (i.e: /usr/local/man/man1). + + +SUPPORTED COMPILERS/PORTING NOTES: +================================== + +The supported formats for the different compilers are described below: +In this section, meta-names are used as place-holders in the line +formats: <FILE> <ROW> <COL> <SEVERITY> <REASON> <> +The <> denotes ignored text. +Line formats are delimited by the ^ (caret) symbol. + +0) Special case: "gmake directory change" lines: + Lines with a format like: + ^gmake[<NUM>]: Entering directory `<DIR>'^ + are used to follow the directory changes during the make process, + providing in the <FILE> part, a relative (if possible) directory + path to the erroneous file. + + +1) GCC: + Recognized lines are of the format: + - ^In file included from <FILE>:<ROW>:^ + Line following this one is used as <REASON> + <SEVERITY> is always 'e' (error) + <COL> is always '0' + + - ^<FILE>:<ROW>:<REASON>^ + <SEVERITY> is always 'e' (error) + <COL> is always '0' + + +2) AIX: + Recognized lines are of the format: + - ^"<FILE>", line <ROW>.<COL>: <> (<SEVERITY>) <REASON>", + + +3) HPUX: + Recognized lines are of the format: + - ^cc: "<FILE>", line <ROW>: <SEVERITY>: <REASON>^ + <COL> is always '0' + + +4) SOLARIS: + Recognized lines are of the format: + - ^"<FILE>", line <ROW>: warning: <REASON>^ + This assumes <SEVERITY> is "W" + <COL> is always '0' + + - ^"<FILE>", line <ROW>: <REASON>^ + This assumes <SEVERITY> is "E" + <COL> is always '0' + + +5) ATT / NCR: + Recognized lines are of the format: + - ^<SEVERITY> "<FILE>",L<ROW>/C<COL><>:<REASON>^ + or + - ^<SEVERITY> "<FILE>",L<ROW>/C<COL>:<REASON>^ + Following lines beginning with a pipe (|) are continuation + lines, and are therefore appended to the <REASON> + + - ^<SEVERITY> "<FILE>",L<ROW>:<REASON>^ + <COL> is '0' + Following lines beginning with a pipe (|) are continuation + lines, and are therefore appended to the <REASON> + + +6) SGI-IRIX: + Recognized lines are of the format: + - ^cfe: <SEVERITY>: <FILE>: <ROW>: <REASON>^ + or + ^cfe: <SEVERITY>: <FILE>, line <ROW>: <REASON>^ + Following lines beginning with a dash (-) are "column-bar" + that end with a caret in the column of the error. These lines + are analyzed to generate the <COL>. diff --git a/runtime/tools/efm_filter.pl b/runtime/tools/efm_filter.pl new file mode 100755 index 0000000000..1d1a4f303b --- /dev/null +++ b/runtime/tools/efm_filter.pl @@ -0,0 +1,39 @@ +#!/usr/bin/env perl +# +# This program works as a filter that reads from stdin, copies to +# stdout *and* creates an error file that can be read by vim. +# +# This program has only been tested on SGI, Irix5.3. +# +# Written by Ives Aerts in 1996. This little program is not guaranteed +# to do (or not do) anything at all and can be freely used for +# whatever purpose you can think of. + +$args = @ARGV; + +unless ($args == 1) { + die("Usage: vimccparse <output filename>\n"); +} + +$filename = @ARGV[0]; +open (OUT, ">$filename") || die ("Can't open file: \"$filename\""); + +while (<STDIN>) { + print; + if ( (/"(.*)", line (\d+): (e)rror\((\d+)\):/) + || (/"(.*)", line (\d+): (w)arning\((\d+)\):/) ) { + $file=$1; + $line=$2; + $errortype="\u$3"; + $errornr=$4; + chop($errormsg=<STDIN>); + $errormsg =~ s/^\s*//; + $sourceline=<STDIN>; + $column=index(<STDIN>, "^") - 1; + + print OUT "$file>$line:$column:$errortype:$errornr:$errormsg\n"; + } +} + +close(OUT); +exit(0); diff --git a/runtime/tools/efm_filter.txt b/runtime/tools/efm_filter.txt new file mode 100644 index 0000000000..d3f97f45ad --- /dev/null +++ b/runtime/tools/efm_filter.txt @@ -0,0 +1,31 @@ +[adopted from a message that Ives posted in the Vim mailing list] + +Some compilers produce an error message that cannot be handled with +'errorformat' in Vim. Following is an example of a Perl script that +translates one error message into something that Vim understands. + + +The compiler that generates this kind of error messages (4 lines): + +"/tmp_mnt/cm/src/apertos/MoU/MetaCore/MetaCore/common/src/MetaCoreImp_M.cc", +line 50: error(3114): + identifier "PRIMITIVE_M" is undefined + return(ExecuteCore(PRIMITIVE_M, + +You can find a small perl program at the end. +The way I use it is: + +:set errorformat=%f>%l:%c:%t:%n:%m +:set makeprg=clearmake\ -C\ gnu +:set shellpipe=2>&1\|\ vimccparse + +If somebody thinks this is useful: feel free to do whatever you can think +of with this code. + +-Ives +____________________________________________________________ +Ives Aerts (SW Developer) Sony Telecom Europe +ives@sonytel.be St.Stevens Woluwestr. 55 +`Death could create most things, B-1130 Brussels, Belgium + except for plumbing.' PHONE : +32 2 724 19 67 + (Soul Music - T.Pratchett) FAX : +32 2 726 26 86 diff --git a/runtime/tools/efm_perl.pl b/runtime/tools/efm_perl.pl new file mode 100755 index 0000000000..570d6e766a --- /dev/null +++ b/runtime/tools/efm_perl.pl @@ -0,0 +1,153 @@ +#!/usr/bin/perl -w + +# vimparse.pl - Reformats the error messages of the Perl interpreter for use +# with the quickfix mode of Vim +# +# Copyright (©) 2001 by Jörg Ziefle <joerg.ziefle@gmx.de> +# You may use and distribute this software under the same terms as Perl itself. +# +# Usage: put one of the two configurations below in your ~/.vimrc (without the +# description and '# ') and enjoy (be sure to adjust the paths to vimparse.pl +# before): +# +# Program is run interactively with 'perl -w': +# +# set makeprg=$HOME/bin/vimparse.pl\ %\ $* +# set errorformat=%f:%l:%m +# +# Program is only compiled with 'perl -wc': +# +# set makeprg=$HOME/bin/vimparse.pl\ -c\ %\ $* +# set errorformat=%f:%l:%m +# +# Usage: +# vimparse.pl [-c] [-f <errorfile>] <programfile> [programargs] +# +# -c compile only, don't run (perl -wc) +# -f write errors to <errorfile> +# +# Example usages: +# * From the command line: +# vimparse.pl program.pl +# +# vimparse.pl -c -f errorfile program.pl +# Then run vim -q errorfile to edit the errors with Vim. +# +# * From Vim: +# Edit in Vim (and save, if you don't have autowrite on), then +# type ':mak' or ':mak args' (args being the program arguments) +# to error check. +# +# Version history: +# 0.2 (04/12/2001): +# * First public version (sent to Bram) +# * -c command line option for compiling only +# * grammatical fix: 'There was 1 error.' +# * bug fix for multiple arguments +# * more error checks +# * documentation (top of file, &usage) +# * minor code clean ups +# 0.1 (02/02/2001): +# * Initial version +# * Basic functionality +# +# Todo: +# * test on more systems +# * use portable way to determine the location of perl ('use Config') +# * include option that shows perldiag messages for each error +# * allow to pass in program by STDIN +# * more intuitive behaviour if no error is found (show message) +# +# Tested under SunOS 5.7 with Perl 5.6.0. Let me know if it's not working for +# you. + +use strict; +use Getopt::Std; + +use vars qw/$opt_c $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars' + +use constant VERSION => 0.2; + +getopts('cf:h'); + +&usage if $opt_h; # not necessarily needed, but good for further extension + +if (defined $opt_f) { + + open FILE, "> $opt_f" or do { + warn "Couldn't open $opt_f: $!. Using STDOUT instead.\n"; + undef $opt_f; + }; + +}; + +my $handle = (defined $opt_f ? \*FILE : \*STDOUT); + +(my $file = shift) or &usage; # display usage if no filename is supplied +my $args = (@ARGV ? ' ' . join ' ', @ARGV : ''); + +my @lines = `perl @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`; + +my $errors = 0; +foreach my $line (@lines) { + + chomp($line); + my ($file, $lineno, $message, $rest); + + if ($line =~ /^(.*)\sat\s(.*)\sline\s(\d+)(\.|,\snear\s\".*\")$/) { + + ($message, $file, $lineno, $rest) = ($1, $2, $3, $4); + $errors++; + $message .= $rest if ($rest =~ s/^,//); + print $handle "$file:$lineno:$message\n"; + + } else { next }; + +} + +if (defined $opt_f) { + + my $msg; + if ($errors == 1) { + + $msg = "There was 1 error.\n"; + + } else { + + $msg = "There were $errors errors.\n"; + + }; + + print STDOUT $msg; + close FILE; + unlink $opt_f unless $errors; + +}; + +sub usage { + + (local $0 = $0) =~ s/^.*\/([^\/]+)$/$1/; # remove path from name of program + print<<EOT; +Usage: + $0 [-c] [-f <errorfile>] <programfile> [programargs] + + -c compile only, don't run (executes 'perl -wc') + -f write errors to <errorfile> + +Examples: + * At the command line: + $0 program.pl + Displays output on STDOUT. + + $0 -c -f errorfile program.pl + Then run 'vim -q errorfile' to edit the errors with Vim. + + * In Vim: + Edit in Vim (and save, if you don't have autowrite on), then + type ':mak' or ':mak args' (args being the program arguments) + to error check. +EOT + + exit 0; + +}; diff --git a/runtime/tools/mve.awk b/runtime/tools/mve.awk new file mode 100755 index 0000000000..396f80677c --- /dev/null +++ b/runtime/tools/mve.awk @@ -0,0 +1,23 @@ +#!/usr/bin/nawk -f +# +# Change "nawk" to "awk" or "gawk" if you get errors. +# +# Make Vim Errors +# Processes errors from cc for use by Vim's quick fix tools +# specifically it translates the ---------^ notation to a +# column number +# +BEGIN { FS="[:,]" } + +/^cfe/ { file=$3 + msg=$5 + split($4,s," ") + line=s[2] +} + +# You may have to substitute a tab character for the \t here: +/^[\t-]*\^/ { + p=match($0, ".*\\^" ) + col=RLENGTH-2 + printf("%s, line %d, col %d : %s\n", file,line,col,msg) +} diff --git a/runtime/tools/mve.txt b/runtime/tools/mve.txt new file mode 100644 index 0000000000..8aa5cf66bf --- /dev/null +++ b/runtime/tools/mve.txt @@ -0,0 +1,20 @@ +[ The mve awk script was posted on the vimdev mailing list ] + +From: jimmer@barney.mdhc.mdc.com (J. McGlasson) +Date: Mon, 31 Mar 1997 13:16:49 -0700 (Mar) + +My compiler (SGI MIPSpro C compiler - IRIX 6.4) works like this. +I have written a script mve (make vim errors), through which I pipe my make +output, which translates output of the following form: + +cfe: Error: syntax.c, line 4: Syntax Error + int i[12; + ------------^ + +into: + + cl.c, line 4, col 12 : Syntax Error + +(in vim notation: %f, line %l, col %c : %m) + +You might be able to tailor this for your compiler's output. diff --git a/runtime/tools/pltags.pl b/runtime/tools/pltags.pl new file mode 100755 index 0000000000..7a74682b87 --- /dev/null +++ b/runtime/tools/pltags.pl @@ -0,0 +1,300 @@ +#!/usr/bin/env perl + +# pltags - create a tags file for Perl code, for use by vi(m) +# +# Distributed with Vim <http://www.vim.org/>, latest version always available +# at <http://www.mscha.com/mscha.html?pltags#tools> +# +# Version 2.3, 28 February 2002 +# +# Written by Michael Schaap <pltags@mscha.com>. Suggestions for improvement +# are very welcome! +# +# This script will not work with Perl 4 or below! +# +# Revision history: +# 1.0 1997? Original version, quickly hacked together +# 2.0 1999? Completely rewritten, better structured and documented, +# support for variables, packages, Exuberant Ctags extensions +# 2.1 Jun 2000 Fixed critical bug (typo in comment) ;-) +# Support multiple level packages (e.g. Archive::Zip::Member) +# 2.2 Jul 2001 'Glob' wildcards - especially useful under Windows +# (thanks to Serge Sivkov and Jason King) +# Bug fix: reset package name for each file +# 2.21 Jul 2001 Oops... bug in variable detection (/local../ -> /^local.../) +# 2.3 Feb 2002 Support variables declared with "our" +# (thanks to Lutz Mende) + +# Complain about undeclared variables +use strict; + +# Used modules +use Getopt::Long; + +# Options with their defaults +my $do_subs = 1; # --subs, --nosubs include subs in tags file? +my $do_vars = 1; # --vars, --novars include variables in tags file? +my $do_pkgs = 1; # --pkgs, --nopkgs include packages in tags file? +my $do_exts = 1; # --extensions, --noextensions + # include Exuberant Ctags extensions + +# Global variables +my $VERSION = "2.21"; # pltags version +my $status = 0; # GetOptions return value +my $file = ""; # File being processed +my @tags = (); # List of produced tags +my $is_pkg = 0; # Are we tagging a package? +my $has_subs = 0; # Has this file any subs yet? +my $package_name = ""; # Name of current package +my $var_continues = 0; # Variable declaration continues on last line +my $line = ""; # Current line in file +my $stmt = ""; # Current Perl statement +my @vars = (); # List of variables in declaration +my $var = ""; # Variable in declaration +my $tagline = ""; # Tag file line + +# Create a tag file line and push it on the list of found tags +sub MakeTag($$$$$) +{ + my ($tag, # Tag name + $type, # Type of tag + $is_static, # Is this a static tag? + $file, # File in which tag appears + $line) = @_; # Line in which tag appears + + my $tagline = ""; # Created tag line + + # Only process tag if not empty + if ($tag) + { + # Get rid of \n, and escape / and \ in line + chomp $line; |