[teletype strick**20120229082659 Ignore-this: b85981877de886ac00a28db5620642d3 ] addfile ./terse-a1/res/values/teletype.xml hunk ./terse-a1/gen/terse/a1/R.java 27 + public static final class style { + public static final int teletype=0x7f060000; + } hunk ./terse-a1/res/layout/list_item.xml 5 - android:padding="4dp" - android:textSize="18sp" > + android:padding="5dp" + android:textSize="24sp" > hunk ./terse-a1/res/values/teletype.xml 1 + + + + hunk ./terse-a1/src/terse/a1/TerseActivity.java 39 +import android.view.Menu; hunk ./terse-a1/src/terse/a1/TerseActivity.java 261 - ed.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); + //ed.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); + ed.setTextAppearance(this, R.style.teletype); hunk ./terse-a1/src/terse/a1/TerseActivity.java 336 - explain = "CAUGHT Exception: " + ex; + ex.printStackTrace(); + StringBuilder sb = new StringBuilder("CAUGHT Exception: " + ex + + "\n\n"); + StackTraceElement[] st = ex.getStackTrace(); + for (int i = 0; i < st.length; i++) { + sb.append(" * "); + sb.append(st[i]); + sb.append("\n"); + } + explain = sb.toString(); hunk ./terse-a1/src/terse/a1/TerseActivity.java 352 - explainv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); + explainv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24); hunk ./terse-a1/src/terse/a1/TerseActivity.java 361 + @Override + public void setContentView(View view) { +// view.setOnCreateContextMenuListener(this); + super.setContentView(view); + } + hunk ./terse-a1/src/terse/a1/TerseActivity.java 423 - startTerseActivity(path, queryStr, "action", - "up", "flags", Integer.toString(flags), "xx", + startTerseActivity(path, queryStr, "action", "up", + "flags", Integer.toString(flags), "xx", hunk ./terse-a1/src/terse/a1/TerseActivity.java 431 - + hunk ./terse-a1/src/terse/a1/TerseActivity.java 438 - + hunk ./terse-a1/src/terse/a1/TerseActivity.java 498 -// protected String getSaveMe() { -// return saveMe; -// } -// -// protected void setSaveMe(String saveMe) { -// this.saveMe = saveMe; -// } -// -// protected String getPath() { -// return path; -// } -// -// protected void setPath(String path) { -// this.path = path; -// } -// -// protected String getQueryStr() { -// return queryStr; -// } + // From the Note Pad example. + /** + * Called when the user clicks the device's Menu button the first time for + * this Activity. Android passes in a Menu object that is populated with + * items. + * + * Sets up a menu that provides the Insert option plus a list of alternative + * actions for this Activity. Other applications that want to handle notes + * can "register" themselves in Android by providing an intent filter that + * includes the category ALTERNATIVE and the mimeTYpe + * NotePad.Notes.CONTENT_TYPE. If they do this, the code in + * onCreateOptionsMenu() will add the Activity that contains the intent + * filter to its list of options. In effect, the menu will offer the user + * other applications that can handle notes. + * + * @param menu + * A Menu object, to which menu items should be added. + * @return True, always. The menu should be displayed. + */ + @Override + public boolean onCreateOptionsMenu(Menu menu) { +// // Inflate menu from XML resource +// MenuInflater inflater = getMenuInflater(); +// inflater.inflate(R.menu.list_options_menu, menu); hunk ./terse-a1/src/terse/a1/TerseActivity.java 523 -// protected void setQueryStr(String queryStr) { -// this.queryStr = queryStr; -// } +// // Generate any additional actions that can be performed on the +// // overall list. In a normal install, there are no additional +// // actions found here, but this allows other applications to extend +// // our menu with their own actions. +// Intent intent = new Intent(null, getIntent().getData()); +// intent.addCategory(Intent.CATEGORY_ALTERNATIVE); +// menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, +// new ComponentName(this, NotesList.class), null, intent, 0, null); + + return super.onCreateOptionsMenu(menu); + } + + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + return super.onPrepareOptionsMenu(menu); + } hunk ./terse-vm/src/terse/vm/Pro.java 1293 - // =meth Vec "access" at:put: + // =meth Vec "access" at:put:,at:p: hunk ./terse-vm/src/terse/vm/Pro.java 1305 - terp.tVec.addMethod(new JavaMeth(terp.tVec, "len", null, - "Length of the Vec.") { - public Num apply(Frame f, Pro r, Pro[] args) { - return new Num(terp, r.asVec().vec.size()); - } - }); - terp.tVec.addMethod(new JavaMeth(terp.tVec, "at:", null, - "Item at given index") { - public Pro apply(Frame f, Pro r, Pro[] args) { - Vec self = r.asVec(); - return self.vec.get(self.toNearestIndex(args[0])); - } - }); - terp.tVec - .addMethod(new JavaMeth(terp.tVec, "at:put:", "at:p:", "") { - public Pro apply(Frame f, Pro r, Pro[] args) { - Vec self = r.asVec(); - self.vec.set(self.toNearestIndex(args[0]), args[1]); - return r; - } - }); - terp.tVec.addMethod(new JavaMeth(terp.tVec, "append:", "ap:", "") { - public Pro apply(Frame f, Pro r, Pro[] args) { - Vec self = r.asVec(); - self.vec.add(args[0]); - return r; - } - }); +// terp.tVec.addMethod(new JavaMeth(terp.tVec, "len", null, +// "Length of the Vec.") { +// public Num apply(Frame f, Pro r, Pro[] args) { +// return new Num(terp, r.asVec().vec.size()); +// } +// }); +// terp.tVec.addMethod(new JavaMeth(terp.tVec, "at:", null, +// "Item at given index") { +// public Pro apply(Frame f, Pro r, Pro[] args) { +// Vec self = r.asVec(); +// return self.vec.get(self.toNearestIndex(args[0])); +// } +// }); +// terp.tVec +// .addMethod(new JavaMeth(terp.tVec, "at:put:", "at:p:", "") { +// public Pro apply(Frame f, Pro r, Pro[] args) { +// Vec self = r.asVec(); +// self.vec.set(self.toNearestIndex(args[0]), args[1]); +// return r; +// } +// }); +// terp.tVec.addMethod(new JavaMeth(terp.tVec, "append:", "ap:", "") { +// public Pro apply(Frame f, Pro r, Pro[] args) { +// Vec self = r.asVec(); +// self.vec.add(args[0]); +// return r; +// } +// }); hunk ./terse-vm/src/terse/vm/Terp.java 165 + Wrap.install(this); hunk ./terse-vm/src/terse/vm/Terp.java 282 - say(" query %s = %s", k, query.get(k)); + String v = query.get(k); + say(" query <%s> = <%s>", k, v); + if (v == null) + v = ""; hunk ./terse-vm/src/terse/vm/Terp.java 287 - Pro queryValue = newStr(query.get(k).replaceAll("\r\n", "\n")); + Pro queryValue = newStr(v.replaceAll("\r\n", "\n")); hunk ./terse-vm/src/terse/vm/Terp.java 317 - result_pro = cls.eval(fmt(" handle: (%s) query: (%s)", - urlRepr, qDictRepr)); + result_pro = cls.eval(fmt(" handle: (%s) query: (%s)", urlRepr, + qDictRepr)); hunk ./terse-vm/src/terse/vm/Terp.java 322 - id = usrInst == null? 0 : usrInst.store(); // LRU Cache - + id = usrInst == null ? 0 : usrInst.mention(); // LRU Cache + hunk ./terse-vm/src/terse/vm/Usr.java 12 - static LRUsr cache = new LRUsr(32); - private static int next_id = (int) System.currentTimeMillis() % 999999999 + 101; - private int id_; - - HashMap vars; + static LRUsr lruCache = new LRUsr(32); + private static int next_id = Math.abs((int) System.currentTimeMillis()) % 999999999 + 101; + private int usrId = 0; // Transient id, while in memory. + public String usrName = null; // For saved, persistent objects. hunk ./terse-vm/src/terse/vm/Usr.java 19 - this.id_ = 0; - this.vars = new HashMap(); hunk ./terse-vm/src/terse/vm/Usr.java 20 - public int id() { - if (id_ == 0) { - id_ = next_id; + /** usrName() is the id, if it has no string name. */ + public String usrName() { + if (usrName == null) { + return Integer.toString(usrId); + } else { + return usrName; + } + } + public int usrId() { + if (usrId == 0) { + usrId = next_id; hunk ./terse-vm/src/terse/vm/Usr.java 33 - return id_; + return usrId; hunk ./terse-vm/src/terse/vm/Usr.java 42 - public int store() { - return cache.store(this); + public int mention() { + return lruCache.store(this); hunk ./terse-vm/src/terse/vm/Usr.java 46 - return cache.find(id); + return lruCache.find(id); hunk ./terse-vm/src/terse/vm/Usr.java 80 - return u.id(); + return u.usrId(); hunk ./terse-vm/src/terse/vm/Usr.java 88 - return u.id(); + return u.usrId(); hunk ./terse-vm/src/terse/vm/Usr.java 92 - if (memory[i].id() == id) { + if (memory[i].usrId() == id) {