add private data integral (bug 534970) a=npotb
authorFrédéric Wang <fred.wang@free.fr>
Mon, 08 Nov 2010 09:34:44 +1300
changeset 57079 0e03f2057b4cf37daeb915b81122b1c05b168cc3
parent 57078 38bc6e6dbf06204fc3143ba08ac4c050e4f97cc3
child 57080 e3ce3780f87062e3eb2006c9a3b06e4271fc8546
push idunknown
push userunknown
push dateunknown
reviewersnpotb
bugs534970
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
add private data integral (bug 534970) a=npotb
layout/mathml/updateOperatorDictionary.pl
--- a/layout/mathml/updateOperatorDictionary.pl
+++ b/layout/mathml/updateOperatorDictionary.pl
@@ -77,16 +77,17 @@ if ($ARGV[0] eq "compare" && $#ARGV == 1
 #      6   | stretchy
 #      7   | separator
 #      8   | accent
 #      9   | fence
 #     10   | symmetric
 #     11   | priority
 #     12   | linebreakstyle
 #     13   | direction
+#     14   | integral
 
 # 1) build %moz_hash from $MOZ_DICTIONARY
 
 print "loading $MOZ_DICTIONARY...\n";
 open($file, $MOZ_DICTIONARY) || die ("Couldn't open $MOZ_DICTIONARY!");
 
 print "building dictionary...\n";
 while (<$file>) {
@@ -109,16 +110,17 @@ while (<$file>) {
     $value[7] = (m/^(.*)separator(.*)$/);
     $value[8] = (m/^(.*)accent(.*)$/);
     $value[9] = (m/^(.*)fence(.*)$/);
     $value[10] = (m/^(.*)symmetric(.*)$/);
     $value[11] = ""; # we don't store "priority" in our dictionary
     $value[12] = ""; # we don't store "linebreakstyle" in our dictionary
     if (m/^(.*)direction:([a-z]*)(.*)$/) { $value[13] = $2; }
     else { $value[13] = ""; }
+    $value[14] = (m/^(.*)integral(.*)$/);
 
     # 1.3) save the key and value
     $moz_hash{$key} = [ @value ];
 }
 
 close($file);
 
 ################################################################################
@@ -126,32 +128,46 @@ close($file);
 #    If mode "compare", go to step 3)
 
 if ($ARGV[0] eq "check") {
     print "checking operator dictionary...\n";
     open($file_syntax_errors, ">$FILE_SYNTAX_ERRORS") ||
         die ("Couldn't open $FILE_SYNTAX_ERRORS!");
 
     $nb_errors = 0;
+    $nb_warnings = 0;
     @moz_keys = (keys %moz_hash);
     # check the validity of our private data
     while ($key = pop(@moz_keys)) {
         @moz = @{ $moz_hash{$key} };
         $entry = &generateEntry($key, @moz);
         $valid = 1;
 
         if (!(@moz[13] eq "" ||
               @moz[13] eq "horizontal" ||
               @moz[13] eq "vertical")) {
             $valid = 0;
+            $nb_errors++;
             print $file_syntax_errors "error: invalid direction \"$moz[13]\"\n";
         }
 
+        if (!@moz[4] && @moz[14]) {
+            $valid = 0;
+            $nb_warnings++;
+            print $file_syntax_errors "warning: operator is integral but not lareop\n";
+        }
+        
+        $_ = @moz[0];
+        if ((m/^(.*)[iI]ntegral(.*)$/) && !@moz[14]) {
+            $valid = 0;
+            $nb_warnings++;
+            print $file_syntax_errors "warning: operator contains the term \"integral\" in its comment, but is not integral\n";
+        }
+
         if (!$valid) {
-            $nb_errors++;
             print $file_syntax_errors $entry;
             print $file_syntax_errors "\n";
         }
     }
 
     # check that all forms have the same direction.
     @moz_keys = (keys %moz_hash);
     while ($key = pop(@moz_keys)) {
@@ -217,18 +233,19 @@ if ($ARGV[0] eq "check") {
             if (@moz_postfix) {
                 delete $moz_hash{$key_postfix};
             }
         }
     }
 
     close($file_syntax_errors);
     print "\n";
-    if ($nb_errors > 0) {
-        print "$nb_errors errors found\n";
+    if ($nb_errors > 0 || $nb_warnings > 0) {
+        print "$nb_errors error(s) found\n";
+        print "$nb_warnings warning(s) found\n";
         print "See output file $FILE_SYNTAX_ERRORS.\n\n";
     } else {
         print "No error found.\n\n";
     }
 
     exit 0;
 }
 
@@ -279,16 +296,17 @@ for ($i = 0; $i < $n; $i++) {
     $value[8] = (m/^(.*)accent(.*)$/);
     $value[9] = (m/^(.*)fence(.*)$/);
     $value[10] = (m/^(.*)symmetric(.*)$/);
     $value[11] = $entry->getAttribute("priority");
     $value[12] = $entry->getAttribute("linebreakstyle");
 
     # not stored in the WG dictionary
     $value[13] = ""; # direction
+    $value[14] = ""; # integral
 
     # 3.3) save the key and value
     push(@wg_keys, $key);
     $wg_hash{$key} = [ @value ];
 }
 $doc->dispose;
 @wg_keys = reverse(@wg_keys);
 
@@ -414,16 +432,17 @@ sub generateCommon {
 
 sub completeCommon {
     # helper to add key and private data to generateCommon
     my($entry, $key, @v_moz, @v_wg) = @_;
     
     $entry = "$key = $entry";
 
     if ($v_moz[13]) { $entry = "$entry direction:$v_moz[13]"; }
+    if ($v_moz[14]) { $entry = "$entry integral"; }
 
     if ($v_moz[0]) {
         # keep our previous comment
         $entry = "$entry # $v_moz[0]";
     } else {
         # otherwise use the description given by the WG
         $entry = "$entry # $v_wg[0]";
     }