diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2008-07-18 16:05:54 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2008-07-18 16:05:54 +0000 |
commit | 6fd3ad3f828f394c6f668cc6b43981a22e1f6317 (patch) | |
tree | 61c90e72b7bf915d9d80c8e5e1837abbbaaadb0d /devtools | |
parent | 97fa1ff1e6cf30fa55cb9c32081ea3ef9055fbd2 (diff) | |
download | MPC-6fd3ad3f828f394c6f668cc6b43981a22e1f6317.tar.gz |
ChangeLogTag: Fri Jul 18 16:03:52 UTC 2008 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'devtools')
-rwxr-xr-x | devtools/document_template.pl | 79 | ||||
-rwxr-xr-x | devtools/highlight_template.pl | 70 |
2 files changed, 70 insertions, 79 deletions
diff --git a/devtools/document_template.pl b/devtools/document_template.pl index 2b99a871..f88dfb51 100755 --- a/devtools/document_template.pl +++ b/devtools/document_template.pl @@ -18,7 +18,7 @@ use FindBin; use File::Spec; use File::Basename; -my($basePath) = $FindBin::Bin; +my $basePath = $FindBin::Bin; if ($^O eq 'VMS') { $basePath = File::Spec->rel2abs(dirname($0)) if ($basePath eq ''); $basePath = VMS::Filespec::unixify($basePath); @@ -35,20 +35,20 @@ require StringProcessor; # Data Section # ****************************************************************** -my(%keywords) = (); -my(%arrow_op) = (); -my($doc_ext) = '.txt'; -my($version) = '1.2'; +my %keywords; +my %arrow_op; +my $doc_ext = '.txt'; +my $version = '1.2'; # ****************************************************************** # Subroutine Section # ****************************************************************** sub setup_keywords { - my($language) = shift; + my $language = shift; ## Get the main MPC keywords - my($keywords) = ProjectCreator::getKeywords(); + my $keywords = ProjectCreator::getKeywords(); foreach my $key (keys %$keywords) { $keywords{$key} = 1; } @@ -60,7 +60,7 @@ sub setup_keywords { } ## Get the pseudo template variables - my($pjc) = new ProjectCreator(); + my $pjc = new ProjectCreator(); $keywords = $pjc->get_command_subs(); foreach my $key (keys %$keywords) { $keywords{$key} = 1; @@ -81,10 +81,7 @@ sub setup_keywords { sub display_template { - my($fh) = shift; - my($cp) = shift; - my($input) = shift; - my($tkeys) = shift; + my($fh, $cp, $input, $tkeys) = @_; print $fh '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', "\n", "<head>\n", @@ -107,8 +104,8 @@ sub display_template { " <th>Description</th>\n", " </tr>\n"; foreach my $key (sort keys %$tkeys) { - my($desc) = $cp->get_value($key) || ' '; - my($def) = undef; + my $desc = $cp->get_value($key) || ' '; + my $def; if (defined $$tkeys{$key}) { foreach my $ikey (sort keys %{$$tkeys{$key}}) { if (defined $def) { @@ -142,15 +139,13 @@ sub usageAndExit { # Main Section # ****************************************************************** -my($status) = 0; -my($fh) = new FileHandle(); -my($input) = $ARGV[0]; -my($output) = $ARGV[1]; -my($language) = $ARGV[2]; +my $status = 0; +my $fh = new FileHandle(); +my $input = $ARGV[0]; +my $output = $ARGV[1]; +my $language = $ARGV[2]; -if (!defined $input || $input =~ /^-/) { - usageAndExit(); -} +usageAndExit() if (!defined $input || $input =~ /^-/); if (!defined $output) { $output = $input; @@ -171,17 +166,17 @@ if (open($fh, $input)) { } } - my(%template_keys) = (); + my %template_keys; setup_keywords($language); - my(@foreach) = (); - my($findex) = -1; + my @foreach; + my $findex = -1; while(<$fh>) { - my($len) = length($_); + my $len = length($_); for(my $start = 0; $start < $len;) { - my($sindex) = index($_, '<%', $start); + my $sindex = index($_, '<%', $start); if ($sindex >= 0) { - my($eindex) = index($_, '%>', $sindex); + my $eindex = index($_, '%>', $sindex); if ($eindex >= $sindex) { $eindex += 2; } @@ -189,14 +184,14 @@ if (open($fh, $input)) { $eindex = $len; } - my($part) = substr($_, $sindex, $eindex - $sindex); - my($key) = substr($part, 2, length($part) - 4); - my($name) = lc($key); - my($tvar) = undef; - my($def) = undef; + my $part = substr($_, $sindex, $eindex - $sindex); + my $key = substr($part, 2, length($part) - 4); + my $name = lc($key); + my $tvar; + my $def; if ($key =~ /^([^\(]+)\((.*)\)/) { $name = lc($1); - my($vname) = $2; + my $vname = $2; if (defined $keywords{$name}) { $tvar = 1; @@ -208,10 +203,10 @@ if (open($fh, $input)) { $vname =~ s/$keyword\(([^\)]+)\)/$1/gi; } - my($remove_s) = 1; + my $remove_s = 1; if ($vname =~ /([^,]*),(.*)/) { - my($n) = $1; - my($v) = $2; + my $n = $1; + my $v = $2; $n =~ s/^\s+//; $n =~ s/\s+$//; $v =~ s/^\s+//; @@ -267,7 +262,7 @@ if (open($fh, $input)) { $key = lc($key); } - my($otvar) = $tvar; + my $otvar = $tvar; foreach my $k (split(/\s+/, $key)) { $tvar = $otvar; if (defined $keywords{$k}) { @@ -315,9 +310,7 @@ if (open($fh, $input)) { } else { $template_keys{$n} = {}; - if (defined $def) { - $template_keys{$n}->{$def} = 1; - } + $template_keys{$n}->{$def} = 1 if (defined $def); } } } @@ -333,10 +326,10 @@ if (open($fh, $input)) { } close($fh); - my($cp) = new ConfigParser(); + my $cp = new ConfigParser(); $cp->read_file("$basePath/docs/templates/common$doc_ext"); - my($doc) = $input; + my $doc = $input; $doc =~ s/\.[^\.]+$/$doc_ext/; $doc =~ s/templates/docs\/templates/; if (-r $doc) { diff --git a/devtools/highlight_template.pl b/devtools/highlight_template.pl index 65b2c6ca..54769ed6 100755 --- a/devtools/highlight_template.pl +++ b/devtools/highlight_template.pl @@ -18,7 +18,7 @@ use FindBin; use File::Spec; use File::Basename; -my($basePath) = $FindBin::Bin; +my $basePath = $FindBin::Bin; if ($^O eq 'VMS') { $basePath = File::Spec->rel2abs(dirname($0)) if ($basePath eq ''); $basePath = VMS::Filespec::unixify($basePath); @@ -33,16 +33,16 @@ require TemplateParser; # Data Section # ****************************************************************** -my(%keywords) = (); -my(%arrow_op) = (); -my($ifmod) = 0; -my($formod) = 0; -my($cmod) = 50; -my(%keycolors) = (0 => [160, 32, 240], - 1 => [255, 50, 50], - 2 => [50, 50, 255], - ); -my($version) = '1.3'; +my %keywords; +my %arrow_op; +my $ifmod = 0; +my $formod = 0; +my $cmod = 50; +my %keycolors = (0 => [160, 32, 240], + 1 => [255, 50, 50], + 2 => [50, 50, 255], + ); +my $version = '1.3'; # ****************************************************************** # Subroutine Section @@ -50,13 +50,13 @@ my($version) = '1.3'; sub setup_keywords { ## Get the main MPC keywords - my($keywords) = ProjectCreator::getKeywords(); + my $keywords = ProjectCreator::getKeywords(); foreach my $key (keys %$keywords) { $keywords{$key} = 0; } ## Get the pseudo template variables - my($pjc) = new ProjectCreator(); + my $pjc = new ProjectCreator(); $keywords = $pjc->get_command_subs(); foreach my $key (keys %$keywords) { $keywords{$key} = 0; @@ -88,7 +88,7 @@ sub setup_keywords { sub convert_to_html { - my($line) = shift; + my $line = shift; $line =~ s/&/&/g; $line =~ s/</</g; $line =~ s/>/>/g; @@ -113,14 +113,12 @@ sub usageAndExit { # Main Section # ****************************************************************** -my($status) = 0; -my($fh) = new FileHandle(); -my($input) = $ARGV[0]; -my($output) = $ARGV[1]; +my $status = 0; +my $fh = new FileHandle(); +my $input = $ARGV[0]; +my $output = $ARGV[1]; -if (!defined $input || $input =~ /^-/) { - usageAndExit(); -} +usageAndExit() if (!defined $input || $input =~ /^-/); if (!defined $output) { $output = $input; @@ -131,18 +129,18 @@ if (!defined $output) { if (open($fh, $input)) { setup_keywords(); - my($deftxt) = 'black'; - my(@codes) = (); + my $deftxt = 'black'; + my @codes; while(<$fh>) { - my($len) = length($_); + my $len = length($_); for(my $start = 0; $start < $len;) { - my($sindex) = index($_, '<%', $start); + my $sindex = index($_, '<%', $start); if ($sindex >= 0) { - my($left) = substr($_, $start, $sindex - $start); + my $left = substr($_, $start, $sindex - $start); if ($left ne '') { push(@codes, [$deftxt, $left]); } - my($eindex) = index($_, '%>', $sindex); + my $eindex = index($_, '%>', $sindex); if ($eindex >= $sindex) { $eindex += 2; } @@ -150,11 +148,11 @@ if (open($fh, $input)) { $eindex = $len; } - my($part) = substr($_, $sindex, $eindex - $sindex); - my($key) = substr($part, 2, length($part) - 4); - my($name) = $key; - my($color) = 'green'; - my(@entry) = (); + my $part = substr($_, $sindex, $eindex - $sindex); + my $key = substr($part, 2, length($part) - 4); + my $name = $key; + my $color = 'green'; + my @entry; if ($key =~ /^([^\(]+)\(.*\)/) { $name = $1; if (defined $keywords{$name}) { @@ -165,10 +163,10 @@ if (open($fh, $input)) { @entry = @{$keycolors{$keywords{$key}}}; } else { - foreach my $ao (keys %arrow_op) { + foreach my $ao (keys %arrow_op) { if ($key =~ /^$ao/) { @entry = @{$keycolors{$arrow_op{$ao}}}; - last; + last; } } } @@ -208,7 +206,7 @@ if (open($fh, $input)) { $start = $eindex; } else { - my($part) = substr($_, $start, $len - $start); + my $part = substr($_, $start, $len - $start); push(@codes, [$deftxt, $part]); $start += ($len - $start); } @@ -222,7 +220,7 @@ if (open($fh, $input)) { "<body>\n"; foreach my $code (@codes) { $$code[1] = convert_to_html($$code[1]); - my($newline) = ($$code[1] =~ s/<br>//); + my $newline = ($$code[1] =~ s/<br>//); print $fh ($$code[1] ne '' ? "<font color=\"$$code[0]\">$$code[1]</font>" : ''), ($newline ? "<br>\n" : ''); |