From 9de4932f230a29b1a6910710f99037bce810ae31 Mon Sep 17 00:00:00 2001 From: cuz Date: Sat, 11 Oct 2003 18:43:12 +0000 Subject: [PATCH] New command line options "linenumbers" and "linelabels" which generate line numbers and labels for each line. Generate HTML 4.01 instead of 4.0. git-svn-id: svn://svn.cc65.org/cc65/trunk@2514 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65html/ca65html | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/ca65html/ca65html b/src/ca65html/ca65html index c86e4b8af..8823c7eac 100755 --- a/src/ca65html/ca65html +++ b/src/ca65html/ca65html @@ -7,10 +7,10 @@ # # # # # # -# (C) 2000 Ullrich von Bassewitz # -# Wacholderweg 14 # -# D-70597 Stuttgart # -# EMail: uz@musoftware.de # +# (C) 2000-2003 Ullrich von Bassewitz # +# Römerstrasse 52 # +# D-70794 Filderstadt # +# EMail: uz@cc65.org # # # # # # This software is provided 'as-is', without any expressed or implied # @@ -77,6 +77,8 @@ my $IndexCols = 6; # Columns in the file listing my $IndexTitle = "Index"; # Title of index page my $IndexName = "index.html"; # Name of index page my $IndexPage = 0; # Create an index page +my $LineLabels = 0; # Add a HTML label to each line +my $LineNumbers = 0; # Add line numbers to the output my $LinkStyle = 0; # Default link style my $ReplaceExt = 0; # Replace extension instead of appending my $TextColor = "#000000"; # Text color @@ -172,7 +174,7 @@ sub DocHeader { my $OUT = shift (@_); my $Asm = shift (@_); print $OUT <<"EOF"; - + @@ -200,7 +202,7 @@ sub DocFooter {



-Valid HTML 4.0! +Valid HTML 4.01! $Name; generated on $Today by ca65html
uz\@cc65.org
@@ -443,14 +445,29 @@ sub Process2 { # Read the input file, replacing references by hyperlinks and mark # labels as link targets. + my $LineNo = 0; while ($Line = ) { + # Count input lines + $LineNo++; + # Remove the newline chop ($Line); - # Clear the output line + # Clear the output line $OutLine = ""; + # If requested, add a html label to each line with a name "linexxx", + # so it can be referenced from the outside (this is the same convention + # that is used by c2html). If we have line numbers enabled, add them. + if ($LineLabels && $LineNumbers) { + $OutLine .= sprintf ("%6d: ", $LineNo, $LineNo); + } elsif ($LineLabels) { + $OutLine .= sprintf ("", $LineNo); + } elsif ($LineNumbers) { + $OutLine .= sprintf ("%6d: ", $LineNo); + } + # Check for a label. If we have one, process it and remove it # from the line if ($Line =~ /^\s*?(\@?)([_a-zA-Z][_\w]*)(\s*)(:|=)(.*)$/) { @@ -808,7 +825,7 @@ sub CreateIndex { # Print the header print INDEX <<"EOF"; - + @@ -850,6 +867,7 @@ sub Usage { print " --indexname file Use file for the index file instead of $IndexName\n"; print " --indexpage Create an index page\n"; print " --indextitle title Use title as the index title instead of $IndexTitle\n"; + print " --linenumbers Add line numbers to the output\n"; print " --linkstyle style Use the given link style\n"; print " --replaceext Replace source extension instead of appending .html\n"; print " --textcolor color Use text color c instead of $TextColor\n"; @@ -873,6 +891,8 @@ GetOptions ("bgcolor=s" => \$BGColor, "indexname=s" => \$IndexName, "indexpage" => \$IndexPage, "indextitle=s" => \$IndexTitle, + "linelabels" => \$LineLabels, + "linenumbers" => \$LineNumbers, "linkstyle=i" => \$LinkStyle, "replaceext" => \$ReplaceExt, "textcolor=s" => \$TextColor,