Back to index

LispMe sessions

Beginning with version 2.5, LispMe supports multiple sessions in contrast to the single session in earlier versions.

Each LispMe session is like a single process in a multiprocessing operating system. You can switch between sessions at any time (even during evaluation) and restart the session later.

Using sessions

All sessions are totally separate from each other, there's no way of communication (except external resources like MemoPad I/O) between them. That's not a problem as the idea behind them is not concurrent programming (you could do this using continuations in a single session much better), but to provide the framework to switch between many small utility programs written in LispMe without having to pop and reload Memos in a single session.

A session database holds of course not only the Scheme program loaded, but also all data, so for simple applications you don't have to write code to save your data e.g. to a memo, as your data won't be lost when switching to another session. Have a look how the Calculator sample program does not explicitly save its state on exit (it's not handling the frm-close event)

Using starter icons

This is even more faciliated by the option to create starter icons, which start LispMe together with a specific session database. So now your dream has come true: Write Scheme programs on your Pilot, create dialogs for them, and execute them by a simple tap in the application launcher!

A starter application is a tiny program which appears in the Pilot application launcher and starts LispMe with a selected session database and simulates tapping the Eval button. So the steps to create a stand-alone LispMe program are:

  1. Go to the Session dialog, create a new session and switch to it.
  2. Change its memory settings
  3. Load all needed memos
  4. Enter the start expression into the input field
  5. Test it
  6. Go to the Session dialog again and check the icon checkbox.
  7. You might want to select another category for it in the application launcher
Normally starter icons show in the application launcher as Big icon (or Small icon in list view), but you can create your own ones by including a tAIB resource with id 9000 (instead of 1000 for big icon) and/or a tAIB resource with id 9001 (instead of 1001 for small icon) in the resource DB used by your app. The resource DB must be open at the moment you create the starter app by checking the checkbox, since LispMe looks in this moment for icons with IDs 9000 and 9001 in all open resource DBs. If you didn't define icons, LispMe will find its own default icons depicted above.

Backing up and beaming sessions

Each LispMe session is stored in a separate Pilot database, which has the same name as the session. You can backup and restore these databases like any other .pdb file and transfer it to other Pilots running LispMe (please make sure that LispMe version numbers match!) with some tools.

A LispMe session is (almost) fully self-contained, so you can backup and restore (or beam to other Palm devices) a LispMe session and it will continue in the exactly same state when it left your Pilot. This always works for a self-contained session, the problems are external references. In case of LispMe, these can be:

Technical background

When you check the icon option in the session list to create a starter icon, a new program is created in fact, which simply starts LispMe using a special launch code and the name of the session database to start. The database name of the starter is the same as the session database name, but the high bit of the first char in the name is flipped. So don't be alarmed when you find those strange looking .prc names on your Pilot. You can delete a starter app any time you want and recreate it via the session list.

The creator ID of all starter apps must be distinct, so LispMe searches an unused one beginning with fbLA. So you should not try to transfer a starter app to another Pilot, as the creator ID might already be in use there. Just transfer the session database and create the starter app on the other Pilot.