home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / utility / dosedit next >
Encoding:
Text File  |  1997-08-18  |  1.5 KB  |  51 lines  |  [TEXT/R*ch]

  1. Using Moscow ML under plain DOS
  2. -------------------------------
  3.  
  4. If you use mosml under plain DOS, then you need an external editor
  5. such as DOS `edit' to edit your ML source files.  
  6.  
  7. Assume that the source file you want to edit is called "gcd.sml".
  8. Then you can invoke the editor from within the ML session by
  9. evaluating
  10.  
  11.     system "edit gcd.sml";
  12.  
  13. When returning from the editor, you can load the source file by
  14. evaluating
  15.  
  16.     use "gcd.sml";
  17.  
  18. This works, but is tedious.  To simplify the calls to edit and use,
  19. use the following program in file mosml\lib\edit:
  20.  
  21. (* ---------------------------------------------------------- *)
  22.    local 
  23.       val file = ref ""
  24.       fun setit "" = !file
  25.     | setit s  = (file := s; s)
  26.    in 
  27.       fun e s = (system ("edit " ^ setit s); use (setit s))
  28.    end
  29. (* ---------------------------------------------------------- *)
  30.  
  31. You may invoke Moscow ML with
  32.  
  33.     mosml edit
  34.  
  35. Then, inside the mosml session, you may evaluate
  36.  
  37.     e "gcd.sml";
  38.  
  39. This will invoke the DOS editor `edit' on file "gcd.sml".  When you
  40. are finished editing the file, save it, and exit the editor.  Then the
  41. edited file will automatically be loaded into the current mosml
  42. session by `use'.  (If you prefer to use e.g. the Turbo Pascal editor,
  43. then replace "edit " by "turbo " in function `e' above).
  44.  
  45. The call to the `e' function saves the filename, so if you need to
  46. edit the same file "gcd.sml" again, you need to type only
  47.  
  48.     e "";
  49.  
  50. This will edit (and then use) the file most recently edited.
  51.