pwl@fluke.UUCP (Paul Lutt) (06/19/85)
I am having a problem with a function in ``S'' and I am hoping someone out there in netland has a solution. The S manual describes a function called "menu" which allows the user to build simple menus of commands. When we tried this function locally, we got the message: "Error: Function menu not found". It turns out that the `Smakefile' for the menu function is setup in such a fashion that the tools that build the list of available functions skips the "menu" function. I modified the `Smakefile', changing the first line from: menu: menu.x plmenu.o to: menu: interface.o menu.x plmenu.o This change satisfied the function-list builder, making the "menu" function available to the user. The next step was to try the "menu(items,actions)" example shown in the S manual. This example displays the following menu: 1 - List Datasets in Work Directory 2 - List Datasets in Save Directory 3 - quit Which one? At this point, I tried to quit by answering "3". The system thought for a bit and then come up with the following error message: S terminating: bad address At this point I spent a fair amount of time finding out how the menu function goes about doing its job. It turns out that when I answer "3", the corresponding action in the "action" dataset is written out to a temporary file. In this particular case, the action is "q" for quit. Once the temporary file has been written, S is put in a mode where it reads its input stream from the temporary file. It is at this point that things go sour. The temporary file is written successfully, but when S goes to re-open it to read the command stream, it uses a null string as the file name. This gives S a bunch of garbage to interpret at commands, which fails miserably. I've tried to figure out why the temporary file name gets lost, but I'm stuck in a maze of m4 macros, ratfor subroutines, and sorted software glue. Any help would be greatly appreciated. -- Paul Lutt (206) 356-5059 John Fluke Mfg. Co. P.O. Box C9090 Everett, WA 98206 {allegra,decvax!microsof,ssc-vax,ucbvax!lbl-csam,uw-beaver}!fluke!pwl