Package org.asturlinux.frade.currin.exceptions

Examples of org.asturlinux.frade.currin.exceptions.InterpreterException


  float a = ((CurrinFloat)first_op.getReference()).getValue();
  float b = ((CurrinFloat)second_op.getReference()).getValue();

  if ( b == 0 )
      throw new InterpreterException("Float division: 0 in denominator!");

  Logger logger = Logger.getLogger("RuntimeLogger");
  logger.debug("Primitive float division: " + a + " " + b);
  m.setResult( new CurrinRef(new CurrinFloat(a / b)));
    }
View Full Code Here


  int a = ((CurrinInt)first_op.getReference()).getValue();
  int b = ((CurrinInt)second_op.getReference()).getValue();

  if ( b == 0 )
      throw new InterpreterException("Integer division: 0 in denominator!");

  Logger logger = Logger.getLogger("RuntimeLogger");
  logger.debug("Primitiva Division enteros: " + a + " " + b);
  m.setResult( new CurrinRef(new CurrinFloat(a / b)));
    }
View Full Code Here

      Function f = (Function)i.next();
      if (f.getName().equals(cualified_name))
        return f;
  }

  throw new InterpreterException("Unable to find the function "
               + cualified_name
               + " in module "
               + _name );
    }
View Full Code Here

      return new Ascii64Primitive();
  }

 

  throw new InterpreterException("Cannot find " + id + " function");
  }
View Full Code Here

    public Function findFunction( String cualified_name )
  throws InterpreterException {
  int underscore = cualified_name.indexOf("_");

  if ( underscore < 1 ) {
      throw new InterpreterException("Function " + cualified_name
             + " not found in Program");
  }
  String module_to_find = cualified_name.substring(0, underscore);

  Iterator i = _modules.iterator();

  while ( i.hasNext() ) {
      Module m = (Module)i.next();
      if ( m.getName().toUpperCase().equals(module_to_find.toUpperCase()))
    return m.getFunction(cualified_name);
  }
 
  throw new InterpreterException("Function " + cualified_name
               + " not found in Program");
    }
View Full Code Here

      if ( function.getName().endsWith("IO") ) {
    CurrinRef cr = new CurrinRef(new CurrinConstr("empty",
                    new Vector()));
    running_params.add(cr);
      } else
    throw new InterpreterException("ERROR: Function "
                 + function.getName()
                 + " require "
                 + function.getNumberOfParameters()
                 + " and called only with "
                 + running_params.size());
View Full Code Here

  logger.debug("Running Switch ");

  Memory mem = m.getContextStack().currentContext().getMemory();
  CurrinRef switcher = mem.getElementAt(_selector);
  if ( switcher == null ) {
      throw new InterpreterException("Switcher nulo en Switch");
  }

  Iterator i = _cases.iterator();
  SwitchCase sc;
  while ( i.hasNext() ) {
      sc = ((SwitchCase)i.next());

      if (sc.getSwitcher().equals(switcher, mem)) {
    logger.debug("Matched switch Option");
    m.getContextStack().currentContext().runInstrBlock(sc.getInstrToRun());
    return; /* Unreachable state */
      }
  }
  logger.debug("In switch default case");
  if ( _default == null )
      throw new InterpreterException("Required default case in switch"
             + " but is not defined");
  m.getContextStack().currentContext().runInstrBlock(_default.getInstrToRun());
  logger.debug("Not found valid option in switch");
    }
View Full Code Here

TOP

Related Classes of org.asturlinux.frade.currin.exceptions.InterpreterException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.