[BACK]Return to OMproxy.java CVS log [TXT][DIR] Up to [local] / OpenXM / src / OpenMath

Diff for /OpenXM/src/OpenMath/OMproxy.java between version 1.37 and 1.38

version 1.37, 2000/06/13 14:04:19 version 1.38, 2000/06/14 08:01:08
Line 1 
Line 1 
 /**  /**
  * $OpenXM: OpenXM/src/OpenMath/OMproxy.java,v 1.36 2000/04/17 03:18:57 tam Exp $   * $OpenXM: OpenXM/src/OpenMath/OMproxy.java,v 1.37 2000/06/13 14:04:19 tam Exp $
  */   */
   
 import JP.ac.kobe_u.math.tam.OpenXM.*;  import JP.ac.kobe_u.math.tam.OpenXM.*;
Line 7  import java.util.Stack;
Line 7  import java.util.Stack;
 import java.io.*;  import java.io.*;
   
 public class OMproxy extends OpenXMserver{  public class OMproxy extends OpenXMserver{
   private OpenXM ox;  
   private Stack stack = new Stack();    private Stack stack = new Stack();
   protected boolean debug = true;    protected boolean debug = false;
   final int version = 200006130;    final int version = 200006130;
   
   public OMproxy(String hostname,int ControlPort,int DataPort){    public OMproxy(String hostname,int ControlPort,int DataPort){
Line 28  public class OMproxy extends OpenXMserver{
Line 27  public class OMproxy extends OpenXMserver{
   
           switch(ox_tag){            switch(ox_tag){
           case OXmessage.OX_COMMAND:            case OXmessage.OX_COMMAND:
             StackMachine((SM)message.getBody());              StackMachine((SM)message.getBody(),stream);
             break;              break;
   
           case OXmessage.OX_DATA:            case OXmessage.OX_DATA:
Line 65  public class OMproxy extends OpenXMserver{
Line 64  public class OMproxy extends OpenXMserver{
   }    }
   */    */
   
   private void SM_popCMO() throws java.io.IOException{    private void SM_popCMO(OpenXMconnection stream) throws java.io.IOException{
     try{      try{
       if(stack.empty()){        if(stack.empty()){
         ox.send(new CMO_NULL());          stream.send(new CMO_NULL());
       }else{        }else{
         debug("sending CMO: "+ stack.peek());          debug("sending CMO: "+ stack.peek());
         ox.send((CMO)stack.pop());          stream.send((CMO)stack.pop());
         debug("test");          debug("test");
       }        }
     }catch(MathcapViolation e){      }catch(MathcapViolation e){
       try{        try{
         ox.send(new CMO_ERROR2(new CMO_STRING("MathcapViolation: "+          stream.send(new CMO_ERROR2(new CMO_STRING("MathcapViolation: "+
                                               e.getMessage())));                                                e.getMessage())));
       }catch(MathcapViolation tmp){}        }catch(MathcapViolation tmp){}
     }      }
Line 115  public class OMproxy extends OpenXMserver{
Line 114  public class OMproxy extends OpenXMserver{
     return;      return;
   }    }
   
   private void SM_mathcap() throws java.io.IOException{    private void SM_mathcap(OpenXMconnection stream) throws java.io.IOException{
     CMO[] mathcap = new CMO[3];      CMO[] mathcap = new CMO[3];
   
     {      {
Line 164  public class OMproxy extends OpenXMserver{
Line 163  public class OMproxy extends OpenXMserver{
     debug("push: "+ stack.peek());      debug("push: "+ stack.peek());
   }    }
   
   private void SM_setMathCap() throws java.io.IOException{    private void SM_setMathCap(OpenXMconnection stream)
          throws java.io.IOException{
     Object mathcap = stack.pop();      Object mathcap = stack.pop();
   
     if(mathcap instanceof CMO_MATHCAP){      if(mathcap instanceof CMO_MATHCAP){
       stack.push(new CMO_ERROR2(new CMO_NULL()));        stack.push(new CMO_ERROR2(new CMO_NULL()));
     }      }
     ox.setMathCap((CMO_MATHCAP)mathcap);      stream.setMathCap((CMO_MATHCAP)mathcap);
   }    }
   
   private void StackMachine(SM mesg) throws java.io.IOException{    private void StackMachine(SM mesg,OpenXMconnection stream)
          throws java.io.IOException{
     debug("receive: "+mesg);      debug("receive: "+mesg);
   
     switch(mesg.getCode()){      switch(mesg.getCode()){
     case SM.SM_popCMO:      case SM.SM_popCMO:
       SM_popCMO();        SM_popCMO(stream);
       break;        break;
   
     case SM.SM_executeFunction:      case SM.SM_executeFunction:
Line 186  public class OMproxy extends OpenXMserver{
Line 187  public class OMproxy extends OpenXMserver{
       break;        break;
   
     case SM.SM_mathcap:      case SM.SM_mathcap:
       SM_mathcap();        SM_mathcap(stream);
       break;        break;
   
     case SM.SM_setMathCap:      case SM.SM_setMathCap:
       SM_setMathCap();        SM_setMathCap(stream);
       break;        break;
   
     default:      default:
Line 238  public class OMproxy extends OpenXMserver{
Line 239  public class OMproxy extends OpenXMserver{
   }    }
   
   private void debug(String str){    private void debug(String str){
     //if(debug){      if(debug){
     System.err.println(str);        System.err.println(str);
     //}      }
   }    }
   
   private static String usage(){    private static String usage(){

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>