From d6d807c3db51f36e6b7162f541afedb74f8fc698 Mon Sep 17 00:00:00 2001 From: uz Date: Tue, 11 Nov 2008 21:21:10 +0000 Subject: [PATCH] New option --tabsize. git-svn-id: svn://svn.cc65.org/cc65/trunk@3902 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65html/ca65html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ca65html/ca65html b/src/ca65html/ca65html index 574b696a8..ba2ce8de1 100755 --- a/src/ca65html/ca65html +++ b/src/ca65html/ca65html @@ -75,6 +75,7 @@ my $CommentColor = "#B22222"; # Color for comments my $CRefs = 0; # Add references to the C file my $CtrlColor = "#228B22"; # Color for control directives my $CvtTabs = 0; # Convert tabs to spaces +my $TabSize = 8; # This is how god created them my $Debug = 0; # No debugging my $Help = 0; # Help flag my $HTMLDir = ""; # Directory in which to create the files @@ -567,7 +568,7 @@ sub Process2 { # If requested, convert tabs to spaces if ($CvtTabs) { # Don't ask me - this is from the perl manual page - 1 while ($Line =~ s/\t+/' ' x (length($&)*8 - length($`)%8)/e) ; + 1 while ($Line =~ s/\t+/' ' x (length($&) * $TabSize - length($`) % $TabSize)/e) ; } # Clear the output line @@ -1176,6 +1177,7 @@ GetOptions ("bgcolor=s" => \$BGColor, "linenumbers" => \$LineNumbers, "linkstyle=i" => \$LinkStyle, "replaceext" => \$ReplaceExt, + "tabsize=i" => \$TabSize, "textcolor=s" => \$TextColor, "verbose!" => \$Verbose, "<>" => \&AddFile); @@ -1184,6 +1186,9 @@ GetOptions ("bgcolor=s" => \$BGColor, if ($IndexCols <= 0 || $IndexCols >= 20) { Abort ("Invalid value for --indexcols option"); } +if ($TabSize < 1 || $TabSize > 16) { + Abort ("Invalid value for --tabsize option"); +} if ($HTMLDir ne "" && $HTMLDir =~ /[^\/]$/) { # Add a trailing path separator $HTMLDir .= "/"; -- 2.39.5