On Tue, Oct 21, 2008 at 12:42 PM, klaas.holwerda <[EMAIL PROTECTED]> wrote:
> John Labenski wrote:
>> On Sat, Oct 18, 2008 at 6:23 AM, klaas.holwerda <[EMAIL PROTECTED]> wrote:
>>>
>>> One more, a2dWalkEvent is a simple "const long"
>>> In the rules file i did add this:
>>> AllocDataType("a2dWalkEvent", "const long", false)
>>
>> Force it to be treated as a number:
>> AllocDataType("a2dWalkEvent", "const long", true)
>>
> I think you mean:
> AllocDataType("a2dWalkEvent", "number", true)

Sorry, yes.

> That is how its used in genwxbind.lua. And it does work.
> Still strange that i need to this and not a %typedef, which it really
> is. We do i use %typedef??.
>
> Still I am confused about the use of AllocDataType().
>
> If i add this to the rules file.
> AllocDataType("a2dNamedPropertyList", "class", false)
>
> What does that mean, do, and what not?
> Is it like a forward declaration, in case where there is a cycle
> dependency in a classA with member using pointers to classB, and visa
> versa?

%typedefs simply allow the binder to translate between the new type to
some already known type. AllocDataType() gives a little more info to
the binder about how to get and set it to Lua. I've made a
modification to the generator so that you won't need the
AllocDataType() for %typedefs anymore.

> Do i still need to wrap this class, at a minimum like this, if it not in
> another bind library?
>
> %class %noclassinfo a2dNamedPropertyList
> %endclass
>
> And if so, then it is in fact only a forward declaration mechanism in
> case of classes.
> The strange thing is that for a2dWalkEvent it seems no other information
> in the *.i file is needed.

For an AllocDataType() for a2dWalkEvent you've declared that it's a
number so the binder knows how to get/set from/to Lua. However, simply
calling AllocDataType() for a class like a2dNamedPropertyList may not
work since it needs to know if it's encapsulated. The generator may
work, but it won't compile.

Basically, the interface files are run through before fully parsing
and AllocDataType() is called for all %class, %enum, %struct types
with the assumption that they will be fully defined correctly. This
allows us to give better messages for typos and missing types when we
really parse it.

> And what is the difference compared to what happens in here:
>
> datatype_cache_input_fileTable = {
> "c:/data/art2d/wxluacvs/wxLua/bindings/wxwidgets/wx_datatypes.lua" }
>
> Is this more or less the same, as the AllocDataType?

This is a cache of the AllocDataType() calls for other bindings.

Regards,
     John

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to