From: uz Date: Tue, 11 Nov 2008 21:21:10 +0000 (+0000) Subject: New option --tabsize. X-Git-Tag: V2.13.0rc1~353 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d6d807c3db51f36e6b7162f541afedb74f8fc698;p=cc65 New option --tabsize. git-svn-id: svn://svn.cc65.org/cc65/trunk@3902 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- 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 .= "/";