home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 01e / max130.zip / SHELL.MAX < prev    next >
Text File  |  1988-10-30  |  1KB  |  46 lines

  1.  
  2. tclear()
  3.  
  4. $include ("windef.max")
  5.  
  6. ; This program provides the framework for a simple
  7. ; Max command processor.
  8.  
  9. ; The MaxEdit prompt function is used to set the prompt
  10. ; character to colon. Normally the editor returns all characters
  11. ; to the left of the cursor. The prompt feature is used to specify
  12. ; the last character in the prompt. The editor then returns only
  13. ; characters between the prompt character and the cursor.
  14.  
  15. ; Try commands like "put(time())" to see how it works.
  16. ; Try prompt to change the default prompt.
  17.  
  18. Function shell
  19.     Begin
  20.  
  21.         set (prompt "Max")
  22.         window (WPrompt ":")
  23.  
  24.         Loop
  25.  
  26.             ; Print a prompt and get a command.
  27.  
  28.             printx (prompt ": ")
  29.             get (cmd)
  30.  
  31.             ; If command is the prompt command then let user change
  32.             ; prompt, otherwise let Max evaluate it.
  33.  
  34.             If strind (cmd "prompt")
  35.                 Then
  36.                     put ("Enter new prompt")
  37.                     get (prompt)
  38.                 EndThen
  39.                 Else
  40.                     eval (cmd)
  41.                 EndElse
  42.             EndIf
  43.                                            
  44.         EndLoop
  45.  
  46. EndFunction