The new HP67-UI interface needs a way for the engine to call back to the user interface and request an additional argument when one is required. For instance, the memory-store key, STO, requires an argument to indicate where the store is to take place. If no such argument is supplied, it will be requested through this interface.
We used to ask the UI to build the appropriate query string, but it makes more sense to put this into the engine. So now, all the UI has to do is to write out the string it receives, without any modification or augmentation.
The handle-one-keypress function in the engine is not aware of the new HP67-UI interface. It doesn’t have to be, all of the method functions it might need to use are passed down to it inside closures. This is a very nice feature of Lisp, the ability to build closures easily and pass them down to functions. In C, you would do this with function pointers, but that requires writing the code in a separate function, which makes it less easy to see immediately what it is doing. The Lisp code in question looks like this:
(handle-one-keypress response #'(lambda (x) (hp67-ui:ui-get-argument ui x)) nil stack mode :arg-is-num t))
This code is checked into the git repository under the tag v2014-12-06.