Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Test/V01zmodload.ztst



Bart wrote:
> Currently one of the tests fails:  After defining an autoloaded math func,
> you can't undefine it again, even if the module has not been loaded.  It's
> probably something incredibly simple, but I'm not up to pursuing it right
> now, so if you want "make check" to pass you have to comment out the line
> `zmodload -uf bogus'.

There's a typo here --- using CONDF_* flags instead of MFF_* flags.
Actually that doesn't change anything because they're both defined to 2,
so that's not the real problem.

What's happening is simple enough --- addmathfunc adds the `added' flag
straight away, which is what is tested to see if the function was
autoloaded, so this is screwy.  Probably add_automathfunc() shouldn't be
allowing addmathfunc() to add the MFF_ADDED flag, it should be done when
the module is loaded.  The following seems to work.

Index: Src/module.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/module.c,v
retrieving revision 1.8
diff -u -r1.8 module.c
--- Src/module.c	2001/01/16 13:44:20	1.8
+++ Src/module.c	2001/05/18 13:06:13
@@ -1346,7 +1346,7 @@
     int ret = 0;
 
     if (ops['u']) {
-	/* remove autoloaded conditions */
+	/* remove autoloaded math functions */
 	for (; *args; args++) {
 	    MathFunc f = getmathfunc(*args, 0);
 
@@ -1355,7 +1355,7 @@
 		    zwarnnam(nam, "%s: no such math function", *args, 0);
 		    ret = 1;
 		}
-	    } else if (f->flags & CONDF_ADDED) {
+	    } else if (f->flags & MFF_ADDED) {
 		zwarnnam(nam, "%s: math function is already defined", *args, 0);
 		ret = 1;
 	    } else
@@ -1377,7 +1377,7 @@
 	}
 	return 0;
     } else {
-	/* add autoloaded conditions */
+	/* add autoloaded math functions */
 	char *modnam;
 
 	modnam = *args++;
@@ -2119,6 +2119,8 @@
 
 	return 1;
     }
+    f->flags &= ~MFF_ADDED; /* still to autoload, not added yet */
+
     return 0;
 }
 
 
-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author