[DGD]Auto object

Erwin Harte harte at xs4all.nl
Fri May 11 05:27:49 CEST 2001


On Thu, May 10, 2001 at 11:14:52PM -0400, Stephen Schmidt wrote:
> On Thu, 10 May 2001, Erwin Harte wrote:
> > On Thu, May 10, 2001 at 04:30:53PM -0400, Stephen Schmidt wrote:
> > > Question: If one is writing a system to run over the kernel lib,
> > > and one wants a program to be inherited by every object in the
> > > system (ie, everything in /usr/System, or perhaps better, everything
> > > in /usr), how does one do that?
>  
> > There's a built-in solution for this in the kernel-lib itself. :-)
> 
> Figured there had to be :)
>  
> > Documentation of this feature can be found in
> > 
> >   dgd/mud/doc/kernel/hook/driver
> > 
> > read the section regarding set_object_manager and in particular the
> > part about include_special().
> 
> Found it, I think. There is no include_special(). I presume
> that path_special() was intended?

*blush* Yes, I must've been seeing both include() and path_special()
and have combined it in my mind.  My apologies.

> If I understand the docs right, I create an object manager
> (probably /usr/System/objectd.c or /usr/System/sys/objectd.c),
> and it defines the function path_special(). If path_special()
> is called, and the string argument begins with "/usr/System",
> then I have path_special return - it's not exactly clear what.
> Do I return "/usr/System/lib/my_auto", or is it understood
> about /usr/System and I just return "lib/my_auto"? I'll try
> it both ways and see what happens. If the string argument
> begins with anything else, I return nil.

You'll be returning the name of a file that is going to be included,
best to create a dummy empty file and return the name of that if you
don't want anything included, instead of nil.

Also, because you're returning an include-file, you don't want to
return the name of the auto-object itself, but the name of an include
file that has an inherit-statement for it in there, otherwise you end
up including the code for the auto-object in each object, rather than
inheriting in each object.  A 'minor' but significant difference. ;-)

> Then, I put the line 
> 
> # include "AUTO"
> 
> in the "standard" include file. What is the "standard" include
> file? Is that something in the kernel which already has that
> line? Or is it something I have to put in a file outside the
> kernel? In that case, which file do I put it in?

Look in your DGD configuration file:

  include_file    = "/include/std.h";     /* standard include file */

That one.

> Also, can I use the line
> 
> #include "AUTO"
> 
> instead, or is the space critical?

Both are accepted by the preprocessor, you can for instance use
preprocessor statements like this:

# ifdef FOO
#   ifdef BAR
#     include <foo/bar.h>
#   else
#     include <bar/foo.h>
#   endif
# endif

Using '#include' or '# include' is merely a matter of personal
preference, the latter being Dworkin preference, it seems. :-)

Erwin.
-- 
Erwin Harte
harte at xs4all.nl

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list