! Spell.TPU - Spell the selection or a buffer ! ! Edit History ! ! Which When Who What ! ! X00-01 20-Mar-85 JLB Built from Dave Griffen's ! Variation of Snow's original ! Turn eve$ to eveplus_ ! Clean up the prompting ! ! X00-02 18-Jul-85 JLB Fix locals per MarkG ! ! X00-03 29-Jul-1985 RAB Remove cause of spurious "No select ! active" messages. "Delete" temporary ! file via "spawn" instead of "eve_dcl". ! Support both one and two window editing ! environments. Eliminate intermediate ! screen updates. ! X00-04 30-Jul-85 JLB Fix a typo in EVE_spell that broke ! correcting a selected range. ! X00-05 18-Mar-87 SS,AAW Modified to use DECUS SPELL ! utility instead of DECspell. Procedure EVE_Spell !+ ! EVE_SPELL is a procedure to take a selected region or the ! whole buffer, write it to a file, called sys$scratch:eve_spell_sort.tmp ! and spawn DECspell to check the spelling, then include the corrected ! file back into the document. This file was started as Mike Taylor's ! EDT spell.tpu but with changes in the spawn command it is much ! easier and doesn't require the DECspell subprocess to be created ! before you get into TPU. This procedure only works with TPU Y1.3 ! and on. ! ! David W. Snow Jan 10, 1985 !- local answer , text_ptr ; if ( eve$x_select_position <> 0 ) then answer := read_line( 'Spell selected text? [Y] '); text_ptr := select_range; else answer := read_line( 'Spell '+ get_info ( current_buffer , "name" ) + ' [Y] '); text_ptr := current_buffer; endif; change_case (answer, lower); if (length (answer) = 0) or (answer = substr ("yes", 1, length (answer))) then message("Beginning spelling correction..."); eveplus_spell ( text_ptr ); message("Spelling correction complete."); endif; endprocedure ! eve_spell procedure eveplus_spell ( text_ptr ) !+ ! pre: text_ptr is pointer to region or buffer ! spawn DECspell ! post: replaced text with correctly spelled text ! reset selected region !- local in_file , out_file , spell_line ; out_file := "sys$scratch:eve_spell_sort.tmp"; in_file := "sys$scratch:eve_spell_sort.tmp"; ! ! write out temp file to be checked by DECspell ! ! set(screen_update, off); write_file ( text_ptr , in_file ); spell_line := "$ SPELL/NOSTATISTICS "+ in_file; ! spell_line := "SPELL "+ in_file + "/output=" + out_file; if get_info(eve$x_spell_defined,"TYPE") = UNSPECIFIED then eve$x_spell_defined := "TRUE"; eve_dcl("DELETE/SYMBOL/GLOBAL SPELL"); eve_dcl("SET COMMAND ENGL:SPELL"); endif; eve_dcl(spell_line); ! spawn(spell_line); ! eve$x_select_position := 0; ! erase ( text_ptr ); ! read_file ( out_file ); spawn("$delete sys$scratch:eve_spell_sort.tmp;*"); ! set(screen_update, on); ! eve_refresh; endprocedure ! eveplus_spell