RALPH@UHHEPG.BITNET (08/05/87)
Date: 3-AUG-1987 23:09:43.53 From: Ralph Becker-Szendy RALPH AT UHHEPG To: B_INFOVAX,RALPH Subj: Better LIB$GET_INPUT ? Hi everyone I have the following little problem: I am writing a LARGE program in FORTRAN. It uses CLI$DCL_PARSE and friends to process command input from the user. Now, i want to give it two additional features. 1. I want something like the DCL @ command: If the command is @filespec, the command interpreters should open this file, and present it (line by line) to CLI$DCL_PARSE and other routines, which read special input from a terminal. Don't worry about the fortran READ(5...), i do all the input via LIB$GET_INPUT. I see two possible solutions: (A) assign SYS$INPUT to a filename, when an EOF is encountered, assign it back. I have no idea how to do the assign from a program, and all the manuals seem to send me deep into the bowels of RMS (where i don't want to go). Also this makes the EOF processing complicated: an EOF after an @ just means "switch back to previous command input", otherwise it means "User typed Z, exit gracefully". (B) Write a little subroutine which behaves like LIB$GET_INPUT, which does the following: if it is in the normal state, it just reads a line with LIB$GET_INPUT and passes it through. If the first nonblank character is a "@", it opens the filename specified, and does all the following input from this file. EOF processing exactly as above. The stupid problem: i can either call this routine LIB$GET_INPUT, then i can't access the "real one" any more, or i give it another name, in which all my cute little utility routines, which rely on LIB$GET_INPUT, have to be rewritten. Neither solution seems nice. 2. Now we get more luxurious: somthing similar for the output ! My dream is the equivalent of the unix ">" pipe. Imagine something like this: With the command ">filespec" you redirect all output (typically to SYS$OUTPUT via FOR006) to filespec. The best solution would also have the unix "TEE": another command (for example ">>filespec") would send all output both to the associated terminal and to the file in question. The first problem could be tackled via assignin (as soon as someone teaches me to do the assin from inside a program). The second one would probably need another LIB$PUT_OUTPUT routine, which sends everything both to a file and to the real LIB$PUT_OUTPUT. I know, these are not the most pressing problems in the VAX universe, but they would make my monte-carlo into a fancy tool, which is not only operated by DCL-style commands, but also shares the DCL "@" command, and extends DCL with a log-file. Any help is appreciated. If enough interesting stuff pops up, i'll post a summary here. BTW, the summary for my recent question about FTP and TeX-DVI drivers will be posted as soon as the flow of help stops a little bit. Ralph Becker-Szendy University of Hawaii / High Energy Physics Group