[net.micro.pc] vgrindef for MASM

bmarsh@noscvax.UUCP (William C. Marsh) (09/04/85)

*** REPLACE THIS LINE WITH YOUR STUPID COMMENT ***

Here is a set of files which will enable the assembly language
programmer (yes, they really exist!) to use vgrind(1) on their
favorite masm source file.  Just cut at the right place and
feed to sh (not csh) to unpack.  Get your systems administrator
to append the file masm.src to the end of /usr/lib/vgrindefs,
or use the -d option of vgrind to point it to your copy.

Be sure to see the README file for some limitations and hints.

bill marsh
------------ cut here cut here ------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	README
#	depage.c
#	masm.src
# This archive created: Tue Sep  3 11:18:55 1985
export PATH; PATH=/bin:$PATH
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
cat << \SHAR_EOF > 'README'
Here are the files needed to vgrind(1) an masm source file.  The file
masm.src contains the definition of the masm language which vgrind
will use in decoding your source file.  It needs to be added to the file
/usr/lib/vgrindefs.

There are four things to keep in mind using vgrind on masm files:

	1) Only vgrind SOURCE (*.asm) files, not listings.

	2) Do not put tabs in comments which follow instructions.
	   vgrind runs out of tab stops and messes up the listing.
	
	3) The comment directive in masm is unsupported.  If you
	   have comments this way, vgrind won't know they are comments
	   and won't put them in italics.  Also keywords which appear
	   in the comment block will be highlighted.
	
	4) The page directive in masm is unsupported.  I have included
	   a program which will take an masm file and insert a form-
	   feed before each page directive which would cause a new
	   page.  After compiling, (cc depage.c -o depage),
	   use depage to make a new file:

	   mv test.asm test.raw
	   depage test.raw > test.asm
	   vgrind -lmasm test.asm

	   The mv command is so the output of depage can be re-directed
	   to the asm file.  Vgrind uses the name of the source file
	   in the header it gives to vtroff.

Hope you find this as impressive as my boss did.
-----------
Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@nosc
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!noscvax!bmarsh

"If everything seems to be coming your way, you're probably in the wrong lane."
SHAR_EOF
fi # end of overwriting check
if test -f 'depage.c'
then
	echo shar: will not over-write existing file "'depage.c'"
else
cat << \SHAR_EOF > 'depage.c'
#include <stdio.h>
#include <ctype.h>

main(argc, argv)
int argc;
char **argv;
{
	FILE *fd, *fopen();

	if(argc == 1)
	{
		depage(stdin);
		exit(0);
	}
	for(argc--, argv++; argc > 0; argv++, argc--)
	{
		fd = fopen(*argv, "r");
		if(fd == NULL)
		{
			fprintf(stderr, "depage: ");
			perror(*argv);
			continue;
		}
		depage(fd);
		fclose(fd);
	}
}

depage(fildes)
FILE *fildes;
{
	register char *line_ptr;
	char line[128], *fgets();

	for( ; fgets(line, 128, fildes) != NULL; )
	{
		for(line_ptr=line; *line_ptr; line_ptr++)
			if(!isspace(*line_ptr))
				break;

		if(strcmp(line_ptr,"page\n")==0 || strcmp(line_ptr,"PAGE\n")==0)
			printf("\014\n");

		printf("%s", line);
	}
}
SHAR_EOF
fi # end of overwriting check
if test -f 'masm.src'
then
	echo shar: will not over-write existing file "'masm.src'"
else
cat << \SHAR_EOF > 'masm.src'
masm|asm86:\
	:pb=^\p\d?(proc|segment|macro|struc):\
	:bb=(proc|segment|macro|struc):be=(endp|ends|endm):\
	:cb=;:ce=$:\
	:sb=':se=\e':\
	:lb=':le=\e':\
	:oc:\
	:kw=%out comment db dd dq dt dw else end endc endif endm endp\
	ends eq equ even exitm extrn ge group gt high if if1 if2 ifb\
	ifdif ife ifidn ifnb ifndef include irp irpc label le length\
	local low lt macro mask mod name ne offset org page\
	proc ptr public purge record rept seg segment short\
	size struc subttl this title type width:
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0

-- 

Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@nosc
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!noscvax!bmarsh

"If everything seems to be coming your way, you're probably in the wrong lane."

bmarsh@noscvax.UUCP (William C. Marsh) (09/04/85)

*** REPLACE THIS LINE WITH YOUR EXCUSE ***

Oops, forgot one keyword in my haste to post my vgrindef for MASM.
Add the keyword assume after the %out and before comment as shown
below...


masm|asm86:\
	:pb=^\p\d?(proc|segment|macro|struc):\
	:bb=(proc|segment|macro|struc):be=(endp|ends|endm):\
	:cb=;:ce=$:\
	:sb=':se=\e':\
	:lb=':le=\e':\
	:oc:\
	:kw=%out assume comment db dd dq dt dw else end endc endif endm\
	endp ends eq equ even exitm extrn ge group gt high if if1 if2 ifb\
	ifdif ife ifidn ifnb ifndef include irp irpc label le length\
	local low lt macro mask mod name ne offset org page\
	proc ptr public purge record rept seg segment short\
	size struc subttl this title type width:

bmarsh
-- 

Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@nosc
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!noscvax!bmarsh

"If everything seems to be coming your way, you're probably in the wrong lane."