🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #34912

Re: Generating vararg slrn intrinsic at run time ... ???

#34912
From: da... John E. Davis
Date: Mon, 07 Jul 1997 00:00
86 lines
2481 bytes

On 7 Jul 1997 12:43:45 GMT, Lloyd Zusman <asf...@asfast.com>
wrote:
>I know that I can use the s-lang 'strchop' intrinsic to split the
>string and push the components and the number of components onto the
>stack. What I don't know how to do is to assemble the call to
>'get_select_box_response' from these items on the stack.

Use the _stkdepth () intrinsic function.  Here is an example:

define get_color_for_object (title)
{
   variable n;
   
   n = _stkdepth ();
   return select_list_box (title,
			   "black",
			   "red",
			   "green",
			   "brown",
			   "blue",
			   "magenta",
			   "cyan",
			   "lightgray",
			   "gray",
			   "brightred",
			   "brightgreen",
			   "yellow",
			   "brightblue",
			   "brightmagenta",
			   "brightcyan",
			   "white",
			   "default",
			   _stkdepth () - n - 1,
			   0);
}

define color ()
{
   variable n, fg, bg;
   variable obj;
   
   n = _stkdepth ();
   obj = select_list_box ("Object",    %  title
			  
			  "normal",
			  "status",
			  "menu",
			  "menu_press",
			  "headers",
			  "group",
			  "subject",
			  "author",
			  "error",
			  "cursor",
			  "article",
			  "tree",
			  "quotes",
			  "signature",
			  "thread_number",
			  "header_number",
			  "high_score",
			  "description",
			  "grouplens_display",
			  "tilde",
			  "header_name",
			  "response_char",
			  "box",
			  "frame",
			  "selection",
			  _stkdepth () - n - 1,
			  0);
   
   fg = get_color_for_object (strcat ("Foreground for ", obj));
   bg = get_color_for_object (strcat ("Background for ", obj));
   
   set_color (obj, fg, bg);
}


-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    MIT 37-662c, Cambridge, MA 02139
http://space.mit.edu/~davis
Technical Details
Message-ID: <slrn5s226q.a0e.davis@aluche.mit.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
References: <slrn5s1ost.u4u.asfast@ljz.asfast.net>

Show Full Headers
Complete Article Headers
Message-ID: <slrn5s226q.a0e.davis@aluche.mit.edu>
Subject: Re: Generating vararg slrn intrinsic at run time ... ???
Date: Mon, 07 Jul 1997 00:00:00 +0000
From: da...@space.mit.edu (John E. Davis)
References: <slrn5s1ost.u4u.asfast@ljz.asfast.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail
X-Deja-AN: 255336825
Organization: Center for Space Research
Reply-To: da...@space.mit.edu
Newsgroups: news.software.readers,alt.lang.s-lang