From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8449 invoked from network); 30 Apr 1999 06:23:43 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Apr 1999 06:23:43 -0000 Received: (qmail 3504 invoked by alias); 30 Apr 1999 06:23:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6162 Received: (qmail 3496 invoked from network); 30 Apr 1999 06:23:21 -0000 From: "Bart Schaefer" Message-Id: <990429232315.ZM12273@candle.brasslantern.com> Date: Thu, 29 Apr 1999 23:23:15 -0700 In-Reply-To: <199904280951.LAA17706@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "PATCH: autoloaded parameters" (Apr 28, 11:51am) References: <199904280951.LAA17706@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@sunsite.auc.dk Subject: PATCH and comments Re: PATCH: autoloaded parameters MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii First comment: This new code does not link with --disable-dynamic. params.o: In function `getparamnode': /usr/src/local/zsh/zsh-3.1.5-build/Src/../../zsh-3.1.5/Src/params.c:291: undefined reference to `load_module' Patch below. On Apr 28, 11:51am, Sven Wischnowsky wrote: } Subject: PATCH: autoloaded parameters } } Autoloaded parameters are stored in it like normal parameters, but } with a new flag (PM_AUTOLOAD). Then I changed the getnode-functions of } paramtab to use a new function getparamnode() which calls } gethashnode2() and then checks if the Param returned has the } PM_AUTOLOAD flag set. If it has, the module is loaded. [...] } - To avoid having a `local' with the name of a parameter that will } be autoloaded trigger the loading of the module, I had to change } calls like `paramtab->getnode()' to `gethashnode2(paramtab,...)' Hrm. Is this really the only place to hook this in? Seems like doing it there means that you load the module as soon as anybody references the parameter, even if all that's done is to test whether it's set. Heck, it means the module gets loaded if "unset ..." is used on the parameter! And what happens in createparamtable() if there's an environment variable with the same name as one of the autoloaded parameters? Or is it not possible to have an autoloaded parameter at that point? (If it's not, perhaps it should be. See another message, to follow.) } - For now, I made `typeset' without arguments not print the } autoloaded parameters because we have virtually no information } about them as long as the module is not loaded. But since `which' } reports builtins even when their module isn't loaded yet, we might } want to change this. (What exactly should it print then?) It should probably show the type as "undefined" the same as is done for autoloaded functions. Here's the patch. Index: Src/params.c =================================================================== --- params.c 1999/04/30 05:53:26 1.34 +++ params.c 1999/04/30 06:08:13 @@ -257,6 +257,10 @@ /**/ HashTable paramtab, realparamtab; +#ifndef DYNAMIC +#define getparamnode gethashnode2 +#endif /* DYNAMIC */ + /**/ HashTable newparamtable(int size, char const *name) @@ -278,6 +282,7 @@ return ht; } +#ifdef DYNAMIC /**/ static HashNode getparamnode(HashTable ht, char *nam) @@ -294,6 +299,7 @@ } return hn; } +#endif /* DYNAMIC */ /* Copy a parameter hash table */ -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com