Explicitely sort the elements (tags, attributes) in the generated files

Otherwise, the diff easily become untractable when the a differing
version of Perl is used.

---
 flexml.pl                            |   22 +++++++++++-----------
 testbed/missing-att.stderr.expected  |    2 +-
 testbed/multiple-att.stderr.expected |    2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

Index: b/flexml.pl
===================================================================
--- a/flexml.pl
+++ b/flexml.pl
@@ -227,7 +227,7 @@ EOT
 sub api_functions { # Print XML application interface functions.
   my ($pre,$post) = @_;
   print "/* XML application entry points. */\n" if @tags;
-  for (@tags) {
+  for (sort @tags) {
     print $pre . "void STag_${tagprefix}$ctag{$_}(void)$post\n" unless $startok{$_};
     print $pre . "void ETag_${tagprefix}$ctag{$_}(void)$post\n" unless $endok{$_};
   }
@@ -236,7 +236,7 @@ sub api_functions { # Print XML applicat
 
 sub api_types { # Print XML application interface types.
   print "/* XML application data. */\n" if %atttype;
-  for (keys %atttype) {
+  for (sort keys %atttype) {
     if (m.($Nmtoken)[/]($Nmtoken).xo) {
       my ($tag,$attribute) = ($1,$2);
       print "typedef $typeof{$_} AT_${tagprefix}$ctag{$tag}_$catt{$attribute};\n";
@@ -254,7 +254,7 @@ sub api_data { # Print XML application i
   print "extern char *${tagprefix}bufferstack;\n";
   print "#define ${tagprefix}pcdata (${tagprefix}bufferstack + ${tagprefix}pcdata_ix)\n";
 
-  for (keys %atttype) {
+  for (sort keys %atttype) {
     if (m.($Nmtoken)[/]($Nmtoken).xo) {
       print $pre . "AT_${tagprefix}$ctag{$1}_$catt{$2} AX_${tagprefix}$ctag{$1}_$catt{$2};\n";
       print "#define A_${tagprefix}$ctag{$1}_$catt{$2} ";
@@ -1288,7 +1288,7 @@ if ($scanner or $standalone) {
     }
     elsif ( /^FLEXML_START_CONDITIONS$/ ) {
 
-      for (@tags) {
+      for (sort @tags) {
 	my $c = $ctag{$_};
 	print "%x"
             . ($roottags{$_} ? " ROOT_${tagprefix}$c" : "")
@@ -1321,7 +1321,7 @@ if ($scanner or $standalone) {
 	my $c = $ctag{$tag};
 	print "  ${tagprefix}statenames[ROOT_${tagprefix}$c] = NULL;\n" if $roottags{$tag};
 	print "  ${tagprefix}statenames[AL_${tagprefix}$c] = NULL;\n";
-	for (split ',',$states{$tag}) {
+	for (sort split ',',$states{$tag}) {
 	  print "  ${tagprefix}statenames[$_] = \"$tag\";\n";
 	}
       }
@@ -1333,7 +1333,7 @@ if ($scanner or $standalone) {
 	              : ( $uri ? "(\"'$uri'\"|\"\\\"$uri\\\"\")"
 			       : "(\"'$dtd'\"|\"\\\"$dtd\\\"\")" );
 
-      for (keys %roottags) {
+      for (sort keys %roottags) {
 	my $c = $ctag{$_};
 	print " \"<!DOCTYPE\"{S}\"$_\"{S}"
 	    . "SYSTEM{S}" . $sysid . "{s}\">\" SET(ROOT_${tagprefix}$c);\n";
@@ -1348,7 +1348,7 @@ if ($scanner or $standalone) {
     elsif ( /^FLEXML_RULES$/ ) {
 
       # Dump all parameter entity declarations.
-      for (keys %parameter) { printsource($_); }
+      for (sort keys %parameter) { printsource($_); }
 
       # Dump all start and empty tag recognition rules.
       for my $tag (@tags) {
@@ -1368,12 +1368,12 @@ if ($scanner or $standalone) {
 	if (exists $exittrans{$tag}) {
 	  $exitswitch .= "  switch (YY_START) {\n";
 	  my %casesto = ();
-	  for (split /,/,$exittrans{$tag}) {
+	  for (sort split /,/,$exittrans{$tag}) {
 	    if (m/^($Name)=>($Name)$/o) {
 	      $casesto{$2} .= "case $1: ";
 	    }
 	  }
-	  for (keys %casesto) {
+	  for (sort keys %casesto) {
 	    $exitswitch .= "   $casesto{$_}SET($_); break;\n" 
 	  }
 	  $exitswitch .= "  }\n";
@@ -1569,7 +1569,7 @@ if ($scanner or $standalone) {
     elsif ( /FLEXML_NON_MIXED([,>])/ ) {
 
       my $sep = $`;
-      for (@tags) {
+      for (sort @tags) {
 	print $sep . ($roottags{$_} ? "ROOT_${tagprefix}$ctag{$_}," : "")
             . "AL_${tagprefix}$ctag{$_}";
 	print ",$states{$_}" if $properempty{$_} or $children{$_};
@@ -1606,7 +1606,7 @@ if ($scanner or $standalone) {
 
       # Catch-all error cases.
       for my $tag (@tags) {
-	 for (split ',',$states{$tag}) {
+	 for (sort split ',',$states{$tag}) {
 	   print "<$_>{\n";
 	   print " .    FAIL(\"Unrecognized `%c' in $_.\",yytext[0]);\n";
 	   print " [\\n] FAIL(\"Unrecognized newline in $_.\");\n";
Index: b/testbed/missing-att.stderr.expected
===================================================================
--- a/testbed/missing-att.stderr.expected
+++ b/testbed/missing-att.stderr.expected
@@ -1 +1 @@
-Invalid XML (state 13): Required attribute `batt' not set for `bar' element.
+Invalid XML (state 10): Required attribute `batt' not set for `bar' element.
Index: b/testbed/multiple-att.stderr.expected
===================================================================
--- a/testbed/multiple-att.stderr.expected
+++ b/testbed/multiple-att.stderr.expected
@@ -1 +1 @@
-Invalid XML (state 13): Multiple definition of attribute batt in <bar>
+Invalid XML (state 10): Multiple definition of attribute batt in <bar>
