[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tolua 4.0
- From: Jonathan Adamczewski <jadamcze@...>
- Date: Tue, 5 Dec 2000 17:13:21 +1100 (EST)
On Wed, 29 Nov 2000, Waldemar Celes wrote:
> > I've been using tolua4.0a and am corious about the following two points
> > that you mentioned -
> >
> > > The main changes are:
> > > - new support for extracting .pkg instruction from real header file
> >
> > How does this work?
>
> in the real (.h) header file, you can mark pieces of code to be processed
> by tolua,
> using the labels "tolua_begin" and "tolua_end". For instance:
>
> ...
> //tolua_begin
> struct Message
> {
> enum {
> FIRST=1,
> SECOND,
> THIRD
> };
>
> void hello ()
> {
> cout << "hello world" << endl;
> }
> };
> //tolua_end
> ...
>
> then, you instruct tolua to interpret this file, including in the .pkg
> file:
>
> ...
> ${filename.h}
> ...
Ok, have tried the above and works wonderfully. A couple of things come
to mind...
- If you use
${filename.h}
You still need to manually place
$#include "filename.h"
in the pkg file. Does it make sense that the first implies the second?
- How are tolua keywords etc treated within header files? Obviously I
can't start placing Module and @ willy nilly within the code. Is there
still the ability to somehow use these within the header? (I must confess
that I have tried neither experimentation nor examinination of the tolua
code in this matter so do feel free to tell me to work it out myself:)
- If $#include "filename.h" is used within a pkg file, #include's are
placed in the output below the #include "tolua.h" line. This can cause
problems under Visual C++ if precompiled headers are used as it requires
the include stdafx.h as the very first include in the file. Several
solutions are available (AFAICS)
1. I live with it, doomed to spend the rest of my days editing the tolua
output by hand (ok, I'll stop being a melodrama queen :)
2. I modify the tolua code just for me so that it puts #include
"stdafx.h" at the top of every file (which is almost as bad and terribly
bad form)
3. The code is modified so that all #include's are placed above tolua.h
I think this would make the most sense and it will not produce incorrect
code.
- classes and structs are kept within the module they are designated
in. I realize that this is probably by design... it might be nice to have
the option. For example, it makes modules more analogous to namespaces.
I'll look into what changes might be needed over the next couple of days,
but help and opinions on the above would be greatly appreciated.
Thanks
Jonathan.
(There was something else I had been thinking about but my memory fails
me... No doubt it will come to me straight after I hit send :)
> > Thanks for this brilliant piece of software!
> >
>
> thank you for using tolua.
Hey, no worries - it makes a lot of what I'm doing impossibly easy (at
least, it does when I remember to regenerate the tolua output after
changing my code ;) I need to stick an automatic trigger in somewhere...)