New option --tabsize.

git-svn-id: svn://svn.cc65.org/cc65/trunk@3902 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2008-11-11 21:21:10 +00:00
parent d66d72bf95
commit d6d807c3db

View file

@ -75,6 +75,7 @@ my $CommentColor = "#B22222"; # Color for comments
my $CRefs = 0; # Add references to the C file my $CRefs = 0; # Add references to the C file
my $CtrlColor = "#228B22"; # Color for control directives my $CtrlColor = "#228B22"; # Color for control directives
my $CvtTabs = 0; # Convert tabs to spaces my $CvtTabs = 0; # Convert tabs to spaces
my $TabSize = 8; # This is how god created them
my $Debug = 0; # No debugging my $Debug = 0; # No debugging
my $Help = 0; # Help flag my $Help = 0; # Help flag
my $HTMLDir = ""; # Directory in which to create the files my $HTMLDir = ""; # Directory in which to create the files
@ -567,7 +568,7 @@ sub Process2 {
# If requested, convert tabs to spaces # If requested, convert tabs to spaces
if ($CvtTabs) { if ($CvtTabs) {
# Don't ask me - this is from the perl manual page # 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 # Clear the output line
@ -1176,6 +1177,7 @@ GetOptions ("bgcolor=s" => \$BGColor,
"linenumbers" => \$LineNumbers, "linenumbers" => \$LineNumbers,
"linkstyle=i" => \$LinkStyle, "linkstyle=i" => \$LinkStyle,
"replaceext" => \$ReplaceExt, "replaceext" => \$ReplaceExt,
"tabsize=i" => \$TabSize,
"textcolor=s" => \$TextColor, "textcolor=s" => \$TextColor,
"verbose!" => \$Verbose, "verbose!" => \$Verbose,
"<>" => \&AddFile); "<>" => \&AddFile);
@ -1184,6 +1186,9 @@ GetOptions ("bgcolor=s" => \$BGColor,
if ($IndexCols <= 0 || $IndexCols >= 20) { if ($IndexCols <= 0 || $IndexCols >= 20) {
Abort ("Invalid value for --indexcols option"); Abort ("Invalid value for --indexcols option");
} }
if ($TabSize < 1 || $TabSize > 16) {
Abort ("Invalid value for --tabsize option");
}
if ($HTMLDir ne "" && $HTMLDir =~ /[^\/]$/) { if ($HTMLDir ne "" && $HTMLDir =~ /[^\/]$/) {
# Add a trailing path separator # Add a trailing path separator
$HTMLDir .= "/"; $HTMLDir .= "/";