[DGD] The function call_other

Ludvig Lejon ludde at lejon.biz
Mon Aug 23 19:23:44 CEST 2004


Thanks for your answer. But it doesn't quite work out for me.
I've got _F_create in my dgd-config, and I tried to use
_F_create() in my testobject, but the driver complained about
"redeclaration of nomask function _F_create (/sys/dgd/lib/auto)".

To make my own compile_object doesn't work either.
It work when i call the object from another object with call_other, but not
when
I clone it.

Should i call the create() function in both compile_object and
clone_object in order to make it work?

I don't see that (my) DGD tried to call the create() function.

/Ludvig Lejon

----- Original Message -----
From: <birgit.schulte at philips.com>
To: <dgd at list.imaginary.com>
Sent: Monday, August 23, 2004 6:31 PM
Subject: Re: [DGD] The function call_other


>
>
>
>
> > I have another question. I edited the auto object before to call the
> > create() function every time a new object is cloned.
> > I added the following to the function clone_object:
> > if(function_exists("create", retobj)) {
> >   retobj->create();
> >     }
> > I noticed that this only affects the objects beeing cloned, not the ones
> > called for the first time. If another object does
> > "/obj/an-object"->display_text() the create() doesn't get called. I'm
> > wondering. Can I rewrite the function compile_object in auto to?
>
> Well, you can rewrite any kernel-function by redefining it in the auto
> object.
>
> The check which you added to your clone_object-function will probably not
> work
> in the intended way. First, function_exists() should be function_object()
> (dunno if that
> changed maybe due to the DGD version, or due to your library).
> Second, function_object() will only check the very object you have given
> for the
> function name, not any objects which are inherited. So if create() was
> defined
> by some ancestor, and not redefined in your toplevel object, your check
> will always fail.
> Third, create() is usually defined as static, meaning you can't do a call
> to
> some_object->create().
>
> Generally, you don't need to check at all if a function exists to call
it -
> just do it.
> If the function you are calling does not exist, nothing happens, not even
> an error.
>
> So you don't have to call create() explicitely in clone_object(),
> since DGD will do that for you. If you have a look at the mud.ini file,
> you'll
> see that a create_function is defined in there. I don't know if you are
> working with
> the kernel-library, if so, then there will be wrapper-function defined in
> the auto object
> to make sure that the function create() gets called when needed.
> DGD will call this function in any clone right after cloning, and else in
> any object
> upon the first function-call to it.
>
> If you want to make sure that every object gets initialized as soon as
> possible,
> just add the following into your compile_object somewhere after the
> successful compile
> happened:
>
> ::call_other(new_obj,"");
>
> This will try to perform a call to a nameless function which will never
> exist, and thus
> make DGD call the create() in that object.
>
>
> Regards,
> Birgit
>
> _________________________________________________________________
> List config page:  http://list.imaginary.com/mailman/listinfo/dgd
>
>


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



More information about the DGD mailing list