#!/usr/bin/perl # asmtag # Author: Shankar Chakkere # Date: 18 Dec 1997 # Status: Working # Abstract: This script will generate tags for z80 assembly language # Update: April 6 ,1998 Add line number instead of regular expression # Update: Feb 11 ,1999 Modified to recognise Z80 MACROs (CP/M) # Usage under DOS: perl c:\bin\asmtag *.vf *.equ *.lib > tags # Copyright (C) 1999 Shankar Chakkere # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # Visit http://www.fsf.org for more information ######################################################################## $debug = 0; print "ARGV:$#ARGV\n" if $debug; ($#ARGV < 0 ) && &usage; while ($#ARGV >= 0) { $file = $ARGV[0]; shift(@ARGV); print "file:$file\n" if $debug; open(FILE, $file) || die "Can't open input file : $file"; while () { # The equates if (/^.*EQU.*/) { ($tag,@junk) = (split(/EQU/)); # Remove the trailing space $_=$tag; ($tag,@junk) = (split(/\s/)); print "$tag\t$file\t/^$tag/\n"; #4/6/98 print "$tag\t$file\t:$.\n"; } # The label elsif (/^\w.*:/) { # Anchor the string over the : character ($tag,@junk) = (split(/:/)); print "$tag\t$file\t/^$tag/\n"; #4/6/98 print "$tag\t$file\t:$.\n"; } #2/11/1999 # The macro elsif (/^\w.*MACRO/) { # Anchor the string over the : character ($tag,@junk) = (split('MACRO')); print "$tag\t$file\t/^$tag/\n"; } } close FILE; } sub usage { die <