[Libreoffice-commits] .: Branch 'integration/dev300_m101' - scp2/source solenv/bin
Michael Meeks
mmeeks at kemper.freedesktop.org
Thu Mar 17 13:49:03 PDT 2011
scp2/source/calc/file_calc.scp | 2
scp2/source/graphicfilter/file_graphicfilter.scp | 2
scp2/source/ooo/file_ooo.scp | 2
solenv/bin/modules/par2script/work.pm | 120 +++++++++++------------
4 files changed, 65 insertions(+), 61 deletions(-)
New commits:
commit fe49ddd25a0f2555902df2b4cf3f090beb3dead5
Author: Michael Meeks <michael.meeks at novell.com>
Date: Thu Mar 17 20:46:52 2011 +0000
fix scp2 errors, re-factor, accelerate, and add error detection to parser
diff --git a/scp2/source/calc/file_calc.scp b/scp2/source/calc/file_calc.scp
index fc55805..b1fd14b 100644
--- a/scp2/source/calc/file_calc.scp
+++ b/scp2/source/calc/file_calc.scp
@@ -53,7 +53,7 @@ STD_LIB_FILE( gid_File_Lib_Sc, sc)
STD_LIB_FILE( gid_File_Lib_Scui, scui)
-STD_UNO_LIB_FILE( gid_File_Lib_Scfilt, scfilt)
+STD_FILTER_FILE( gid_File_Lib_Scfilt, scfilt)
STD_LIB_FILE( gid_File_Lib_Scd, scd)
diff --git a/scp2/source/graphicfilter/file_graphicfilter.scp b/scp2/source/graphicfilter/file_graphicfilter.scp
index eeac226..35895bd 100644
--- a/scp2/source/graphicfilter/file_graphicfilter.scp
+++ b/scp2/source/graphicfilter/file_graphicfilter.scp
@@ -38,4 +38,4 @@ STD_LIB_FILE( gid_File_Lib_Flash, flash )
STD_LIB_FILE( gid_File_Lib_Svg, svgfilter )
-STD_LIB_FILE( gid_File_Lib_WPGImport, wpgimport )
+STD_FILTER_FILE( gid_File_Lib_WPGImport, wpgimport )
diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
index 56cb070..035ab2c 100644
--- a/scp2/source/ooo/file_ooo.scp
+++ b/scp2/source/ooo/file_ooo.scp
@@ -314,7 +314,7 @@ File gid_File_Dtd_Toolbar
Name = "toolbar.dtd";
End
-STD_LIB_FILE( gid_File_Filter_Sdfilt, sdfilt)
+STD_FILTER_FILE( gid_File_Filter_Sdfilt, sdfilt)
STD_FILTER_FILE( gid_File_Filter_Eme, eme)
diff --git a/solenv/bin/modules/par2script/work.pm b/solenv/bin/modules/par2script/work.pm
index 273436f..a862420 100644
--- a/solenv/bin/modules/par2script/work.pm
+++ b/solenv/bin/modules/par2script/work.pm
@@ -148,68 +148,72 @@ sub collect_definitions
my $multidefinitionerror = 0;
my @multidefinitiongids = ();
+ my %itemhash;
- foreach $oneitem ( @par2script::globals::allitems )
- {
- my $docollect = 0;
- my $gid = "";
- my %allitemhash = ();
-
- for ( my $i = 0; $i <= $#{$parfilecontent}; $i++ )
- {
- my $line = ${$parfilecontent}[$i];
-
- if ( $line =~ /^\s*$oneitem\s+(\w+)\s*$/ )
- {
- $gid = $1;
- $docollect = 1;
- }
- else
- {
- $docollect = 0;
- }
-
- if ( $docollect )
- {
- my $currentline = $i;
- my %oneitemhash;
-
- while (! ( ${$parfilecontent}[$currentline] =~ /^\s*End\s*$/i ) )
- {
- if ( ${$parfilecontent}[$currentline] =~ /^\s*(.+?)\s*\=\s*(.+?)\s*\;\s*$/ ) # only oneliner!
- {
- $itemkey = $1;
- $itemvalue = $2;
-
- if ( $oneitem eq "Directory" ) { if ( $itemkey =~ "DosName" ) { $itemkey =~ s/DosName/HostName/; } }
- if (( $oneitem eq "Directory" ) || ( $oneitem eq "File" ) || ( $oneitem eq "Unixlink" )) { if ( $itemvalue eq "PD_PROGDIR" ) { $itemvalue = "PREDEFINED_PROGDIR"; }}
- if (( $itemkey eq "Styles" ) && ( $itemvalue =~ /^\s*(\w+)(\s*\;\s*)$/ )) { $itemvalue = "($1)$2"; }
-
- $oneitemhash{$itemkey} = $itemvalue;
- }
-
- $currentline++;
- }
-
- # no hyphen allowed in gids -> cannot happen here because (\w+) is required for gids
- if ( $gid =~ /-/ ) { par2script::exiter::exit_program("ERROR: No hyphen allowed in global id: $gid", "test_of_hyphen"); }
-
- # test of uniqueness
- if ( exists($allitemhash{$gid}) )
- {
- $multidefinitionerror = 1;
- push(@multidefinitiongids, $gid);
- }
-
- $allitemhash{$gid} = \%oneitemhash;
- }
- }
+ # create empty item hashes
+ foreach $oneitem ( @par2script::globals::allitems ) {
+ my %items;
+ $par2script::globals::definitions{$oneitem} = \%items;
+ }
- $par2script::globals::definitions{$oneitem} = \%allitemhash;
+ for ( my $i = 0; $i <= $#{$parfilecontent}; $i++ )
+ {
+ my $line = ${$parfilecontent}[$i];
+ my $oneitem, $gid;
+
+ $line =~ /^\s*$/ && next; # skip blank lines
+
+ # lines should be well formed:
+ if ($line =~ m/^\s*(\w+)\s+(\w+)\s*$/)
+ {
+ $oneitem = $1;
+ $gid = $2;
+ } else {
+ par2script::exiter::exit_program("ERROR: malformed par file, expecting <token> <gid> but saw '$line'", "test_par_syntax");
+ }
+# print STDERR "line '$line' -> '$oneitem' '$gid'\n";
+
+ # hunt badness variously
+ if ( ! defined $par2script::globals::definitions{$oneitem} )
+ {
+ par2script::exiter::exit_program("ERROR: invalid scp2 fragment item type '$oneitem' in line: '$line'", "test_par_syntax");
+ }
+
+ # no hyphen allowed in gids -> cannot happen here because (\w+) is required for gids
+ if ( $gid =~ /-/ ) { par2script::exiter::exit_program("ERROR: No hyphen allowed in global id: $gid", "test_of_hyphen"); }
+
+ my %oneitemhash;
+
+ while (! ( ${$parfilecontent}[$i] =~ /^\s*End\s*$/i ) )
+ {
+ if ( ${$parfilecontent}[$i] =~ /^\s*(.+?)\s*\=\s*(.+?)\s*\;\s*$/ ) # only oneliner!
+ {
+ $itemkey = $1;
+ $itemvalue = $2;
+
+ if ( $oneitem eq "Directory" ) { if ( $itemkey =~ "DosName" ) { $itemkey =~ s/DosName/HostName/; } }
+ if (( $oneitem eq "Directory" ) || ( $oneitem eq "File" ) || ( $oneitem eq "Unixlink" )) { if ( $itemvalue eq "PD_PROGDIR" ) { $itemvalue = "PREDEFINED_PROGDIR"; }}
+ if (( $itemkey eq "Styles" ) && ( $itemvalue =~ /^\s*(\w+)(\s*\;\s*)$/ )) { $itemvalue = "($1)$2"; }
+
+ $oneitemhash{$itemkey} = $itemvalue;
+ }
+ $i++;
+ }
+
+ my $allitemhash = \$par2script::globals::definitions{$oneitem};
+
+ # test of uniqueness
+ if ( defined ($par2script::globals::definitions{$oneitem}->{$gid}) )
+ {
+ $multidefinitionerror = 1;
+ push(@multidefinitiongids, $gid);
+ }
+
+ $par2script::globals::definitions{$oneitem}->{$gid} = \%oneitemhash;
}
- if ( $multidefinitionerror ) { par2script::exiter::multidefinitionerror(\@multidefinitiongids); }
-
+ if ( $multidefinitionerror ) { par2script::exiter::multidefinitionerror(\@multidefinitiongids); }
+
# foreach $key (keys %par2script::globals::definitions)
# {
# print "Key: $key \n";
More information about the Libreoffice-commits
mailing list