r7057 struggleyb - /branches/struggleyb/domts-transform-perl/DOMTSHandler.pm

netsurf at semichrome.net netsurf at semichrome.net
Wed Apr 8 07:36:25 BST 2009


Author: struggleyb
Date: Wed Apr  8 01:36:24 2009
New Revision: 7057

URL: http://source.netsurf-browser.org?rev=7057&view=rev
Log:
Complete attribute setter method generation.

Modified:
    branches/struggleyb/domts-transform-perl/DOMTSHandler.pm

Modified: branches/struggleyb/domts-transform-perl/DOMTSHandler.pm
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-perl/DOMTSHandler.pm?rev=7057&r1=7056&r2=7057&view=diff
==============================================================================
--- branches/struggleyb/domts-transform-perl/DOMTSHandler.pm (original)
+++ branches/struggleyb/domts-transform-perl/DOMTSHandler.pm Wed Apr  8 01:36:24 2009
@@ -381,7 +381,7 @@
 
 		if ($t eq "DOMString") {
 			$self->generate_domstring($ats{$p});
-			$params = $params.", string$string_index";
+			$params = $params.", dstring$string_index";
 			next;
 		}
 
@@ -462,9 +462,16 @@
 	}
 
 	my $setter = to_attribute_setter($ats{'interface'}, "$en");
+	my $param = "$ats{'obj'}";
+	if ($node->getAttribute("type") eq "DOMString") {
+		$self->generate_domstring($ats{'value'});
+		$param = $param.", dstring$string_index";
+	} else {
+		$param = $param.", $ats{'value'}";
+	}
 
 	print << "__EOF__";
-	exp = $setter($ats{'obj'}, $ats{'value'});
+	exp = $setter($param);
 	if (exp != DOM_NO_ERR) {
 		fprintf(stderr, "Exception raised when fetch attribute %s", $en);
 __EOF__
@@ -591,6 +598,9 @@
 	if ($name =~ /assert/i) {
 		print "\tassert($cond);\n";
 	}
+
+	# Print some comments
+	print "\t/* End of $name */\n\n";
 }
 
 sub record_statement {
@@ -625,6 +635,9 @@
 #    print the real statement.
 # 2. "end", then we are in sub-statement of that assertion, and we are not the 
 #    first one, just print the statement.
+#
+# But after searching the whole testcases, I found no use of sub-statements of assertions.
+# So, this function left unsed!
 
 sub end_half_assertion {
 	my ($self, $name) = @_;
@@ -686,6 +699,9 @@
 		$param = $param.", $ats->{ignoreCase}";
 	}
 
+	# Print some comments for more readability
+	print "\t/* Start $name */\n";
+
 	$condition_index++;
 	print "\tbool condition$condition_index;\n";
 	print "\tcondition$condition_index = $method($param);\n";
@@ -709,6 +725,10 @@
 
 	my $method = "is_null";
 	my $obj = $ats->{'actual'} || $ats->{'obj'};
+
+	# Print some comments for more readability
+	print "\t/* Start $name */\n";
+
 	$condition_index++;
 	print "\tbool condition$condition_index;\n";
 	print "\tcondition$condition_index = $method((void *)$obj);\n";
@@ -731,6 +751,10 @@
 
 	my $method = "is_true";
 	my $obj = $ats->{'actual'} || $ats->{'value'};
+
+	# Print some comments for more readability
+	print "\t/* Start $name */\n";
+
 	if (defined($obj)) {
 		$condition_index++;
 		print "\tbool condition$condition_index;\n";




More information about the netsurf-commits mailing list