Package org.jatha.dynatype

Examples of org.jatha.dynatype.LispValue


  public void Execute(SECDMachine machine)
  {
    /* Make a closure and push it on the S Register. */
    machine.C.pop();      // Get rid of 'LDF'
    LispValue code = machine.C.pop()// Get the new code.

    // todo: should we copy the value of E here?  My notes in book say to.
    //
    machine.S.assign(f_lisp.makeCons(f_lisp.makeCons(code,
                                                     machine.E.value()),
View Full Code Here


  }


  public void Execute(SECDMachine machine)
  {
    LispValue selector    = machine.S.pop();
    LispValue trueValue;

    machine.C.pop();               /* Pop the TEST command. */
    trueValue   = machine.C.pop();

    if (selector != f_lisp.NIL)
View Full Code Here

  }


  public void Execute(SECDMachine machine)
  {
    LispValue symb = machine.C.value().second();

    machine.S.push(machine.get_special_value(symb));

    machine.C.pop(); // opcode
    machine.C.pop(); // symbol
View Full Code Here

          catch( BadLocationException e1 ) {
            return;
          }
        }
     
        final LispValue input  = jatha.parse( inText );
        if( ggPrintInput.isSelected() )  System.out.println( "IN: " + input );
        final LispValue result = jatha.eval( input );
        if( ggPrintResult.isSelected() ) System.out.println( "OUT: " + result);
      } catch( Exception e1 ) {
        System.err.println( "LISP Exception: " + e1 );
      }
    }
View Full Code Here

      super( lisp, "PROGRESSION-SET", 1, 1 );
    }

    public void Execute( SECDMachine machine )
    {
      LispValue   progVal  = machine.S.pop();

      try {
        if( host != null && progVal.basic_numberp() ) {
          host.setProgression( offset + weight * (float) ((LispNumber) progVal).getDoubleValue() );
        }
      }
      finally {
        machine.S.push( f_lisp.NIL );
View Full Code Here

 
  private BufferTemplate createBufferTemplate( Request r )
  throws IOException
  {
    BufferTemplate  bt      = new BufferTemplate();
    LispValue    cmdListList  = r.mediumOptions;
    LispValue    cmdList, val;
    int        i;
    String      cmdStr;
    Object      o, id;
   
    bt.byteBuf  = (ByteBuffer) r.medium;
    bt.byteBuf.clear();
    bt.floatBuf = bt.byteBuf.asFloatBuffer();
    bt.numCmds  = r.mediumOptions.basic_length();
    bt.cmd    = new int[ bt.numCmds ];
    bt.constant  = new int[ bt.numCmds ];
    bt.offset  = new int[ bt.numCmds ];
   
    for( i = 0; i < bt.numCmds; i++ ) {
      cmdList    = cmdListList.car();
      cmdListList = cmdListList.cdr();
      cmdStr    = cmdList.first().toStringSimple().toUpperCase();
     
      if( cmdStr.equals( "SEND" )) {
        bt.cmd[ i ] = BT_SEND;
        id      = cmdList.second().toJava();
        o      = jatha.getObject( id);
        if( o == null ) {
          throw new IOException( getResourceString( "errLispWrongObjType" ) + " : " + id );
        }
        if( !(o instanceof DatagramChannel) ) {
          throw new IOException( getResourceString( "errLispWrongObjType" ) + " : " + id );
        }
        bt.dch  = (DatagramChannel) o;
     
      } else {
        val = cmdList.basic_length() == 3 ? cmdList.third() : cmdList.second();
        if( !val.basic_integerp() ) {
          throw new IOException( getResourceString( "errLispWrongArgType" ));
        }
        bt.offset[ i ] = (int) ((LispNumber) val).getLongValue();

        if( cmdStr.equals( "INT" )) {
          bt.cmd[ i ] = BT_CONST;
          val = cmdList.second();
          if( !val.basic_numberp() ) {
            throw new IOException( getResourceString( "errLispWrongArgType" ));
          }
          bt.constant[ i ] = (int) ((LispNumber) val).getLongValue();
         
        } else if( cmdStr.equals( "FLOAT" )) {
          bt.cmd[ i ] = BT_CONST;
          val = cmdList.second();
          if( !val.basic_numberp() ) {
            throw new IOException( getResourceString( "errLispWrongArgType" ));
          }
          bt.constant[ i ] = Float.floatToRawIntBits( (float) ((LispNumber) val).getDoubleValue() );
         
        } else if( cmdStr.equals( "VAR" )) {
          bt.cmd[ i ] = BT_VAR;
          cmdStr = cmdList.second().toStringSimple().toUpperCase();
          if( cmdStr.equals( "BUFOFF" )) {
            bt.constant[ i ] = BT_VAR_BUFOFF;
          } else {
            throw new IOException( getResourceString( "errLispWrongArgValue" ));
          }
View Full Code Here

    MapManager      m    = so.getMap();
    Iterator      iter  = m.keySet( MapManager.Context.ALL_INCLUSIVE, MapManager.Context.NONE_EXCLUSIVE ).iterator();
    String        key;
    Object        value;
    MapManager.Context  c;
    LispValue      lispValue;
 
    h.setf_gethash( jatha.makeString( "NAME" ), jatha.makeString( so.getName() ));
    while( iter.hasNext() ) {
      key    = iter.next().toString();
      c    = m.getContext( key );
View Full Code Here

//System.err.println( "loadLispSource '"+name+"' --> "+f );

    FileReader      fr;
    LispParser      parser;
    PushbackReader    pbr;
    LispValue      codeFragment, result;
    boolean        verbose = classPrefs.getBoolean( KEY_VERBOSE, false );
   
    fr        = new FileReader( f )// throws FileNotFoundException
    try {
      pbr      = new PushbackReader( fr, 32 );
View Full Code Here

      panelLispGUI.removeAll();
    }
    if( lispSourceName == null || jatha == null || !contextKnown ) return;

//System.err.println( "fillLispGUI(). lispSourceLoaded = "+lispSourceLoaded+"; jatha == null ? "+(jatha==null)+"; contextKnown = "+contextKnown+"; this.hashCode() = "+this.hashCode() );
    LispValue    lispFunc, lispResult;
    boolean      verbose    = classPrefs.getBoolean( KEY_VERBOSE, false );
    int        i, numGadgets;
    Window      ancestor;
    java.util.List  collGadgets;
View Full Code Here

   @return          true = success, false = failure
   */
  protected boolean executeLisp( String lispFuncName, LispValue args )
  throws IOException
  {
    LispValue   lispFunc, lispResult;

    lispFunc  = jatha.findFunction( lispFuncName );
    if( lispFunc != null ) {
      lispResult  = jatha.eval( jatha.makeCons( lispFunc, args )); // (cmd . args)
      if( classPrefs.getBoolean( KEY_VERBOSE, false )) {
View Full Code Here

TOP

Related Classes of org.jatha.dynatype.LispValue

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.