geirm       01/08/07 14:56:30

  Modified:    src/java/org/apache/velocity/runtime/parser/node
                        ASTAddNode.java ASTAndNode.java ASTDirective.java
                        ASTDivNode.java ASTEQNode.java ASTGENode.java
                        ASTGTNode.java ASTIdentifier.java
                        ASTIntegerRange.java ASTLENode.java ASTLTNode.java
                        ASTMethod.java ASTModNode.java ASTMulNode.java
                        ASTNENode.java ASTReference.java
                        ASTSetDirective.java ASTStringLiteral.java
                        ASTSubtractNode.java SimpleNode.java
  Log:
  Support for separable instances of the runtime engine.
  
  Revision  Changes    Path
  1.7       +3 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAddNode.java
  
  Index: ASTAddNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAddNode.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ASTAddNode.java   2001/06/20 04:24:24     1.6
  +++ ASTAddNode.java   2001/08/07 21:56:30     1.7
  @@ -63,11 +63,10 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTAddNode.java,v 1.6 2001/06/20 04:24:24 geirm Exp $ 
  + * @version $Id: ASTAddNode.java,v 1.7 2001/08/07 21:56:30 geirm Exp $ 
   */
   
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.Parser;
   
   import org.apache.velocity.exception.MethodInvocationException;
  @@ -111,7 +110,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) 
  +            rsvc.error( ( left == null ? "Left" : "Right" ) 
                              + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of addition operation has null value."
  @@ -127,7 +126,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of addition operation is not a valid type. "
                              + "Currently only integers (1,2,3...) and Integer type 
is supported. "
                              + context.getCurrentTemplateName() + " [line " + 
getLine() 
  
  
  
  1.7       +3 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java
  
  Index: ASTAndNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ASTAndNode.java   2001/05/30 04:47:38     1.6
  +++ ASTAndNode.java   2001/08/07 21:56:30     1.7
  @@ -58,14 +58,14 @@
   import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.parser.Parser;
   import org.apache.velocity.exception.MethodInvocationException;
  -import org.apache.velocity.runtime.Runtime;
  +
   /**
    * Please look at the Parser.jjt file which is
    * what controls the generation of this class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTAndNode.java,v 1.6 2001/05/30 04:47:38 geirm Exp $ 
  + * @version $Id: ASTAndNode.java,v 1.7 2001/08/07 21:56:30 geirm Exp $ 
    */
   public class ASTAndNode extends SimpleNode
   {
  @@ -114,7 +114,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) + " side of '&&' 
operation is null."
  +            rsvc.error( ( left == null ? "Left" : "Right" ) + " side of '&&' 
operation is null."
                              + " Operation not possible. "
                              + context.getCurrentTemplateName() + " [line " + 
getLine() 
                              + ", column " + getColumn() + "]");
  
  
  
  1.18      +7 -6      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
  
  Index: ASTDirective.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ASTDirective.java 2001/04/27 15:44:39     1.17
  +++ ASTDirective.java 2001/08/07 21:56:30     1.18
  @@ -61,7 +61,6 @@
   import org.apache.velocity.runtime.directive.Directive;
   import org.apache.velocity.runtime.directive.Parse;
   import org.apache.velocity.runtime.parser.Parser;
  -import org.apache.velocity.runtime.Runtime;
   
   import org.apache.velocity.exception.MethodInvocationException;
   
  @@ -75,7 +74,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Kasper Nielsen</a>
  - * @version $Id: ASTDirective.java,v 1.17 2001/04/27 15:44:39 geirm Exp $ 
  + * @version $Id: ASTDirective.java,v 1.18 2001/08/07 21:56:30 geirm Exp $ 
    */
   public class ASTDirective extends SimpleNode
   {
  @@ -103,6 +102,8 @@
       public Object init( InternalContextAdapter context, Object data) 
           throws Exception
       {
  +        super.init( context, data );
  +
           /*
            *  only do things that are not context dependant
            */
  @@ -114,20 +115,20 @@
               directive = (Directive) parser.getDirective( directiveName )
                   .getClass().newInstance();
       
  -            directive.init(context,this);
  +            directive.init(rsvc, context,this);
   
               directive.setLocation( getLine(), getColumn() );
           }          
  -        else if (Runtime.isVelocimacro( directiveName, 
context.getCurrentTemplateName()  )) 
  +        else if (rsvc.isVelocimacro( directiveName, 
context.getCurrentTemplateName()  )) 
           {
               /*
                *  we seem to be a Velocimacro.
                */
   
               isDirective = true;
  -            directive = (Directive) Runtime.getVelocimacro( directiveName,  
context.getCurrentTemplateName() );
  -            directive.init( context, this );
  +            directive = (Directive) rsvc.getVelocimacro( directiveName,  
context.getCurrentTemplateName() );
   
  +            directive.init( rsvc, context, this );
               directive.setLocation( getLine(), getColumn() );
           } 
           else
  
  
  
  1.7       +4 -5      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDivNode.java
  
  Index: ASTDivNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTDivNode.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ASTDivNode.java   2001/06/20 04:24:25     1.6
  +++ ASTDivNode.java   2001/08/07 21:56:30     1.7
  @@ -55,7 +55,6 @@
    */
   
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.Parser;
   
   import org.apache.velocity.exception.MethodInvocationException;
  @@ -68,7 +67,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTDivNode.java,v 1.6 2001/06/20 04:24:25 geirm Exp $ 
  + * @version $Id: ASTDivNode.java,v 1.7 2001/08/07 21:56:30 geirm Exp $ 
    */
   public class ASTDivNode extends SimpleNode
   {
  @@ -109,7 +108,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) 
  +            rsvc.error( ( left == null ? "Left" : "Right" ) 
                              + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of division operation has null value."
  @@ -126,7 +125,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of division operation is not a valid type. "
                              + "Currently only integers (1,2,3...) and Integer type 
is supported. "
                              + context.getCurrentTemplateName() + " [line " + 
getLine() 
  @@ -141,7 +140,7 @@
   
           if ( ( (Integer) right).intValue() == 0 )
           {
  -            Runtime.error( "Right side of division operation is zero. Must be 
non-zero. "
  +            rsvc.error( "Right side of division operation is zero. Must be 
non-zero. "
                              +  context.getCurrentTemplateName() + " [line " + 
getLine() 
                              + ", column " + getColumn() + "]");
    
  
  
  
  1.8       +3 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java
  
  Index: ASTEQNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ASTEQNode.java    2001/06/20 04:24:26     1.7
  +++ ASTEQNode.java    2001/08/07 21:56:30     1.8
  @@ -56,7 +56,6 @@
   
   import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.parser.Parser;
  -import org.apache.velocity.runtime.Runtime;
   
   import org.apache.velocity.exception.MethodInvocationException;
   
  @@ -68,7 +67,7 @@
    *  This operator requires that the LHS and RHS are both of the
    *  same Class.
    *
  - *  @version $Id: ASTEQNode.java,v 1.7 2001/06/20 04:24:26 geirm Exp $
  + *  @version $Id: ASTEQNode.java,v 1.8 2001/08/07 21:56:30 geirm Exp $
    */
   public class ASTEQNode extends SimpleNode
   {
  @@ -116,7 +115,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) 
  +            rsvc.error( ( left == null ? "Left" : "Right" ) 
                              + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal() 
                              + ") of '==' operation "
  @@ -140,7 +139,7 @@
           }
           else
           {
  -            Runtime.error("Error in evaluation of == expression."
  +            rsvc.error("Error in evaluation of == expression."
                             + " Both arguments must be of the same Class."
                             + " Currently left = " + left.getClass() + ", right = " 
                             + right.getClass() + ". "
  
  
  
  1.8       +2 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java
  
  Index: ASTGENode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ASTGENode.java    2001/06/20 04:24:26     1.7
  +++ ASTGENode.java    2001/08/07 21:56:30     1.8
  @@ -57,7 +57,6 @@
   import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.parser.Parser;
   import org.apache.velocity.exception.MethodInvocationException;
  -import org.apache.velocity.runtime.Runtime;
   
   public class ASTGENode extends SimpleNode
   {
  @@ -93,7 +92,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) 
  +            rsvc.error( ( left == null ? "Left" : "Right" ) 
                              + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal() 
                              + ") of '>=' operation has null value."
  @@ -110,7 +109,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of '>=' operation is not a valid type. "
                              + " It is a " + ( !( left instanceof Integer ) ? 
left.getClass() : right.getClass() ) 
                              + ". Currently only integers (1,2,3...) and Integer type 
is supported. "
  
  
  
  1.7       +3 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java
  
  Index: ASTGTNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ASTGTNode.java    2001/06/20 04:24:27     1.6
  +++ ASTGTNode.java    2001/08/07 21:56:30     1.7
  @@ -57,8 +57,8 @@
   import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.parser.Parser;
   import org.apache.velocity.exception.MethodInvocationException;
  -import org.apache.velocity.runtime.Runtime;
   
  +
   public class ASTGTNode extends SimpleNode
   {
       public ASTGTNode(int id)
  @@ -93,7 +93,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) 
  +            rsvc.error( ( left == null ? "Left" : "Right" ) 
                              + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of '>' operation has null value."
  @@ -110,7 +110,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of '>' operation is not a valid type. "
                              + " It is a " + ( !( left instanceof Integer ) ? 
left.getClass() : right.getClass() ) 
                              + ". Currently only integers (1,2,3...) and Integer type 
is supported. "
  
  
  
  1.13      +4 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
  
  Index: ASTIdentifier.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ASTIdentifier.java        2001/04/18 12:56:46     1.12
  +++ ASTIdentifier.java        2001/08/07 21:56:30     1.13
  @@ -61,7 +61,7 @@
   import org.apache.velocity.runtime.parser.Parser;
   import org.apache.velocity.util.introspection.IntrospectionCacheData;
   import org.apache.velocity.util.introspection.Introspector;
  -import org.apache.velocity.runtime.Runtime;
  +import org.apache.velocity.runtime.RuntimeConstants;
   
   import org.apache.velocity.exception.MethodInvocationException;
   import java.lang.reflect.InvocationTargetException;
  @@ -80,7 +80,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTIdentifier.java,v 1.12 2001/04/18 12:56:46 geirm Exp $ 
  + * @version $Id: ASTIdentifier.java,v 1.13 2001/08/07 21:56:30 geirm Exp $ 
    */
   public class ASTIdentifier extends SimpleNode
   {
  @@ -195,7 +195,7 @@
           }
           catch( Exception e)
           {
  -            Runtime.error("ASTIdentifier.execute() : identifier = " 
  +            rsvc.error("ASTIdentifier.execute() : identifier = " 
                                  + identifier + " : " + e );
           }
   
  @@ -221,7 +221,7 @@
           }
           catch( Exception e )
           {
  -            Runtime.error("ASTIdentifier() : exception invoking method for 
identifier '" 
  +            rsvc.error("ASTIdentifier() : exception invoking method for identifier 
'" 
                                  + identifier + "' in " + o.getClass() + " : "  + e );
           }            
   
  
  
  
  1.4       +3 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
  
  Index: ASTIntegerRange.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ASTIntegerRange.java      2001/03/19 17:17:49     1.3
  +++ ASTIntegerRange.java      2001/08/07 21:56:30     1.4
  @@ -63,13 +63,12 @@
    * what controls the generation of this class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTIntegerRange.java,v 1.3 2001/03/19 17:17:49 geirm Exp $ 
  + * @version $Id: ASTIntegerRange.java,v 1.4 2001/08/07 21:56:30 geirm Exp $ 
   */
   
   import java.util.ArrayList;
   
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.Parser;
   
   import org.apache.velocity.exception.MethodInvocationException;
  @@ -115,7 +114,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) + " side of range 
operator [n..m] has null value."
  +            rsvc.error( ( left == null ? "Left" : "Right" ) + " side of range 
operator [n..m] has null value."
                              + " Operation not possible. "
                              +  context.getCurrentTemplateName() + " [line " + 
getLine() 
                              + ", column " + getColumn() + "]");
  @@ -128,7 +127,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of range operator is not a valid type. "
                              + "Currently only integers (1,2,3...) and Integer type 
is supported. "
                              + context.getCurrentTemplateName() + " [line " + 
getLine() 
  
  
  
  1.7       +2 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java
  
  Index: ASTLENode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ASTLENode.java    2001/06/20 04:24:28     1.6
  +++ ASTLENode.java    2001/08/07 21:56:30     1.7
  @@ -56,7 +56,6 @@
   
   import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.parser.Parser;
  -import org.apache.velocity.runtime.Runtime;
   
   import org.apache.velocity.exception.MethodInvocationException;
   
  @@ -94,7 +93,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) 
  +            rsvc.error( ( left == null ? "Left" : "Right" ) 
                              + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of '<=' operation has null value."
  @@ -111,7 +110,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of '<=' operation is not a valid type. "
                              + " It is a " + ( !( left instanceof Integer ) ? 
left.getClass() : right.getClass() ) 
                              + ". Currently only integers (1,2,3...) and Integer type 
is supported. "
  
  
  
  1.7       +2 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java
  
  Index: ASTLTNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ASTLTNode.java    2001/06/20 04:24:28     1.6
  +++ ASTLTNode.java    2001/08/07 21:56:30     1.7
  @@ -56,7 +56,6 @@
   
   import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.parser.Parser;
  -import org.apache.velocity.runtime.Runtime;
   
   import org.apache.velocity.exception.MethodInvocationException;
   
  @@ -94,7 +93,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) 
  +            rsvc.error( ( left == null ? "Left" : "Right" ) 
                              + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of '<' operation has null value."
  @@ -111,7 +110,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of '<' operation is not a valid type. "
                              + " It is a " + ( !( left instanceof Integer ) ? 
left.getClass() : right.getClass() ) 
                              + ". Currently only integers (1,2,3...) and Integer type 
is supported. "
  
  
  
  1.19      +6 -6      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
  
  Index: ASTMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ASTMethod.java    2001/07/18 10:42:22     1.18
  +++ ASTMethod.java    2001/08/07 21:56:30     1.19
  @@ -59,7 +59,7 @@
   import java.io.*;
   
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
  +import org.apache.velocity.runtime.RuntimeServices;
   import org.apache.velocity.runtime.parser.*;
   import org.apache.velocity.util.introspection.Introspector;
   import org.apache.velocity.util.introspection.IntrospectionCacheData;
  @@ -84,7 +84,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTMethod.java,v 1.18 2001/07/18 10:42:22 geirm Exp $ 
  + * @version $Id: ASTMethod.java,v 1.19 2001/08/07 21:56:30 geirm Exp $ 
    */
   public class ASTMethod extends SimpleNode
   {
  @@ -112,10 +112,10 @@
        *  simple init - init our subtree and get what we can from 
        *  the AST
        */
  -    public Object init( InternalContextAdapter context, Object data)
  +    public Object init(  InternalContextAdapter context, Object data)
           throws Exception
       {
  -        super.init( context, data );
  +        super.init(  context, data );
   
           /*
            *  this is about all we can do
  @@ -241,7 +241,7 @@
                *  can come from the doIntropection() also, from Introspector
                */
   
  -            Runtime.error("ASTMethod.execute() : exception from introspection : " + 
e);
  +            rsvc.error("ASTMethod.execute() : exception from introspection : " + e);
               return null;
           }
   
  @@ -316,7 +316,7 @@
           }
           catch( Exception e )
           {
  -            System.out.println("ASTMethod.execute() : exception invoking method '" 
  +            rsvc.error("ASTMethod.execute() : exception invoking method '" 
                                  + methodName + "' in " + o.getClass() + " : "  + e );
                                  
               return null;
  
  
  
  1.6       +4 -5      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java
  
  Index: ASTModNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ASTModNode.java   2001/06/20 04:24:29     1.5
  +++ ASTModNode.java   2001/08/07 21:56:30     1.6
  @@ -64,10 +64,9 @@
    * what controls the generation of this class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTModNode.java,v 1.5 2001/06/20 04:24:29 geirm Exp $ 
  + * @version $Id: ASTModNode.java,v 1.6 2001/08/07 21:56:30 geirm Exp $ 
   */
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.Parser;
   
   import org.apache.velocity.exception.MethodInvocationException;
  @@ -106,7 +105,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) + " side ("
  +            rsvc.error( ( left == null ? "Left" : "Right" ) + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of modulus operation has null value."
                              + " Operation not possible. "
  @@ -121,7 +120,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of modulus operation is not a valid type. "
                              + "Currently only integers (1,2,3...) and Integer type 
is supported. "
                              + context.getCurrentTemplateName() + " [line " + 
getLine() 
  @@ -136,7 +135,7 @@
   
           if ( ( (Integer) right).intValue() == 0 )
           {
  -            Runtime.error( "Right side of modulus operation is zero. Must be 
non-zero. "
  +            rsvc.error( "Right side of modulus operation is zero. Must be non-zero. 
"
                              + context.getCurrentTemplateName() + " [line " + 
getLine() 
                              + ", column " + getColumn() + "]");
    
  
  
  
  1.6       +3 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java
  
  Index: ASTMulNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ASTMulNode.java   2001/06/20 04:24:29     1.5
  +++ ASTMulNode.java   2001/08/07 21:56:30     1.6
  @@ -56,7 +56,6 @@
    */
   
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.Parser;
   
   import org.apache.velocity.exception.MethodInvocationException;
  @@ -69,7 +68,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTMulNode.java,v 1.5 2001/06/20 04:24:29 geirm Exp $ 
  + * @version $Id: ASTMulNode.java,v 1.6 2001/08/07 21:56:30 geirm Exp $ 
   */
   public class ASTMulNode extends SimpleNode
   {
  @@ -109,7 +108,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) + " side ("
  +            rsvc.error( ( left == null ? "Left" : "Right" ) + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of multiplication operation has null value."
                              + " Operation not possible. "
  @@ -124,7 +123,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of multiplication operation is not a valid 
type. "
                              + "Currently only integers (1,2,3...) and Integer type 
is supported. "
                              +  context.getCurrentTemplateName() + " [line " + 
getLine() 
  
  
  
  1.6       +2 -3      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java
  
  Index: ASTNENode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ASTNENode.java    2001/06/20 04:24:30     1.5
  +++ ASTNENode.java    2001/08/07 21:56:30     1.6
  @@ -56,7 +56,6 @@
   
   import org.apache.velocity.context.InternalContextAdapter;
   import org.apache.velocity.runtime.parser.Parser;
  -import org.apache.velocity.runtime.Runtime;
   
   import org.apache.velocity.exception.MethodInvocationException;
   
  @@ -90,7 +89,7 @@
   
           if ( left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) + " side ("
  +            rsvc.error( ( left == null ? "Left" : "Right" ) + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of '!=' operation has null value."
                              + " Operation not possible. "
  @@ -113,7 +112,7 @@
           }
           else
           {
  -            Runtime.error("Error in evaluation of != expression."
  +            rsvc.error("Error in evaluation of != expression."
                             + " Both arguments must be of the same Class."
                             + " Currently left = " + left.getClass() + ", right = " 
                             + right.getClass() + ". "
  
  
  
  1.35      +22 -12    
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
  
  Index: ASTReference.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- ASTReference.java 2001/06/19 03:34:20     1.34
  +++ ASTReference.java 2001/08/07 21:56:30     1.35
  @@ -62,7 +62,7 @@
   
   import org.apache.velocity.context.Context;
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
  +import org.apache.velocity.runtime.RuntimeServices;
   import org.apache.velocity.runtime.RuntimeConstants;
   import org.apache.velocity.runtime.exception.ReferenceException;
   import org.apache.velocity.runtime.parser.*;
  @@ -83,7 +83,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christoph Reck</a>
    * @author <a href="mailto:[EMAIL PROTECTED]>Kent Johnson</a>
  - * @version $Id: ASTReference.java,v 1.34 2001/06/19 03:34:20 geirm Exp $ 
  + * @version $Id: ASTReference.java,v 1.35 2001/08/07 21:56:30 geirm Exp $ 
   */
   public class ASTReference extends SimpleNode
   {
  @@ -130,6 +130,9 @@
   
           super.init( context, data );
   
  +        //        System.out.println("Reference init() : " + literal() );
  +
  +
           /*
            *  the only thing we can do in init() is getRoot()
            *  as that is template based, not context based,
  @@ -212,7 +215,7 @@
                *  someone tossed their cookies
                */
   
  -            Runtime.error("Method " + mie.getMethodName() + " threw exception for 
reference $" 
  +            rsvc.error("Method " + mie.getMethodName() + " threw exception for 
reference $" 
                             + rootString 
                             + " in template " + context.getCurrentTemplateName()
                             + " at " +  " [" + this.getLine() + "," + 
this.getColumn() + "]");
  @@ -240,6 +243,8 @@
            *  2) if not, then \$foo  (its considered shmoo, not VTL)
            */
   
  +        //        System.out.println("Render : Escaped? " + escaped + " : " + 
((Object) this) );
  +
           if ( escaped )
           {
               if ( value == null )
  @@ -285,10 +290,10 @@
               writer.write( nullString );
               
               if (referenceType != QUIET_REFERENCE 
  -                && Runtime.getBoolean( 
  +                && rsvc.getBoolean( 
                                         
RuntimeConstants.RUNTIME_LOG_REFERENCE_LOG_INVALID, true) )
               {
  -                Runtime.warn(new ReferenceException("reference : template = " 
  +               rsvc.warn(new ReferenceException("reference : template = " 
                                                       + 
context.getCurrentTemplateName(), this));
               }
   
  @@ -362,7 +367,7 @@
           
           if (result == null)
           {
  -            Runtime.error(new ReferenceException("reference set : template = " + 
context.getCurrentTemplateName(), this));
  +            rsvc.error(new ReferenceException("reference set : template = " + 
context.getCurrentTemplateName(), this));
               return false;
           }                          
           
  @@ -376,7 +381,7 @@
               
               if (result == null)
               {
  -                Runtime.error(new ReferenceException("reference set : template = " 
+ context.getCurrentTemplateName(), this));
  +                rsvc.error(new ReferenceException("reference set : template = " + 
context.getCurrentTemplateName(), this));
                   return false;
               }                          
           }            
  @@ -439,7 +444,7 @@
                   }
                   catch (Exception ex)
                   {
  -                    Runtime.error("ASTReference Map.put : exception : " + ex 
  +                    rsvc.error("ASTReference Map.put : exception : " + ex 
                                     + " template = " + 
context.getCurrentTemplateName() 
                                     + " [" + this.getLine() + "," + this.getColumn() 
+ "]");
                       return false;
  @@ -447,7 +452,7 @@
               }
               else
               {
  -                Runtime.error("ASTReference : cannot find " + identifier + " as 
settable property or key to Map in"
  +                rsvc.error("ASTReference : cannot find " + identifier + " as 
settable property or key to Map in"
                                 + " template = " + context.getCurrentTemplateName() 
                                 + " [" + this.getLine() + "," + this.getColumn() + 
"]");
                   return false;
  @@ -472,7 +477,7 @@
               /*
                *  maybe a security exception?
                */
  -            Runtime.error("ASTReference setValue() : exception : " + e 
  +            rsvc.error("ASTReference setValue() : exception : " + e 
                                     + " template = " + 
context.getCurrentTemplateName() 
                                     + " [" + this.getLine() + "," + this.getColumn() 
+ "]");
               return false;
  @@ -484,7 +489,9 @@
       private String getRoot()
       {
           Token t = getFirstToken();
  -         
  +
  +        //        System.out.println("First token for " + ((Object) this ) + " : " 
+ t );
  +
           /*
            *  we have a special case where something like 
            *  $(\\)*!, where the user want's to see something
  @@ -518,7 +525,7 @@
               if (i == -1)
               {
                   /* yikes! */
  -                Runtime.error("ASTReference.getRoot() : internal error : no $ found 
for slashbang.");
  +                rsvc.error("ASTReference.getRoot() : internal error : no $ found 
for slashbang.");
                   computableReference = false;
                   nullString = t.image;
                   return nullString;
  @@ -574,8 +581,11 @@
               while( i < len && t.image.charAt(i) == '\\' )
                   i++;
   
  + 
               if ( (i % 2) != 0 )                
                   escaped = true;
  +
  +            //           System.out.println("Escaped?  : " + i + " : " + escaped + 
" : " + ( (Object) this) );
   
               if (i > 0)
                   prefix = t.image.substring(0, i / 2 );
  
  
  
  1.19      +4 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java
  
  Index: ASTSetDirective.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ASTSetDirective.java      2001/05/20 21:14:32     1.18
  +++ ASTSetDirective.java      2001/08/07 21:56:30     1.19
  @@ -58,7 +58,7 @@
   import java.io.Writer;
   
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
  +import org.apache.velocity.runtime.RuntimeConstants;
   import org.apache.velocity.runtime.exception.ReferenceException;
   import org.apache.velocity.runtime.parser.Parser;
   import org.apache.velocity.runtime.parser.Token;
  @@ -73,7 +73,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTSetDirective.java,v 1.18 2001/05/20 21:14:32 geirm Exp $
  + * @version $Id: ASTSetDirective.java,v 1.19 2001/08/07 21:56:30 geirm Exp $
    */
   public class ASTSetDirective extends SimpleNode
   {
  @@ -112,7 +112,7 @@
           right = getRightHandSide();
           left = getLeftHandSide();
   
  -        blather = Runtime.getBoolean(Runtime.RUNTIME_LOG_REFERENCE_LOG_INVALID, 
true);
  +        blather = 
rsvc.getBoolean(RuntimeConstants.RUNTIME_LOG_REFERENCE_LOG_INVALID, true);
    
           /*
            *  grab this now.  No need to redo each time
  @@ -159,7 +159,7 @@
   
                   if (doit)
                   {
  -                    Runtime.error("RHS of #set statement is null. Context will not 
be modified. " 
  +                    rsvc.error("RHS of #set statement is null. Context will not be 
modified. " 
                                     + context.getCurrentTemplateName() + " [line " + 
getLine() 
                                     + ", column " + getColumn() + "]");
                   }
  
  
  
  1.11      +6 -6      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
  
  Index: ASTStringLiteral.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ASTStringLiteral.java     2001/04/22 18:02:32     1.10
  +++ ASTStringLiteral.java     2001/08/07 21:56:30     1.11
  @@ -62,14 +62,14 @@
   import java.io.BufferedReader;
   import java.io.StringReader;
   
  -import org.apache.velocity.runtime.Runtime;
  +import org.apache.velocity.runtime.RuntimeConstants;
   
   /**
    * ASTStringLiteral support.  Will interpolate!
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: ASTStringLiteral.java,v 1.10 2001/04/22 18:02:32 geirm Exp $
  + * @version $Id: ASTStringLiteral.java,v 1.11 2001/08/07 21:56:30 geirm Exp $
    */
   public class ASTStringLiteral extends SimpleNode
   {
  @@ -113,7 +113,7 @@
            *  can  interpolate.  Otherwise, don't bother.
            */
   
  -        interpolate = Runtime.getBoolean(Runtime.INTERPOLATE_STRINGLITERALS , true)
  +        interpolate = rsvc.getBoolean(RuntimeConstants.INTERPOLATE_STRINGLITERALS , 
true)
               && getFirstToken().image.startsWith("\"")
               && ( (getFirstToken().image.indexOf("$") != -1 ) 
                    || ( getFirstToken().image.indexOf("#") != -1 ));
  @@ -165,13 +165,13 @@
                       BufferedReader br = new BufferedReader( new StringReader( 
interpolateimage ));
   
                       nodeTree 
  -                        = Runtime.parse( br,context.getCurrentTemplateName() );     
   
  +                        = rsvc.parse( br,context.getCurrentTemplateName() );        
                   
                       /*
                        *  init with context. It won't modify anything
                        */
   
  -                    nodeTree.init( context, null );
  +                    nodeTree.init( context, rsvc );
                   }
   
                   /*
  @@ -200,7 +200,7 @@
                    *  eh.  If anything wrong, just punt 
                    *  and output the literal 
                    */
  -                Runtime.error("Error in interpolating string literal : " + e );
  +                rsvc.error("Error in interpolating string literal : " + e );
               }
           }
           
  
  
  
  1.6       +3 -4      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTSubtractNode.java
  
  Index: ASTSubtractNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTSubtractNode.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ASTSubtractNode.java      2001/06/20 04:24:30     1.5
  +++ ASTSubtractNode.java      2001/08/07 21:56:30     1.6
  @@ -57,7 +57,6 @@
    */
   
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
   import org.apache.velocity.runtime.parser.Parser;
   
   import org.apache.velocity.exception.MethodInvocationException;
  @@ -70,7 +69,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
  - * @version $Id: ASTSubtractNode.java,v 1.5 2001/06/20 04:24:30 geirm Exp $ 
  + * @version $Id: ASTSubtractNode.java,v 1.6 2001/08/07 21:56:30 geirm Exp $ 
    */
   public class ASTSubtractNode extends SimpleNode
   {
  @@ -111,7 +110,7 @@
   
           if (left == null || right == null)
           {
  -            Runtime.error( ( left == null ? "Left" : "Right" ) + " side ("
  +            rsvc.error( ( left == null ? "Left" : "Right" ) + " side ("
                              + jjtGetChild( (left == null? 0 : 1) ).literal()
                              + ") of subtraction operation has null value."
                              + " Operation not possible. "
  @@ -126,7 +125,7 @@
   
           if ( !( left instanceof Integer )  || !( right instanceof Integer ))
           {
  -            Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
  +            rsvc.error( ( !( left instanceof Integer ) ? "Left" : "Right" ) 
                              + " side of subtraction operation is not a valid type. "
                              + "Currently only integers (1,2,3...) and Integer type 
is supported. "
                              + context.getCurrentTemplateName() + " [line " + 
getLine() 
  
  
  
  1.10      +15 -7     
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
  
  Index: SimpleNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/SimpleNode.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SimpleNode.java   2001/03/19 17:14:47     1.9
  +++ SimpleNode.java   2001/08/07 21:56:30     1.10
  @@ -59,7 +59,7 @@
   import java.io.IOException;
   
   import org.apache.velocity.context.InternalContextAdapter;
  -import org.apache.velocity.runtime.Runtime;
  +import org.apache.velocity.runtime.RuntimeServices;
   import org.apache.velocity.runtime.exception.ReferenceException;
   import org.apache.velocity.runtime.parser.Parser;
   import org.apache.velocity.runtime.parser.Token;
  @@ -69,6 +69,8 @@
   
   public class SimpleNode implements Node
   {
  +    protected RuntimeServices rsvc = null;
  +
       protected Node parent;
       protected Node[] children;
       protected int id;
  @@ -175,10 +177,10 @@
           toString(String), otherwise overriding toString() is probably all
           you need to do. */
   
  -    public String toString()
  -    {
  -        return ParserTreeConstants.jjtNodeName[id];
  -    }
  +    //    public String toString()
  +    // {
  +    //    return ParserTreeConstants.jjtNodeName[id];
  +    // }
       public String toString(String prefix)
       {
           return prefix + toString();
  @@ -221,17 +223,23 @@
   
       public Object init( InternalContextAdapter context, Object data) throws 
Exception
       {
  +        /*
  +         * hold onto the RuntimeServices
  +         */
  +
  +        rsvc = (RuntimeServices) data;
  +
           int i, k = jjtGetNumChildren();
   
           for (i = 0; i < k; i++)
           {
               try
               {
  -                jjtGetChild(i).init(context, data);
  +                jjtGetChild(i).init( context, data);
               }
               catch (ReferenceException re)
               {
  -                Runtime.error(re);
  +                rsvc.error(re);
               }
           }            
       
  
  
  

Reply via email to