[DGD] kfun.h and kfuns for function pointers

bart at wotf.org bart at wotf.org
Wed Aug 14 17:55:03 CEST 2013


On Wed, 14 Aug 2013 16:15:53 +0200, Felix A. Croes wrote
> bart at wotf.org wrote:
> 
> > Looking at how I could determine from lpc if the driver is built with -DCLOSURES, I 
looked 
> > at kfun.h and noticed they appear there as #define KF_NEW.FUNCTION etc, which 
> > apparantly is accepted by the precompiler. However, #ifdef KF_NEW.FUNCTION results 
in a 
> > 'bad token in control'.
> 
> That is a mistake, conf_includes() should replace the period with an
> underscore.  The period should remain in the function names, since it
> prevents explicit calls to those functions.
>

See, I knew there would be a reason for this.
Currently have no internet at home (isp having an equipment issue) and copy/pasting to my 
tablet is somewhat cumbersome, so no patch from me for this, but it looks like this would 
mean adding one line below 1275 in config.c that says
if(*p == '.') then *p = '_';

> >[...]
> > Also, I was wondering if ot would be a good idea to let ppcontrol.c add a define similar 
to 
> > what it does for the network extensions. This would allow writing code that checks for 
this 
> > in a way that is compatible with versions of dgd that didn't create kfun.h yet. Biggest 
> > objection I can think of is not wanting to clutter the lpc environment with driver 
provided 
> > defines.
> 
> I'm not in favour of having a predefined macro for this.  Just use
> operator overloading in your mudlib, and it will only work with DGD
> versions that generate kfun.h. :-)

Talking about operators.. made me a simple bigarray to play with those, and noticed 
something that seems somewhat strange.
I can write something like

object o;
o = new_object(O_BIGARRAY);

o = o + ({ 1, 2, 3 });

That compiles and works, however, if I replace the last line with
o += ({ 1, 2, 3 })

I get a bad argument 1 to kfun + runtime error.

Bart
--
http://www.flickr.com/photos/mrobjective/
http://www.om-d.org/



More information about the DGD mailing list