changeset 22:1bd3a6740cfb

Fix return value calculation.
author Mikhail Kryshen <mikhail@kryshen.net>
date Wed, 22 Apr 2009 03:04:30 +0400
parents 8c6302226917
children 55fe63bb7858
files doc/manual/manual.tema src/kryshen/tema/TemplateParser.java
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/doc/manual/manual.tema	Wed Apr 22 01:48:11 2009 +0400
+++ b/doc/manual/manual.tema	Wed Apr 22 03:04:30 2009 +0400
@@ -58,8 +58,8 @@
 <%par:Every function returns integer value. The general convention is to 
 return non-zero for successful operation. The value of the macro substitution 
 is the return value of the first function in the function list. The value of
-any Tema text is the sum value of all macro in the text, except the value of
-the text without any macro equals -1.%>
+any Tema text is the sum of the absolute values of all macro in the text,
+except the value of the text without any macro equals -1.%>
 
 <%par:Internally, Tema function could be represented by any Java object.
 Instances of kryshen.tema.Function and kryshen.tema.Context are handled
--- a/src/kryshen/tema/TemplateParser.java	Wed Apr 22 01:48:11 2009 +0400
+++ b/src/kryshen/tema/TemplateParser.java	Wed Apr 22 03:04:30 2009 +0400
@@ -184,9 +184,9 @@
                     
                     int tb = termBracket;
                     termBracket = openBracket;
-                    int returnCode = Math.abs(parseFunction(in, out, format));
+                    int returnCode = parseFunction(in, out, format);
                     lastReturnCode = returnCode;
-                    result.retCode += returnCode;
+                    result.retCode += Math.abs(returnCode);
                     result.empty = false;
                     termBracket = tb;