[DGD] Question about overriding AUTO objects

Noah Gibbs noah_gibbs at yahoo.com
Mon Sep 6 18:15:25 CEST 2004


  Further notes:  I'm an idiot.  The problem was in the definition of
my INHERIT_COMMON_AUTO macro, which was actually set to the *script*
auto object.  Since everything tried to inherit from the script auto
object, there was a cycle in the script auto object, and much badness
happened.

  Sorry!

--- Noah Gibbs <noah_gibbs at yahoo.com> wrote:

>   Further notes:  in this test case, no scripts (that is, any file of
> the form /usr/blah/script/...) are being compiled, and the
> game_path_special object is set to (nil).  So neither of those things
> should be factors.
> 
> --- Noah Gibbs <noah_gibbs at yahoo.com> wrote:
> 
> >   I've got a path_special object for use in Phantasmal.  I'm trying
> > to
> > get nonstandard AUTO objects working for some specific files.  I
> got
> > them working on one particular special case, but I'm trying to
> apply
> > them more broadly and I'm having problems.
> > 
> >   Phantasmal dies, claiming 'Runtime error: Cycle in inheritance
> from
> > "/usr/common/lib/script_auto.c"'.  That's a little odd since I'm
> not
> > sure why it's compiling the /usr/common/lib/script_auto.c file at
> > all. 
> > Anyway, this problem suggests that I'm somehow inheriting something
> I
> > don't mean to be.  Let me show you the core function that does this
> > stuff and maybe somebody more perceptive than I am will show me the
> > error of my ways:
> > 
> > string path_special(string file) {
> >   string user, subdir;
> > 
> >   if(sscanf(file, "/usr/%s/%s/%*s", user, subdir) != 3) {
> >     return nil;
> >   }
> > 
> >   if(file == "/usr/common/lib/common_auto") {
> >     return nil;
> >   }
> > 
> >   if(user != "System" && user != "common" && subdir == "script") {
> >     LOGD->write_syslog("Inheriting script AUTO for file " + file);
> >     return INHERIT_SCRIPT_AUTO;
> >   }
> > 
> >   if(user == "common") {
> >     LOGD->write_syslog("Inheriting common AUTO for file " + file);
> >     return INHERIT_COMMON_AUTO;
> >   }
> > 
> >   if(user == "System") {
> >     return nil;
> >   }
> > 
> >   if(game_path_object)
> >     return game_path_object->path_special(file);
> > 
> >   return nil;
> > }
> > 
> > That perceptive person may have noticed that I'm logging which file
> > gets inherited.  My log shows SoulD being successfully compiled,
> and
> > inheriting the COMMON_AUTO version.  Then, the script AUTO file
> > ("/usr/common/lib/script_auto.c") gets compiled (why?), and it says
> > that it inherits from the common AUTO as well.
> > 
> > The INHERIT_COMMON_AUTO file, a header, has only a single line in
> it:
> > 
> > 'inherit "/usr/common/lib/common_auto"'.
> > 
> > The /usr/common/lib/common_auto file overrides call_other to check
> > for
> > errors.  It doesn't explicitly inherit from anybody else, though of
> > course it winds up inheriting from the Kernel Lib's AUTO object
> since
> > everything in the system does.
> > 
> > The version that worked before had no "common AUTO", just a "script
> > AUTO", which worked fine.  Scripts were written only outside of
> > /usr/common, which may be why this all worked out.
> > 
> > 
> > =====
> > 
> > 
> > 
> > 		
> > _______________________________
> > Do you Yahoo!?
> > Win 1 of 4,000 free domain names from Yahoo! Enter now.
> > http://promotions.yahoo.com/goldrush
> > _________________________________________________________________
> > List config page:  http://list.imaginary.com/mailman/listinfo/dgd
> > 
> 
> 
> =====
> 
> 
> 
> 		
> _______________________________
> Do you Yahoo!?
> Win 1 of 4,000 free domain names from Yahoo! Enter now.
> http://promotions.yahoo.com/goldrush
> _________________________________________________________________
> List config page:  http://list.imaginary.com/mailman/listinfo/dgd
> 


=====



		
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list