Page 1 of 1

When

Posted: Mon May 01, 2023 10:41 am
by duaner
This displays a when (http://www.lightandmatter.com/when/when.html) calendar on android. It's probably not useful if you've never heard of when, but you might be interested in the source code. I put in a tokenizer that doesn't use regular expressions, and the calendar math is done in reverse-polish notation, converted from infix read from the calendar file. It also has a simple, scrolling window.

The when.lua file will display a when calendar in a terminal when run with the lua interpreter, though it has none of the configuration you get with the actual when.

When turns calendar descriptions like this into lists of events by day:

Code: Select all

1912* apr 9 , Uncle Fester's \a birthday
!(j%16-2) , Haircut 
m=jan & w=mon & a=3 , Martin Luther King Day
* feb 14 , Valentine's Day
You modify the calendar file with any text editor. There's no easy way to do it from android -- it's just for display.

There's a lot of room for improvement in this code -- I still haven't accounted for line wrapping, so the window is usually too small. I haven't implemented the easter variable yet. I might even make it editable some day.