Adding an Exec command and File Browser support to Insphex
I implemented the last features originally planned for Insphex, my hex dump tool in Common Lisp for Medley Interlisp.
The first new feature is an Exec command for invoking the program. The command HD
works the same way as the function INSPHEX:HEXDUMP
and accepts the same arguments, a file name and an optional boolean flag to indicate whether the output should go to a separate window:
← HD FILENAME [NEWIN-P]
The other feature is the addition to the File Browser menu of the Hexdump
command, which shows the hex dump of the selected files in as many separate windows:
For other commands that produce output in windows the File Browser lets the user view one window at a time, with menu options for skipping through the windows. Insphex doesn't do anything so elaborate though.
Implementing the features was easy as the relevant Interlisp APIs are well documented and I have experience with adding an Exec command to Stringscope.
The Medley Lisp library modules manual covers the File Browser API from page 115 of the PDF, with the explanation of how to add commands on page 118. It's as simple as registering a callback function the command invokes, INSPHEX::FB-HEXDUMP
for Insphex.
An issue I bumped into is that instead of 4 arguments as the manual says, the callback actually requires 5. The last, undocumented argument was likely introduced since the publication of the manual.
#insphex #CommonLisp #Interlisp #Lisp
Discuss... Email | Reply @amoroso@fosstodon.org