home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / textutil / gcmacro.zip / SS.S < prev    next >
Text File  |  1993-05-10  |  2KB  |  58 lines

  1. // ****************************************************************************/
  2. //
  3. // 02-12-93: Submitted by Don Dougherty (Msg 6266 Cnf 15)
  4. // 03-09-93: KAC - Rewritten, commented, and tested.
  5. // 7 Apr 93: ggc - addition for environmental variable.
  6. //
  7. // Macro to Execute Share Spell on the current file
  8. //
  9. // ASSUMPTIONS: ShareSpell is installed and located in the current directory
  10. //              or along the users path.  The name of the Share Spell
  11. //              executable is "SS.EXE"
  12. //
  13. // PARAMETERS:  none
  14. //
  15. // RETURNS:     nothing
  16. //
  17. // GLOBAL VARS: none
  18. //
  19. // LOCAL VARS:  cfilename   - string that is loaded with the current filename
  20. //              cline       - current line in file
  21. //              cpos        - current pos in file
  22. //              cxofs       - current XOffset in window
  23. //              crow        - current row in window
  24. //
  25. proc Main()
  26.     integer cline, cpos, cxofs, crow
  27.     string  cfilename[128] = CurrFileName(),
  28.             env[30] = GetEnvStr("SS")    // environment path to SS.exe
  29.                                          // ggc 7 Apr 93
  30.     if isChanged() and not SaveFile()
  31.         //
  32.         // If file has been changed and we could not save it, then we should
  33.         // immediately return without attempting to call ShareSpell.
  34.         //
  35.         return()
  36.     endif
  37.  
  38.     if not Length(env)      // if there is no EV then use current dir
  39.        env = LoadDir()      // ggc 7 apr 93
  40.     endif
  41.  
  42.     cline = CurrLine()      // this saves our position in the file
  43.     cpos = CurrPos()
  44.     cxofs = CurrXOffset()
  45.     crow = CurrRow()
  46.     PushBlock()             // just in case a block is currently marked
  47.     Dos(env+"\SS "+cfilename, _DONTPROMPT_)    // call ShareSpell
  48.     AbandonFile()           // get rid of the file so we can reload it
  49.     EditFile(cfilename)     // reloads the file from disk
  50.     GotoLine(cline)         // restore our position in the file
  51.     GotoPos(cpos)
  52.     GotoXOffset(cxofs)
  53.     ScrollToRow(crow)
  54.     PopBlock()              // restore block, if one was marked
  55. end
  56. //
  57. // End of ShareSpell()
  58.