[TerpFactory
strick**20120219110619
 Ignore-this: 4b34a3857dd6eab067f724ad1c8acf07
] move ./terse-vm/src/terse/vm/TalkTest.java ./terse-vm/src/terse/vm/TerpTest.java
hunk ./terse-vm/src/terse/vm/AllTests.java 12
-		suite.addTestSuite(TalkTest.class);
+		suite.addTestSuite(TerpTest.class);
hunk ./terse-vm/src/terse/vm/Async.java 16
-	static Pattern OK_FILENAME = Pattern.compile("[A-Za-z0-9_]+");
+	Terp.Factory factory;
hunk ./terse-vm/src/terse/vm/Async.java 28
-	public Async(String dirname) {
+	static Pattern OK_FILENAME = Pattern.compile("[A-Za-z0-9_]+");
+
+	public Async(Terp.Factory factory, String dirname) {
hunk ./terse-vm/src/terse/vm/Async.java 32
+		this.factory = factory;
hunk ./terse-vm/src/terse/vm/Async.java 84
-		Terp tmp = new Terp(false, "", ""); // TODO: eliminate this, by using
-											// Json?
-		Dict z = tmp.newDict(Static.pros(tmp.newVec(Static.pros(tmp
-				.newStr("type"), tmp.newStr("text"))), tmp.newVec(Static.pros(
-				tmp.newStr("value"), tmp.newStr(Static.fmt(msg, objects))))));
+		Terp tmp = factory.createTerp(false, "", "");
+		Dict z = tmp
+				.newDict(Static.pros(
+						tmp.newVec(Static.pros(tmp.newStr("type"),
+								tmp.newStr("text"))),
+						tmp.newVec(Static.pros(tmp.newStr("value"),
+								tmp.newStr(Static.fmt(msg, objects))))));
hunk ./terse-vm/src/terse/vm/Async.java 126
-					terp = new Terp(true, imageName, new File(dirname,
-							imageName + ".txt").getPath());
+					terp = factory.createTerp(true, imageName, new File(
+							dirname, imageName + ".txt").getPath());
hunk ./terse-vm/src/terse/vm/ExprTest.java 14
-        t = new Terp();
+        t = new Terp.TestingTerp(false, "__ExprTest__", "");
hunk ./terse-vm/src/terse/vm/Parser.java 56
-    private static String replace(Pattern p, String replacement, String a) {
-        Matcher m = p.matcher(a);
-        StringBuffer sb = new StringBuffer();
-        while (m.find()) {
-            m.appendReplacement(sb, replacement);
-        }
-        m.appendTail(sb);
-        return sb.toString();
-    }
-    private static String reduceDoubleSingleQuotes(String a) {
-        return replace(doubleSingeQuote, "'", a);
-    }
+//    private static String replace(Pattern p, String replacement, String a) {
+//        Matcher m = p.matcher(a);
+//        StringBuffer sb = new StringBuffer();
+//        while (m.find()) {
+//            m.appendReplacement(sb, replacement);
+//        }
+//        m.appendTail(sb);
+//        return sb.toString();
+//    }
hunk ./terse-vm/src/terse/vm/ParserTest.java 12
-		t = new Terp();
+		t = new Terp.TestingTerp(false, "__ParserTest__", "");
hunk ./terse-vm/src/terse/vm/Terp.java 25
-public class Terp extends Static {
+public abstract class Terp extends Static {
hunk ./terse-vm/src/terse/vm/Terp.java 85
-	/** The Interpreter with no init file. */
-	public Terp() {
-		this(false, "", "");
-	}
-
hunk ./terse-vm/src/terse/vm/Terp.java 86
-	public Terp(boolean loadPrelude, String imageName, String initFilename) {
+	protected Terp(boolean loadPrelude, String imageName, String initFilename) {
hunk ./terse-vm/src/terse/vm/Terp.java 507
-	static FileWriter logWriter;
+	public abstract void say(String s, Object... objects);
+	
+	public interface Factory {
+		Terp createTerp(boolean loadPrelude, String imageName, String initFilename);
+	}
+	
+	public static class TestingTerp extends Terp {
hunk ./terse-vm/src/terse/vm/Terp.java 515
-	void say(String s, Object... objects) {
-		try {
-			if (logWriter == null) {
-				logWriter = new FileWriter("__log.txt");
-			}
+		protected TestingTerp(boolean loadPrelude, String imageName,
+				String initFilename) {
+			super(loadPrelude, imageName, initFilename);
+		}
+
+		@Override
+		public void say(String s, Object... objects) {
+			// TODO Auto-generated method stub
hunk ./terse-vm/src/terse/vm/Terp.java 525
-
-			logWriter.write(msg);
-			logWriter.write("\n");
-			logWriter.flush();
-		} catch (IOException e) {
-			e.printStackTrace();
-			throw new AssertionError(e.toString());
hunk ./terse-vm/src/terse/vm/Terp.java 526
+		
hunk ./terse-vm/src/terse/vm/TerpTest.java 7
-public class TalkTest extends TestCase {
+public class TerpTest extends TestCase {
hunk ./terse-vm/src/terse/vm/TerpTest.java 11
-	public TalkTest(String arg0) {
+	public TerpTest(String arg0) {
hunk ./terse-vm/src/terse/vm/TerpTest.java 15
-    public void testTerpCtor() {
-        new Terp();
-    }
-    public void testTerpInitFile() {
-        new Terp(true, "", "");
-    }
-    public void testStrs() {
-        String[] a = Static.strs("one", "two");
-        String[] b = Static.append(a, "three");
-        assertEquals(3, b.length);
-        assertEquals("one", b[0]);
-        assertEquals("two", b[1]);
-        assertEquals("three", b[2]);
-    }
-    
-    public void testhtmlEscape() {
-        assertEquals("it&quot;s &lt;pb&gt; &amp; J.\n", Static.htmlEscape("it\"s <pb> & J.\n"));
-    }
-    
-    public void testSplitNonEmpty() {
-        assertEquals("foo", Static.splitNonEmpty("foo", '/')[0]);
-        assertEquals("foo", Static.splitNonEmpty("/foo", '/')[0]);
-        assertEquals("foo", Static.splitNonEmpty("foo/", '/')[0]);
-        assertEquals("foo", Static.splitNonEmpty("//foo", '/')[0]);
-        assertEquals("foo", Static.splitNonEmpty("foo//", '/')[0]);
-        assertEquals("foo", Static.splitNonEmpty("/foo//bar//", '/')[0]);
-        assertEquals("foo", Static.splitNonEmpty("foo/bar", '/')[0]);
-        assertEquals("bar", Static.splitNonEmpty("/foo//bar//", '/')[1]);
-        assertEquals("bar", Static.splitNonEmpty("foo/bar", '/')[1]);
-    }
+	public void testTerpSimple() {
+		new Terp.TestingTerp(false, "__ExprTest__", "");
+	}
+
+	public void testTerpWithPrelude() {
+		new Terp.TestingTerp(true, "__TerpTest__", "");
+		;
+	}
+
+	public void testStrs() {
+		String[] a = Static.strs("one", "two");
+		String[] b = Static.append(a, "three");
+		assertEquals(3, b.length);
+		assertEquals("one", b[0]);
+		assertEquals("two", b[1]);
+		assertEquals("three", b[2]);
+	}
+
+	public void testhtmlEscape() {
+		assertEquals("it&quot;s &lt;pb&gt; &amp; J.\n",
+				Static.htmlEscape("it\"s <pb> & J.\n"));
+	}
+
+	public void testSplitNonEmpty() {
+		assertEquals("foo", Static.splitNonEmpty("foo", '/')[0]);
+		assertEquals("foo", Static.splitNonEmpty("/foo", '/')[0]);
+		assertEquals("foo", Static.splitNonEmpty("foo/", '/')[0]);
+		assertEquals("foo", Static.splitNonEmpty("//foo", '/')[0]);
+		assertEquals("foo", Static.splitNonEmpty("foo//", '/')[0]);
+		assertEquals("foo", Static.splitNonEmpty("/foo//bar//", '/')[0]);
+		assertEquals("foo", Static.splitNonEmpty("foo/bar", '/')[0]);
+		assertEquals("bar", Static.splitNonEmpty("/foo//bar//", '/')[1]);
+		assertEquals("bar", Static.splitNonEmpty("foo/bar", '/')[1]);
+	}
hunk ./terse-web/default.txt 21
+meth DrawStar handle:query:
+    i = 0.
+    j = 0.
+  
+    v= Vec new.
+    Vec{ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. } do/ [ /i
+      ( 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 ) do/ [ /j
+        x= i pl/ j --sin ti/ 400 --pl/ 300.
+        y= i pl/ j --cos ti/ 290 --pl/ 300.
+        v ap/ Vec{ 'line'. 300. 300. x. y. }.
+      ]
+    ].
+  
+    DICT{ 'type', 'draw'.
+  	'title', 'Drawing a line'.
+  	'value', v.
+  	'width', 600.
+  	'height', 600.
+    }
+   
+  
hunk ./terse-web/src/terse/web/WebServer.java 3
+import java.io.FileWriter;
hunk ./terse-web/src/terse/web/WebServer.java 30
+import terse.vm.Terp.Factory;
hunk ./terse-web/src/terse/web/WebServer.java 52
+	Terp.Factory factory = new WebTerpFactory();
hunk ./terse-web/src/terse/web/WebServer.java 56
-		async = new Async(".");
+		async = new Async(factory, ".");
hunk ./terse-web/src/terse/web/WebServer.java 65
-		Terp t = new Terp(true, "", "");
+		Terp t = factory.createTerp(true, "", "");
hunk ./terse-web/src/terse/web/WebServer.java 432
-				Ht.tag(head, "title", null, maybeString(dict.dict.get(TITLE),
-						"Untitled"));
+				Ht.tag(head, "title", null,
+						maybeString(dict.dict.get(TITLE), "Untitled"));
hunk ./terse-web/src/terse/web/WebServer.java 436
-				Ht.tag(body, "b", null, maybeString(dict.dict.get(TITLE),
-						"Untitled"));
+				Ht.tag(body, "b", null,
+						maybeString(dict.dict.get(TITLE), "Untitled"));
hunk ./terse-web/src/terse/web/WebServer.java 600
+	}
+
+	public static class WebTerp extends Terp {
+
+		public WebTerp(boolean loadPrelude, String imageName,
+				String initFilename) {
+			super(loadPrelude, imageName, initFilename);
+			// TODO Auto-generated constructor stub
+		}
+
+		static FileWriter logWriter;
+
+		public void say(String s, Object... objects) {
+			try {
+				if (logWriter == null) {
+					logWriter = new FileWriter("__log_webterp.txt");
+				}
+				String msg = fmt(s, objects);
+				System.out.println(msg);
+
+				logWriter.write(msg);
+				logWriter.write("\n");
+				logWriter.flush();
+			} catch (IOException e) {
+				e.printStackTrace();
+				throw new AssertionError(e.toString());
+			}
+		}
+	}
+
+	public static class WebTerpFactory implements Factory {
+
+		@Override
+		public Terp createTerp(boolean loadPrelude, String imageName,
+				String initFilename) {
+			return new WebTerp(loadPrelude, imageName, initFilename);
+		}
+