[543] in linux-announce channel archive

home help back first fref pref prev next nref lref last post

vgrind ported to Linux

daemon@ATHENA.MIT.EDU (Lars Wirzenius)
Fri May 5 14:26:26 1995

Date: Fri, 5 May 1995 18:50:24 +0300
From: Lars Wirzenius <wirzeniu@cc.helsinki.fi>
To: linux-activists@niksula.hut.fi, linux-announce@vger.rutgers.edu

X-Mn-Key: announce

Newsgroups: comp.os.linux.announce
Subject: vgrind ported to Linux
Organization: IBM Microelectronics Division
Keywords: C postscript printing
Summary: Fancy postscript printing of C programs
From: "Frank Swasey" <frank_swasey@VNET.IBM.COM>
Approved: linux-announce@news.ornl.gov (Lars Wirzenius)
Followup-to: comp.os.linux.development.apps

>From the vgrind manual page:

Vgrind formats the program sources which are arguments in a nice style
using troff.  Comments are placed in italics, keywords in bold face,
and the name of the current function is listed down the margin of each
page as it is encountered.

I have used the vgrind program in my work on IBM RS/6000 systems
running AIX and like the output it gives.  Therefore, when I needed to
do some programming on my Linux system, I searched out the source for
the vgrind program and got it working.  I found the source on
ftp.uu.net in /systems/unix/bsd-sources/usr.bin/vgrind.  It, of
course, was designed to be used with the BSD make program and
installed in a BSD directory structure.  Other than a complete
replacement of the Makefile, there were only 26 lines of documentation
and code out of the more than 2200 which needed to be modified to make
vgrind operational on Linux.

In addition to the patch, supplied below, to be applied to the sources
from ftp.uu.net, two files have been uploaded to sunsite.unc.edu in
the /pub/Linux/Incoming directory.  Those files are the complete
modified source (vgrindsrc.tgz) and an a.out binary distribution
(vgrindbin.tgz) compiled using gcc 2.6.3 and libc.4.6.27.

Here is the lsm entry for vgrindsrc.tgz:
==========================================================================
Begin3
Title:          vgrind source distribution
Version:        1.0
Entered-date:   April 8, 1995
Description:    vgrind formats the program sources which are arguments in
                a nice style using troff.  Comments are placed in
                italics, keywords in bold face, and the name of the
                current function is listed down the margin of each
                page as it is encountered.
Keywords:       PostScript, Print, Source Code
Author:         BSD
Maintained-by:  Frank_Swasey@vnet.ibm.com (Frank Swasey)
Primary-site:   sunsite.unc.edu /pub/Linux/system/Printing
                17542 vgrindsrc.tgz
Original-site:  ftp.uu.net /systems/unix/bsd-sources/usr.bin/vgrind/
                364  Makefile.Z
                1312 pathnames.h.Z
                6560 regexp.c.Z
                519  tmac.vgrind.Z
                7969 vfontedpr.c.Z
                3541 vgrind.1.Z
                2293 vgrind.sh.Z
                3470 vgrindefs.5.Z
                4477 vgrindefs.c.Z
                4009 vgrindefs.src.Z
Platform:       groff, PostScript printing capability
Copying-policy: BSD
End
========================================================================

The lsm entry for vgrindbin.tgz is identical to the one listed above
with the exception of the size and name of the file in the
Primary-site field: 16909 vgrindbin.tgz.

 --- Patch ---

Before applying this patch, uncompress the files from ftp.uu.net and
rename (or remove) the original Makefile to get it out of the way.

diff -u -r1.1 pathnames.h
--- 1.1 1995/03/12 22:08:38
+++ pathnames.h 1995/03/12 22:08:56
@@ -33,4 +33,4 @@
  *     @(#)pathnames.h 5.2 (Berkeley) 6/1/90
  */

-#define        _PATH_VGRINDEFS "/usr/share/misc/vgrindefs"
+#define        _PATH_VGRINDEFS "/usr/lib/groff/tmac/vgrindefs"
diff -u -r1.1 vfontedpr.c
--- 1.1 1995/03/12 22:09:44
+++ vfontedpr.c 1995/03/13 21:33:08
@@ -249,7 +249,7 @@
            cp = strings;
            while (*cp) {
                while (*cp == ' ' || *cp =='\t')
-                   *cp++ = NULL;
+                   *cp++ = '\0';
                if (*cp)
                    *cpp++ = cp;
                while (*cp != ' ' && *cp  != '\t' && *cp)
@@ -291,7 +291,7 @@
        _escaped = FALSE;
        blklevel = 0;
        for (psptr=0; psptr<PSMAX; psptr++) {
-           pstack[psptr][0] = NULL;
+           pstack[psptr][0] = '\0';
            plstack[psptr] = 0;
        }
        psptr = -1;
@@ -374,7 +374,7 @@
        if (psptr < PSMAX) {
            ++psptr;
            strncpy (pstack[psptr], pname, PNAMELEN);
-           pstack[psptr][PNAMELEN] = NULL;
+           pstack[psptr][PNAMELEN] = '\0';
            plstack[psptr] = blklevel;
        }
     }
@@ -675,7 +675,7 @@
 isproc(s)
     char *s;
 {
-    pname[0] = NULL;
+    pname[0] = '\0';
     if (!l_toplex || blklevel == 0)
        if (expmatch (s, l_prcbeg, pname) != NIL) {
            return (TRUE);
diff -u -r1.1 vgrind.1
--- 1.1 1995/03/12 22:09:51
+++ vgrind.1    1995/03/12 22:14:05
@@ -107,7 +107,7 @@
 .It Fl d Ar file
 specifies an alternate language definitions
 file (default is
-.Pa /usr/share/misc/vgrindefs )
+.Pa /usr/lib/groff/tmac/vgrindefs )
 .It Fl f
 forces filter mode
 .It Fl h Ar header
@@ -163,14 +163,14 @@
 as argument.
 .El
 .Sh FILES
-.Bl -tag -width /usr/share/misc/vgrindefsxx -compact
+.Bl -tag -width /usr/lib/groff/tmac/vgrindefsxx -compact
 .It Pa index
 file where source for index is created
-.It Pa /usr/share/tmac/tmac.vgrind
+.It Pa /usr/lib/groff/tmac/tmac.vgrind
 macro package
-.It Pa /usr/libexec/vfontedpr
+.It Pa /usr/lib/groff/tmac/vfontedpr
 preprocessor
-.It Pa /usr/share/misc/vgrindefs
+.It Pa /usr/lib/groff/tmac/vgrindefs
 language descriptions
 .El
 .Sh SEE ALSO
diff -u -r1.1 vgrind.sh
--- 1.1 1995/03/12 02:10:05
+++ vgrind.sh   1995/03/12 22:46:05
@@ -39,8 +39,8 @@
 set files=
 set f=''
 set head=""
-set vf=/usr/libexec/vfontedpr
-set tm=/usr/share/tmac
+set vf=/usr/lib/groff/tmac/vfontedpr
+set tm=/usr/lib/groff/tmac
 top:
 if ($#argv > 0) then
     switch ($1:q)
@@ -116,10 +116,10 @@
     else
        if ("$head" != "") then
            $vf $options -h "$head" $files | \
-               sh -c "vtroff -rx1 $voptions -i -mvgrind 2>> xindex"
+               sh -c "troff -rx1 $voptions -i -mvgrind 2>> xindex"
        else
            $vf $options $files | \
-               sh -c "vtroff -rx1 $voptions -i -mvgrind 2>> xindex"
+               sh -c "troff -rx1 $voptions -i -mvgrind 2>> xindex"
        endif
     endif
     sort -df +0 -2 xindex >index
@@ -133,9 +133,9 @@
        endif
     else
        if ("$head" != "") then
-           $vf $options -h "$head" $files | vtroff -i $voptions -mvgrind
+           $vf $options -h "$head" $files | troff -i $voptions -mvgrind
        else
-           $vf $options $files | vtroff -i $voptions -mvgrind
+           $vf $options $files | troff -i $voptions -mvgrind
        endif
     endif
 endif
diff -u -r1.1 vgrindefs.5
--- 1.1 1995/03/12 22:09:58
+++ vgrindefs.5 1995/03/12 22:14:49
@@ -144,8 +144,8 @@
 and lower case are equivalent, then all the keywords should be
 specified in lower case.
 .Sh FILES
-.Bl -tag -width /usr/share/misc/vgrindefs -compact
-.It Pa /usr/share/misc/vgrindefs
+.Bl -tag -width /usr/lib/groff/tmac/vgrindefs -compact
+.It Pa /usr/lib/groff/tmac/vgrindefs
 File containing terminal descriptions.
 .El
 .Sh SEE ALSO
diff -u -r1.1 vgrindefs.c
--- 1.1 1995/03/12 22:10:09
+++ vgrindefs.c 1995/03/13 21:34:10
@@ -57,9 +57,9 @@
 static char *tbuf;
 static char *filename;
 static int hopcount;   /* detect infinite loops in termcap, init 0 */
-char   *tskip();
+static char *tskip();
 char   *tgetstr();
-char   *tdecode();
+static char *tdecode();
 char   *getenv();

 /*
diff -u /dev/null Makefile
--- /dev/null   Wed Dec 21 10:28:23 1994
+++ Makefile    Mon Mar 13 16:56:35 1995
@@ -0,0 +1,57 @@
+# Makefile for vgrind         Frank Swasey
+#                             32 Hickok Place
+#                             Burlington, Vermont 05401-8515
+#                             USA
+#                             Email: Frank_Swasey@vnet.ibm.com
+#
+
+CC = gcc
+CFLAGS = -O
+PROG=  vfontedpr
+SRCS=  regexp.c vfontedpr.c vgrindefs.c
+DOCS=  vgrind.1 vgrindefs.5
+OTHR=  Makefile vgrind.sh vgrindefs.src tmac.vgrind pathnames.h
+INSTS= /usr/bin/vgrind /usr/lib/groff/tmac/vgrindefs \
+       /usr/lib/groff/tmac/tmac.vgrind /usr/lib/groff/tmac/vfontedpr \
+       /usr/man/cat1/vgrind.1 /usr/man/cat5/vgrindefs.5
+
+all: vfontedpr
+
+vfontedpr: regexp.o vfontedpr.o vgrindefs.o
+
+install: bininstall /usr/man/cat1/vgrind.1 /usr/man/cat5/vgrindefs.5
+       touch install
+
+bininstall: vfontedpr vgrind.sh vgrindefs.src tmac.vgrind
+       install -c -o bin -g bin -m 555 vgrind.sh /usr/bin/vgrind
+       install -c -o bin -g bin -m 444 vgrindefs.src /usr/lib/groff/tmac/vgrindefs
+       install -c -o bin -g bin -m 444 tmac.vgrind /usr/lib/groff/tmac
+       install -c -o bin -g bin -m 555 vfontedpr /usr/lib/groff/tmac
+       touch bininstall
+
+/usr/man/cat1/vgrind.1: vgrind.1
+       nroff -mandoc vgrind.1 >/usr/man/cat1/vgrind.1
+
+/usr/man/cat5/vgrindefs.5: vgrindefs.5
+       nroff -mandoc vgrindefs.5 >/usr/man/cat5/vgrindefs.5
+
+uninstall:
+       rm -f /usr/bin/vgrind
+       rm -f /usr/lib/groff/tmac/vgrindefs
+       rm -f /usr/lib/groff/tmac/tmac.vgrind
+       rm -f /usr/lib/groff/tmac/vfontedpr
+       rm -f /usr/man/cat1/vgrind.1
+       rm -f /usr/man/cat5/vgrindefs.5
+
+clean:
+       rm -f *.o vfontedpr a.out *.bak core make.log
+
+srcdist: vgrindsrc.tgz
+
+vgrindsrc.tgz: $(OTHR) $(SRCS) $(DOCS)
+       tar cvzf vgrindsrc.tgz $(OTHR) $(SRCS) $(DOCS)
+
+bindist: vgrindbin.tgz
+
+vgrindbin.tgz: $(INSTS)
+       tar cvzf vgrindbin.tgz $(INSTS)

--
e-mail: Frank_Swasey@vnet.ibm.com, fswasey@btv.ibm.com         ,,,
Tel: 802-769-4011 (tie: 446), Fax: 802-769-4253 (tie: 446)    (o o)
           Speaking *from* but not *for* IBM             -oOO--(_)--OOo-

--
Send submissions for comp.os.linux.announce to: linux-announce@news.ornl.gov
PLEASE remember Keywords: and a short description of the software.


home help back first fref pref prev next nref lref last post