From: uwe@snoopy.niif.spb.su (Valeriy E. Ushakov)
Message-Id: <9409301950.AA00492@snoopy.niif.spb.su>
Subject: gwmsh etc...
To: colas@mirsa.inria.fr
Date: Fri, 30 Sep 1994 22:50:36 +0300 (MSK)
In-Reply-To: <199409290958.AA22263@arthur.inria.fr> from "Colas Nahaboo" at Sep 29, 94 10:58:51 am
Organization: Physics Institute of St.Petersburg State Universisty
X-Operating-System: SunOS 4.1.3C 8
X-Phone: +7 (812) 428-45-27
X-Mailer: ELM [version 2.4 PL23]
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-8
Content-Transfer-Encoding: 8bit
Content-Length: 2854      

Hi, Colas!

Here is also a little package of command templates menu. A xterm with
specified command is started.

;;;;     --- from my-menus.gwm ---
;; List of templates with default values:
;;(cmd-type ((formal1 default1 ...) (strings that makes up a command )))
(: command-template-list
   '(Rlogin ((host "localhost" user ())
	     ("rlogin " host " -8"  (if user (+ " -l " user))))
     Telnet ((host "localhost" port ())
	     ("telnet " host (if port (+ " " port))))
     Mud    ((world ())
	     ("tf " (if world world)))))

;; Sample commands to place in the menu.
;; Actual params for templates are given here.
(: command-list
   ;;  Title       Cmd     Actual params
   '(("Doors"      Rlogin (host "doors"))
     ("Dux"        Rlogin (host "dux.spb.su"))
     ("Base"       Rlogin (host "base.dux.spb.su"))
     ("Phim"       Telnet (host "phim1"))
     ("Snark.Smtp" Telnet (host "snark" port "25"))
     ("Unter"      Mud)
     ("SunCircle"  Mud    (world "SunCircle"))))

;; Place this menu to root pop-up
(insert-at '(item-make "Commands..." (std-pop-menu cmd-pop))
	   root-pop-items 4)

;;;; --- def-menus.gwm initialisation  ---
  (for screen (list-of-screens)
       .......
       (setq cmd-items
	     '(menu-make (pop-label-make "Commands")))

       ;; uh-oh... Any simpler way to do this?
       (for cmd command-list
	 (with (cmd-name (# 0 cmd)
		cmd-type (# 1 cmd)
		cmd-args (# 2 cmd))
	   (with (cmd-template (# cmd-type command-template-list))
	     (with (cmd-defaults (# 0 cmd-template)
                    cmd-parts    (# 1 cmd-template))
	       (with-eval cmd-defaults
	         (with-eval cmd-args
		   (with-eval (list 'command (+ (list '+) cmd-parts))
                     (: cmd-items
			(+ cmd-items
			   (list (list 'item-make (+ cmd-type " " cmd-name)
				       (list '! "/bin/sh" "-c"
					     (+ "xterm +ls -T " cmd-name " -n " cmd-name
						" -e " command)))))))))))))

       (: cmd-pop (eval cmd-items))
       .....
   )

Best regards!

SY, Uwe.
--------
Valeriy E. Ushakov (aka Uwe)            |       Zu Grunde kommen
uwe@niif.spb.su                         |       Ist zu Grunde gehen
