1 3 5 22 23 package edu.neu.ccs.jmk.shell; 24 25 import kawa.standard.Scheme; 26 import edu.neu.ccs.jmk.Operator; 27 import edu.neu.ccs.jmk.CommandFailedException; 28 29 40 public class Kawa 41 implements Operator 42 { 43 public String getName() { 44 return "Kawa"; 45 } 46 47 54 public void exec(String [] args, java.io.PrintWriter out) 55 throws CommandFailedException 56 { 57 if (args.length == 0) 58 throw new CommandFailedException("No args to " + getName()); 59 StringBuffer sb = new StringBuffer (args[0]); 60 for (int i = 1; i < args.length; i++) 61 sb.append(args[i]); 62 Scheme scheme = new Scheme(); 63 try { 64 scheme.eval(sb.toString()); 65 } 66 catch (Exception schex) { 67 out.println(schex); 68 throw new CommandFailedException(getName() + " threw an exception"); 69 } 70 } 71 } 72 | Popular Tags |