!!$ Save file as: SYMBOLS_AND_LOGICALS.TPU Source: FILESERV@SHSU.BITNET !!$ NOTE: Accompanying text from transmission follows at end of file !!$ ==================================================================== ! ! vim$dcl_buf - Return DCL buffer. ! procedure vim$dcl_buf return get_info ( BUFFER, "find_buffer", "DCL" ); endprocedure ! ! vim$start_dcl - If Eve DCL process is not running, then start it. ! procedure vim$start_dcl if ( eve$x_dcl_process = 0 ) or ( eve$x_dcl_process = TPU$K_UNSPECIFIED ) then eve_dcl ( 'write sys$output "Starting DCL process..."' ); ! Would be nice just to delete DCL window in case we had more ! than one window before this was called... eve_one_window; update ( CURRENT_WINDOW ); endif; endprocedure ! ! vim$dcl_send - Send a line to the Eve DCL process. ! procedure vim$dcl_send ( s ) local old_mark; vim$start_dcl; old_mark := mark ( NONE ); position ( end_of ( vim$dcl_buf ) ); split_line; copy_text ( "[" + s + "]" ); send ( s, eve$x_dcl_process ); position ( old_mark ); endprocedure ! ! vim$dcl_symbol - Return value of a DCL symbol. ! ! This procedure returns the value of a symbol in the Eve DCL process. ! It will return the empty string ("") if the symbol is undefined. ! ! Assumes no '"' in the symbol name. ! procedure vim$dcl_symbol ( symbol ) local old_mark; local line; local start; ! ! Send "SHOW SYMBOL" command to DCL and read response. ! old_mark := mark ( NONE ); vim$dcl_send ( "show symbol " + symbol ); position ( end_of ( vim$dcl_buf ) ); move_vertical ( -1 ); line := CURRENT_LINE; position ( old_mark ); if ( substr ( line, 1, 1 ) = "%" ) then return ""; endif; start := index ( line, '"' ) + 1; return substr ( line, start, length ( line ) - start ); endprocedure ! ! vim$dcl_logical - Return value of a DCL logical. ! ! This procedure returns the value of a logical in the Eve DCL process. ! It will return the empty string ("") if the logical is undefined. ! ! Assumes no '=' or '(' in the logical name or value! ! ! Doesn't handle list logicals! ! procedure vim$dcl_logical ( logical ) local old_mark; local line; local start; local ending; ! ! Send "SHOW LOGICAL" command to DCL and read response. ! old_mark := mark ( NONE ); vim$dcl_send ( "show logical " + logical ); position ( end_of ( vim$dcl_buf ) ); move_vertical ( -1 ); line := CURRENT_LINE; position ( old_mark ); if ( substr ( line, 1, 1 ) = "%" ) then return ""; endif; start := index ( line, '=' ) + 3; ending := index ( line, '(' ) - 3; return substr ( line, start, ending - start + 1 ); endprocedure !!$ ==================================================================== !!$ X-ListName: Text Processing Utility (TPU) Language Discussion List !!$ !!$ From: gehammon@sdrc.com (Eric S. Hammond) !!$ Message-ID: <9207081718.AA18777@sdrc.com> !!$ Subject: Evaluating symbols & logicals (SOURCE) !!$ To: info-tpu@shsu.edu !!$ Date: Wed, 8 Jul 92 13:18:19 EDT !!$ !!$ Fellow progammers: !!$ !!$ Here's what I use to get the values of symbols and logicals from TPU. !!$ The following TPU code is not extremely robust. It contains several !!$ assumptions and does not perform much error processing. There is a !!$ slight delay for the first evaluation if the DCL process is not run- !!$ ning. !!$ !!$ The arguments to vim$dcl_symbol and vim$dcl_logical are strings con- !!$ taining the names of the symbol and logical to be evaluated. !!$ !!$ I would appreciate receiving any enhancements to the following code, !!$ or source which replaces the functionality in a more elegant manner. !!$ !!$ Thanks, !!$ Eric.Hammond@sdrc.com