!7 static Web web; static Canvas canvas; static IVar thinkAheadDays = new Var(7); // now including today static new Var cal; svoid initWeb { web.node("Today"); } p-subst { thinkAheadDays = persistentVar("Think ahead this many days", thinkAheadDays!); web = persistentObject("Web", Web); web.useCLParse = false; web.onNewLabel.add(voidfunc(WebNode node, O label) { processNode(node); change(); }); initWeb(); cal.set(webToCAL(web)); canvas = showCAL(cal!, 650, 450); calAddAutoLayoutSwitch(cal, canvas, voidfunc(CALSpringLayout layout) { layout.desiredLength = 0.25; }, true); calcOnConceptChanges(1000, r { webToCAL(web, cal!, canvas) }, false); botWithCommandList("Current Day."); } answer { if "clear" { web.clear(); initWeb(); ret "OK"; } if "make days" { makeDays(); ret "OK"; } if "make * days" { thinkAheadDays.set(parseInt($1)); makeDays(); ret "OK"; } } sS dayName(int n) { ret n == 1 ? "Tomorrow" : "In " + n + " days"; } svoid makeDays { WebNode day = web.node("Today"); Calendar now = Calendar.getInstance(); addDate(day, now); for (int n = 1; n < thinkAheadDays!; n++) { day = web_followOrMakeForwardRelation(day, "Next day", dayName(n)); now.add(Calendar.DATE, 1); addDate(day, now); } } svoid addDate(WebNode day, Calendar now) { S date = englishMonthName(now.get(Calendar.MONTH)+1) + " " + now.get(Calendar.DAY_OF_MONTH); S origDate = web_stringLabel(day, 1); if (notNullAndDifferent(origDate, date)) fail(); day.addLabel(date); } svoid processNode(WebNode node) {}