[Kst] extragear/graphics/kst/kst/extensions/js

George Staikos staikos at kde.org
Wed May 25 20:27:21 CEST 2005


SVN commit 418146 by staikos:

add exception support and fix return types


 M  +2 -1      bind_vector.h  
 M  +16 -2     jsdocs2xml.pl  


--- trunk/extragear/graphics/kst/kst/extensions/js/bind_vector.h #418145:418146
@@ -58,7 +58,8 @@
                                editable.
     */
     KJS::Value resize(KJS::ExecState *exec, const KJS::List& args);
-    /* @method Number interpolate
+    /* @method interpolate
+       @returns Number
        @description Interpolates the vector to <i>n</i> samples and
                     returns the interpolated value of sample <i>i</i>.
        @arg Number i The sample number to obtain the interpolated value of.
--- trunk/extragear/graphics/kst/kst/extensions/js/jsdocs2xml.pl #418145:418146
@@ -110,8 +110,8 @@
 	$handle = @_[0];
 	$return = "";
 	$_ = $text;
-	if (/(.*?)\@(\w+)\s+(\w+)\s+(\w+)/) {
-		$return = " type=\"$4\"";
+	if (/(.*?)\@returns\s+(\w+)/) {
+		$return = " type=\"$2\"";
 	}
 	print $handle "$indent<$type name=\"$name\"$return>\n";
 	while ($text) {
@@ -154,6 +154,20 @@
 					return;
 				}
 			} elsif (/^exception$/) {
+				$_ = $rest;
+				if (/\s*(\w+)\s*(.*?)(\@\w+.*|$)/s) {
+					$ename = $1;
+					$edesc = escape($2);
+					$rest = $3;
+					print $handle "$indent  <exception name=\"$ename\">\n";
+					print $handle "$indent    <description>\n";
+					print $handle "$indent    $edesc\n";
+					print $handle "$indent    </description>\n";
+					print $handle "$indent  </exception>\n";
+				} else {
+					print "Error: \@exception requires two arguments\n";
+					return;
+				}
 			} else {
 				print "Found an unknown comment type: $_\n";
 			}


More information about the Kst mailing list