home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / emacs / sources / 565 < prev    next >
Encoding:
Text File  |  1992-07-29  |  2.4 KB  |  85 lines

  1. Newsgroups: gnu.emacs.sources
  2. Path: sparky!uunet!wupost!gumby!destroyer!ubc-cs!uw-beaver!micro-heart-of-gold.mit.edu!mit-eddie!eddie.mit.edu!ronnie
  3. From: ronnie@eddie.mit.edu (Ron Schnell)
  4. Subject: dunnet - please replace dun-batch.el (included)
  5. Message-ID: <1992Jul29.183330.17304@eddie.mit.edu>
  6. Sender: news@eddie.mit.edu (Usenet News)
  7. Reply-To: ronnie@eddie.mit.edu (Ron Schnell)
  8. Organization: MIT EECS/ECF Facility, Cambridge Mass
  9. Date: Wed, 29 Jul 92 18:33:30 GMT
  10. Lines: 73
  11.  
  12. For some reason, a line got deleted from the second sharfile as
  13. posted to gnu.emacs.sources only.  The archived file is fine, as should
  14. be the one posted to comp.sources.games.  Please replace
  15. dun-batch.el as it is below.
  16.  
  17. #Ron
  18.  
  19. -------------------------
  20.  
  21. ;;;;;;;;;;;;;;;;;;;
  22. ;;;;;;;;;;;;;;;;;;;
  23.  
  24.  
  25. ; These are functions, and function re-definitions so that dungeon can
  26. ; be run in batch mode.
  27.  
  28. (defun mprinc (arg)
  29.    (if (stringp arg)
  30.        (send-string-to-terminal arg)
  31.      (send-string-to-terminal (prin1-to-string arg))))
  32.  
  33. (defun mprincl (arg)
  34.    (if (stringp arg)
  35.        (progn
  36.            (send-string-to-terminal arg)
  37.            (send-string-to-terminal "\n"))
  38.      (send-string-to-terminal (prin1-to-string arg))
  39.      (send-string-to-terminal "\n")))
  40. (defun parse (ignore verblist line)
  41.   (setq line-list (listify-string (concat line " ")))
  42.   (doverb ignore verblist (car line-list) (cdr line-list)))
  43.  
  44. (defun parse2 (ignore verblist line)
  45.   (setq line-list (listify-string2 (concat line " ")))
  46.   (doverb ignore verblist (car line-list) (cdr line-list)))
  47.  
  48. (defun read-line ()
  49.   (read-string ""))
  50.  
  51. (setq batch-mode t)
  52.  
  53. (defun dungeon-batch-loop ()
  54.   (setq dead nil)
  55.   (setq room 0)
  56.   (while (not dead)
  57.     (if (eq dungeon-mode 'dungeon)
  58.     (progn
  59.       (if (not (= room current-room))
  60.           (progn
  61.         (describe-room current-room)
  62.         (setq room current-room)))
  63.       (mprinc ">")
  64.       (setq line (downcase (read-string "")))
  65.       (if (eq (parse ignore verblist line) -1)
  66.           (mprinc "I don't understand that.\n"))))))
  67.  
  68.   (defun unix-interface ()
  69.     (login)
  70.     (if logged-in
  71.     (progn
  72.       (setq dungeon-mode 'unix)
  73.       (while (eq dungeon-mode 'unix)
  74.         (mprinc "$ ")
  75.         (setq line (downcase (read-string "")))
  76.         (if (eq (parse2 nil unix-verbs line) -1)
  77.         (progn
  78.           (if (setq esign (string-match "=" line))
  79.               (doassign line)        
  80.             (mprinc (car line-list))
  81.             (mprincl ": not found.")))))
  82.       (goto-char (point-max))
  83.       (mprinc "\n"))))
  84.  
  85.