1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00

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 $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 .= "/";