Index: trunk/extensions/timeline/EasyTimeline.pl |
— | — | @@ -67,18 +67,113 @@ |
68 | 68 | # vulnerability |
69 | 69 | # |
70 | 70 | # 1.13 Jan 2010 |
71 | | -# -change svg encoding from iso-8859-1 -> UTF-8 |
72 | | -# -allow font to be specified using -f option as opposed to hardcoded FreeSans. |
| 71 | +# - change svg encoding from iso-8859-1 -> UTF-8 |
| 72 | +# - allow font to be specified using -f option as opposed to hardcoded FreeSans. |
73 | 73 | |
74 | | -$version = "1.13"; |
| 74 | +our $VERSION = "1.13"; |
75 | 75 | |
76 | 76 | use Time::Local; |
77 | 77 | use Getopt::Std; |
78 | 78 | use Cwd; |
| 79 | +use English '-no_match_vars'; |
79 | 80 | |
| 81 | +# Global variables. |
| 82 | +# Many of these should be refactored. |
| 83 | +my @PlotLines; |
| 84 | +my $CntErrors = 0; |
| 85 | +my @Info; |
| 86 | +my @Warnings; |
| 87 | + |
| 88 | +my $file_in; |
| 89 | +my $file_name; |
| 90 | +my $file_bitmap; |
| 91 | +my $file_vector; |
| 92 | +my $file_png; |
| 93 | +my $file_htmlmap; |
| 94 | +my $file_html; |
| 95 | +my $file_errors; |
| 96 | + |
| 97 | +my %options; |
| 98 | +my $listinput; |
| 99 | +my $linkmap; |
| 100 | +my $makehtml; |
| 101 | +my $bypass; |
| 102 | +my $showmap; |
| 103 | +my $tmpdir; |
| 104 | +my $ploticus_command; |
| 105 | +my $articlepath; |
| 106 | +my $font_file; |
| 107 | + |
| 108 | +my $true = 1; |
| 109 | +my $false = 0; |
| 110 | + |
| 111 | +my $LinkColor = "brightblue"; |
| 112 | +my $MapPNG = $false; # switched when link or hint found |
| 113 | +my $MapSVG = $false; # switched when link found |
| 114 | +my $WarnTextOutsideArea = 0; |
| 115 | +my $WarnOnRightAlignedText = 0; |
| 116 | + |
| 117 | +my $hPerc = &EncodeInput("\%"); |
| 118 | +my $hAmp = &EncodeInput("\&"); |
| 119 | +my $hAt = &EncodeInput("\@"); |
| 120 | +my $hDollar = &EncodeInput("\$"); |
| 121 | +my $hBrO = &EncodeInput("\("); |
| 122 | +my $hBrC = &EncodeInput("\)"); |
| 123 | +my $hSemi = &EncodeInput("\;"); |
| 124 | +my $hIs = &EncodeInput("\="); |
| 125 | +my $hLt = &EncodeInput("\<"); |
| 126 | +my $hGt = &EncodeInput("\>"); |
| 127 | + |
| 128 | +my $file; |
| 129 | +my $image_file_fmt; |
| 130 | +my $env; |
| 131 | +my $pathseparator; |
| 132 | + |
| 133 | +my $LineNo; |
| 134 | +my $InputParsed; |
| 135 | +my $CommandNext = q(); |
| 136 | +my $Command; |
| 137 | +my $DateFormat; |
| 138 | +my $Line; |
| 139 | +my $NoData; |
| 140 | + |
| 141 | +my %Consts; # see sub GetDefine |
| 142 | +my %Colors; # see sub StoreColor |
| 143 | +my %BackgroundColors; |
| 144 | +my %Axis; |
| 145 | +my @Bars; |
| 146 | +my %BarLegend; |
| 147 | +my %BarLink; |
| 148 | +my @LegendData; |
| 149 | +my %LineDefs; |
| 150 | +my $AlignBars; |
| 151 | +my %ColorLabels; |
| 152 | +my %Period; |
| 153 | +my @DrawLines; |
| 154 | +my %Image; |
| 155 | +my %Legend; |
| 156 | +my %PlotArea; |
| 157 | +my %PlotDefs; |
| 158 | +my @PlotBars; |
| 159 | +my @PlotText; |
| 160 | +my $MaxBarWidth; |
| 161 | +my %BarWidths; |
| 162 | +my $maxwidth; # XXX problematic |
| 163 | +my $Preset; |
| 164 | +my @PresetList; |
| 165 | +my %Scales; |
| 166 | +my %TextDefs; |
| 167 | + |
| 168 | +# These two must definitely be refactored |
| 169 | +my %Attributes; |
| 170 | +my @Attributes; |
| 171 | + |
| 172 | +my $firstcmd; |
| 173 | + |
| 174 | +# BEGIN |
80 | 175 | $| = 1; # flush screen output |
81 | 176 | |
82 | | -print "EasyTimeline version $version\n" |
| 177 | +print "EasyTimeline version $VERSION\n" |
83 | 178 | . "Copyright (C) 2004 Erik Zachte\n" |
84 | 179 | . "Email xxx\@chello.nl (nospam: xxx=epzachte)\n\n" |
85 | 180 | . "This program is free software; you can redistribute it\n" |
— | — | @@ -92,23 +187,29 @@ |
93 | 188 | &InitFiles; |
94 | 189 | |
95 | 190 | open "FILE_IN", "<", $file_in; |
96 | | -@lines = <FILE_IN>; |
| 191 | +my @lines = <FILE_IN>; |
97 | 192 | close "FILE_IN"; |
98 | 193 | |
99 | | -&InitVars; |
100 | 194 | &ParseScript; |
101 | 195 | |
102 | | -if ($CntErrors == 0) { &WritePlotFile; } |
| 196 | +if ($CntErrors == 0) { |
| 197 | + &WritePlotFile; |
| 198 | +} |
103 | 199 | |
104 | | -if ($CntErrors == 1) { &Abort("1 error found"); } |
105 | | -elsif ($CntErrors > 1) { &Abort("$CntErrors errors found"); } |
| 200 | +if ($CntErrors == 1) { |
| 201 | + &Abort("1 error found"); |
| 202 | +} |
| 203 | +elsif ($CntErrors > 1) { |
| 204 | + &Abort("$CntErrors errors found"); |
| 205 | +} |
106 | 206 | else { |
107 | | - if (defined @Info) { |
| 207 | + if (@Info) { |
108 | 208 | print "\nINFO\n"; |
109 | 209 | print @Info; |
110 | 210 | print "\n"; |
111 | 211 | } |
112 | | - if (defined @Warnings) { |
| 212 | + |
| 213 | + if (@Warnings) { |
113 | 214 | print "\nWARNING(S)\n"; |
114 | 215 | print @Warnings; |
115 | 216 | print "\n"; |
— | — | @@ -133,55 +234,50 @@ |
134 | 235 | my $options; |
135 | 236 | getopt("iTAPef", \%options); |
136 | 237 | |
137 | | - &Abort("Specify input file as: -i filename") if (!defined(@options{"i"})); |
| 238 | + &Abort("Specify input file as: -i filename") if (!defined($options{"i"})); |
138 | 239 | |
139 | | - $file_in = @options{"i"}; |
140 | | - $listinput = @options{"l"}; # list all input lines (not recommended) |
141 | | - $linkmap = @options{"m"}; # make clickmap for inclusion in html |
142 | | - $makehtml = @options{"h"}; # make test html file with gif/png + svg output |
143 | | - $bypass = @options{"b"}; # do not use in Wikipedia:bypass some checks |
144 | | - $showmap = @options{"d"}; # debug: shows clickable areas in gif/png |
145 | | - # The following parameters are used by MediaWiki |
146 | | - # to pass config settings from LocalSettings.php to |
147 | | - # the perl script |
148 | | - $tmpdir = @options{"T"}; # For MediaWiki: temp directory to use |
149 | | - $plcommand = @options{"P"}; # For MediaWiki: full path of ploticus command |
150 | | - $articlepath = @options{"A" |
151 | | - }; # For MediaWiki: Path of an article, relative to this servers root |
152 | | - $font_file = @options{"f" |
153 | | - }; # font to use. Must be in environemnt variable GDFONTPATH unless builtin "ascii" font |
| 240 | + $file_in = $options{"i"}; |
| 241 | + $listinput = $options{"l"}; # list all input lines (not recommended) |
| 242 | + $linkmap = $options{"m"}; # make clickmap for inclusion in html |
| 243 | + # make test html file with gif/png + svg output |
| 244 | + $makehtml = $options{"h"}; |
154 | 245 | |
155 | | - if (!defined @options{"f"}) { $font_file = "ascii"; } |
| 246 | + # do not use in Wikipedia:bypass some checks |
| 247 | + $bypass = $options{"b"}; |
156 | 248 | |
157 | | - if (!defined @options{"A"}) { |
| 249 | + # debug: shows clickable areas in gif/png |
| 250 | + $showmap = $options{"d"}; |
| 251 | + |
| 252 | + # The following parameters are used by MediaWiki |
| 253 | + # to pass config settings from LocalSettings.php to |
| 254 | + # the perl script |
| 255 | + |
| 256 | + # For MediaWiki: temp directory to use |
| 257 | + $tmpdir = $options{"T"}; |
| 258 | + |
| 259 | + # For MediaWiki: full path of ploticus command |
| 260 | + $ploticus_command = $options{"P"}; |
| 261 | + |
| 262 | + # For MediaWiki: Path of an article, relative to this servers root |
| 263 | + $articlepath = $options{"A"}; |
| 264 | + |
| 265 | + # font to use. Must be in environemnt variable |
| 266 | + # GDFONTPATH unless builtin "ascii" font |
| 267 | + $font_file = $options{"f"}; |
| 268 | + |
| 269 | + if (!defined $options{"f"}) { |
| 270 | + $font_file = "ascii"; |
| 271 | + } |
| 272 | + |
| 273 | + if (!defined $options{"A"}) { |
158 | 274 | $articlepath = "http://en.wikipedia.org/wiki/\$1"; |
159 | 275 | } |
160 | 276 | |
161 | | - if (!-e $file_in) { &Abort("Input file '" . $file_in . "' not found."); } |
| 277 | + if (!-e $file_in) { |
| 278 | + &Abort("Input file '" . $file_in . "' not found."); |
| 279 | + } |
162 | 280 | } |
163 | 281 | |
164 | | -sub InitVars { |
165 | | - $true = 1; |
166 | | - $false = 0; |
167 | | - $CntErrors = 0; |
168 | | - $LinkColor = "brightblue"; |
169 | | - $MapPNG = $false; # switched when link or hint found |
170 | | - $MapSVG = $false; # switched when link found |
171 | | - $WarnTextOutsideArea = 0; |
172 | | - $WarnOnRightAlignedText = 0; |
173 | | - |
174 | | - $hPerc = &EncodeInput("\%"); |
175 | | - $hAmp = &EncodeInput("\&"); |
176 | | - $hAt = &EncodeInput("\@"); |
177 | | - $hDollar = &EncodeInput("\$"); |
178 | | - $hBrO = &EncodeInput("\("); |
179 | | - $hBrC = &EncodeInput("\)"); |
180 | | - $hSemi = &EncodeInput("\;"); |
181 | | - $hIs = &EncodeInput("\="); |
182 | | - $hLt = &EncodeInput("\<"); |
183 | | - $hGt = &EncodeInput("\>"); |
184 | | -} |
185 | | - |
186 | 282 | sub InitFiles { |
187 | 283 | print "\nInput: Script file $file_in\n"; |
188 | 284 | |
— | — | @@ -190,7 +286,7 @@ |
191 | 287 | # 1.10 dot ignore dots in folder names -> |
192 | 288 | $file =~ s/\.[^\\\/\.]*$//; # remove extension |
193 | 289 | $file_name = $file; |
194 | | - $file_bitmap = $file . "." . $fmt; |
| 290 | + $file_bitmap = $file . "." . $image_file_fmt; |
195 | 291 | $file_vector = $file . ".svg"; |
196 | 292 | $file_png = $file . ".png"; |
197 | 293 | $file_htmlmap = $file . ".map"; |
— | — | @@ -220,28 +316,28 @@ |
221 | 317 | $env = ""; |
222 | 318 | |
223 | 319 | # $dir = cwd() ; # is there a better way to detect OS? |
224 | | - # if ($dir =~ /\//) { $env = "Linux" ; $fmt = "png" ; $pathseparator = "/";} |
225 | | - # if ($dir =~ /\\/) { $env = "Windows" ; $fmt = "gif" ; $pathseparator = "\\";} |
| 320 | + # if ($dir =~ /\//) { $env = "Linux" ; $image_file_fmt = "png" ; $pathseparator = "/";} |
| 321 | + # if ($dir =~ /\\/) { $env = "Windows" ; $image_file_fmt = "gif" ; $pathseparator = "\\";} |
226 | 322 | # cwd always to returns '/'s ? -> |
227 | | - $OS = $^O; |
228 | | - if ($OS =~ /darwin/i) { |
229 | | - $env = "Linux"; |
230 | | - $fmt = "png"; |
231 | | - $pathseparator = "/"; |
| 323 | + if ($OSNAME =~ /darwin/i) { |
| 324 | + $env = "Linux"; |
| 325 | + $image_file_fmt = "png"; |
| 326 | + $pathseparator = "/"; |
232 | 327 | } |
233 | | - elsif ($OS =~ /win/i) { |
234 | | - $env = "Windows"; |
235 | | - $fmt = "gif"; |
236 | | - $pathseparator = "\\"; |
| 328 | + elsif ($OSNAME =~ /win/i) { |
| 329 | + $env = "Windows"; |
| 330 | + $image_file_fmt = "gif"; |
| 331 | + $pathseparator = "\\"; |
237 | 332 | } |
238 | | - else { $env = "Linux"; $fmt = "png"; $pathseparator = "/"; } |
| 333 | + else { $env = "Linux"; $image_file_fmt = "png"; $pathseparator = "/"; } |
239 | 334 | |
240 | 335 | if ($env ne "") { |
241 | | - print "\nOS $env detected -> create image in $fmt format.\n"; |
| 336 | + print |
| 337 | + "\nOS $env detected -> create image in $image_file_fmt format.\n"; |
242 | 338 | } |
243 | 339 | else { |
244 | 340 | print |
245 | | - "\nOS not detected. Assuming Windows -> create image in $fmt format.\n"; |
| 341 | + "\nOS not detected. Assuming Windows -> create image in $image_file_fmt format.\n"; |
246 | 342 | $env = "Windows"; |
247 | 343 | } |
248 | 344 | } |
— | — | @@ -337,7 +433,7 @@ |
338 | 434 | ) |
339 | 435 | { |
340 | 436 | my @attributes = split(" ", $value); |
341 | | - foreach $attribute (@attributes) { |
| 437 | + foreach my $attribute (@attributes) { |
342 | 438 | my ($attrname, $attrvalue) = split("\:", $attribute); |
343 | 439 | if ( |
344 | 440 | !( |
— | — | @@ -395,24 +491,31 @@ |
396 | 492 | } |
397 | 493 | |
398 | 494 | sub GetLine { |
399 | | - if ($#lines < 0) { $InputParsed = $true; return (""); } |
| 495 | + if ($#lines < 0) { |
| 496 | + $InputParsed = $true; |
| 497 | + return (""); |
| 498 | + } |
400 | 499 | |
401 | 500 | # running in Wikipedia context and first line empty ? |
402 | 501 | # skip first line without incrementing line count |
403 | 502 | # this is part behind <timeline> and will not be thought of as line 1 |
404 | | - if (defined @options{"A"}) { |
405 | | - if (($#lines >= 0) && (@lines[0] =~ /^\s*$/)) { |
| 503 | + if (defined $options{"A"}) { |
| 504 | + if (($#lines >= 0) && ($lines[0] =~ /^\s*$/)) { |
406 | 505 | $Line = shift(@lines); |
407 | 506 | } |
408 | 507 | } |
409 | 508 | |
| 509 | + my $commentstart; |
| 510 | + |
410 | 511 | $Line = ""; |
411 | 512 | while (($#lines >= 0) && ($Line =~ /^\s*$/)) { |
412 | 513 | $LineNo++; |
413 | 514 | $Line = shift(@lines); |
414 | 515 | chomp($Line); |
415 | 516 | |
416 | | - if ($listinput) { print "$LineNo: " . &DecodeInput($Line) . "\n"; } |
| 517 | + if ($listinput) { |
| 518 | + print "$LineNo: " . &DecodeInput($Line) . "\n"; |
| 519 | + } |
417 | 520 | |
418 | 521 | # preserve '#' within double quotes |
419 | 522 | $Line =~ s/(\"[^\"]*\")/$a=$1,$a=~s^\#^\%\?\+^g,$a/ge; |
— | — | @@ -473,7 +576,7 @@ |
474 | 577 | } |
475 | 578 | |
476 | 579 | if ($Command =~ /^[^\s]/) { |
477 | | - $line = $Command; |
| 580 | + my $line = $Command; |
478 | 581 | $line =~ s/^.*$hIs\s*//; |
479 | 582 | &CollectAttributes($line); |
480 | 583 | } |
— | — | @@ -503,12 +606,10 @@ |
504 | 607 | sub CollectAttributes { |
505 | 608 | my $line = shift; |
506 | 609 | |
507 | | - $line =~ s/(\slink\:[^\s\:]*)\:/$1'colon'/i |
508 | | - ; # replace colon (:), would conflict with syntax |
509 | | - $line =~ s/(\stext\:[^\s\:]*)\:/$1'colon'/i |
510 | | - ; # replace colon (:), would conflict with syntax |
511 | | - $line =~ s/(https?)\:/$1'colon'/i |
512 | | - ; # replace colon (:), would conflict with syntax |
| 610 | + # replace colon (:), would conflict with syntax |
| 611 | + $line =~ s/(\slink\:[^\s\:]*)\:/$1'colon'/i; |
| 612 | + $line =~ s/(\stext\:[^\s\:]*)\:/$1'colon'/i; |
| 613 | + $line =~ s/(https?)\:/$1'colon'/i; |
513 | 614 | |
514 | 615 | my $text; |
515 | 616 | ($line, $text) = &ExtractText($line); |
— | — | @@ -517,10 +618,10 @@ |
518 | 619 | $line =~ s/( $hBrO .+? $hBrC )/&RemoveSpaces($1)/gxe; |
519 | 620 | $line =~ s/\s*\:\s*/:/g; |
520 | 621 | $line =~ s/([a-zA-Z0-9\_]+)\:/lc($1) . ":"/gxe; |
521 | | - @Fields = split(" ", $line); |
| 622 | + my @Fields = split(" ", $line); |
522 | 623 | |
523 | | - $name = ""; |
524 | | - foreach $field (@Fields) { |
| 624 | + my ($name, $value); |
| 625 | + foreach my $field (@Fields) { |
525 | 626 | if ($field =~ /\:/) { |
526 | 627 | ($name, $value) = split(":", $field); |
527 | 628 | $name =~ s/^\s*(.*)\s*$/lc($1)/gxe; |
— | — | @@ -546,29 +647,29 @@ |
547 | 648 | ); |
548 | 649 | } |
549 | 650 | } |
550 | | - else { @Attributes{$name} = $value; } |
| 651 | + else { $Attributes{$name} = $value; } |
551 | 652 | } |
552 | 653 | else { |
553 | | - if (defined(@Attributes{"single"})) { |
| 654 | + if (defined($Attributes{"single"})) { |
554 | 655 | &Error( |
555 | 656 | "Invalid attribute '$field' ignored.\nSpecify attributes as 'name:value' pair(s)." |
556 | 657 | ); |
557 | 658 | } |
558 | 659 | else { |
559 | 660 | $field =~ s/^\s*(.*)\s*$/$1/gxe; |
560 | | - @Attributes{"single"} = $field; |
| 661 | + $Attributes{"single"} = $field; |
561 | 662 | } |
562 | 663 | } |
563 | 664 | } |
564 | | - if (($name ne "") && (@Attributes{"single"} ne "")) { |
| 665 | + if (($name ne "") && ($Attributes{"single"} ne "")) { |
565 | 666 | &Error( "Invalid attribute '" |
566 | | - . @Attributes{"single"} |
| 667 | + . $Attributes{"single"} |
567 | 668 | . "' ignored.\nSpecify attributes as 'name:value' pairs."); |
568 | | - delete(@Attributes{"single"}); |
| 669 | + delete($Attributes{"single"}); |
569 | 670 | } |
570 | 671 | |
571 | 672 | if ((defined($text)) && ($text ne "")) { |
572 | | - @Attributes{"text"} = &ParseText($text); |
| 673 | + $Attributes{"text"} = &ParseText($text); |
573 | 674 | } |
574 | 675 | } |
575 | 676 | |
— | — | @@ -576,7 +677,7 @@ |
577 | 678 | my $command = shift; |
578 | 679 | my $const = shift; |
579 | 680 | $const = lc($const); |
580 | | - my $value = @Consts{ lc($const) }; |
| 681 | + my $value = $Consts{ lc($const) }; |
581 | 682 | if (!defined($value)) { |
582 | 683 | &Error("Unknown constant. 'Define $const = ... ' expected."); |
583 | 684 | return ($const); |
— | — | @@ -587,7 +688,7 @@ |
588 | 689 | sub ParseAlignBars { |
589 | 690 | &CheckPreset("AlignBars"); |
590 | 691 | |
591 | | - $align = @Attributes{"single"}; |
| 692 | + my $align = $Attributes{"single"}; |
592 | 693 | if (!($align =~ /^(?:justify|early|late)$/i)) { |
593 | 694 | &Error( |
594 | 695 | "AlignBars value '$align' invalid. Specify 'justify', 'early' or 'late'." |
— | — | @@ -599,16 +700,19 @@ |
600 | 701 | } |
601 | 702 | |
602 | 703 | sub ParseBackgroundColors { |
603 | | - if (!&ValidAttributes("BackgroundColors")) { &GetData; next; } |
| 704 | + if (!&ValidAttributes("BackgroundColors")) { |
| 705 | + &GetData; |
| 706 | + next; |
| 707 | + } |
604 | 708 | |
605 | 709 | &CheckPreset("BackGroundColors"); |
606 | 710 | |
607 | | - foreach $attribute (keys %Attributes) { |
608 | | - my $attrvalue = @Attributes{$attribute}; |
| 711 | + foreach my $attribute (keys %Attributes) { |
| 712 | + my $attrvalue = $Attributes{$attribute}; |
609 | 713 | |
610 | 714 | if ($attribute =~ /Canvas/i) { |
611 | 715 | if (!&ColorPredefined($attrvalue)) { |
612 | | - if (!defined(@Colors{ lc($attrvalue) })) { |
| 716 | + if (!defined($Colors{ lc($attrvalue) })) { |
613 | 717 | &Error( |
614 | 718 | "BackgroundColors definition invalid. Attribute '$attribute': unknown color '$attrvalue'.\n" |
615 | 719 | . " Specify command 'Color' before this command." |
— | — | @@ -616,20 +720,22 @@ |
617 | 721 | return; |
618 | 722 | } |
619 | 723 | } |
620 | | - if (defined(@Colors{ lc($attrvalue) })) { |
621 | | - @Attributes{"canvas"} = @Colors{ lc($attrvalue) }; |
| 724 | + if (defined($Colors{ lc($attrvalue) })) { |
| 725 | + $Attributes{"canvas"} = $Colors{ lc($attrvalue) }; |
622 | 726 | } |
623 | | - else { @Attributes{"canvas"} = lc($attrvalue); } |
| 727 | + else { |
| 728 | + $Attributes{"canvas"} = lc($attrvalue); |
| 729 | + } |
624 | 730 | } |
625 | 731 | elsif ($attribute =~ /Bars/i) { |
626 | | - if (!defined(@Colors{ lc($attrvalue) })) { |
| 732 | + if (!defined($Colors{ lc($attrvalue) })) { |
627 | 733 | &Error( |
628 | 734 | "BackgroundColors definition invalid. Attribute '$attribute' unknown color '$attrvalue'.\n" |
629 | 735 | . " Specify command 'Color' before this command."); |
630 | 736 | return; |
631 | 737 | } |
632 | 738 | |
633 | | - @Attributes{"bars"} = lc($attrvalue); |
| 739 | + $Attributes{"bars"} = lc($attrvalue); |
634 | 740 | } |
635 | 741 | } |
636 | 742 | |
— | — | @@ -656,12 +762,13 @@ |
657 | 763 | $hint = ""; |
658 | 764 | $barset = ""; # $barcount = "" ; |
659 | 765 | |
660 | | - my $data2 = $data; |
| 766 | + # warn "data: $data"; |
| 767 | + my $data2; # = $data; |
661 | 768 | ($data2, $text) = &ExtractText($data2); |
662 | 769 | @Attributes = split(" ", $data2); |
663 | 770 | |
664 | | - foreach $attribute (keys %Attributes) { |
665 | | - my $attrvalue = @Attributes{$attribute}; |
| 771 | + foreach my $attribute (keys %Attributes) { |
| 772 | + my $attrvalue = $Attributes{$attribute}; |
666 | 773 | |
667 | 774 | if ($attribute =~ /^Bar$/i) { |
668 | 775 | $bar = $attrvalue; |
— | — | @@ -761,13 +868,13 @@ |
762 | 869 | } |
763 | 870 | |
764 | 871 | if ($bar ne "") { |
765 | | - if (@Axis{"time"} eq "x") { push @Bars, $bar; } |
| 872 | + if ($Axis{"time"} eq "x") { push @Bars, $bar; } |
766 | 873 | else { unshift @Bars, $bar; } |
767 | 874 | |
768 | | - if ($text ne "") { @BarLegend{ lc($bar) } = $text; } |
769 | | - else { @BarLegend{ lc($bar) } = " "; } |
| 875 | + if ($text ne "") { $BarLegend{ lc($bar) } = $text; } |
| 876 | + else { $BarLegend{ lc($bar) } = " "; } |
770 | 877 | |
771 | | - if ($link ne "") { @BarLink{ lc($bar) } = $link; } |
| 878 | + if ($link ne "") { $BarLink{ lc($bar) } = $link; } |
772 | 879 | } |
773 | 880 | else { |
774 | 881 | |
— | — | @@ -776,11 +883,11 @@ |
777 | 884 | # $bar = $barset . "#" . $b ; |
778 | 885 | |
779 | 886 | $bar = $barset . "#1"; |
780 | | - if (@Axis{"time"} eq "x") { push @Bars, $bar; } |
| 887 | + if ($Axis{"time"} eq "x") { push @Bars, $bar; } |
781 | 888 | else { unshift @Bars, $bar; } |
782 | 889 | |
783 | | - if ($text ne "") { @BarLegend{ lc($bar) } = $text . " - " . $b; } |
784 | | - else { @BarLegend{ lc($bar) } = " "; } |
| 890 | + if ($text ne "") { $BarLegend{ lc($bar) } = $text . " - " . $b; } |
| 891 | + else { $BarLegend{ lc($bar) } = " "; } |
785 | 892 | |
786 | 893 | # } |
787 | 894 | } |
— | — | @@ -790,6 +897,7 @@ |
791 | 898 | } |
792 | 899 | |
793 | 900 | sub ParseColors { |
| 901 | + my $colorname; |
794 | 902 | |
795 | 903 | &GetData; |
796 | 904 | if ($NoData) { |
— | — | @@ -809,8 +917,8 @@ |
810 | 918 | my $legendvalue = ""; |
811 | 919 | my $colorvalue = ""; |
812 | 920 | |
813 | | - foreach $attribute (keys %Attributes) { |
814 | | - my $attrvalue = @Attributes{$attribute}; |
| 921 | + foreach my $attribute (keys %Attributes) { |
| 922 | + my $attrvalue = $Attributes{$attribute}; |
815 | 923 | |
816 | 924 | if ($attribute =~ /Id/i) { |
817 | 925 | $colorname = $attrvalue; |
— | — | @@ -924,19 +1032,19 @@ |
925 | 1033 | my $colorname = shift; |
926 | 1034 | my $colorvalue = shift; |
927 | 1035 | my $legendvalue = shift; |
928 | | - if (defined(@Colors{ lc($colorname) })) { |
| 1036 | + if (defined($Colors{ lc($colorname) })) { |
929 | 1037 | &Warning("Color '$colorname' redefined."); |
930 | 1038 | } |
931 | | - @Colors{ lc($colorname) } = lc($colorvalue); |
| 1039 | + $Colors{ lc($colorname) } = lc($colorvalue); |
932 | 1040 | if ((defined($legendvalue)) && ($legendvalue ne "")) { |
933 | | - @ColorLabels{ lc($colorname) } = $legendvalue; |
| 1041 | + $ColorLabels{ lc($colorname) } = $legendvalue; |
934 | 1042 | } |
935 | 1043 | } |
936 | 1044 | |
937 | 1045 | sub ParseDateFormat { |
938 | 1046 | &CheckPreset("DateFormat"); |
939 | 1047 | |
940 | | - my $datevalue = lc(@Attributes{"single"}); |
| 1048 | + my $datevalue = lc($Attributes{"single"}); |
941 | 1049 | $datevalue =~ s/\s//g; |
942 | 1050 | $datevalue = lc($datevalue); |
943 | 1051 | if ( ($datevalue ne "dd/mm/yyyy") |
— | — | @@ -974,7 +1082,7 @@ |
975 | 1083 | } |
976 | 1084 | |
977 | 1085 | $value =~ s/($hDollar[a-zA-Z0-9]+)/&GetDefine($command,$1)/ge; |
978 | | - @Consts{ lc($name) } = $value; |
| 1086 | + $Consts{ lc($name) } = $value; |
979 | 1087 | } |
980 | 1088 | |
981 | 1089 | sub ParseLineData { |
— | — | @@ -986,7 +1094,7 @@ |
987 | 1095 | return; |
988 | 1096 | } |
989 | 1097 | |
990 | | - if ((!(defined($DateFormat))) || (!(defined(@Period{"from"})))) { |
| 1098 | + if ((!(defined($DateFormat))) || (!(defined($Period{"from"})))) { |
991 | 1099 | if (!(defined($DateFormat))) { |
992 | 1100 | &Error( |
993 | 1101 | "LineData invalid. No (valid) command 'DateFormat' specified in previous lines." |
— | — | @@ -1011,7 +1119,8 @@ |
1012 | 1120 | $layer = "front"; |
1013 | 1121 | $width = 2.0; |
1014 | 1122 | |
1015 | | - my $data2 = $data; |
| 1123 | + # warn "data: $data"; |
| 1124 | + my $data2; # = $data; |
1016 | 1125 | |
1017 | 1126 | LineData: |
1018 | 1127 | while ((!$InputParsed) && (!$NoData)) { |
— | — | @@ -1027,26 +1136,26 @@ |
1028 | 1137 | |
1029 | 1138 | if (!&ValidAttributes("LineData")) { &GetData; next; } |
1030 | 1139 | |
1031 | | - if (defined(@LineDefs{"color"})) { $color = @LineDefs{"color"}; } |
1032 | | - if (defined(@LineDefs{"layer"})) { $layer = @LineDefs{"layer"}; } |
1033 | | - if (defined(@LineDefs{"width"})) { $width = @LineDefs{"width"}; } |
1034 | | - if (defined(@LineDefs{"frompos"})) { |
1035 | | - $frompos = @LineDefs{"frompos"}; |
| 1140 | + if (defined($LineDefs{"color"})) { $color = $LineDefs{"color"}; } |
| 1141 | + if (defined($LineDefs{"layer"})) { $layer = $LineDefs{"layer"}; } |
| 1142 | + if (defined($LineDefs{"width"})) { $width = $LineDefs{"width"}; } |
| 1143 | + if (defined($LineDefs{"frompos"})) { |
| 1144 | + $frompos = $LineDefs{"frompos"}; |
1036 | 1145 | } |
1037 | | - if (defined(@LineDefs{"tillpos"})) { |
1038 | | - $tillpos = @LineDefs{"tillpos"}; |
| 1146 | + if (defined($LineDefs{"tillpos"})) { |
| 1147 | + $tillpos = $LineDefs{"tillpos"}; |
1039 | 1148 | } |
1040 | | - if (defined(@LineDefs{"atpos"})) { $atpos = @LineDefs{"atpos"}; } |
| 1149 | + if (defined($LineDefs{"atpos"})) { $atpos = $LineDefs{"atpos"}; } |
1041 | 1150 | |
1042 | | - foreach $attribute (keys %Attributes) { |
1043 | | - my $attrvalue = @Attributes{$attribute}; |
| 1151 | + foreach my $attribute (keys %Attributes) { |
| 1152 | + my $attrvalue = $Attributes{$attribute}; |
1044 | 1153 | |
1045 | 1154 | if ($attribute =~ /^(?:At|From|Till)$/i) { |
1046 | 1155 | if ($attrvalue =~ /^Start$/i) { |
1047 | | - $attrvalue = @Period{"from"}; |
| 1156 | + $attrvalue = $Period{"from"}; |
1048 | 1157 | } |
1049 | 1158 | |
1050 | | - if ($attrvalue =~ /^End$/i) { $attrvalue = @Period{"till"}; } |
| 1159 | + if ($attrvalue =~ /^End$/i) { $attrvalue = $Period{"till"}; } |
1051 | 1160 | |
1052 | 1161 | if (!&ValidDateFormat($attrvalue)) { |
1053 | 1162 | &Error( "LineData attribute '$attribute' invalid.\n" |
— | — | @@ -1101,7 +1210,7 @@ |
1102 | 1211 | } |
1103 | 1212 | elsif ($attribute =~ /Color/i) { |
1104 | 1213 | if ( (!&ColorPredefined($attrvalue)) |
1105 | | - && (!defined(@Colors{ lc($attrvalue) }))) |
| 1214 | + && (!defined($Colors{ lc($attrvalue) }))) |
1106 | 1215 | { |
1107 | 1216 | &Error( |
1108 | 1217 | "LineData attribute '$attribute' invalid. Unknown color '$attrvalue'.\n" |
— | — | @@ -1112,7 +1221,7 @@ |
1113 | 1222 | } |
1114 | 1223 | |
1115 | 1224 | if (!&ColorPredefined($attrvalue)) { |
1116 | | - $attrvalue = @Colors{ lc($attrvalue) }; |
| 1225 | + $attrvalue = $Colors{ lc($attrvalue) }; |
1117 | 1226 | } |
1118 | 1227 | |
1119 | 1228 | $color = $attrvalue; |
— | — | @@ -1168,12 +1277,12 @@ |
1169 | 1278 | && ($till eq "") |
1170 | 1279 | && ($points eq "")) # upd defaults |
1171 | 1280 | { |
1172 | | - if ($color ne "") { @LineDefs{"color"} = $color; } |
1173 | | - if ($layer ne "") { @LineDefs{"layer"} = $layer; } |
1174 | | - if ($width ne "") { @LineDefs{"width"} = $width; } |
1175 | | - if ($atpos ne "") { @LineDefs{"atpos"} = $atpos; } |
1176 | | - if ($frompos ne "") { @LineDefs{"frompos"} = $frompos; } |
1177 | | - if ($tillpos ne "") { @LineDefs{"tillpos"} = $tillpos; } |
| 1281 | + if ($color ne "") { $LineDefs{"color"} = $color; } |
| 1282 | + if ($layer ne "") { $LineDefs{"layer"} = $layer; } |
| 1283 | + if ($width ne "") { $LineDefs{"width"} = $width; } |
| 1284 | + if ($atpos ne "") { $LineDefs{"atpos"} = $atpos; } |
| 1285 | + if ($frompos ne "") { $LineDefs{"frompos"} = $frompos; } |
| 1286 | + if ($tillpos ne "") { $LineDefs{"tillpos"} = $tillpos; } |
1178 | 1287 | } |
1179 | 1288 | |
1180 | 1289 | if ($layer eq "") { $layer = "back"; } |
— | — | @@ -1247,8 +1356,8 @@ |
1248 | 1357 | |
1249 | 1358 | &CheckPreset("ImageSize"); |
1250 | 1359 | |
1251 | | - foreach $attribute (keys %Attributes) { |
1252 | | - my $attrvalue = @Attributes{$attribute}; |
| 1360 | + foreach my $attribute (keys %Attributes) { |
| 1361 | + my $attrvalue = $Attributes{$attribute}; |
1253 | 1362 | |
1254 | 1363 | if ($attribute =~ /Width|Height/i) { |
1255 | 1364 | if ($attrvalue !~ /auto/i) { |
— | — | @@ -1269,19 +1378,19 @@ |
1270 | 1379 | return; |
1271 | 1380 | } |
1272 | 1381 | |
1273 | | - @Attributes{"barinc"} = $attrvalue; |
| 1382 | + $Attributes{"barinc"} = $attrvalue; |
1274 | 1383 | } |
1275 | 1384 | |
1276 | 1385 | # if ($attribute =~ /Width/i) |
1277 | | - # { @Attributes {"width"} = $attrvalue ; } |
| 1386 | + # { $Attributes{"width"} = $attrvalue ; } |
1278 | 1387 | # elsif ($attribute =~ /Height/i) |
1279 | | - # { @Attributes {"height"} = $attrvalue ; } |
| 1388 | + # { $Attributes{"height"} = $attrvalue ; } |
1280 | 1389 | } |
1281 | 1390 | |
1282 | | - if ( (@Attributes{"width"} =~ /auto/i) |
1283 | | - || (@Attributes{"height"} =~ /auto/i)) |
| 1391 | + if ( ($Attributes{"width"} =~ /auto/i) |
| 1392 | + || ($Attributes{"height"} =~ /auto/i)) |
1284 | 1393 | { |
1285 | | - if (@Attributes{"barinc"} eq "") { |
| 1394 | + if ($Attributes{"barinc"} eq "") { |
1286 | 1395 | &Error( "ImageSize attribute 'barincrement' missing.\n" |
1287 | 1396 | . "Automatic determination of image width or height implies specification of this attribute" |
1288 | 1397 | ); |
— | — | @@ -1289,10 +1398,10 @@ |
1290 | 1399 | } |
1291 | 1400 | } |
1292 | 1401 | |
1293 | | - if ( (@Attributes{"width"} !~ /auto/i) |
1294 | | - && (@Attributes{"height"} !~ /auto/i)) |
| 1402 | + if ( ($Attributes{"width"} !~ /auto/i) |
| 1403 | + && ($Attributes{"height"} !~ /auto/i)) |
1295 | 1404 | { |
1296 | | - if (@Attributes{"barinc"} ne "") { |
| 1405 | + if ($Attributes{"barinc"} ne "") { |
1297 | 1406 | &Error( "ImageSize attribute 'barincrement' not valid now.\n" |
1298 | 1407 | . "This attribute is only valid (and mandatory) in combination with 'width:auto' or 'height:auto'" |
1299 | 1408 | ); |
— | — | @@ -1308,8 +1417,8 @@ |
1309 | 1418 | |
1310 | 1419 | &CheckPreset("Legend"); |
1311 | 1420 | |
1312 | | - foreach $attribute (keys %Attributes) { |
1313 | | - my $attrvalue = @Attributes{$attribute}; |
| 1421 | + foreach my $attribute (keys %Attributes) { |
| 1422 | + my $attrvalue = $Attributes{$attribute}; |
1314 | 1423 | |
1315 | 1424 | if ($attribute =~ /Columns/i) { |
1316 | 1425 | if (($attrvalue < 1) || ($attrvalue > 4)) { |
— | — | @@ -1326,7 +1435,7 @@ |
1327 | 1436 | return; |
1328 | 1437 | } |
1329 | 1438 | |
1330 | | - @Attributes{"orientation"} = substr($attrvalue, 0, 3); |
| 1439 | + $Attributes{"orientation"} = substr($attrvalue, 0, 3); |
1331 | 1440 | } |
1332 | 1441 | elsif ($attribute =~ /Position/i) { |
1333 | 1442 | if (!($attrvalue =~ /^(?:top|bottom|right)$/i)) { |
— | — | @@ -1362,8 +1471,8 @@ |
1363 | 1472 | } |
1364 | 1473 | } |
1365 | 1474 | |
1366 | | - if (defined(@Attributes{"position"})) { |
1367 | | - if (defined(@Attributes{"left"})) { |
| 1475 | + if (defined($Attributes{"position"})) { |
| 1476 | + if (defined($Attributes{"left"})) { |
1368 | 1477 | &Error( |
1369 | 1478 | "Legend definition invalid. Attributes 'position' and 'left' are mutually exclusive." |
1370 | 1479 | ); |
— | — | @@ -1371,15 +1480,15 @@ |
1372 | 1481 | } |
1373 | 1482 | } |
1374 | 1483 | else { |
1375 | | - if ((!defined(@Attributes{"left"})) && (!defined(@Attributes{"top"}))) |
| 1484 | + if ((!defined($Attributes{"left"})) && (!defined($Attributes{"top"}))) |
1376 | 1485 | { |
1377 | 1486 | &Info( |
1378 | 1487 | "Legend definition: none of attributes 'position', 'left' or 'top' have been defined. Position 'bottom' assumed." |
1379 | 1488 | ); |
1380 | | - @Attributes{"position"} = "bottom"; |
| 1489 | + $Attributes{"position"} = "bottom"; |
1381 | 1490 | } |
1382 | | - elsif ((!defined(@Attributes{"left"})) |
1383 | | - || (!defined(@Attributes{"top"}))) |
| 1491 | + elsif ((!defined($Attributes{"left"})) |
| 1492 | + || (!defined($Attributes{"top"}))) |
1384 | 1493 | { |
1385 | 1494 | &Error( |
1386 | 1495 | "Legend definition invalid. Specify 'position', or 'left' & 'top'." |
— | — | @@ -1388,14 +1497,14 @@ |
1389 | 1498 | } |
1390 | 1499 | } |
1391 | 1500 | |
1392 | | - if (@Attributes{"position"} =~ /right/i) { |
1393 | | - if (defined(@Attributes{"columns"})) { |
| 1501 | + if ($Attributes{"position"} =~ /right/i) { |
| 1502 | + if (defined($Attributes{"columns"})) { |
1394 | 1503 | &Error( |
1395 | 1504 | "Legend definition invalid.\nAttribute 'columns' and 'position:right' are mutually exclusive." |
1396 | 1505 | ); |
1397 | 1506 | return; |
1398 | 1507 | } |
1399 | | - if (defined(@Attributes{"columnwidth"})) { |
| 1508 | + if (defined($Attributes{"columnwidth"})) { |
1400 | 1509 | &Error( |
1401 | 1510 | "Legend definition invalid.\nAttribute 'columnwidth' and 'position:right' are mutually exclusive." |
1402 | 1511 | ); |
— | — | @@ -1403,20 +1512,20 @@ |
1404 | 1513 | } |
1405 | 1514 | } |
1406 | 1515 | |
1407 | | - if (@Attributes{"orientation"} =~ /hor/i) { |
1408 | | - if (@Attributes{"position"} =~ /right/i) { |
| 1516 | + if ($Attributes{"orientation"} =~ /hor/i) { |
| 1517 | + if ($Attributes{"position"} =~ /right/i) { |
1409 | 1518 | &Error( |
1410 | 1519 | "Legend definition invalid.\n'position:right' and 'orientation:horizontal' are mutually exclusive." |
1411 | 1520 | ); |
1412 | 1521 | return; |
1413 | 1522 | } |
1414 | | - if (defined(@Attributes{"columns"})) { |
| 1523 | + if (defined($Attributes{"columns"})) { |
1415 | 1524 | &Error( |
1416 | 1525 | "Legend definition invalid.\nAttribute 'columns' and 'orientation:horizontal' are mutually exclusive." |
1417 | 1526 | ); |
1418 | 1527 | return; |
1419 | 1528 | } |
1420 | | - if (defined(@Attributes{"columnwidth"})) { |
| 1529 | + if (defined($Attributes{"columnwidth"})) { |
1421 | 1530 | &Error( |
1422 | 1531 | "Legend definition invalid.\nAttribute 'columnwidth' and 'orientation:horizontal' are mutually exclusive." |
1423 | 1532 | ); |
— | — | @@ -1424,8 +1533,8 @@ |
1425 | 1534 | } |
1426 | 1535 | } |
1427 | 1536 | |
1428 | | - if ( (@Attributes{"orientation"} =~ /hor/i) |
1429 | | - && (defined(@Attributes{"columns"}))) |
| 1537 | + if ( ($Attributes{"orientation"} =~ /hor/i) |
| 1538 | + && (defined($Attributes{"columns"}))) |
1430 | 1539 | { |
1431 | 1540 | &Error( |
1432 | 1541 | "Legend definition invalid.\nDo not specify attribute 'columns' with 'orientation:horizontal'." |
— | — | @@ -1433,9 +1542,9 @@ |
1434 | 1543 | return; |
1435 | 1544 | } |
1436 | 1545 | |
1437 | | - if (@Attributes{"columns"} > 1) { |
1438 | | - if ( (defined(@Attributes{"left"})) |
1439 | | - && (!defined(@Attributes{"columnwidth"}))) |
| 1546 | + if ($Attributes{"columns"} > 1) { |
| 1547 | + if ( (defined($Attributes{"left"})) |
| 1548 | + && (!defined($Attributes{"columnwidth"}))) |
1440 | 1549 | { |
1441 | 1550 | &Error( |
1442 | 1551 | "Legend attribute 'columnwidth' not defined.\nThis is needed when attribute 'left' is specified." |
— | — | @@ -1444,8 +1553,8 @@ |
1445 | 1554 | } |
1446 | 1555 | } |
1447 | 1556 | |
1448 | | - if (!defined(@Attributes{"orientation"})) { |
1449 | | - @Attributes{"orientation"} = "ver"; |
| 1557 | + if (!defined($Attributes{"orientation"})) { |
| 1558 | + $Attributes{"orientation"} = "ver"; |
1450 | 1559 | } |
1451 | 1560 | |
1452 | 1561 | %Legend = %Attributes; |
— | — | @@ -1461,8 +1570,8 @@ |
1462 | 1571 | |
1463 | 1572 | if (!ValidAttributes("Period")) { return; } |
1464 | 1573 | |
1465 | | - foreach $attribute (keys %Attributes) { |
1466 | | - my $attrvalue = @Attributes{$attribute}; |
| 1574 | + foreach my $attribute (keys %Attributes) { |
| 1575 | + my $attrvalue = $Attributes{$attribute}; |
1467 | 1576 | |
1468 | 1577 | if ($DateFormat eq "yyyy") { |
1469 | 1578 | if ($attrvalue !~ /^\-?\d+$/) { |
— | — | @@ -1496,8 +1605,7 @@ |
1497 | 1606 | } |
1498 | 1607 | } |
1499 | 1608 | |
1500 | | - $ValidDate = &ValidDateFormat($attrvalue); |
1501 | | - if (!$ValidDate) { |
| 1609 | + if (!&ValidDateFormat($attrvalue)) { |
1502 | 1610 | &Error( "Period attribute '$attribute' invalid.\n" |
1503 | 1611 | . "Date does not conform to specified DateFormat '$DateFormat'." |
1504 | 1612 | ); |
— | — | @@ -1510,7 +1618,7 @@ |
1511 | 1619 | return; |
1512 | 1620 | } |
1513 | 1621 | |
1514 | | - @Attributes{$attribute} = $attrvalue; |
| 1622 | + $Attributes{$attribute} = $attrvalue; |
1515 | 1623 | } |
1516 | 1624 | } |
1517 | 1625 | |
— | — | @@ -1518,12 +1626,14 @@ |
1519 | 1627 | } |
1520 | 1628 | |
1521 | 1629 | sub ParsePlotArea { |
1522 | | - if (!&ValidAttributes("PlotArea")) { return; } |
| 1630 | + if (!&ValidAttributes("PlotArea")) { |
| 1631 | + return; |
| 1632 | + } |
1523 | 1633 | |
1524 | 1634 | &CheckPreset("PlotArea"); |
1525 | 1635 | |
1526 | | - foreach $attribute (@Attributes) { |
1527 | | - my $attrvalue = @Attributes{$attribute}; |
| 1636 | + foreach my $attribute (@Attributes) { |
| 1637 | + my $attrvalue = $Attributes{$attribute}; |
1528 | 1638 | if (!&ValidAbsRel($attrvalue)) { |
1529 | 1639 | &Error( "PlotArea attribute '$attribute' invalid.\n" |
1530 | 1640 | . "Specify value as x[.y][px, in, cm, %] examples: '200', '20px', '1.3in', '80%'" |
— | — | @@ -1532,28 +1642,28 @@ |
1533 | 1643 | } |
1534 | 1644 | } |
1535 | 1645 | |
1536 | | - if ((@Attributes{"top"} ne "") && (@Attributes{"height"} ne "")) { |
| 1646 | + if (($Attributes{"top"} ne "") && ($Attributes{"height"} ne "")) { |
1537 | 1647 | &Error( |
1538 | 1648 | "PlotArea attributes 'top' and 'height' are mutually exclusive. Specify only one of them." |
1539 | 1649 | ); |
1540 | 1650 | return; |
1541 | 1651 | } |
1542 | 1652 | |
1543 | | - if ((@Attributes{"right"} ne "") && (@Attributes{"width"} ne "")) { |
| 1653 | + if (($Attributes{"right"} ne "") && ($Attributes{"width"} ne "")) { |
1544 | 1654 | &Error( |
1545 | 1655 | "PlotArea attributes 'right' and 'width' are mutually exclusive. Specify only one of them." |
1546 | 1656 | ); |
1547 | 1657 | return; |
1548 | 1658 | } |
1549 | 1659 | |
1550 | | - if ((@Attributes{"top"} eq "") && (@Attributes{"height"} eq "")) { |
| 1660 | + if (($Attributes{"top"} eq "") && ($Attributes{"height"} eq "")) { |
1551 | 1661 | &Error( |
1552 | 1662 | "PlotArea definition incomplete. Either attribute 'top' (advised) or 'height' should be specified" |
1553 | 1663 | ); |
1554 | 1664 | return; |
1555 | 1665 | } |
1556 | 1666 | |
1557 | | - if ((@Attributes{"right"} eq "") && (@Attributes{"width"} eq "")) { |
| 1667 | + if (($Attributes{"right"} eq "") && ($Attributes{"width"} eq "")) { |
1558 | 1668 | &Error( |
1559 | 1669 | "PlotArea definition incomplete. Either attribute 'right' (advised) or 'width' should be specified" |
1560 | 1670 | ); |
— | — | @@ -1574,24 +1684,25 @@ |
1575 | 1685 | # | bar: |== 0 | - | assume | | |
1576 | 1686 | # | | assume bar:--- | | bar:--- | | |
1577 | 1687 | # | |== 1 | |
1578 | | -# | | assume @Bar[0] | |
| 1688 | +# | | assume $Bar[0] | |
1579 | 1689 | # | |> 1 | |
1580 | 1690 | # | | err | |
1581 | 1691 | sub ParsePlotData { |
1582 | | - if (defined(@Bars)) { $BarsCommandFound = $true; } |
1583 | | - else { $BarsCommandFound = $false; } |
1584 | | - $prevbar = ""; |
| 1692 | + my $attrvalue2; |
| 1693 | + my $BarsCommandFound = @Bars; |
| 1694 | + my $prevbar = ""; |
| 1695 | + my $barndx; |
1585 | 1696 | |
1586 | 1697 | if ( (!(defined($DateFormat))) |
1587 | | - || (@Period{"from"} eq "") |
1588 | | - || (@Axis{"time"} eq "")) |
| 1698 | + || ($Period{"from"} eq "") |
| 1699 | + || ($Axis{"time"} eq "")) |
1589 | 1700 | { |
1590 | 1701 | if (!(defined($DateFormat))) { |
1591 | 1702 | &Error( |
1592 | 1703 | "PlotData invalid. No (valid) command 'DateFormat' specified in previous lines." |
1593 | 1704 | ); |
1594 | 1705 | } |
1595 | | - elsif (@Period{"from"} eq "") { |
| 1706 | + elsif ($Period{"from"} eq "") { |
1596 | 1707 | &Error( |
1597 | 1708 | "PlotData invalid. No (valid) command 'Period' specified in previous lines." |
1598 | 1709 | ); |
— | — | @@ -1622,7 +1733,7 @@ |
1623 | 1734 | $mark, $markcolor, $link, $hint |
1624 | 1735 | ); |
1625 | 1736 | |
1626 | | - @PlotDefs{"anchor"} = "middle"; |
| 1737 | + $PlotDefs{"anchor"} = "middle"; |
1627 | 1738 | |
1628 | 1739 | PlotData: |
1629 | 1740 | while ((!$InputParsed) && (!$NoData)) { |
— | — | @@ -1650,34 +1761,34 @@ |
1651 | 1762 | |
1652 | 1763 | &CheckPreset("PlotData"); |
1653 | 1764 | |
1654 | | - if (defined(@PlotDefs{"bar"})) { $bar = @PlotDefs{"bar"}; } |
| 1765 | + if (defined($PlotDefs{"bar"})) { $bar = $PlotDefs{"bar"}; } |
1655 | 1766 | |
1656 | | - # if (defined (@PlotDefs {"barset"})) { $barset = @PlotDefs {"barset"} ; } |
1657 | | - if (defined(@PlotDefs{"color"})) { $color = @PlotDefs{"color"}; } |
1658 | | - if (defined(@PlotDefs{"bgcolor"})) { |
1659 | | - $bgcolor = @PlotDefs{"bgcolor"}; |
| 1767 | + # if (defined ($PlotDefs{"barset"})) { $barset = $PlotDefs{"barset"} ; } |
| 1768 | + if (defined($PlotDefs{"color"})) { $color = $PlotDefs{"color"}; } |
| 1769 | + if (defined($PlotDefs{"bgcolor"})) { |
| 1770 | + $bgcolor = $PlotDefs{"bgcolor"}; |
1660 | 1771 | } |
1661 | | - if (defined(@PlotDefs{"textcolor"})) { |
1662 | | - $textcolor = @PlotDefs{"textcolor"}; |
| 1772 | + if (defined($PlotDefs{"textcolor"})) { |
| 1773 | + $textcolor = $PlotDefs{"textcolor"}; |
1663 | 1774 | } |
1664 | | - if (defined(@PlotDefs{"fontsize"})) { |
1665 | | - $fontsize = @PlotDefs{"fontsize"}; |
| 1775 | + if (defined($PlotDefs{"fontsize"})) { |
| 1776 | + $fontsize = $PlotDefs{"fontsize"}; |
1666 | 1777 | } |
1667 | | - if (defined(@PlotDefs{"width"})) { $width = @PlotDefs{"width"}; } |
1668 | | - if (defined(@PlotDefs{"anchor"})) { $anchor = @PlotDefs{"anchor"}; } |
1669 | | - if (defined(@PlotDefs{"align"})) { $align = @PlotDefs{"align"}; } |
1670 | | - if (defined(@PlotDefs{"shiftx"})) { $shiftx = @PlotDefs{"shiftx"}; } |
1671 | | - if (defined(@PlotDefs{"shifty"})) { $shifty = @PlotDefs{"shifty"}; } |
1672 | | - if (defined(@PlotDefs{"mark"})) { $mark = @PlotDefs{"mark"}; } |
1673 | | - if (defined(@PlotDefs{"markcolor"})) { |
1674 | | - $markcolor = @PlotDefs{"markcolor"}; |
| 1778 | + if (defined($PlotDefs{"width"})) { $width = $PlotDefs{"width"}; } |
| 1779 | + if (defined($PlotDefs{"anchor"})) { $anchor = $PlotDefs{"anchor"}; } |
| 1780 | + if (defined($PlotDefs{"align"})) { $align = $PlotDefs{"align"}; } |
| 1781 | + if (defined($PlotDefs{"shiftx"})) { $shiftx = $PlotDefs{"shiftx"}; } |
| 1782 | + if (defined($PlotDefs{"shifty"})) { $shifty = $PlotDefs{"shifty"}; } |
| 1783 | + if (defined($PlotDefs{"mark"})) { $mark = $PlotDefs{"mark"}; } |
| 1784 | + if (defined($PlotDefs{"markcolor"})) { |
| 1785 | + $markcolor = $PlotDefs{"markcolor"}; |
1675 | 1786 | } |
1676 | 1787 | |
1677 | | - # if (defined (@PlotDefs {"link"})) { $link = @PlotDefs {"link"} ; } |
1678 | | - # if (defined (@PlotDefs {"hint"})) { $hint = @PlotDefs {"hint"} ; } |
| 1788 | + # if (defined ($PlotDefs{"link"})) { $link = $PlotDefs{"link"} ; } |
| 1789 | + # if (defined ($PlotDefs{"hint"})) { $hint = $PlotDefs{"hint"} ; } |
1679 | 1790 | |
1680 | | - foreach $attribute (keys %Attributes) { |
1681 | | - my $attrvalue = @Attributes{$attribute}; |
| 1791 | + foreach my $attribute (keys %Attributes) { |
| 1792 | + my $attrvalue = $Attributes{$attribute}; |
1682 | 1793 | |
1683 | 1794 | if ($attribute =~ /^Bar$/i) { |
1684 | 1795 | if (!($attrvalue =~ /[a-zA-Z0-9\_]+/)) { |
— | — | @@ -1701,8 +1812,12 @@ |
1702 | 1813 | } |
1703 | 1814 | else { |
1704 | 1815 | if (!&BarDefined($attrvalue2)) { |
1705 | | - if (@Axis{"time"} eq "x") { push @Bars, $attrvalue2; } |
1706 | | - else { unshift @Bars, $attrvalue2; } |
| 1816 | + if ($Axis{"time"} eq "x") { |
| 1817 | + push @Bars, $attrvalue2; |
| 1818 | + } |
| 1819 | + else { |
| 1820 | + unshift @Bars, $attrvalue2; |
| 1821 | + } |
1707 | 1822 | } |
1708 | 1823 | } |
1709 | 1824 | $bar = $attrvalue2; |
— | — | @@ -1719,7 +1834,9 @@ |
1720 | 1835 | |
1721 | 1836 | $attrvalue2 = $attrvalue; |
1722 | 1837 | |
1723 | | - if ($attrvalue =~ /break/i) { $barndx = 0; } |
| 1838 | + if ($attrvalue =~ /break/i) { |
| 1839 | + $barndx = 0; |
| 1840 | + } |
1724 | 1841 | elsif ($attrvalue =~ /skip/i) { |
1725 | 1842 | $barndx++; |
1726 | 1843 | &BarDefined($prevbar . "#" . $barndx); |
— | — | @@ -1741,9 +1858,9 @@ |
1742 | 1859 | } |
1743 | 1860 | elsif ($attribute =~ /^(?:At|From|Till)$/i) { |
1744 | 1861 | if ($attrvalue =~ /^Start$/i) { |
1745 | | - $attrvalue = @Period{"from"}; |
| 1862 | + $attrvalue = $Period{"from"}; |
1746 | 1863 | } |
1747 | | - if ($attrvalue =~ /^End$/i) { $attrvalue = @Period{"till"}; } |
| 1864 | + if ($attrvalue =~ /^End$/i) { $attrvalue = $Period{"till"}; } |
1748 | 1865 | |
1749 | 1866 | if (!&ValidDateFormat($attrvalue)) { |
1750 | 1867 | &Error( "PlotData attribute '$attribute' invalid.\n" |
— | — | @@ -1770,7 +1887,7 @@ |
1771 | 1888 | # elsif ($attribute =~ /^From$/i) |
1772 | 1889 | # { |
1773 | 1890 | # if ($attrvalue =~ /^Start$/i) |
1774 | | - # { $attrvalue = @Period {"from"} ; } |
| 1891 | + # { $attrvalue = $Period{"from"} ; } |
1775 | 1892 | |
1776 | 1893 | # if (! &ValidDateFormat ($attrvalue)) |
1777 | 1894 | # { &Error ("PlotData invalid.\nDate '$attrvalue' does not conform to specified DateFormat $DateFormat.") ; |
— | — | @@ -1786,7 +1903,7 @@ |
1787 | 1904 | # elsif ($attribute =~ /^Till$/i) |
1788 | 1905 | # { |
1789 | 1906 | # if ($attrvalue =~ /^End$/i) |
1790 | | - # { $attrvalue = @Period {"till"} ; } |
| 1907 | + # { $attrvalue = $Period{"till"} ; } |
1791 | 1908 | |
1792 | 1909 | # if (! &ValidDateFormat ($attrvalue)) |
1793 | 1910 | # { &Error ("PlotData invalid. Date '$attrvalue' does not conform to specified DateFormat $DateFormat.") ; |
— | — | @@ -1801,7 +1918,7 @@ |
1802 | 1919 | # } |
1803 | 1920 | elsif ($attribute =~ /^Color$/i) { |
1804 | 1921 | if (!&ColorPredefined($attrvalue)) { |
1805 | | - if (!defined(@Colors{ lc($attrvalue) })) { |
| 1922 | + if (!defined($Colors{ lc($attrvalue) })) { |
1806 | 1923 | &Error( |
1807 | 1924 | "PlotData invalid. Attribute '$attribute' has unknown color '$attrvalue'.\n" |
1808 | 1925 | . " Specify command 'Color' before this command." |
— | — | @@ -1810,8 +1927,8 @@ |
1811 | 1928 | next PlotData; |
1812 | 1929 | } |
1813 | 1930 | } |
1814 | | - if (defined(@Colors{ lc($attrvalue) })) { |
1815 | | - $color = @Colors{ lc($attrvalue) }; |
| 1931 | + if (defined($Colors{ lc($attrvalue) })) { |
| 1932 | + $color = $Colors{ lc($attrvalue) }; |
1816 | 1933 | } |
1817 | 1934 | else { $color = lc($attrvalue); } |
1818 | 1935 | |
— | — | @@ -1819,7 +1936,7 @@ |
1820 | 1937 | } |
1821 | 1938 | elsif ($attribute =~ /^BgColor$/i) { |
1822 | 1939 | if (!&ColorPredefined($attrvalue)) { |
1823 | | - if (!defined(@Colors{ lc($attrvalue) })) { |
| 1940 | + if (!defined($Colors{ lc($attrvalue) })) { |
1824 | 1941 | &Error( |
1825 | 1942 | "PlotData invalid. Attribute '$attribute' has unknown color '$attrvalue'.\n" |
1826 | 1943 | . " Specify command 'Color' before this command." |
— | — | @@ -1828,14 +1945,14 @@ |
1829 | 1946 | next PlotData; |
1830 | 1947 | } |
1831 | 1948 | } |
1832 | | - if (defined(@Colors{ lc($attrvalue) })) { |
1833 | | - $bgcolor = @Colors{ lc($attrvalue) }; |
| 1949 | + if (defined($Colors{ lc($attrvalue) })) { |
| 1950 | + $bgcolor = $Colors{ lc($attrvalue) }; |
1834 | 1951 | } |
1835 | 1952 | else { $bgcolor = lc($attrvalue); } |
1836 | 1953 | } |
1837 | 1954 | elsif ($attribute =~ /^TextColor$/i) { |
1838 | 1955 | if (!&ColorPredefined($attrvalue)) { |
1839 | | - if (!defined(@Colors{ lc($attrvalue) })) { |
| 1956 | + if (!defined($Colors{ lc($attrvalue) })) { |
1840 | 1957 | &Error( |
1841 | 1958 | "PlotData invalid. Attribute '$attribute' contains unknown color '$attrvalue'.\n" |
1842 | 1959 | . " Specify command 'Color' before this command." |
— | — | @@ -1844,8 +1961,8 @@ |
1845 | 1962 | next PlotData; |
1846 | 1963 | } |
1847 | 1964 | } |
1848 | | - if (defined(@Colors{ lc($attrvalue) })) { |
1849 | | - $textcolor = @Colors{ lc($attrvalue) }; |
| 1965 | + if (defined($Colors{ lc($attrvalue) })) { |
| 1966 | + $textcolor = $Colors{ lc($attrvalue) }; |
1850 | 1967 | } |
1851 | 1968 | else { $textcolor = lc($attrvalue); } |
1852 | 1969 | } |
— | — | @@ -1908,7 +2025,7 @@ |
1909 | 2026 | $shift = $attrvalue; |
1910 | 2027 | $shift =~ s/$hBrO(.*?)$hBrC/$1/; |
1911 | 2028 | $shift =~ s/\s//g; |
1912 | | - ($shiftx2, $shifty2) = split(",", $shift); |
| 2029 | + my ($shiftx2, $shifty2) = split(",", $shift); |
1913 | 2030 | if ($shiftx2 ne "") { $shiftx = &Normalize($shiftx2); } |
1914 | 2031 | if ($shifty2 ne "") { $shifty = &Normalize($shifty2); } |
1915 | 2032 | |
— | — | @@ -1949,8 +2066,8 @@ |
1950 | 2067 | # } |
1951 | 2068 | elsif ($attribute =~ /^Mark$/i) { |
1952 | 2069 | $attrvalue =~ s/$hBrO (.*) $hBrC/$1/x; |
1953 | | - (@suboptions) = split(",", $attrvalue); |
1954 | | - $mark = @suboptions[0]; |
| 2070 | + my (@suboptions) = split(",", $attrvalue); |
| 2071 | + $mark = $suboptions[0]; |
1955 | 2072 | if (!($mark =~ /^(?:Line|None)$/i)) { |
1956 | 2073 | &Error( |
1957 | 2074 | "PlotData invalid. Value '$mark' for attribute 'mark' unknown." |
— | — | @@ -1959,11 +2076,11 @@ |
1960 | 2077 | next PlotData; |
1961 | 2078 | } |
1962 | 2079 | |
1963 | | - if (defined(@suboptions[1])) { |
1964 | | - $markcolor = @suboptions[1]; |
| 2080 | + if (defined($suboptions[1])) { |
| 2081 | + $markcolor = $suboptions[1]; |
1965 | 2082 | |
1966 | 2083 | if (!&ColorPredefined($markcolor)) { |
1967 | | - if (!defined(@Colors{ lc($markcolor) })) { |
| 2084 | + if (!defined($Colors{ lc($markcolor) })) { |
1968 | 2085 | &Error( |
1969 | 2086 | "PlotData invalid. Attribute 'mark': unknown color '$markcolor'.\n" |
1970 | 2087 | . " Specify command 'Color' before this command." |
— | — | @@ -1997,33 +2114,33 @@ |
1998 | 2115 | if ($MaxBarWidth eq "") { $MaxBarWidth = $width - 0.001; } |
1999 | 2116 | |
2000 | 2117 | if ($bar ne "") { |
2001 | | - if (!defined(@BarLegend{ lc($bar) })) { |
2002 | | - @BarLegend{ lc($bar) } = $bar; |
| 2118 | + if (!defined($BarLegend{ lc($bar) })) { |
| 2119 | + $BarLegend{ lc($bar) } = $bar; |
2003 | 2120 | } |
2004 | | - if (!defined(@BarWidths{$bar})) { |
2005 | | - @BarWidths{$bar} = $width; |
| 2121 | + if (!defined($BarWidths{$bar})) { |
| 2122 | + $BarWidths{$bar} = $width; |
2006 | 2123 | } # was 0 ?? |
2007 | 2124 | } |
2008 | 2125 | |
2009 | 2126 | if (($at eq "") && ($from eq "") && ($till eq "")) # upd defaults |
2010 | 2127 | { |
2011 | | - if ($bar ne "") { @PlotDefs{"bar"} = $bar; } |
| 2128 | + if ($bar ne "") { $PlotDefs{"bar"} = $bar; } |
2012 | 2129 | |
2013 | | - # if ($barset ne "") { @PlotDefs {"barset"} = $barset ; } |
2014 | | - if ($color ne "") { @PlotDefs{"color"} = $color; } |
2015 | | - if ($bgcolor ne "") { @PlotDefs{"bgcolor"} = $bgcolor; } |
2016 | | - if ($textcolor ne "") { @PlotDefs{"textcolor"} = $textcolor; } |
2017 | | - if ($fontsize ne "") { @PlotDefs{"fontsize"} = $fontsize; } |
2018 | | - if ($width ne "") { @PlotDefs{"width"} = $width; } |
2019 | | - if ($anchor ne "") { @PlotDefs{"anchor"} = $anchor; } |
2020 | | - if ($align ne "") { @PlotDefs{"align"} = $align; } |
2021 | | - if ($shiftx ne "") { @PlotDefs{"shiftx"} = $shiftx; } |
2022 | | - if ($shifty ne "") { @PlotDefs{"shifty"} = $shifty; } |
2023 | | - if ($mark ne "") { @PlotDefs{"mark"} = $mark; } |
2024 | | - if ($markcolor ne "") { @PlotDefs{"markcolor"} = $markcolor; } |
| 2130 | + # if ($barset ne "") { $PlotDefs{"barset"} = $barset ; } |
| 2131 | + if ($color ne "") { $PlotDefs{"color"} = $color; } |
| 2132 | + if ($bgcolor ne "") { $PlotDefs{"bgcolor"} = $bgcolor; } |
| 2133 | + if ($textcolor ne "") { $PlotDefs{"textcolor"} = $textcolor; } |
| 2134 | + if ($fontsize ne "") { $PlotDefs{"fontsize"} = $fontsize; } |
| 2135 | + if ($width ne "") { $PlotDefs{"width"} = $width; } |
| 2136 | + if ($anchor ne "") { $PlotDefs{"anchor"} = $anchor; } |
| 2137 | + if ($align ne "") { $PlotDefs{"align"} = $align; } |
| 2138 | + if ($shiftx ne "") { $PlotDefs{"shiftx"} = $shiftx; } |
| 2139 | + if ($shifty ne "") { $PlotDefs{"shifty"} = $shifty; } |
| 2140 | + if ($mark ne "") { $PlotDefs{"mark"} = $mark; } |
| 2141 | + if ($markcolor ne "") { $PlotDefs{"markcolor"} = $markcolor; } |
2025 | 2142 | |
2026 | | - # if ($link ne "") { @PlotDefs {"link"} = $link ; } |
2027 | | - # if ($hint ne "") { @PlotDefs {"hint"} = $hint ; } |
| 2143 | + # if ($link ne "") { $PlotDefs{"link"} = $link ; } |
| 2144 | + # if ($hint ne "") { $PlotDefs{"hint"} = $hint ; } |
2028 | 2145 | &GetData; |
2029 | 2146 | next PlotData; |
2030 | 2147 | } |
— | — | @@ -2040,27 +2157,15 @@ |
2041 | 2158 | next PlotData; |
2042 | 2159 | } |
2043 | 2160 | elsif ($#Bars == 0) { |
2044 | | - $bar = @Bars[0]; |
2045 | | - &Info($data, |
| 2161 | + $bar = $Bars[0]; |
| 2162 | + # warn "data: $data"; |
| 2163 | + &Info(q(), # $data, |
2046 | 2164 | "PlotData incomplete. Attribute 'bar' missing, value '" |
2047 | | - . @Bars[0] |
| 2165 | + . $Bars[0] |
2048 | 2166 | . "' assumed."); |
2049 | 2167 | } |
2050 | 2168 | else { $bar = "1"; } |
2051 | 2169 | |
2052 | | - # } |
2053 | | - # else |
2054 | | - # { |
2055 | | - # if ($#Bars > 0) |
2056 | | - # { &Error ("PlotData invalid. Attribute 'bar' missing.") ; |
2057 | | - # &GetData ; next PlotData ; } |
2058 | | - # elsif ($#Bars == 0) |
2059 | | - # { |
2060 | | - # $bar = @Bars [0] ; |
2061 | | - # &Info ($data, "PlotData incomplete. Attribute 'bar' missing, value '" . @Bars [0] . "' assumed.") ; |
2062 | | - # } |
2063 | | - # else { $bar = "1" ; } |
2064 | | - # } |
2065 | 2170 | $prevbar = $bar; |
2066 | 2171 | } |
2067 | 2172 | } |
— | — | @@ -2144,7 +2249,7 @@ |
2145 | 2250 | push @PlotBars, |
2146 | 2251 | sprintf("%6.3f,%s,%s,%s,%s,%s,%s,\n", |
2147 | 2252 | $width, $bar, $from, $till, lc($color), $link, $hint); |
2148 | | - if ($width > @BarWidths{$bar}) { @BarWidths{$bar} = $width; } |
| 2253 | + if ($width > $BarWidths{$bar}) { $BarWidths{$bar} = $width; } |
2149 | 2254 | |
2150 | 2255 | if ($text ne "") { |
2151 | 2256 | if ($anchor eq "from") { $at = $from; } |
— | — | @@ -2187,7 +2292,8 @@ |
2188 | 2293 | if ($align eq "") { $align = "center"; } |
2189 | 2294 | if ($color eq "") { $color = "black"; } |
2190 | 2295 | if ($fontsize eq "") { $fontsize = "S"; } |
2191 | | - if ($adjust eq "") { $adjust = "0,0"; } |
| 2296 | + # $adjust Doesn't seem to be used anywhere |
| 2297 | + # if ($adjust eq "") { $adjust = "0,0"; } |
2192 | 2298 | |
2193 | 2299 | # $textdetails = " textdetails: align=$align size=$size" ; |
2194 | 2300 | # if ($textcolor eq "") |
— | — | @@ -2199,11 +2305,11 @@ |
2200 | 2306 | # my $barcnt = 0 ; |
2201 | 2307 | # for ($b = 0 ; $b <= $#Bars ; $b++) |
2202 | 2308 | # { |
2203 | | - # if (lc(@Bars [$b]) eq lc($bar)) |
| 2309 | + # if (lc($Bars[$b]) eq lc($bar)) |
2204 | 2310 | # { $barcnt = ($b + 1) ; last ; } |
2205 | 2311 | # } |
2206 | 2312 | |
2207 | | - # if (@Axis {"time"} eq "x") |
| 2313 | + # if ($Axis{"time"} eq "x") |
2208 | 2314 | # { $xpos = "$at(s)" ; $ypos = "[$barcnt](s)" ; } |
2209 | 2315 | # else |
2210 | 2316 | # { $ypos = "$at(s)" ; $xpos = "[$barcnt](s)" ; } |
— | — | @@ -2246,18 +2352,19 @@ |
2247 | 2353 | } |
2248 | 2354 | |
2249 | 2355 | $maxwidth = 0; |
| 2356 | + my $key; |
2250 | 2357 | foreach $key (keys %BarWidths) { |
2251 | | - if (@BarWidths{$key} == 0) { |
| 2358 | + if ($BarWidths{$key} == 0) { |
2252 | 2359 | &Warning( |
2253 | 2360 | "PlotData incomplete. No bar width defined for bar '$key', assume width from widest bar (used for line marks)." |
2254 | 2361 | ); |
2255 | 2362 | } |
2256 | | - elsif (@BarWidths{$key} > $maxwidth) { |
2257 | | - $maxwidth = @BarWidths{$key}; |
| 2363 | + elsif ($BarWidths{$key} > $maxwidth) { |
| 2364 | + $maxwidth = $BarWidths{$key}; |
2258 | 2365 | } |
2259 | 2366 | } |
2260 | 2367 | foreach $key (keys %BarWidths) { |
2261 | | - if (@BarWidths{$key} == 0) { @BarWidths{$key} = $maxwidth; } |
| 2368 | + if ($BarWidths{$key} == 0) { $BarWidths{$key} = $maxwidth; } |
2262 | 2369 | } |
2263 | 2370 | } |
2264 | 2371 | |
— | — | @@ -2269,7 +2376,7 @@ |
2270 | 2377 | return; |
2271 | 2378 | } |
2272 | 2379 | |
2273 | | - $preset = @Attributes{"single"}; |
| 2380 | + my $preset = $Attributes{"single"}; |
2274 | 2381 | if ($preset !~ |
2275 | 2382 | /^(?:TimeVertical_OneBar_UnitYear|TimeHorizontal_AutoPlaceBars_UnitYear)$/i |
2276 | 2383 | ) |
— | — | @@ -2286,20 +2393,20 @@ |
2287 | 2394 | if ($Preset =~ /^TimeVertical_OneBar_UnitYear/i) { |
2288 | 2395 | $DateFormat = "yyyy"; |
2289 | 2396 | $AlignBars = "early"; |
2290 | | - @Axis{"format"} = "yyyy"; |
2291 | | - @Axis{"time"} = "y"; |
2292 | | - @PlotArea{"left"} = 45; |
2293 | | - @PlotArea{"right"} = 10; |
2294 | | - @PlotArea{"top"} = 10; |
2295 | | - @PlotArea{"bottom"} = 10; |
2296 | | - push @PresetList, "PlotArea|+|left|" . @PlotArea{"left"}; |
2297 | | - push @PresetList, "PlotArea|+|right|" . @PlotArea{"right"}; |
2298 | | - push @PresetList, "PlotArea|+|top|" . @PlotArea{"top"}; |
2299 | | - push @PresetList, "PlotArea|+|bottom|" . @PlotArea{"bottom"}; |
| 2397 | + $Axis{"format"} = "yyyy"; |
| 2398 | + $Axis{"time"} = "y"; |
| 2399 | + $PlotArea{"left"} = 45; |
| 2400 | + $PlotArea{"right"} = 10; |
| 2401 | + $PlotArea{"top"} = 10; |
| 2402 | + $PlotArea{"bottom"} = 10; |
| 2403 | + push @PresetList, "PlotArea|+|left|" . $PlotArea{"left"}; |
| 2404 | + push @PresetList, "PlotArea|+|right|" . $PlotArea{"right"}; |
| 2405 | + push @PresetList, "PlotArea|+|top|" . $PlotArea{"top"}; |
| 2406 | + push @PresetList, "PlotArea|+|bottom|" . $PlotArea{"bottom"}; |
2300 | 2407 | push @PresetList, "PlotArea|-|width"; |
2301 | 2408 | push @PresetList, "PlotArea|-|height"; |
2302 | 2409 | push @PresetList, "Dateformat|-||yyyy"; |
2303 | | - push @PresetList, "TimeAxis|=|format|" . @Axis{"format"}; |
| 2410 | + push @PresetList, "TimeAxis|=|format|" . $Axis{"format"}; |
2304 | 2411 | push @PresetList, "TimeAxis|=|orientation|vertical"; |
2305 | 2412 | push @PresetList, "ScaleMajor|=|unit|year"; |
2306 | 2413 | push @PresetList, "ScaleMinor|=|unit|year"; |
— | — | @@ -2313,39 +2420,39 @@ |
2314 | 2421 | elsif ($Preset =~ /TimeHorizontal_AutoPlaceBars_UnitYear/i) { |
2315 | 2422 | $DateFormat = "yyyy"; |
2316 | 2423 | $AlignBars = "justify"; |
2317 | | - @Axis{"format"} = "yyyy"; |
2318 | | - @Axis{"time"} = "x"; |
2319 | | - @PlotArea{"left"} = 25; |
2320 | | - @PlotArea{"right"} = 25; |
2321 | | - @PlotArea{"top"} = 15; |
2322 | | - @PlotArea{"bottom"} = 30; |
2323 | | - @Image{"height"} = "auto"; |
2324 | | - @Image{"barinc"} = 20; |
2325 | | - @BackgroundColors{"canvas"} = "gray(0.7)"; |
2326 | | - @Legend{"orientation"} = "ver"; |
2327 | | - @Legend{"left"} = @PlotArea{"left"} + 10; |
2328 | | - @Legend{"top"} = @PlotArea{"bottom"} + 100; |
| 2424 | + $Axis{"format"} = "yyyy"; |
| 2425 | + $Axis{"time"} = "x"; |
| 2426 | + $PlotArea{"left"} = 25; |
| 2427 | + $PlotArea{"right"} = 25; |
| 2428 | + $PlotArea{"top"} = 15; |
| 2429 | + $PlotArea{"bottom"} = 30; |
| 2430 | + $Image{"height"} = "auto"; |
| 2431 | + $Image{"barinc"} = 20; |
| 2432 | + $BackgroundColors{"canvas"} = "gray(0.7)"; |
| 2433 | + $Legend{"orientation"} = "ver"; |
| 2434 | + $Legend{"left"} = $PlotArea{"left"} + 10; |
| 2435 | + $Legend{"top"} = $PlotArea{"bottom"} + 100; |
2329 | 2436 | &StoreColor("canvas", &EncodeInput("gray(0.7)"), ""); |
2330 | 2437 | &StoreColor("grid1", &EncodeInput("gray(0.4)"), ""); |
2331 | 2438 | &StoreColor("grid2", &EncodeInput("gray(0.2)"), ""); |
2332 | 2439 | push @PresetList, "ImageSize|=|height|auto"; |
2333 | 2440 | push @PresetList, "ImageSize|+|barincrement|20"; |
2334 | | - push @PresetList, "PlotArea|+|left|" . @PlotArea{"left"}; |
2335 | | - push @PresetList, "PlotArea|+|right|" . @PlotArea{"right"}; |
2336 | | - push @PresetList, "PlotArea|+|top|" . @PlotArea{"top"}; |
2337 | | - push @PresetList, "PlotArea|+|bottom|" . @PlotArea{"bottom"}; |
| 2441 | + push @PresetList, "PlotArea|+|left|" . $PlotArea{"left"}; |
| 2442 | + push @PresetList, "PlotArea|+|right|" . $PlotArea{"right"}; |
| 2443 | + push @PresetList, "PlotArea|+|top|" . $PlotArea{"top"}; |
| 2444 | + push @PresetList, "PlotArea|+|bottom|" . $PlotArea{"bottom"}; |
2338 | 2445 | push @PresetList, "PlotArea|-|width"; |
2339 | 2446 | push @PresetList, "PlotArea|-|height"; |
2340 | 2447 | push @PresetList, "Dateformat|-||yyyy"; |
2341 | | - push @PresetList, "TimeAxis|=|format|" . @Axis{"format"}; |
| 2448 | + push @PresetList, "TimeAxis|=|format|" . $Axis{"format"}; |
2342 | 2449 | push @PresetList, "TimeAxis|=|orientation|horizontal"; |
2343 | 2450 | push @PresetList, "ScaleMajor|=|unit|year"; |
2344 | 2451 | push @PresetList, "ScaleMajor|+|grid|grid1"; |
2345 | 2452 | push @PresetList, "ScaleMinor|=|unit|year"; |
2346 | 2453 | push @PresetList, "AlignBars|=||justify"; |
2347 | | - push @PresetList, "Legend|+|orientation|" . @Legend{"orientation"}; |
2348 | | - push @PresetList, "Legend|+|left|" . @Legend{"left"}; |
2349 | | - push @PresetList, "Legend|+|top|" . @Legend{"top"}; |
| 2454 | + push @PresetList, "Legend|+|orientation|" . $Legend{"orientation"}; |
| 2455 | + push @PresetList, "Legend|+|left|" . $Legend{"left"}; |
| 2456 | + push @PresetList, "Legend|+|top|" . $Legend{"top"}; |
2350 | 2457 | push @PresetList, "PlotData|+|align|left"; |
2351 | 2458 | push @PresetList, "PlotData|+|anchor|from"; |
2352 | 2459 | push @PresetList, "PlotData|+|fontsize|M"; |
— | — | @@ -2365,30 +2472,30 @@ |
2366 | 2473 | |
2367 | 2474 | &CheckPreset(Scale . $scale); |
2368 | 2475 | |
2369 | | - @Scales{$scale} = $true; |
| 2476 | + $Scales{$scale} = $true; |
2370 | 2477 | |
2371 | | - foreach $attribute (keys %Attributes) { |
2372 | | - my $attrvalue = @Attributes{$attribute}; |
| 2478 | + foreach my $attribute (keys %Attributes) { |
| 2479 | + my $attrvalue = $Attributes{$attribute}; |
2373 | 2480 | |
2374 | 2481 | if ($attribute =~ /Grid/i |
2375 | 2482 | ) # preferred gridcolor instead of grid, grid allowed for compatability |
2376 | 2483 | { |
2377 | 2484 | if ( (!&ColorPredefined($attrvalue)) |
2378 | | - && (!defined(@Colors{ lc($attrvalue) }))) |
| 2485 | + && (!defined($Colors{ lc($attrvalue) }))) |
2379 | 2486 | { |
2380 | 2487 | &Error( |
2381 | 2488 | "Scale attribute '$attribute' invalid. Unknown color '$attrvalue'.\n" |
2382 | 2489 | . " Specify command 'Color' before this command."); |
2383 | 2490 | return; |
2384 | 2491 | } |
2385 | | - @Attributes{ $scale . " grid" } = $attrvalue; |
2386 | | - delete(@Attributes{"grid"}); |
| 2492 | + $Attributes{ $scale . " grid" } = $attrvalue; |
| 2493 | + delete($Attributes{"grid"}); |
2387 | 2494 | } |
2388 | 2495 | elsif ($attribute =~ /Text/i) { |
2389 | 2496 | $attrvalue =~ s/\~/\\n/g; |
2390 | 2497 | $attrvalue =~ s/^\"//g; |
2391 | 2498 | $attrvalue =~ s/\"$//g; |
2392 | | - @Attributes{ $scale . " stubs" } = $attrvalue; |
| 2499 | + $Attributes{ $scale . " stubs" } = $attrvalue; |
2393 | 2500 | } |
2394 | 2501 | elsif ($attribute =~ /Unit/i) { |
2395 | 2502 | if ($DateFormat eq "yyyy") { |
— | — | @@ -2408,8 +2515,8 @@ |
2409 | 2516 | } |
2410 | 2517 | } |
2411 | 2518 | $attrvalue =~ s/s$//; |
2412 | | - @Attributes{ $scale . " unit" } = $attrvalue; |
2413 | | - delete(@Attributes{"unit"}); |
| 2519 | + $Attributes{ $scale . " unit" } = $attrvalue; |
| 2520 | + delete($Attributes{"unit"}); |
2414 | 2521 | } |
2415 | 2522 | elsif ($attribute =~ /Increment/i) { |
2416 | 2523 | if ((!($attrvalue =~ /^\d+$/i)) || ($attrvalue == 0)) { |
— | — | @@ -2418,8 +2525,8 @@ |
2419 | 2526 | ); |
2420 | 2527 | return; |
2421 | 2528 | } |
2422 | | - @Attributes{ $scale . " inc" } = $attrvalue; |
2423 | | - delete(@Attributes{"increment"}); |
| 2529 | + $Attributes{ $scale . " inc" } = $attrvalue; |
| 2530 | + delete($Attributes{"increment"}); |
2424 | 2531 | } |
2425 | 2532 | elsif ($attribute =~ /Start/i) { |
2426 | 2533 | if (!(defined($DateFormat))) { |
— | — | @@ -2462,20 +2569,21 @@ |
2463 | 2570 | return; |
2464 | 2571 | } |
2465 | 2572 | |
2466 | | - @Attributes{ $scale . " start" } = $attrvalue; |
2467 | | - delete(@Attributes{"start"}); |
| 2573 | + $Attributes{ $scale . " start" } = $attrvalue; |
| 2574 | + delete($Attributes{"start"}); |
2468 | 2575 | } |
2469 | 2576 | if ($DateFormat eq "yyyy") { |
2470 | | - @Attributes{ $scale . " unit" } = "year"; |
| 2577 | + $Attributes{ $scale . " unit" } = "year"; |
2471 | 2578 | } |
2472 | 2579 | } |
2473 | 2580 | |
2474 | | - foreach $attribute (keys %Attributes) { |
2475 | | - @Scales{$attribute} = @Attributes{$attribute}; |
| 2581 | + foreach my $attribute (keys %Attributes) { |
| 2582 | + $Scales{$attribute} = $Attributes{$attribute}; |
2476 | 2583 | } |
2477 | 2584 | } |
2478 | 2585 | |
2479 | 2586 | sub ParseTextData { |
| 2587 | + my ($posx, $posy); |
2480 | 2588 | &GetData; |
2481 | 2589 | if ($NoData) { |
2482 | 2590 | &Error( |
— | — | @@ -2500,23 +2608,24 @@ |
2501 | 2609 | $link = ""; |
2502 | 2610 | $hint = ""; |
2503 | 2611 | |
2504 | | - if (defined(@TextDefs{"tabs"})) { $tabs = @TextDefs{"tabs"}; } |
2505 | | - if (defined(@TextDefs{"fontsize"})) { |
2506 | | - $fontsize = @TextDefs{"fontsize"}; |
| 2612 | + if (defined($TextDefs{"tabs"})) { $tabs = $TextDefs{"tabs"}; } |
| 2613 | + if (defined($TextDefs{"fontsize"})) { |
| 2614 | + $fontsize = $TextDefs{"fontsize"}; |
2507 | 2615 | } |
2508 | | - if (defined(@TextDefs{"lineheight"})) { |
2509 | | - $lineheight = @TextDefs{"lineheight"}; |
| 2616 | + if (defined($TextDefs{"lineheight"})) { |
| 2617 | + $lineheight = $TextDefs{"lineheight"}; |
2510 | 2618 | } |
2511 | | - if (defined(@TextDefs{"textcolor"})) { |
2512 | | - $textcolor = @TextDefs{"textcolor"}; |
| 2619 | + if (defined($TextDefs{"textcolor"})) { |
| 2620 | + $textcolor = $TextDefs{"textcolor"}; |
2513 | 2621 | } |
2514 | 2622 | |
| 2623 | + warn "data: $data"; |
2515 | 2624 | my $data2 = $data; |
2516 | 2625 | ($data2, $text) = &ExtractText($data2); |
2517 | 2626 | @Attributes = split(" ", $data2); |
2518 | 2627 | |
2519 | | - foreach $attribute (keys %Attributes) { |
2520 | | - my $attrvalue = @Attributes{$attribute}; |
| 2628 | + foreach my $attribute (keys %Attributes) { |
| 2629 | + my $attrvalue = $Attributes{$attribute}; |
2521 | 2630 | |
2522 | 2631 | if ($attribute =~ /^FontSize$/i) { |
2523 | 2632 | if ( ($attrvalue !~ /\d+(?:\.\d)?/) |
— | — | @@ -2569,7 +2678,7 @@ |
2570 | 2679 | } |
2571 | 2680 | elsif ($attribute =~ /^(?:Color|TextColor)$/i) { |
2572 | 2681 | if (!&ColorPredefined($attrvalue)) { |
2573 | | - if (!defined(@Colors{ lc($attrvalue) })) { |
| 2682 | + if (!defined($Colors{ lc($attrvalue) })) { |
2574 | 2683 | &Error( |
2575 | 2684 | "TextData invalid. Attribute '$attribute' contains unknown color '$attrvalue'.\n" |
2576 | 2685 | . " Specify command 'Color' before this command." |
— | — | @@ -2578,8 +2687,8 @@ |
2579 | 2688 | next TextData; |
2580 | 2689 | } |
2581 | 2690 | } |
2582 | | - if (defined(@Colors{ lc($attrvalue) })) { |
2583 | | - $textcolor = @Colors{ lc($attrvalue) }; |
| 2691 | + if (defined($Colors{ lc($attrvalue) })) { |
| 2692 | + $textcolor = $Colors{ lc($attrvalue) }; |
2584 | 2693 | } |
2585 | 2694 | else { $textcolor = lc($attrvalue); } |
2586 | 2695 | } |
— | — | @@ -2620,12 +2729,12 @@ |
2621 | 2730 | if ($textcolor eq "") { $textcolor = "black"; } |
2622 | 2731 | |
2623 | 2732 | if ($pos eq "") { |
2624 | | - $pos = @TextDefs{"pos"}; |
| 2733 | + $pos = $TextDefs{"pos"}; |
2625 | 2734 | ($posx, $posy) = split(",", $pos); |
2626 | 2735 | $posy -= $lineheight; |
2627 | 2736 | if ($posy < 0) { $posy = 0; } |
2628 | 2737 | $pos = "$posx,$posy"; |
2629 | | - @TextDefs{"pos"} = $pos; |
| 2738 | + $TextDefs{"pos"} = $pos; |
2630 | 2739 | } |
2631 | 2740 | |
2632 | 2741 | # if ($link ne "") |
— | — | @@ -2633,11 +2742,11 @@ |
2634 | 2743 | |
2635 | 2744 | if ($text eq "") # upd defaults |
2636 | 2745 | { |
2637 | | - if ($pos ne "") { @TextDefs{"pos"} = $pos; } |
2638 | | - if ($tabs ne "") { @TextDefs{"tabs"} = $tabs; } |
2639 | | - if ($fontsize ne "") { @TextDefs{"fontsize"} = $fontsize; } |
2640 | | - if ($textcolor ne "") { @TextDefs{"textcolor"} = $textcolor; } |
2641 | | - if ($lineheight ne "") { @TextDefs{"lineheight"} = $lineheight; } |
| 2746 | + if ($pos ne "") { $TextDefs{"pos"} = $pos; } |
| 2747 | + if ($tabs ne "") { $TextDefs{"tabs"} = $tabs; } |
| 2748 | + if ($fontsize ne "") { $TextDefs{"fontsize"} = $fontsize; } |
| 2749 | + if ($textcolor ne "") { $TextDefs{"textcolor"} = $textcolor; } |
| 2750 | + if ($lineheight ne "") { $TextDefs{"lineheight"} = $lineheight; } |
2642 | 2751 | &GetData; |
2643 | 2752 | next TextData; |
2644 | 2753 | } |
— | — | @@ -2663,7 +2772,7 @@ |
2664 | 2773 | |
2665 | 2774 | if (defined($tabs) && ($tabs ne "")) { |
2666 | 2775 | $tabs =~ s/^\s*$hBrO (.*) $hBrC\s*$/$1/x; |
2667 | | - @Tabs = split(",", $tabs); |
| 2776 | + my @Tabs = split(",", $tabs); |
2668 | 2777 | foreach $tab (@Tabs) { |
2669 | 2778 | $tab =~ s/\s* (.*) \s*$/$1/x; |
2670 | 2779 | if (!($tab =~ /\d+\-(?:center|left|right)$/)) { |
— | — | @@ -2703,7 +2812,7 @@ |
2704 | 2813 | &CheckPreset("TimeAxis"); |
2705 | 2814 | |
2706 | 2815 | foreach $attribute (keys %Attributes) { |
2707 | | - my $attrvalue = @Attributes{$attribute}; |
| 2816 | + my $attrvalue = $Attributes{$attribute}; |
2708 | 2817 | |
2709 | 2818 | if ($attribute =~ /Format/i) { |
2710 | 2819 | if ($attrvalue =~ /^yy$/i) { |
— | — | @@ -2741,32 +2850,32 @@ |
2742 | 2851 | return; |
2743 | 2852 | } |
2744 | 2853 | |
2745 | | - @Attributes{"order"} = lc($attrvalue); |
| 2854 | + $Attributes{"order"} = lc($attrvalue); |
2746 | 2855 | } |
2747 | 2856 | |
2748 | 2857 | elsif ($attribute =~ /Orientation/i) { |
2749 | 2858 | if ($attrvalue =~ /^hor(?:izontal)?$/i) { |
2750 | | - @Attributes{"time"} = "x"; |
| 2859 | + $Attributes{"time"} = "x"; |
2751 | 2860 | } |
2752 | 2861 | elsif ($attrvalue =~ /^ver(?:tical)?$/i) { |
2753 | | - @Attributes{"time"} = "y"; |
| 2862 | + $Attributes{"time"} = "y"; |
2754 | 2863 | } |
2755 | 2864 | else { |
2756 | 2865 | &Error( "TimeAxis attribute '$attribute' invalid.\n" |
2757 | 2866 | . "Specify hor[izontal] or ver[tical]"); |
2758 | 2867 | return; |
2759 | 2868 | } |
2760 | | - delete(@Attributes{"orientation"}); |
| 2869 | + delete($Attributes{"orientation"}); |
2761 | 2870 | } |
2762 | 2871 | } |
2763 | 2872 | |
2764 | | - if (!defined(@Attributes{"format"})) { @Attributes{"format"} = "yyyy"; } |
| 2873 | + if (!defined($Attributes{"format"})) { $Attributes{"format"} = "yyyy"; } |
2765 | 2874 | |
2766 | 2875 | %Axis = %Attributes; |
2767 | 2876 | } |
2768 | 2877 | |
2769 | 2878 | sub ParseUnknownCommand { |
2770 | | - $name = $Command; |
| 2879 | + my $name = $Command; |
2771 | 2880 | $name =~ s/[^a-zA-Z].*$//; |
2772 | 2881 | &Error("Command '$name' unknown."); |
2773 | 2882 | } |
— | — | @@ -2778,25 +2887,25 @@ |
2779 | 2888 | } |
2780 | 2889 | |
2781 | 2890 | sub DetectMissingCommands { |
2782 | | - if (!defined(%Image)) { |
| 2891 | + if (!%Image) { |
2783 | 2892 | &Error2("Command ImageSize missing or invalid"); |
2784 | 2893 | } |
2785 | | - if (!defined(%PlotArea)) { |
| 2894 | + if (!%PlotArea) { |
2786 | 2895 | &Error2("Command PlotArea missing or invalid"); |
2787 | 2896 | } |
2788 | | - if (!defined($DateFormat)) { |
| 2897 | + if (!$DateFormat) { |
2789 | 2898 | &Error2("Command DateFormat missing or invalid"); |
2790 | 2899 | } |
2791 | | - if (!defined(@Axis{"time"})) { |
| 2900 | + if (!$Axis{"time"}) { |
2792 | 2901 | &Error2("Command TimeAxis missing or invalid"); |
2793 | 2902 | } |
2794 | 2903 | |
2795 | | - if ((@Image{"width"} =~ /auto/i) && (@Axis{"time"} =~ /x/i)) { |
| 2904 | + if (($Image{"width"} =~ /auto/i) && ($Axis{"time"} =~ /x/i)) { |
2796 | 2905 | &Error2( |
2797 | 2906 | "ImageSize value 'width:auto' only allowed with TimeAxis value 'orientation:vertical'" |
2798 | 2907 | ); |
2799 | 2908 | } |
2800 | | - if ((@Image{"height"} =~ /auto/i) && (@Axis{"time"} =~ /y/i)) { |
| 2909 | + if (($Image{"height"} =~ /auto/i) && ($Axis{"time"} =~ /y/i)) { |
2801 | 2910 | &Error2( |
2802 | 2911 | "ImageSize value 'height:auto' only allowed with TimeAxis value 'orientation:horizontal'" |
2803 | 2912 | ); |
— | — | @@ -2824,9 +2933,9 @@ |
2825 | 2934 | sub ValidateAndNormalizeDimensions { |
2826 | 2935 | my ($val, $dim); |
2827 | 2936 | |
2828 | | - if (@Image{"width"} =~ /auto/i) { |
| 2937 | + if ($Image{"width"} =~ /auto/i) { |
2829 | 2938 | foreach $attribute ("width", "left", "right") { |
2830 | | - if (@PlotArea{$attribute} =~ /\%/) { |
| 2939 | + if ($PlotArea{$attribute} =~ /\%/) { |
2831 | 2940 | &Error2( "You specified 'ImageSize = width:auto'.\n" |
2832 | 2941 | . " This implies absolute values in PlotArea attributes 'left', 'right' and/or 'width' (no \%).\n" |
2833 | 2942 | ); |
— | — | @@ -2834,9 +2943,9 @@ |
2835 | 2944 | } |
2836 | 2945 | } |
2837 | 2946 | |
2838 | | - if ( (@PlotArea{"width"} ne "") |
2839 | | - || (@PlotArea{"left"} eq "") |
2840 | | - || (@PlotArea{"right"} eq "")) |
| 2947 | + if ( ($PlotArea{"width"} ne "") |
| 2948 | + || ($PlotArea{"left"} eq "") |
| 2949 | + || ($PlotArea{"right"} eq "")) |
2841 | 2950 | { |
2842 | 2951 | &Error2( "You specified 'ImageSize = width:auto'.\n" |
2843 | 2952 | . " This implies 'PlotArea = width:auto'.\n" |
— | — | @@ -2846,9 +2955,9 @@ |
2847 | 2956 | } |
2848 | 2957 | } |
2849 | 2958 | |
2850 | | - if (@Image{"height"} =~ /auto/i) { |
| 2959 | + if ($Image{"height"} =~ /auto/i) { |
2851 | 2960 | foreach $attribute ("height", "top", "bottom") { |
2852 | | - if (@PlotArea{$attribute} =~ /\%/) { |
| 2961 | + if ($PlotArea{$attribute} =~ /\%/) { |
2853 | 2962 | &Error2( "You specified 'ImageSize = height:auto'.\n" |
2854 | 2963 | . " This implies absolute values in PlotArea attributes 'top', 'bottom' and/or 'height' (no \%).\n" |
2855 | 2964 | ); |
— | — | @@ -2856,9 +2965,9 @@ |
2857 | 2966 | } |
2858 | 2967 | } |
2859 | 2968 | |
2860 | | - if ( (@PlotArea{"height"} ne "") |
2861 | | - || (@PlotArea{"top"} eq "") |
2862 | | - || (@PlotArea{"bottom"} eq "")) |
| 2969 | + if ( ($PlotArea{"height"} ne "") |
| 2970 | + || ($PlotArea{"top"} eq "") |
| 2971 | + || ($PlotArea{"bottom"} eq "")) |
2863 | 2972 | { |
2864 | 2973 | &Error2( "You specified 'ImageSize = height:auto'.\n" |
2865 | 2974 | . " This implies 'PlotArea = height:auto'.\n" |
— | — | @@ -2868,39 +2977,39 @@ |
2869 | 2978 | } |
2870 | 2979 | } |
2871 | 2980 | |
2872 | | - @Image{"width"} = &Normalize(@Image{"width"}); |
2873 | | - @Image{"height"} = &Normalize(@Image{"height"}); |
2874 | | - @Image{"barinc"} = &Normalize(@Image{"barinc"}); |
2875 | | - @PlotArea{"width"} = &Normalize(@PlotArea{"width"}, @Image{"width"}); |
2876 | | - @PlotArea{"height"} = &Normalize(@PlotArea{"height"}, @Image{"height"}); |
2877 | | - @PlotArea{"left"} = &Normalize(@PlotArea{"left"}, @Image{"width"}); |
2878 | | - @PlotArea{"right"} = &Normalize(@PlotArea{"right"}, @Image{"width"}); |
2879 | | - @PlotArea{"bottom"} = &Normalize(@PlotArea{"bottom"}, @Image{"height"}); |
2880 | | - @PlotArea{"top"} = &Normalize(@PlotArea{"top"}, @Image{"height"}); |
| 2981 | + $Image{"width"} = &Normalize($Image{"width"}); |
| 2982 | + $Image{"height"} = &Normalize($Image{"height"}); |
| 2983 | + $Image{"barinc"} = &Normalize($Image{"barinc"}); |
| 2984 | + $PlotArea{"width"} = &Normalize($PlotArea{"width"}, $Image{"width"}); |
| 2985 | + $PlotArea{"height"} = &Normalize($PlotArea{"height"}, $Image{"height"}); |
| 2986 | + $PlotArea{"left"} = &Normalize($PlotArea{"left"}, $Image{"width"}); |
| 2987 | + $PlotArea{"right"} = &Normalize($PlotArea{"right"}, $Image{"width"}); |
| 2988 | + $PlotArea{"bottom"} = &Normalize($PlotArea{"bottom"}, $Image{"height"}); |
| 2989 | + $PlotArea{"top"} = &Normalize($PlotArea{"top"}, $Image{"height"}); |
2881 | 2990 | |
2882 | | - if (@Image{"width"} =~ /auto/i) { |
2883 | | - @PlotArea{"width"} = $#Bars * @Image{"barinc"}; |
2884 | | - @Image{"width"} = |
2885 | | - @PlotArea{"left"} + @PlotArea{"width"} + @PlotArea{"right"}; |
| 2991 | + if ($Image{"width"} =~ /auto/i) { |
| 2992 | + $PlotArea{"width"} = $#Bars * $Image{"barinc"}; |
| 2993 | + $Image{"width"} = |
| 2994 | + $PlotArea{"left"} + $PlotArea{"width"} + $PlotArea{"right"}; |
2886 | 2995 | } |
2887 | 2996 | |
2888 | | - elsif (@Image{"height"} =~ /auto/i) { |
2889 | | - @PlotArea{"height"} = $#Bars * @Image{"barinc"}; |
2890 | | - @Image{"height"} = |
2891 | | - @PlotArea{"top"} + @PlotArea{"height"} + @PlotArea{"bottom"}; |
| 2997 | + elsif ($Image{"height"} =~ /auto/i) { |
| 2998 | + $PlotArea{"height"} = $#Bars * $Image{"barinc"}; |
| 2999 | + $Image{"height"} = |
| 3000 | + $PlotArea{"top"} + $PlotArea{"height"} + $PlotArea{"bottom"}; |
2892 | 3001 | } |
2893 | 3002 | |
2894 | | - if (@PlotArea{"right"} ne "") { |
2895 | | - @PlotArea{"width"} = |
2896 | | - @Image{"width"} - @PlotArea{"left"} - @PlotArea{"right"}; |
| 3003 | + if ($PlotArea{"right"} ne "") { |
| 3004 | + $PlotArea{"width"} = |
| 3005 | + $Image{"width"} - $PlotArea{"left"} - $PlotArea{"right"}; |
2897 | 3006 | } |
2898 | 3007 | |
2899 | | - if (@PlotArea{"top"} ne "") { |
2900 | | - @PlotArea{"height"} = |
2901 | | - @Image{"height"} - @PlotArea{"top"} - @PlotArea{"bottom"}; |
| 3008 | + if ($PlotArea{"top"} ne "") { |
| 3009 | + $PlotArea{"height"} = |
| 3010 | + $Image{"height"} - $PlotArea{"top"} - $PlotArea{"bottom"}; |
2902 | 3011 | } |
2903 | 3012 | |
2904 | | - if ((@Image{"width"} > 16) || (@Image{"height"} > 20)) { |
| 3013 | + if (($Image{"width"} > 16) || ($Image{"height"} > 20)) { |
2905 | 3014 | if (!$bypass) { |
2906 | 3015 | &Error2( "Maximum image size is 1600x2000 pixels = 16x20 inch\n" |
2907 | 3016 | . " Run with option -b (bypass checks) when this is correct.\n" |
— | — | @@ -2909,62 +3018,62 @@ |
2910 | 3019 | } |
2911 | 3020 | } |
2912 | 3021 | |
2913 | | - if ((@Image{"width"} < 0.25) || (@Image{"height"} < 0.25)) { |
| 3022 | + if (($Image{"width"} < 0.25) || ($Image{"height"} < 0.25)) { |
2914 | 3023 | &Error2("Minimum image size is 25x25 pixels = 0.25x0.25 inch\n"); |
2915 | 3024 | return; |
2916 | 3025 | } |
2917 | 3026 | |
2918 | | - if (@PlotArea{"width"} > @Image{"width"}) { |
| 3027 | + if ($PlotArea{"width"} > $Image{"width"}) { |
2919 | 3028 | &Error2("Plot width larger than image width. Please adjust.\n"); |
2920 | 3029 | return; |
2921 | 3030 | } |
2922 | 3031 | |
2923 | | - if (@PlotArea{"width"} < 0.2) { |
| 3032 | + if ($PlotArea{"width"} < 0.2) { |
2924 | 3033 | &Error2( |
2925 | 3034 | "Plot width less than 20 pixels = 0.2 inch. Please adjust.\n"); |
2926 | 3035 | return; |
2927 | 3036 | } |
2928 | 3037 | |
2929 | | - if (@PlotArea{"height"} > @Image{"height"}) { |
| 3038 | + if ($PlotArea{"height"} > $Image{"height"}) { |
2930 | 3039 | &Error2("Plot height larger than image height. Please adjust.\n"); |
2931 | 3040 | return; |
2932 | 3041 | } |
2933 | 3042 | |
2934 | | - if (@PlotArea{"height"} < 0.2) { |
| 3043 | + if ($PlotArea{"height"} < 0.2) { |
2935 | 3044 | &Error2( |
2936 | 3045 | "Plot height less than 20 pixels = 0.2 inch. Please adjust.\n"); |
2937 | 3046 | return; |
2938 | 3047 | } |
2939 | 3048 | |
2940 | | - if (@PlotArea{"left"} + @PlotArea{"width"} > @Image{"width"}) { |
| 3049 | + if ($PlotArea{"left"} + $PlotArea{"width"} > $Image{"width"}) { |
2941 | 3050 | &Error2( |
2942 | 3051 | "Plot width + margins larger than image width. Please adjust.\n"); |
2943 | 3052 | return; |
2944 | 3053 | } |
2945 | 3054 | |
2946 | | - # @PlotArea {"left"} = @Image {"width"} - @PlotArea {"width"} ; } |
| 3055 | + # $PlotArea{"left"} = $Image{"width"} - $PlotArea{"width"} ; } |
2947 | 3056 | |
2948 | | - if (@PlotArea{"left"} < 0) { @PlotArea{"left"} = 0; } |
| 3057 | + if ($PlotArea{"left"} < 0) { $PlotArea{"left"} = 0; } |
2949 | 3058 | |
2950 | | - if (@PlotArea{"bottom"} + @PlotArea{"height"} > @Image{"height"}) { |
| 3059 | + if ($PlotArea{"bottom"} + $PlotArea{"height"} > $Image{"height"}) { |
2951 | 3060 | &Error2( |
2952 | 3061 | "Plot height + margins larger than image height. Please adjust.\n" |
2953 | 3062 | ); |
2954 | 3063 | return; |
2955 | 3064 | } |
2956 | 3065 | |
2957 | | - # @PlotArea {"bottom"} = @Image {"height"} - @PlotArea {"height"} ; } |
| 3066 | + # $PlotArea{"bottom"} = $Image{"height"} - $PlotArea{"height"} ; } |
2958 | 3067 | |
2959 | | - if (@PlotArea{"bottom"} < 0) { @PlotArea{"bottom"} = 0; } |
| 3068 | + if ($PlotArea{"bottom"} < 0) { $PlotArea{"bottom"} = 0; } |
2960 | 3069 | |
2961 | | - if ( (defined(@Scales{"Major"})) |
2962 | | - || (defined(@Scales{"Minor"}))) |
| 3070 | + if ( (defined($Scales{"Major"})) |
| 3071 | + || (defined($Scales{"Minor"}))) |
2963 | 3072 | { |
2964 | | - if (defined(@Scales{"Major"})) { $margin = 0.2; } |
| 3073 | + if (defined($Scales{"Major"})) { $margin = 0.2; } |
2965 | 3074 | else { $margin = 0.05; } |
2966 | 3075 | |
2967 | | - if (@Axis{"time"} eq "x") { |
2968 | | - if (@PlotArea{"bottom"} < $margin) { |
| 3076 | + if ($Axis{"time"} eq "x") { |
| 3077 | + if ($PlotArea{"bottom"} < $margin) { |
2969 | 3078 | &Error2( |
2970 | 3079 | "Not enough space below plot area for plotting time axis\n" |
2971 | 3080 | . " Specify 'PlotArea = bottom:x', where x is at least " |
— | — | @@ -2974,7 +3083,7 @@ |
2975 | 3084 | } |
2976 | 3085 | } |
2977 | 3086 | else { |
2978 | | - if (@PlotArea{"left"} < $margin) { |
| 3087 | + if ($PlotArea{"left"} < $margin) { |
2979 | 3088 | &Error2( |
2980 | 3089 | "Not enough space outside plot area for plotting time axis\n" |
2981 | 3090 | . " Specify 'PlotArea = left:x', where x is at least " |
— | — | @@ -2985,31 +3094,31 @@ |
2986 | 3095 | } |
2987 | 3096 | } |
2988 | 3097 | |
2989 | | - if (defined(@Legend{"orientation"})) { |
2990 | | - if (defined(@Legend{"left"})) { |
2991 | | - @Legend{"left"} = &Normalize(@Legend{"left"}, @Image{"width"}); |
| 3098 | + if (defined($Legend{"orientation"})) { |
| 3099 | + if (defined($Legend{"left"})) { |
| 3100 | + $Legend{"left"} = &Normalize($Legend{"left"}, $Image{"width"}); |
2992 | 3101 | } |
2993 | | - if (defined(@Legend{"top"})) { |
2994 | | - @Legend{"top"} = &Normalize(@Legend{"top"}, @Image{"height"}); |
| 3102 | + if (defined($Legend{"top"})) { |
| 3103 | + $Legend{"top"} = &Normalize($Legend{"top"}, $Image{"height"}); |
2995 | 3104 | } |
2996 | | - if (defined(@Legend{"columnwidth"})) { |
2997 | | - @Legend{"columnwidth"} = |
2998 | | - &Normalize(@Legend{"columnwidth"}, @Image{"width"}); |
| 3105 | + if (defined($Legend{"columnwidth"})) { |
| 3106 | + $Legend{"columnwidth"} = |
| 3107 | + &Normalize($Legend{"columnwidth"}, $Image{"width"}); |
2999 | 3108 | } |
3000 | 3109 | |
3001 | | - if (!defined(@Legend{"columns"})) { |
3002 | | - @Legend{"columns"} = 1; |
3003 | | - if ( (@Legend{"orientation"} =~ /ver/i) |
3004 | | - && (@Legend{"position"} =~ /^(?:top|bottom)$/i)) |
| 3110 | + if (!defined($Legend{"columns"})) { |
| 3111 | + $Legend{"columns"} = 1; |
| 3112 | + if ( ($Legend{"orientation"} =~ /ver/i) |
| 3113 | + && ($Legend{"position"} =~ /^(?:top|bottom)$/i)) |
3005 | 3114 | { |
3006 | 3115 | if ($#LegendData > 10) { |
3007 | | - @Legend{"columns"} = 3; |
| 3116 | + $Legend{"columns"} = 3; |
3008 | 3117 | &Info2( |
3009 | 3118 | "Legend attribute 'columns' not defined. 3 columns assumed." |
3010 | 3119 | ); |
3011 | 3120 | } |
3012 | 3121 | elsif ($#LegendData > 5) { |
3013 | | - @Legend{"columns"} = 2; |
| 3122 | + $Legend{"columns"} = 2; |
3014 | 3123 | &Info2( |
3015 | 3124 | "Legend attribute 'columns' not defined. 2 columns assumed." |
3016 | 3125 | ); |
— | — | @@ -3017,57 +3126,57 @@ |
3018 | 3127 | } |
3019 | 3128 | } |
3020 | 3129 | |
3021 | | - if (@Legend{"position"} =~ /top/i) { |
3022 | | - if (!defined(@Legend{"left"})) { |
3023 | | - @Legend{"left"} = @PlotArea{"left"}; |
| 3130 | + if ($Legend{"position"} =~ /top/i) { |
| 3131 | + if (!defined($Legend{"left"})) { |
| 3132 | + $Legend{"left"} = $PlotArea{"left"}; |
3024 | 3133 | } |
3025 | | - if (!defined(@Legend{"top"})) { |
3026 | | - @Legend{"top"} = (@Image{"height"} - 0.2); |
| 3134 | + if (!defined($Legend{"top"})) { |
| 3135 | + $Legend{"top"} = ($Image{"height"} - 0.2); |
3027 | 3136 | } |
3028 | | - if ( (!defined(@Legend{"columnwidth"})) |
3029 | | - && (@Legend{"columns"} > 1)) |
| 3137 | + if ( (!defined($Legend{"columnwidth"})) |
| 3138 | + && ($Legend{"columns"} > 1)) |
3030 | 3139 | { |
3031 | | - @Legend{"columnwidth"} = sprintf( |
| 3140 | + $Legend{"columnwidth"} = sprintf( |
3032 | 3141 | "%02f", |
3033 | 3142 | ( |
3034 | | - (@PlotArea{"left"} + @PlotArea{"width"} - 0.2) / |
3035 | | - @Legend{"columns"} |
| 3143 | + ($PlotArea{"left"} + $PlotArea{"width"} - 0.2) / |
| 3144 | + $Legend{"columns"} |
3036 | 3145 | ) |
3037 | 3146 | ); |
3038 | 3147 | } |
3039 | 3148 | } |
3040 | | - elsif (@Legend{"position"} =~ /bottom/i) { |
3041 | | - if (!defined(@Legend{"left"})) { |
3042 | | - @Legend{"left"} = @PlotArea{"left"}; |
| 3149 | + elsif ($Legend{"position"} =~ /bottom/i) { |
| 3150 | + if (!defined($Legend{"left"})) { |
| 3151 | + $Legend{"left"} = $PlotArea{"left"}; |
3043 | 3152 | } |
3044 | | - if (!defined(@Legend{"top"})) { |
3045 | | - @Legend{"top"} = (@PlotArea{"bottom"} - 0.4); |
| 3153 | + if (!defined($Legend{"top"})) { |
| 3154 | + $Legend{"top"} = ($PlotArea{"bottom"} - 0.4); |
3046 | 3155 | } |
3047 | | - if ( (!defined(@Legend{"columnwidth"})) |
3048 | | - && (@Legend{"columns"} > 1)) |
| 3156 | + if ( (!defined($Legend{"columnwidth"})) |
| 3157 | + && ($Legend{"columns"} > 1)) |
3049 | 3158 | { |
3050 | | - @Legend{"columnwidth"} = sprintf( |
| 3159 | + $Legend{"columnwidth"} = sprintf( |
3051 | 3160 | "%02f", |
3052 | 3161 | ( |
3053 | | - (@PlotArea{"left"} + @PlotArea{"width"} - 0.2) / |
3054 | | - @Legend{"columns"} |
| 3162 | + ($PlotArea{"left"} + $PlotArea{"width"} - 0.2) / |
| 3163 | + $Legend{"columns"} |
3055 | 3164 | ) |
3056 | 3165 | ); |
3057 | 3166 | } |
3058 | 3167 | } |
3059 | | - elsif (@Legend{"position"} =~ /right/i) { |
3060 | | - if (!defined(@Legend{"left"})) { |
3061 | | - @Legend{"left"} = |
3062 | | - (@PlotArea{"left"} + @PlotArea{"width"} + 0.2); |
| 3168 | + elsif ($Legend{"position"} =~ /right/i) { |
| 3169 | + if (!defined($Legend{"left"})) { |
| 3170 | + $Legend{"left"} = |
| 3171 | + ($PlotArea{"left"} + $PlotArea{"width"} + 0.2); |
3063 | 3172 | } |
3064 | | - if (!defined(@Legend{"top"})) { |
3065 | | - @Legend{"top"} = |
3066 | | - (@PlotArea{"bottom"} + @PlotArea{"height"} - 0.2); |
| 3173 | + if (!defined($Legend{"top"})) { |
| 3174 | + $Legend{"top"} = |
| 3175 | + ($PlotArea{"bottom"} + $PlotArea{"height"} - 0.2); |
3067 | 3176 | } |
3068 | 3177 | } |
3069 | 3178 | } |
3070 | 3179 | |
3071 | | - if (!defined(@Axis{"order"})) { @Axis{"order"} = "normal"; } |
| 3180 | + if (!defined($Axis{"order"})) { $Axis{"order"} = "normal"; } |
3072 | 3181 | } |
3073 | 3182 | |
3074 | 3183 | sub WriteProcAnnotate { |
— | — | @@ -3110,8 +3219,12 @@ |
3111 | 3220 | $text2 = $text; |
3112 | 3221 | $text2 =~ s/\[\[//g; |
3113 | 3222 | $text2 =~ s/\]\]//g; |
3114 | | - if ($text2 =~ /^\s/) { push @PlotTextsPng, " text: \n\\$text2\n\n"; } |
3115 | | - else { push @PlotTextsPng, " text: $text2\n\n"; } |
| 3223 | + if ($text2 =~ /^\s/) { |
| 3224 | + push @PlotTextsPng, " text: \n\\$text2\n\n"; |
| 3225 | + } |
| 3226 | + else { |
| 3227 | + push @PlotTextsPng, " text: $text2\n\n"; |
| 3228 | + } |
3116 | 3229 | |
3117 | 3230 | $text2 = $text; |
3118 | 3231 | if ($link ne "") { |
— | — | @@ -3138,8 +3251,12 @@ |
3139 | 3252 | while (length($text3) < length($text2)) { $text3 .= "x"; } |
3140 | 3253 | } |
3141 | 3254 | |
3142 | | - if ($text3 =~ /^\s/) { push @PlotTextsSvg, " text: \n\\$text3\n\n"; } |
3143 | | - else { push @PlotTextsSvg, " text: $text3\n\n"; } |
| 3255 | + if ($text3 =~ /^\s/) { |
| 3256 | + push @PlotTextsSvg, " text: \n\\$text3\n\n"; |
| 3257 | + } |
| 3258 | + else { |
| 3259 | + push @PlotTextsSvg, " text: $text3\n\n"; |
| 3260 | + } |
3144 | 3261 | |
3145 | 3262 | if ($link ne "") { |
3146 | 3263 | $MapPNG = $true; |
— | — | @@ -3219,21 +3336,21 @@ |
3220 | 3337 | my ($link2, $hint2, $tab); |
3221 | 3338 | my $outside = $false; |
3222 | 3339 | |
3223 | | - if (@Axis{"order"} =~ /reverse/i) { |
3224 | | - if (@Axis{"time"} eq "y") { $posy =~ s/(.*)(\(s\))/(-$1).$2/xe; } |
| 3340 | + if ($Axis{"order"} =~ /reverse/i) { |
| 3341 | + if ($Axis{"time"} eq "y") { $posy =~ s/(.*)(\(s\))/(-$1).$2/xe; } |
3225 | 3342 | else { $posx =~ s/(.*)(\(s\))/(-$1).$2/xe; } |
3226 | 3343 | } |
3227 | 3344 | |
3228 | 3345 | if ($posx !~ /\(s\)/) { |
3229 | 3346 | if ($posx < 0) { $outside = $true; } |
3230 | | - if (@Image{"width"} !~ /auto/i) { |
3231 | | - if ($posx > @Image{"width"} / 100) { $outside = $true; } |
| 3347 | + if ($Image{"width"} !~ /auto/i) { |
| 3348 | + if ($posx > $Image{"width"} / 100) { $outside = $true; } |
3232 | 3349 | } |
3233 | 3350 | } |
3234 | 3351 | if ($posy !~ /\(s\)/) { |
3235 | 3352 | if ($posy < 0) { $outside = $true; } |
3236 | | - if (@Image{"height"} !~ /auto/i) { |
3237 | | - if ($posy > @Image{"height"} / 100) { $outside = $true; } |
| 3353 | + if ($Image{"height"} !~ /auto/i) { |
| 3354 | + if ($posy > $Image{"height"} / 100) { $outside = $true; } |
3238 | 3355 | } |
3239 | 3356 | } |
3240 | 3357 | if ($outside) { |
— | — | @@ -3247,7 +3364,9 @@ |
3248 | 3365 | } |
3249 | 3366 | |
3250 | 3367 | my @Tabs = split(",", $tabs); |
3251 | | - foreach $tab (@Tabs) { $tab =~ s/\s* (.*) \s*$/$1/x; } |
| 3368 | + foreach (@Tabs) { |
| 3369 | + s/\s* (.*) \s*$/$1/x; |
| 3370 | + } |
3252 | 3371 | |
3253 | 3372 | $posx0 = $posx; |
3254 | 3373 | my @Text; |
— | — | @@ -3258,8 +3377,9 @@ |
3259 | 3378 | $hint = ""; |
3260 | 3379 | } |
3261 | 3380 | |
3262 | | - my @Text; |
3263 | | - if ($mode eq "^") { @Text = split('\^', $text); } |
| 3381 | + if ($mode eq "^") { |
| 3382 | + @Text = split('\^', $text); |
| 3383 | + } |
3264 | 3384 | elsif ($mode eq "~") { |
3265 | 3385 | @Text = split('\n', $text); |
3266 | 3386 | |
— | — | @@ -3277,9 +3397,11 @@ |
3278 | 3398 | } |
3279 | 3399 | } |
3280 | 3400 | } |
3281 | | - else { push @Text, $text; } |
| 3401 | + else { |
| 3402 | + push @Text, $text; |
| 3403 | + } |
3282 | 3404 | |
3283 | | - foreach $text (@Text) { |
| 3405 | + foreach $text (@Text) { # XXX $text should be renamed here |
3284 | 3406 | if ($text !~ /^[\n\s]*$/) { |
3285 | 3407 | $link2 = ""; |
3286 | 3408 | $hint2 = ""; |
— | — | @@ -3358,10 +3480,10 @@ |
3359 | 3481 | |
3360 | 3482 | $script = ""; |
3361 | 3483 | my ($color); |
3362 | | - if (@Axis{"time"} eq "x") { $AxisBars = "y"; } |
| 3484 | + if ($Axis{"time"} eq "x") { $AxisBars = "y"; } |
3363 | 3485 | else { $AxisBars = "x"; } |
3364 | 3486 | |
3365 | | - # if ((@Axis {"time"} eq "y") && ($#Bars > 0)) |
| 3487 | + # if (($Axis{"time"} eq "y") && ($#Bars > 0)) |
3366 | 3488 | # { |
3367 | 3489 | # undef @BarsTmp ; |
3368 | 3490 | # while ($#Bars >= 0) |
— | — | @@ -3372,11 +3494,13 @@ |
3373 | 3495 | if ($tmpdir ne "") { |
3374 | 3496 | $file_script = $tmpdir . $pathseparator . "EasyTimeline.txt.$$"; |
3375 | 3497 | } |
3376 | | - else { $file_script = "EasyTimeline.txt"; } |
| 3498 | + else { |
| 3499 | + $file_script = "EasyTimeline.txt"; |
| 3500 | + } |
3377 | 3501 | |
3378 | 3502 | print "Ploticus input file = " . $file_script . "\n"; |
3379 | 3503 | |
3380 | | - # $fmt = "gif" ; |
| 3504 | + # $image_file_fmt = "gif" ; |
3381 | 3505 | open "FILE_OUT", ">", $file_script; |
3382 | 3506 | |
3383 | 3507 | #proc settings |
— | — | @@ -3388,9 +3512,9 @@ |
3389 | 3513 | $script .= "#proc page\n"; |
3390 | 3514 | $script .= " dopagebox: no\n"; |
3391 | 3515 | $script .= |
3392 | | - " pagesize: " . @Image{"width"} . " " . @Image{"height"} . "\n"; |
3393 | | - if (defined(@BackgroundColors{"canvas"})) { |
3394 | | - $script .= " backgroundcolor: " . @BackgroundColors{"canvas"} . "\n"; |
| 3516 | + " pagesize: " . $Image{"width"} . " " . $Image{"height"} . "\n"; |
| 3517 | + if (defined($BackgroundColors{"canvas"})) { |
| 3518 | + $script .= " backgroundcolor: " . $BackgroundColors{"canvas"} . "\n"; |
3395 | 3519 | } |
3396 | 3520 | $script .= "\n"; |
3397 | 3521 | |
— | — | @@ -3418,7 +3542,7 @@ |
3419 | 3543 | # -> 2BU = PU - PC |
3420 | 3544 | # -> U (2B-P) = -PC |
3421 | 3545 | # -> U = -PC/(2B-P) |
3422 | | - # P = @PlotArea {$extent} |
| 3546 | + # P = $PlotArea{$extent} |
3423 | 3547 | # C = c - 1 = $#Bars |
3424 | 3548 | # 2B = $MaxBarWidth |
3425 | 3549 | if (!defined($AlignBars)) { |
— | — | @@ -3426,17 +3550,17 @@ |
3427 | 3551 | $AlignBars = "early"; |
3428 | 3552 | } |
3429 | 3553 | |
3430 | | - if (@Axis{"time"} eq "x") { $extent = "height"; } |
| 3554 | + if ($Axis{"time"} eq "x") { $extent = "height"; } |
3431 | 3555 | else { $extent = "width"; } |
3432 | 3556 | |
3433 | | - if ($MaxBarWidth > @PlotArea{$extent}) { |
| 3557 | + if ($MaxBarWidth > $PlotArea{$extent}) { |
3434 | 3558 | &Error2("Maximum bar width exceeds plotarea " . $extent . "."); |
3435 | 3559 | return; |
3436 | 3560 | } |
3437 | 3561 | |
3438 | | - if ($MaxBarWidth == @PlotArea{$extent}) { @PlotArea{$extent} += 0.01; } |
| 3562 | + if ($MaxBarWidth == $PlotArea{$extent}) { $PlotArea{$extent} += 0.01; } |
3439 | 3563 | |
3440 | | - if ($MaxBarWidth == @PlotArea{$extent}) { |
| 3564 | + if ($MaxBarWidth == $PlotArea{$extent}) { |
3441 | 3565 | $till = 1; |
3442 | 3566 | $from = 1; |
3443 | 3567 | } |
— | — | @@ -3444,8 +3568,8 @@ |
3445 | 3569 | if ($AlignBars eq "justify") { |
3446 | 3570 | if ($#Bars > 0) { |
3447 | 3571 | $U = |
3448 | | - -(@PlotArea{$extent} * $#Bars) / |
3449 | | - ($MaxBarWidth - @PlotArea{$extent}); |
| 3572 | + -($PlotArea{$extent} * $#Bars) / |
| 3573 | + ($MaxBarWidth - $PlotArea{$extent}); |
3450 | 3574 | $x = ($U - $#Bars) / 2; |
3451 | 3575 | $from = 1 - $x; |
3452 | 3576 | $till = 1 + $#Bars + $x; |
— | — | @@ -3453,7 +3577,7 @@ |
3454 | 3578 | else # one bar-> "justify" is misnomer here, treat as "center" |
3455 | 3579 | { |
3456 | 3580 | |
3457 | | - # $x = ($MaxBarWidth /2) / @PlotArea {$extent} ; |
| 3581 | + # $x = ($MaxBarWidth /2) / $PlotArea{$extent} ; |
3458 | 3582 | # $from = 0.5 - $x ; |
3459 | 3583 | # $till = $from + 1 ; |
3460 | 3584 | $from = 0.5; |
— | — | @@ -3463,13 +3587,13 @@ |
3464 | 3588 | elsif ($AlignBars eq "early") { |
3465 | 3589 | $U = $#Bars + 1; |
3466 | 3590 | if ($U == 0) { $U = 1; } |
3467 | | - $x = (($MaxBarWidth / 2) * $U) / @PlotArea{$extent}; |
| 3591 | + $x = (($MaxBarWidth / 2) * $U) / $PlotArea{$extent}; |
3468 | 3592 | $from = 1 - $x; |
3469 | 3593 | $till = $from + $U; |
3470 | 3594 | } |
3471 | 3595 | elsif ($AlignBars eq "late") { |
3472 | 3596 | $U = $#Bars + 1; |
3473 | | - $x = (($MaxBarWidth / 2) * $U) / @PlotArea{$extent}; |
| 3597 | + $x = (($MaxBarWidth / 2) * $U) / $PlotArea{$extent}; |
3474 | 3598 | $till = $U + $x; |
3475 | 3599 | $from = $till - $U; |
3476 | 3600 | } |
— | — | @@ -3486,30 +3610,30 @@ |
3487 | 3611 | $script .= "#proc areadef\n"; |
3488 | 3612 | $script .= |
3489 | 3613 | " rectangle: " |
3490 | | - . @PlotArea{"left"} . " " |
3491 | | - . @PlotArea{"bottom"} . " " |
3492 | | - . sprintf("%.2f", @PlotArea{"left"} + @PlotArea{"width"}) . " " |
3493 | | - . sprintf("%.2f", @PlotArea{"bottom"} + @PlotArea{"height"}) . "\n"; |
| 3614 | + . $PlotArea{"left"} . " " |
| 3615 | + . $PlotArea{"bottom"} . " " |
| 3616 | + . sprintf("%.2f", $PlotArea{"left"} + $PlotArea{"width"}) . " " |
| 3617 | + . sprintf("%.2f", $PlotArea{"bottom"} + $PlotArea{"height"}) . "\n"; |
3494 | 3618 | if (($DateFormat eq "yyyy") || ($DateFormat eq "x.y")) { |
3495 | | - $script .= " " . @Axis{"time"} . "scaletype: linear\n"; |
| 3619 | + $script .= " " . $Axis{"time"} . "scaletype: linear\n"; |
3496 | 3620 | } # date yyyy |
3497 | 3621 | else { |
3498 | | - $script .= " " . @Axis{"time"} . "scaletype: date $DateFormat\n"; |
| 3622 | + $script .= " " . $Axis{"time"} . "scaletype: date $DateFormat\n"; |
3499 | 3623 | } |
3500 | 3624 | |
3501 | | - if (@Axis{"order"} !~ /reverse/i) { |
| 3625 | + if ($Axis{"order"} !~ /reverse/i) { |
3502 | 3626 | $script .= " " |
3503 | | - . @Axis{"time"} |
| 3627 | + . $Axis{"time"} |
3504 | 3628 | . "range: " |
3505 | | - . @Period{"from"} . " " |
3506 | | - . @Period{"till"} . "\n"; |
| 3629 | + . $Period{"from"} . " " |
| 3630 | + . $Period{"till"} . "\n"; |
3507 | 3631 | } |
3508 | 3632 | else { |
3509 | 3633 | $script .= " " |
3510 | | - . @Axis{"time"} |
| 3634 | + . $Axis{"time"} |
3511 | 3635 | . "range: " |
3512 | | - . (-@Period{"till"}) . " " |
3513 | | - . (-@Period{"from"}) . "\n"; |
| 3636 | + . (-$Period{"till"}) . " " |
| 3637 | + . (-$Period{"from"}) . "\n"; |
3514 | 3638 | } |
3515 | 3639 | |
3516 | 3640 | $script .= " " . $AxisBars . "scaletype: linear\n"; |
— | — | @@ -3533,15 +3657,15 @@ |
3534 | 3658 | $script .= "#proc legendentry\n"; |
3535 | 3659 | $script .= " sampletype: color\n"; |
3536 | 3660 | |
3537 | | - if ((defined(@ColorLabels{$color})) && (@ColorLabels{$color} ne "")) { |
3538 | | - $script .= " label: " . @ColorLabels{$color} . "\n"; |
| 3661 | + if ((defined($ColorLabels{$color})) && ($ColorLabels{$color} ne "")) { |
| 3662 | + $script .= " label: " . $ColorLabels{$color} . "\n"; |
3539 | 3663 | } |
3540 | | - $script .= " details: " . @Colors{$color} . "\n"; |
| 3664 | + $script .= " details: " . $Colors{$color} . "\n"; |
3541 | 3665 | $script .= " tag: $color\n"; |
3542 | 3666 | $script .= "\n"; |
3543 | 3667 | } |
3544 | 3668 | |
3545 | | - if (defined(@BackgroundColors{"bars"})) { |
| 3669 | + if (defined($BackgroundColors{"bars"})) { |
3546 | 3670 | |
3547 | 3671 | #proc getdata / #proc bars |
3548 | 3672 | $script .= "#proc getdata\n"; |
— | — | @@ -3557,18 +3681,18 @@ |
3558 | 3682 | for ($b = 0; $b <= $#Bars; $b++) { |
3559 | 3683 | $script .= |
3560 | 3684 | ($b + 1) . "," |
3561 | | - . @Period{"from"} . "," |
3562 | | - . @Period{"till"} . "," |
3563 | | - . @BackgroundColors{"bars"} . "\n"; |
| 3685 | + . $Period{"from"} . "," |
| 3686 | + . $Period{"till"} . "," |
| 3687 | + . $BackgroundColors{"bars"} . "\n"; |
3564 | 3688 | } |
3565 | 3689 | $script .= "\n"; |
3566 | 3690 | |
3567 | 3691 | #proc bars |
3568 | 3692 | $script .= "#proc bars\n"; |
3569 | | - $script .= " axis: " . @Axis{"time"} . "\n"; |
| 3693 | + $script .= " axis: " . $Axis{"time"} . "\n"; |
3570 | 3694 | $script .= " barwidth: $maxwidth\n"; |
3571 | 3695 | $script .= " outline: no\n"; |
3572 | | - if (@Axis{"time"} eq "x") { $script .= " horizontalbars: yes\n"; } |
| 3696 | + if ($Axis{"time"} eq "x") { $script .= " horizontalbars: yes\n"; } |
3573 | 3697 | $script .= " locfield: 1\n"; |
3574 | 3698 | $script .= " segmentfields: 2 3\n"; |
3575 | 3699 | $script .= " colorfield: 4\n"; |
— | — | @@ -3580,8 +3704,8 @@ |
3581 | 3705 | } |
3582 | 3706 | |
3583 | 3707 | #proc axis |
3584 | | - if (defined(@Scales{"Minor grid"})) { &PlotScale("Minor", $true); } |
3585 | | - if (defined(@Scales{"Major grid"})) { &PlotScale("Major", $true); } |
| 3708 | + if (defined($Scales{"Minor grid"})) { &PlotScale("Minor", $true); } |
| 3709 | + if (defined($Scales{"Major grid"})) { &PlotScale("Major", $true); } |
3586 | 3710 | |
3587 | 3711 | &PlotLines("back"); |
3588 | 3712 | |
— | — | @@ -3594,7 +3718,7 @@ |
3595 | 3719 | foreach $entry (@PlotLines) { |
3596 | 3720 | ($bar) = split(",", $entry); |
3597 | 3721 | $bar =~ s/\#.*//; |
3598 | | - $width = @BarWidths{$bar}; |
| 3722 | + $width = $BarWidths{$bar}; |
3599 | 3723 | $entry = sprintf("%6.3f", $width) . "," . $entry; |
3600 | 3724 | } |
3601 | 3725 | |
— | — | @@ -3626,7 +3750,10 @@ |
3627 | 3751 | $scriptPng2 .= " stubs: text\n"; |
3628 | 3752 | $scriptSvg2 .= " stubs: text\n"; |
3629 | 3753 | |
3630 | | - my ($text, $link, $hint); |
| 3754 | + # XXX huh? Yields a warning. |
| 3755 | + my $text; |
| 3756 | + my $link; |
| 3757 | + my $hint; |
3631 | 3758 | |
3632 | 3759 | undef(@Bars2); |
3633 | 3760 | foreach $bar (@Bars) { |
— | — | @@ -3636,10 +3763,10 @@ |
3637 | 3764 | |
3638 | 3765 | foreach $bar (@Bars2) { |
3639 | 3766 | $hint = ""; |
3640 | | - $text = @BarLegend{ lc($bar) }; |
| 3767 | + $text = $BarLegend{ lc($bar) }; |
3641 | 3768 | if ($text =~ /^\s*$/) { $text = "\\"; } |
3642 | 3769 | |
3643 | | - $link = @BarLink{ lc($bar) }; |
| 3770 | + $link = $BarLink{ lc($bar) }; |
3644 | 3771 | if (!defined($link)) { |
3645 | 3772 | if ($text =~ /\[.*\]/) { |
3646 | 3773 | ($text, $link, $hint) = |
— | — | @@ -3678,10 +3805,10 @@ |
3679 | 3806 | $barcnt = $#Bars + 1; |
3680 | 3807 | foreach $bar (@Bars2) { |
3681 | 3808 | $hint = ""; |
3682 | | - $text = @BarLegend{ lc($bar) }; |
| 3809 | + $text = $BarLegend{ lc($bar) }; |
3683 | 3810 | if ($text =~ /^\s*$/) { $text = "\\"; } |
3684 | 3811 | |
3685 | | - $link = @BarLink{ lc($bar) }; |
| 3812 | + $link = $BarLink{ lc($bar) }; |
3686 | 3813 | if (!defined($link)) { |
3687 | 3814 | if ($text =~ /\[.*\]/) { |
3688 | 3815 | ($text, $link, $hint) = |
— | — | @@ -3693,10 +3820,10 @@ |
3694 | 3821 | $scriptPng3 .= "#proc rect\n"; |
3695 | 3822 | $scriptPng3 .= |
3696 | 3823 | " rectangle: 0 $barcnt(s)+0.05 " |
3697 | | - . @PlotArea{"left"} |
| 3824 | + . $PlotArea{"left"} |
3698 | 3825 | . " $barcnt(s)-0.05\n"; |
3699 | 3826 | $scriptPng3 .= |
3700 | | - " color: " . @BackgroundColors{"canvas"} . "\n"; |
| 3827 | + " color: " . $BackgroundColors{"canvas"} . "\n"; |
3701 | 3828 | $scriptPng3 .= " clickmapurl: " . $link . "\n"; |
3702 | 3829 | if ((defined($hint)) && ($hint ne "")) { |
3703 | 3830 | $scriptPng3 .= " clickmaplabel: " . $hint . "\n"; |
— | — | @@ -3746,8 +3873,8 @@ |
3747 | 3874 | #proc axis |
3748 | 3875 | # repeat without grid to get axis on top of bar |
3749 | 3876 | # needed because axis may overlap bar slightly |
3750 | | - if (defined(@Scales{"Minor"})) { &PlotScale("Minor", $false); } |
3751 | | - if (defined(@Scales{"Major"})) { &PlotScale("Major", $false); } |
| 3877 | + if (defined($Scales{"Minor"})) { &PlotScale("Minor", $false); } |
| 3878 | + if (defined($Scales{"Major"})) { &PlotScale("Major", $false); } |
3752 | 3879 | |
3753 | 3880 | #proc drawcommands |
3754 | 3881 | if ($#TextData >= 0) { |
— | — | @@ -3758,7 +3885,7 @@ |
3759 | 3886 | } |
3760 | 3887 | |
3761 | 3888 | #proc legend |
3762 | | - if (defined(@Legend{"orientation"})) { |
| 3889 | + if (defined($Legend{"orientation"})) { |
3763 | 3890 | if (($#LegendData < 0) && ($Preset eq "")) { |
3764 | 3891 | &Error2( |
3765 | 3892 | "Command 'Legend' found, but no entries for the legend were specified.\n" |
— | — | @@ -3769,19 +3896,19 @@ |
3770 | 3897 | } |
3771 | 3898 | |
3772 | 3899 | $perColumn = 999; |
3773 | | - if (@Legend{"orientation"} =~ /ver/i) { |
3774 | | - if (@Legend{"columns"} > 1) { |
| 3900 | + if ($Legend{"orientation"} =~ /ver/i) { |
| 3901 | + if ($Legend{"columns"} > 1) { |
3775 | 3902 | $perColumn = 0; |
3776 | | - while ((@Legend{"columns"} * $perColumn) < $#LegendData + 1) { |
| 3903 | + while (($Legend{"columns"} * $perColumn) < $#LegendData + 1) { |
3777 | 3904 | $perColumn++; |
3778 | 3905 | } |
3779 | 3906 | } |
3780 | 3907 | } |
3781 | 3908 | |
3782 | | - for ($l = 1; $l <= @Legend{"columns"}; $l++) { |
| 3909 | + for ($l = 1; $l <= $Legend{"columns"}; $l++) { |
3783 | 3910 | $script .= "#proc legend\n"; |
3784 | 3911 | $script .= " noclear: yes\n"; |
3785 | | - if (@Legend{"orientation"} =~ /ver/i) { |
| 3912 | + if ($Legend{"orientation"} =~ /ver/i) { |
3786 | 3913 | $script .= " format: multiline\n"; |
3787 | 3914 | } |
3788 | 3915 | else { $script .= " format: singleline\n"; } |
— | — | @@ -3790,28 +3917,32 @@ |
3791 | 3918 | $script .= " textdetails: size=S\n"; |
3792 | 3919 | $script .= |
3793 | 3920 | " location: " |
3794 | | - . (@Legend{"left"} + 0.2) . " " |
3795 | | - . @Legend{"top"} . "\n"; |
| 3921 | + . ($Legend{"left"} + 0.2) . " " |
| 3922 | + . $Legend{"top"} . "\n"; |
3796 | 3923 | $script .= " specifyorder:\n"; |
3797 | 3924 | for ($l2 = 1; $l2 <= $perColumn; $l2++) { |
3798 | 3925 | $category = shift(@LegendData); |
3799 | 3926 | if (defined($category)) { $script .= "$category\n"; } |
3800 | 3927 | } |
3801 | 3928 | $script .= "\n"; |
3802 | | - @Legend{"left"} += @Legend{"columnwidth"}; |
| 3929 | + $Legend{"left"} += $Legend{"columnwidth"}; |
3803 | 3930 | } |
3804 | 3931 | } |
3805 | 3932 | |
3806 | 3933 | $script .= "#endproc\n"; |
3807 | 3934 | |
3808 | 3935 | print "\nGenerating output:\n"; |
3809 | | - if ($plcommand ne "") { $pl = $plcommand; } |
| 3936 | + if ($ploticus_command ne "") { |
| 3937 | + $pl = $ploticus_command; |
| 3938 | + } |
3810 | 3939 | else { |
3811 | 3940 | $pl = "pl.exe"; |
3812 | 3941 | if ($env eq "Linux") { $pl = "pl"; } |
3813 | 3942 | } |
3814 | 3943 | |
3815 | | - print "Using ploticus command \"" . $pl . "\" (" . $plcommand . ")\n"; |
| 3944 | + print "Using ploticus command \"" |
| 3945 | + . $pl . "\" (" |
| 3946 | + . $ploticus_command . ")\n"; |
3816 | 3947 | |
3817 | 3948 | $script_save = $script; |
3818 | 3949 | |
— | — | @@ -3884,15 +4015,15 @@ |
3885 | 4016 | $map = ''; |
3886 | 4017 | } |
3887 | 4018 | |
3888 | | - # $crop = "-crop 0,0," + @ImageSize {"width"} . "," . @ImageSize {"height"} ; |
| 4019 | + # $crop = "-crop 0,0," + $ImageSize{"width"} . "," . $ImageSize{"height"} ; |
3889 | 4020 | print "Running Ploticus to generate bitmap\n"; |
3890 | 4021 | |
3891 | | - # $cmd = "$pl $map -" . $fmt . " -o $file_bitmap $file_script -tightcrop" ; # -v $file_bitmap" ; |
3892 | | - # $cmd = "$pl $map -" . $fmt . " -o $file_bitmap $file_script -tightcrop -diagfile $file_pl_info -errfile $file_pl_err" ; |
| 4022 | + # $cmd = "$pl $map -" . $image_file_fmt . " -o $file_bitmap $file_script -tightcrop" ; # -v $file_bitmap" ; |
| 4023 | + # $cmd = "$pl $map -" . $image_file_fmt . " -o $file_bitmap $file_script -tightcrop -diagfile $file_pl_info -errfile $file_pl_err" ; |
3893 | 4024 | $cmd = |
3894 | 4025 | EscapeShellArg($pl) |
3895 | 4026 | . " $map -" |
3896 | | - . $fmt . " -o " |
| 4027 | + . $image_file_fmt . " -o " |
3897 | 4028 | . EscapeShellArg($file_bitmap) . " " |
3898 | 4029 | . EscapeShellArg($file_script) |
3899 | 4030 | . " -tightcrop -font " |
— | — | @@ -3908,7 +4039,7 @@ |
3909 | 4040 | } |
3910 | 4041 | |
3911 | 4042 | # not for Wikipedia, only for offline use: |
3912 | | - if ((-e $file_bitmap) && ($fmt eq "gif")) { |
| 4043 | + if ((-e $file_bitmap) && ($image_file_fmt eq "gif")) { |
3913 | 4044 | print "Running nconvert to convert gif image to png format\n\n"; |
3914 | 4045 | print |
3915 | 4046 | "---------------------------------------------------------------------------\n"; |
— | — | @@ -3938,9 +4069,9 @@ |
3939 | 4070 | $shift =~ s/^.*\&\&([^\"]*)\".*$/$1/; |
3940 | 4071 | $line =~ s/\&\&[^\"]*//; |
3941 | 4072 | (@updcoords) = split(",", $coords); |
3942 | | - $maplength = @updcoords[2] - @updcoords[0]; |
3943 | | - @updcoords[0] = @updcoords[0] - 2 * ($maplength - 25); |
3944 | | - @updcoords[2] = @updcoords[0] + $maplength; |
| 4073 | + $maplength = $updcoords[2] - $updcoords[0]; |
| 4074 | + $updcoords[0] = $updcoords[0] - 2 * ($maplength - 25); |
| 4075 | + $updcoords[2] = $updcoords[0] + $maplength; |
3945 | 4076 | $coordsnew = join(",", @updcoords); |
3946 | 4077 | $line =~ s/$coords/$coordsnew/; |
3947 | 4078 | push @map2, $line . "\n"; |
— | — | @@ -3959,9 +4090,9 @@ |
3960 | 4091 | close "FILE_IN"; |
3961 | 4092 | |
3962 | 4093 | foreach $line (@svg) { |
3963 | | - $line =~ s/\{\{(\d+)\}\}x+/@textsSVG[$1]/gxe; |
| 4094 | + $line =~ s/\{\{(\d+)\}\}x+/$textsSVG[$1]/gxe; |
3964 | 4095 | $line =~ |
3965 | | - s/\[(\d+)\[ (.*?) \]\d+\]/'<a style="fill:blue;" xlink:href="' . @linksSVG[$1] . '">' . $2 . '<\/a>'/gxe; |
| 4096 | + s/\[(\d+)\[ (.*?) \]\d+\]/'<a style="fill:blue;" xlink:href="' . $linksSVG[$1] . '">' . $2 . '<\/a>'/gxe; |
3966 | 4097 | } |
3967 | 4098 | |
3968 | 4099 | open "FILE_OUT", ">", $file_vector; |
— | — | @@ -3978,8 +4109,8 @@ |
3979 | 4110 | close "FILE_IN"; |
3980 | 4111 | } |
3981 | 4112 | print "Generating html test file\n"; |
3982 | | - $width = sprintf("%.0f", @Image{"width"} * 100); |
3983 | | - $height = sprintf("%.0f", @Image{"height"} * 100); |
| 4113 | + $width = sprintf("%.0f", $Image{"width"} * 100); |
| 4114 | + $height = sprintf("%.0f", $Image{"height"} * 100); |
3984 | 4115 | $html = <<__HTML__ ; |
3985 | 4116 | |
3986 | 4117 | <html> |
— | — | @@ -4051,10 +4182,10 @@ |
4052 | 4183 | |
4053 | 4184 | my $barcnt = 0; |
4054 | 4185 | for ($b = 0; $b <= $#Bars; $b++) { |
4055 | | - if (lc(@Bars[$b]) eq lc($bar)) { $barcnt = ($b + 1); last; } |
| 4186 | + if (lc($Bars[$b]) eq lc($bar)) { $barcnt = ($b + 1); last; } |
4056 | 4187 | } |
4057 | 4188 | |
4058 | | - if (@Axis{"time"} eq "x") { |
| 4189 | + if ($Axis{"time"} eq "x") { |
4059 | 4190 | $xpos = "$at(s)"; |
4060 | 4191 | $ypos = "[$barcnt](s)"; |
4061 | 4192 | } |
— | — | @@ -4100,12 +4231,12 @@ |
4101 | 4232 | next; |
4102 | 4233 | } |
4103 | 4234 | for ($b = 0; $b <= $#Bars; $b++) { |
4104 | | - if (lc(@Bars[$b]) eq lc($bar)) { |
| 4235 | + if (lc($Bars[$b]) eq lc($bar)) { |
4105 | 4236 | $bar = ($#Bars - ($b - 1)); |
4106 | 4237 | last; |
4107 | 4238 | } |
4108 | 4239 | } |
4109 | | - if (@Axis{"order"} !~ /reverse/i) { |
| 4240 | + if ($Axis{"order"} !~ /reverse/i) { |
4110 | 4241 | $entry = "$bar,$from,$till,$color,$link,$hint,\n"; |
4111 | 4242 | } |
4112 | 4243 | else { |
— | — | @@ -4121,21 +4252,21 @@ |
4122 | 4253 | |
4123 | 4254 | #proc bars |
4124 | 4255 | $script .= "#proc bars\n"; |
4125 | | - $script .= " axis: " . @Axis{"time"} . "\n"; |
| 4256 | + $script .= " axis: " . $Axis{"time"} . "\n"; |
4126 | 4257 | $script .= " barwidth: $maxwidth\n"; |
4127 | 4258 | $script .= " outline: no\n"; |
4128 | 4259 | |
4129 | 4260 | # $script .= " thinbarline: width=5\n" ; |
4130 | | - if (@Axis{"time"} eq "x") { $script .= " horizontalbars: yes\n"; } |
| 4261 | + if ($Axis{"time"} eq "x") { $script .= " horizontalbars: yes\n"; } |
4131 | 4262 | $script .= " locfield: 1\n"; |
4132 | 4263 | $script .= " segmentfields: 2 3\n"; |
4133 | 4264 | $script .= " colorfield: 4\n"; |
4134 | 4265 | |
4135 | 4266 | # $script .= " outline: width=1\n" ; |
4136 | 4267 | # $script .= " barwidthfield: 5\n" ; |
4137 | | - # if (@fields [4] ne "") |
| 4268 | + # if ($fields[4] ne "") |
4138 | 4269 | # { $script .= " clickmapurl: " . &LinkToUrl ($text) . "\n" ; } |
4139 | | - # if (@fields [5] ne "") |
| 4270 | + # if ($fields[5] ne "") |
4140 | 4271 | # { $script .= " clickmaplabel: $text\n" ; } |
4141 | 4272 | $script .= " clickmapurl: \@\@5\n"; |
4142 | 4273 | $script .= " clickmaplabel: \@\@6\n"; |
— | — | @@ -4161,24 +4292,24 @@ |
4162 | 4293 | |
4163 | 4294 | # if (! $grid) # redefine area, scale linear for time axis, showl whole years always, Ploticus bug |
4164 | 4295 | # { |
4165 | | - # $from = @Period {"from"} ; |
4166 | | - # $till = @Period {"till"} ; |
4167 | | - $from = &DateToFloat(@Period{"from"}); |
4168 | | - $till = &DateToFloat(@Period{"till"}); |
| 4296 | + # $from = $Period{"from"} ; |
| 4297 | + # $till = $Period{"till"} ; |
| 4298 | + $from = &DateToFloat($Period{"from"}); |
| 4299 | + $till = &DateToFloat($Period{"till"}); |
4169 | 4300 | |
4170 | 4301 | # $from =~ s/.*\///g ; # delete dd mm if present |
4171 | 4302 | # $till =~ s/.*\///g ; |
4172 | 4303 | #proc areadef |
4173 | 4304 | $script .= "#proc areadef\n"; |
4174 | 4305 | $script .= " #clone: A\n"; |
4175 | | - $script .= " " . @Axis{"time"} . "scaletype: linear\n"; # date yyyy |
| 4306 | + $script .= " " . $Axis{"time"} . "scaletype: linear\n"; # date yyyy |
4176 | 4307 | |
4177 | | - if (@Axis{"order"} !~ /reverse/i) { |
4178 | | - $script .= " " . @Axis{"time"} . "range: $from $till\n"; |
| 4308 | + if ($Axis{"order"} !~ /reverse/i) { |
| 4309 | + $script .= " " . $Axis{"time"} . "range: $from $till\n"; |
4179 | 4310 | } |
4180 | 4311 | else { |
4181 | 4312 | $script .= " " |
4182 | | - . @Axis{"time"} |
| 4313 | + . $Axis{"time"} |
4183 | 4314 | . "range: " |
4184 | 4315 | . (-$till) . " " |
4185 | 4316 | . (-$from) . "\n"; |
— | — | @@ -4188,45 +4319,45 @@ |
4189 | 4320 | |
4190 | 4321 | # } |
4191 | 4322 | |
4192 | | - $script .= "#proc " . @Axis{"time"} . "axis\n"; |
| 4323 | + $script .= "#proc " . $Axis{"time"} . "axis\n"; |
4193 | 4324 | |
4194 | 4325 | if (($scale eq "Major") && (!$grid)) { |
4195 | 4326 | |
4196 | | - # $script .= " stubs: incremental " . @Scales {"Major inc"} . " " . @Scales {"Major unit"} . "\n" ; |
| 4327 | + # $script .= " stubs: incremental " . $Scales{"Major inc"} . " " . $Scales{"Major unit"} . "\n" ; |
4197 | 4328 | # if ($DateFormat =~ /\//) |
4198 | | - # { $script .= " stubformat: " . @Axis {"format"} . "\n" ; } |
| 4329 | + # { $script .= " stubformat: " . $Axis{"format"} . "\n" ; } |
4199 | 4330 | # temp always show whole years (Ploticus autorange bug) |
4200 | | - if (@Scales{"Major stubs"} eq "") # ($DateFormat !~ /\//) |
| 4331 | + if ($Scales{"Major stubs"} eq "") # ($DateFormat !~ /\//) |
4201 | 4332 | { |
4202 | | - $script .= " stubs: incremental " . @Scales{"Major inc"} . "\n"; |
| 4333 | + $script .= " stubs: incremental " . $Scales{"Major inc"} . "\n"; |
4203 | 4334 | } |
4204 | | - else { $script .= " stubs: list " . @Scales{"Major stubs"} . "\n"; } |
| 4335 | + else { $script .= " stubs: list " . $Scales{"Major stubs"} . "\n"; } |
4205 | 4336 | } |
4206 | 4337 | else { $script .= " stubs: none\n"; } |
4207 | 4338 | |
4208 | 4339 | if ($DateFormat !~ /\//) |
4209 | 4340 | |
4210 | | - # { $script .= " ticincrement: " . @Scales {"$scale inc"} . " " . @Scales {"$scale unit"} . "\n" ; } |
| 4341 | + # { $script .= " ticincrement: " . $Scales{"$scale inc"} . " " . $Scales{"$scale unit"} . "\n" ; } |
4211 | 4342 | { |
4212 | | - $script .= " ticincrement: " . @Scales{"$scale inc"} . "\n"; |
| 4343 | + $script .= " ticincrement: " . $Scales{"$scale inc"} . "\n"; |
4213 | 4344 | } |
4214 | 4345 | else { |
4215 | 4346 | my $unit = 1; |
4216 | | - if (@Scales{"$scale unit"} =~ /month/i) { $unit = 1 / 12; } |
4217 | | - if (@Scales{"$scale unit"} =~ /day/i) { $unit = 1 / 365; } |
4218 | | - $script .= " ticincrement: " . @Scales{"$scale inc"} . " $unit\n"; |
| 4347 | + if ($Scales{"$scale unit"} =~ /month/i) { $unit = 1 / 12; } |
| 4348 | + if ($Scales{"$scale unit"} =~ /day/i) { $unit = 1 / 365; } |
| 4349 | + $script .= " ticincrement: " . $Scales{"$scale inc"} . " $unit\n"; |
4219 | 4350 | } |
4220 | 4351 | |
4221 | | - if (defined(@Scales{"$scale start"})) { |
4222 | | - $start = @Scales{"$scale start"}; |
| 4352 | + if (defined($Scales{"$scale start"})) { |
| 4353 | + $start = $Scales{"$scale start"}; |
4223 | 4354 | |
4224 | 4355 | # $start =~ s/.*\///g ; # delete dd mm if present |
4225 | 4356 | $start = &DateToFloat($start); |
4226 | | - if (@Axis{"order"} =~ /reverse/i) { |
| 4357 | + if ($Axis{"order"} =~ /reverse/i) { |
4227 | 4358 | $loop = 0; |
4228 | 4359 | $start = -$start; |
4229 | | - while ($start - @Scales{"$scale inc"} >= -@Period{"till"}) { |
4230 | | - $start -= @Scales{"$scale inc"}; |
| 4360 | + while ($start - $Scales{"$scale inc"} >= -$Period{"till"}) { |
| 4361 | + $start -= $Scales{"$scale inc"}; |
4231 | 4362 | if (++$loop > 1000) { last; } # precaution |
4232 | 4363 | } |
4233 | 4364 | } |
— | — | @@ -4235,10 +4366,10 @@ |
4236 | 4367 | |
4237 | 4368 | if ($scale eq "Major") { |
4238 | 4369 | $script .= " ticlen: 0.05\n"; |
4239 | | - if (@Axis{"time"} eq "y") { |
| 4370 | + if ($Axis{"time"} eq "y") { |
4240 | 4371 | $script .= " stubdetails: adjust=0.05,0\n"; |
4241 | 4372 | } |
4242 | | - if (@Axis{"order"} =~ /reverse/i) { |
| 4373 | + if ($Axis{"order"} =~ /reverse/i) { |
4243 | 4374 | $script .= " signreverse: yes\n"; |
4244 | 4375 | } |
4245 | 4376 | } |
— | — | @@ -4246,9 +4377,9 @@ |
4247 | 4378 | |
4248 | 4379 | # $script .= " location: 4\n" ; test |
4249 | 4380 | |
4250 | | - $color .= @Scales{"$scale grid"}; |
| 4381 | + $color .= $Scales{"$scale grid"}; |
4251 | 4382 | |
4252 | | - if (defined(@Colors{$color})) { $color = @Colors{$color}; } |
| 4383 | + if (defined($Colors{$color})) { $color = $Colors{$color}; } |
4253 | 4384 | |
4254 | 4385 | if ($grid) { $script .= " grid: color=$color\n"; } |
4255 | 4386 | |
— | — | @@ -4291,50 +4422,50 @@ |
4292 | 4423 | |
4293 | 4424 | if ($mode == 1) # draw perpendicular to time axis |
4294 | 4425 | { |
4295 | | - if (@Axis{"order"} =~ /reverse/i) { $at = -$at; } |
| 4426 | + if ($Axis{"order"} =~ /reverse/i) { $at = -$at; } |
4296 | 4427 | |
4297 | | - if (@Axis{"time"} eq "x") { |
4298 | | - if ($from eq "") { $from = @PlotArea{"bottom"} } |
| 4428 | + if ($Axis{"time"} eq "x") { |
| 4429 | + if ($from eq "") { $from = $PlotArea{"bottom"} } |
4299 | 4430 | if ($till eq "") { |
4300 | | - $till = @PlotArea{"bottom"} + @PlotArea{"height"}; |
| 4431 | + $till = $PlotArea{"bottom"} + $PlotArea{"height"}; |
4301 | 4432 | } |
4302 | 4433 | $from += ($width / 200) |
4303 | 4434 | ; # compensate for overstrechting of thick lines |
4304 | 4435 | $till -= ($width / 200); |
4305 | | - if ($from > @Image{"height"}) { $from = @Image{"height"}; } |
4306 | | - if ($till > @Image{"height"}) { $till = @Image{"height"}; } |
| 4436 | + if ($from > $Image{"height"}) { $from = $Image{"height"}; } |
| 4437 | + if ($till > $Image{"height"}) { $till = $Image{"height"}; } |
4307 | 4438 | $script .= " points: $at(s) $from $at(s) $till\n"; |
4308 | 4439 | } |
4309 | 4440 | else { |
4310 | | - if ($from eq "") { $from = @PlotArea{"left"} } |
| 4441 | + if ($from eq "") { $from = $PlotArea{"left"} } |
4311 | 4442 | if ($till eq "") { |
4312 | | - $till = @PlotArea{"left"} + @PlotArea{"width"}; |
| 4443 | + $till = $PlotArea{"left"} + $PlotArea{"width"}; |
4313 | 4444 | } |
4314 | 4445 | $from += ($width / 200); |
4315 | 4446 | $till -= ($width / 200); |
4316 | | - if ($from > @Image{"width"}) { $from = @Image{"width"}; } |
4317 | | - if ($till > @Image{"width"}) { $till = @Image{"width"}; } |
| 4447 | + if ($from > $Image{"width"}) { $from = $Image{"width"}; } |
| 4448 | + if ($till > $Image{"width"}) { $till = $Image{"width"}; } |
4318 | 4449 | $script .= " points: $from $at(s) $till $at(s)\n"; |
4319 | 4450 | } |
4320 | 4451 | } |
4321 | 4452 | |
4322 | 4453 | if ($mode == 2) # draw parralel to time axis |
4323 | 4454 | { |
4324 | | - if (@Axis{"order"} =~ /reverse/i) { |
| 4455 | + if ($Axis{"order"} =~ /reverse/i) { |
4325 | 4456 | $from = -$from; |
4326 | 4457 | $till = -$till; |
4327 | 4458 | } |
4328 | 4459 | |
4329 | 4460 | $from .= "(s)+" . ($width / 200); |
4330 | 4461 | $till .= "(s)-" . ($width / 200); |
4331 | | - if (@Axis{"time"} eq "x") { |
4332 | | - if ($at eq "") { $at = @PlotArea{"bottom"}; } |
4333 | | - if ($at > @Image{"height"}) { $at = @Image{"height"}; } |
| 4462 | + if ($Axis{"time"} eq "x") { |
| 4463 | + if ($at eq "") { $at = $PlotArea{"bottom"}; } |
| 4464 | + if ($at > $Image{"height"}) { $at = $Image{"height"}; } |
4334 | 4465 | $script .= " points: $from $at $till $at\n"; |
4335 | 4466 | } |
4336 | 4467 | else { |
4337 | | - if ($at eq "") { $at = @PlotArea{"left"}; } |
4338 | | - if ($at > @Image{"width"}) { $at = @Image{"width"}; } |
| 4468 | + if ($at eq "") { $at = $PlotArea{"left"}; } |
| 4469 | + if ($at > $Image{"width"}) { $at = $Image{"width"}; } |
4339 | 4470 | $script .= " points: $at $from $at $till\n"; |
4340 | 4471 | } |
4341 | 4472 | } |
— | — | @@ -4343,24 +4474,24 @@ |
4344 | 4475 | { |
4345 | 4476 | @Points = split(",", $points); |
4346 | 4477 | foreach $point (@Points) { $point = &Normalize($point); } |
4347 | | - if ( (@Points[0] > @Image{"width"}) |
4348 | | - || (@Points[1] > @Image{"height"}) |
4349 | | - || (@Points[2] > @Image{"width"}) |
4350 | | - || (@Points[3] > @Image{"height"})) |
| 4478 | + if ( ($Points[0] > $Image{"width"}) |
| 4479 | + || ($Points[1] > $Image{"height"}) |
| 4480 | + || ($Points[2] > $Image{"width"}) |
| 4481 | + || ($Points[3] > $Image{"height"})) |
4351 | 4482 | { |
4352 | 4483 | &Error2( |
4353 | 4484 | "Linedata attribute 'points' invalid.\n" |
4354 | 4485 | . sprintf("(%d,%d)(%d,%d)", |
4355 | | - @Points[0] * 100, |
4356 | | - @Points[1] * 100, |
4357 | | - @Points[2] * 100, |
4358 | | - @Points[3] * 100) |
| 4486 | + $Points[0] * 100, |
| 4487 | + $Points[1] * 100, |
| 4488 | + $Points[2] * 100, |
| 4489 | + $Points[3] * 100) |
4359 | 4490 | . " does not fit in image\n" |
4360 | 4491 | ); |
4361 | 4492 | return; |
4362 | 4493 | } |
4363 | 4494 | $script .= |
4364 | | - " points: @Points[0] @Points[1] @Points[2] @Points[3]\n"; |
| 4495 | + " points: $Points[0] $Points[1] $Points[2] $Points[3]\n"; |
4365 | 4496 | } |
4366 | 4497 | } |
4367 | 4498 | |
— | — | @@ -4378,7 +4509,7 @@ |
4379 | 4510 | purple|lavender|lightpurple|powderblue|powderblue2)$/xi |
4380 | 4511 | ) |
4381 | 4512 | { |
4382 | | - if (!defined(@Colors{ lc($color) })) { |
| 4513 | + if (!defined($Colors{ lc($color) })) { |
4383 | 4514 | &StoreColor($color, $color, "", $command); |
4384 | 4515 | } |
4385 | 4516 | return ($true); |
— | — | @@ -4386,18 +4517,26 @@ |
4387 | 4518 | else { return ($false); } |
4388 | 4519 | } |
4389 | 4520 | |
| 4521 | +# Can be much simpler |
4390 | 4522 | sub ValidAbs { |
4391 | | - $value = shift; |
4392 | | - if ($value =~ /^ \d+ \.? \d* (?:px|in|cm)? $/xi) { return ($true); } |
4393 | | - else { return ($false); } |
| 4523 | + my $value = shift; |
| 4524 | + if ($value =~ /^ \d+ \.? \d* (?:px|in|cm)? $/xi) { |
| 4525 | + return ($true); |
| 4526 | + } |
| 4527 | + else { |
| 4528 | + return ($false); |
| 4529 | + } |
4394 | 4530 | } |
4395 | 4531 | |
| 4532 | +# Can be much simpler |
4396 | 4533 | sub ValidAbsRel { |
4397 | | - $value = shift; |
| 4534 | + my $value = shift; |
4398 | 4535 | if ($value =~ /^ \d+ \.? \d* (?:px|in|cm|$hPerc)? $/xi) { |
4399 | 4536 | return ($true); |
4400 | 4537 | } |
4401 | | - else { return ($false); } |
| 4538 | + else { |
| 4539 | + return ($false); |
| 4540 | + } |
4402 | 4541 | } |
4403 | 4542 | |
4404 | 4543 | sub ValidDateFormat { |
— | — | @@ -4452,8 +4591,8 @@ |
4453 | 4592 | my $date = shift; |
4454 | 4593 | my ($day, $month, $year, $dayf, $monthf, $yearf, $dayt, $montht, $yeart); |
4455 | 4594 | |
4456 | | - my $from = @Period{"from"}; |
4457 | | - my $till = @Period{"till"}; |
| 4595 | + my $from = $Period{"from"}; |
| 4596 | + my $till = $Period{"till"}; |
4458 | 4597 | |
4459 | 4598 | if (($DateFormat eq "yyyy") || ($DateFormat eq "x.y")) { |
4460 | 4599 | if (($date < $from) || ($date > $till)) { return ($false); } |
— | — | @@ -4547,7 +4686,7 @@ |
4548 | 4687 | $days -= int(($year - 1 - 1800) / 100); |
4549 | 4688 | if ($month > 1) { |
4550 | 4689 | for ($m = $month - 2; $m >= 0; $m--) { |
4551 | | - $days += @mmm[$m]; |
| 4690 | + $days += $mmm[$m]; |
4552 | 4691 | if ($m == 1) { |
4553 | 4692 | if ((($year % 4) == 0) && (($year % 100) != 0)) { $days++; } |
4554 | 4693 | } |
— | — | @@ -4581,8 +4720,8 @@ |
4582 | 4721 | } |
4583 | 4722 | |
4584 | 4723 | $month = 0; |
4585 | | - while ($days > @mmm[$month]) { |
4586 | | - $days -= @mmm[$month]; |
| 4724 | + while ($days > $mmm[$month]) { |
| 4725 | + $days -= $mmm[$month]; |
4587 | 4726 | if ($month == 1) { |
4588 | 4727 | if ((($year % 4) == 0) && (($year % 100) != 0)) { $days--; } |
4589 | 4728 | } |
— | — | @@ -4600,8 +4739,8 @@ |
4601 | 4740 | } |
4602 | 4741 | |
4603 | 4742 | sub ExtractText { |
4604 | | - my $data = shift; |
4605 | | - my $data2 = $data; |
| 4743 | + # my $data = shift; |
| 4744 | + my $data2 = shift; |
4606 | 4745 | my $text = ""; |
4607 | 4746 | |
4608 | 4747 | # special case: allow embedded spaces when 'text' is last attribute |
— | — | @@ -4670,13 +4809,13 @@ |
4671 | 4810 | $barcnt--; |
4672 | 4811 | $a = $#Bars; |
4673 | 4812 | for (my $b = 0; $b <= $#Bars; $b++) { |
4674 | | - if (lc(@Bars[$b]) eq lc($barid . $barcnt)) { |
| 4813 | + if (lc($Bars[$b]) eq lc($barid . $barcnt)) { |
4675 | 4814 | $b++; |
4676 | 4815 | for (my $b2 = $#Bars + 1; $b2 > $b; $b2--) { |
4677 | | - @Bars[$b2] = @Bars[ $b2 - 1 ]; |
| 4816 | + $Bars[$b2] = $Bars[ $b2 - 1 ]; |
4678 | 4817 | } |
4679 | | - @Bars[$b] = lc($bar); |
4680 | | - @BarLegend{ lc($bar) } = " "; |
| 4818 | + $Bars[$b] = lc($bar); |
| 4819 | + $BarLegend{ lc($bar) } = " "; |
4681 | 4820 | return ($true); |
4682 | 4821 | } |
4683 | 4822 | } |
— | — | @@ -4784,27 +4923,27 @@ |
4785 | 4924 | $hint .= "'"; |
4786 | 4925 | |
4787 | 4926 | foreach $attribute (@Required) { |
4788 | | - if ( (!defined(@Attributes{$attribute})) |
4789 | | - || (@Attributes{$attribute} eq "")) |
| 4927 | + if ( (!defined($Attributes{$attribute})) |
| 4928 | + || ($Attributes{$attribute} eq "")) |
4790 | 4929 | { |
4791 | 4930 | &Error("$name definition incomplete. $hint"); |
4792 | 4931 | undef(@Attributes); |
4793 | 4932 | return ($false); |
4794 | 4933 | } |
4795 | | - delete(@Attributes2{$attribute}); |
| 4934 | + delete($Attributes2{$attribute}); |
4796 | 4935 | } |
4797 | | - foreach $attribute (@Allowed) { delete(@Attributes2{$attribute}); } |
| 4936 | + foreach $attribute (@Allowed) { delete($Attributes2{$attribute}); } |
4798 | 4937 | |
4799 | 4938 | @AttrKeys = keys %Attributes2; |
4800 | 4939 | if ($#AttrKeys >= 0) { |
4801 | | - if (@AttrKeys[0] eq "single") { |
| 4940 | + if ($AttrKeys[0] eq "single") { |
4802 | 4941 | &Error( |
4803 | 4942 | "$name definition invalid. Specify all attributes as name:value pairs." |
4804 | 4943 | ); |
4805 | 4944 | } |
4806 | 4945 | else { |
4807 | 4946 | &Error( "$name definition invalid. Invalid attribute '" |
4808 | | - . @AttrKeys[0] |
| 4947 | + . $AttrKeys[0] |
4809 | 4948 | . "' found. $hint"); |
4810 | 4949 | } |
4811 | 4950 | undef(@Attributes); |
— | — | @@ -4833,7 +4972,7 @@ |
4834 | 4973 | split('\|', $preset); |
4835 | 4974 | if ($attrname eq "") { $attrname = "single"; } |
4836 | 4975 | |
4837 | | - $attrvalue = @Attributes{$attrname}; |
| 4976 | + $attrvalue = $Attributes{$attrname}; |
4838 | 4977 | |
4839 | 4978 | if (($action eq "-") && ($attrvalue ne "")) { |
4840 | 4979 | if ($attrname eq "single") { |
— | — | @@ -4844,15 +4983,15 @@ |
4845 | 4984 | &Error("Chosen preset conflicts with '$attrname:...'.\n" |
4846 | 4985 | . " Please remove this attribute."); |
4847 | 4986 | } |
4848 | | - @Attributes{$attrname} = ""; |
| 4987 | + $Attributes{$attrname} = ""; |
4849 | 4988 | } |
4850 | 4989 | |
4851 | 4990 | if (($action eq "+") && ($attrvalue eq "")) { |
4852 | | - if ($addvalue) { @Attributes{$attrname} = $attrpreset; } |
| 4991 | + if ($addvalue) { $Attributes{$attrname} = $attrpreset; } |
4853 | 4992 | } |
4854 | 4993 | |
4855 | 4994 | if (($action eq "=") && ($attrvalue eq "")) { |
4856 | | - @Attributes{$attrname} = $attrpreset; |
| 4995 | + $Attributes{$attrname} = $attrpreset; |
4857 | 4996 | } |
4858 | 4997 | |
4859 | 4998 | if ( ($action eq "=") |
— | — | @@ -4869,7 +5008,7 @@ |
4870 | 5009 | "Conflicting settings.\nPreset defines '$attrname:$attrpreset'." |
4871 | 5010 | ); |
4872 | 5011 | } |
4873 | | - @Attributes{$attrname} = $attrpreset; |
| 5012 | + $Attributes{$attrname} = $attrpreset; |
4874 | 5013 | } |
4875 | 5014 | } |
4876 | 5015 | } |
— | — | @@ -5161,7 +5300,7 @@ |
5162 | 5301 | |
5163 | 5302 | open "FILE_OUT", ">", $file_errors; |
5164 | 5303 | print FILE_OUT |
5165 | | - "<p>EasyTimeline $version</p><p><b>Timeline generation failed: " |
| 5304 | + "<p>EasyTimeline $VERSION</p><p><b>Timeline generation failed: " |
5166 | 5305 | . &EncodeHtml($msg) |
5167 | 5306 | . "</b></p>\n"; |
5168 | 5307 | foreach $line (@Errors) { print FILE_OUT &EncodeHtml($line) . "\n"; } |
— | — | @@ -5203,6 +5342,7 @@ |
5204 | 5343 | my $unicode = shift; |
5205 | 5344 | my $char = substr($unicode, 0, 1); |
5206 | 5345 | my $ord = ord($char); |
| 5346 | + my $value; |
5207 | 5347 | |
5208 | 5348 | if ($ord < 128) # plain ascii character |
5209 | 5349 | { |
— | — | @@ -5222,8 +5362,11 @@ |
5223 | 5363 | |
5224 | 5364 | # $html = "\&\#" . $value . ";" ; any unicode can be specified as html char |
5225 | 5365 | |
5226 | | - if (($value >= 128) && ($value <= 255)) { return (chr($value)); } |
5227 | | - else { return "?"; } |
| 5366 | + if (($value >= 128) && ($value <= 255)) { |
| 5367 | + return (chr($value)); |
| 5368 | + } |
| 5369 | + else { |
| 5370 | + return "?"; |
| 5371 | + } |
5228 | 5372 | } |
5229 | 5373 | } |
5230 | | - |