From: k. h. <kla...@nl...> - 2006-01-04 13:15:16
|
Hi John, I think we need something extra to make things work for derived classes. The problem is this. I have a luawraps library, which is based on the (simplified here ) luawraps.i file. Most of it is a sort of forward declaration to parse things which come later. a2dLuaWrapper derived from a2dCanvasCsPlWrapper -> a2dCsPlWrapper a2dCentralCanvasCommandProcessor used as pointer. a2dDocumentCommandProcessor used as pointer. Those classes are not used directly for wrapping here. Wihout them genwxbind.bat does report unknown types. //Forward declaration in order to get a2dLuaWrapper parsed correctly %class %delete %noclassinfo %encapsulate a2dDocumentCommandProcessor a2dDocumentCommandProcessor() %endclass //Forward declaration in order to get a2dLuaWrapper parsed correctly %class %delete %noclassinfo %encapsulate a2dCsPlWrapper a2dCsPlWrapper(a2dDocumentCommandProcessor* commandProcessor) %endclass //Forward declaration in order to get a2dLuaWrapper parsed correctly %class %delete %noclassinfo %encapsulate a2dCentralCanvasCommandProcessor a2dCentralCanvasCommandProcessor() %endclass //Forward declaration in order to get a2dLuaWrapper parsed correctly %class %delete %noclassinfo %encapsulate a2dCanvasCsPlWrapper, a2dCsPlWrapper a2dCanvasCsPlWrapper( a2dCentralCanvasCommandProcessor* commandProcessor ) %endclass %class %delete %noclassinfo %encapsulate a2dLuaWrapper, a2dCanvasCsPlWrapper %define %pointer a2dLuaWP a2dLuaWrapper( a2dCentralCanvasCommandProcessor* commandProcessor ) bool FileOpen( const wxString& path ); %endclass Still this will all work, the problem start in an wxArt2D application, where more luabindings are added. That application has a gedi.i file which needs to contain the same "forward" declarations to make it parse. %class %delete %noclassinfo %encapsulate a2dDocumentCommandProcessor a2dDocumentCommandProcessor() %endclass %class %delete %noclassinfo %encapsulate a2dCsPlWrapper a2dCsPlWrapper(a2dDocumentCommandProcessor* commandProcessor) %endclass %class %delete %noclassinfo %encapsulate a2dCentralEditorCommandProcessor a2dCentralEditorCommandProcessor() %endclass %class %delete %noclassinfo %encapsulate a2dCanvasCsPlWrapper, a2dCsPlWrapper a2dCanvasCsPlWrapper( a2dCentralEditorCommandProcessor* commandProcessor ) %endclass %class %delete %noclassinfo %encapsulate TetoLuaWrapper, a2dCanvasCsPlWrapper %define %pointer a2dGedi TetoLuaWrapper( a2dCentralEditorCommandProcessor* commandProcessor ) bool FileExport( const wxString& path, const wxString& description, bool silent = true ) %endclass Somehow this generates code like the following twice, once for luawraps library, and one for the application. Which of course is a problem in compiling or else linking. wxLUA_DECLARE_ENCAPSULATION(a2dCentralEditorCommandProcessor) wxLUA_DECLARE_ENCAPSULATION(a2dDocumentCommandProcessor) wxLUA_DECLARE_ENCAPSULATION(TetoLuaWrapper) wxLUA_DECLARE_ENCAPSULATION(a2dCsPlWrapper) wxLUA_DECLARE_ENCAPSULATION(a2dCanvasCsPlWrapper) SO i think we need something like a forward declaration in *.i files, which does not result in code generation, but is only used by genwxbind.lua for checking/knowing types. Before we did not have this situation, since one did have one big overall info file, which used includes. But for the modular bindings we have now, we need a way to have some header mechanism, which not result in code, i think. BTW what does %encapsulate mean? What do you think? Is there a way to handle it, and i simply don't know, or is it a real problem? Thanks, Klaas -- Unclassified |
From: k. h. <kla...@nl...> - 2006-01-04 13:52:31
|
Hi, I start realizing that forwrad is not always needed. In the next a2dCentralCanvasCommandProcessor needs to be there first, or genwxbind.lua gives errors. Interesting enough, a2dCommandLanguageWrapper is not knwo, but that is oke?? %class %delete %noclassinfo a2dCentralCanvasCommandProcessor a2dCentralCanvasCommandProcessor() %endclass %class %delete %noclassinfo a2dLuaWrapper, a2dCommandLanguageWrapper %define %pointer a2dLuaWP a2dLuaWrapper( a2dCentralCanvasCommandProcessor* commandProcessor ) If i remove the %class .... a2dCentralCanvasCommandProcessor, i get the following error. c:\data\art2d\a2dren9\modules\luawraps\src>genwxbind.bat Generating wxWidgets Binding loaded rules: luawraps.rules Error: Expected Parameter '=', ')', or ',' got Tag='*'. (Name=a2dCentralCanvasCo mmandProcessor; Undefined DataType) File: C:/data/art2d/wxArt2D/modules/luawraps /src/luawraps.i:(line 14) So i think i don't understand when something has to be know upfront or when not? And when something has to be knwo, how to make it know without generating code for a complete class. I just need pointer to it. regards, Klaas k. holwerda wrote: > Hi John, > > I think we need something extra to make things work for derived classes. > > The problem is this. > > -- Unclassified |
From: John L. <jla...@gm...> - 2006-01-04 17:11:26
|
> I start realizing that forwrad is not always needed. > In the next a2dCentralCanvasCommandProcessor needs to be there first, or > genwxbind.lua gives errors. > Interesting enough, a2dCommandLanguageWrapper is not knwo, but that is ok= e?? This is probably an oversight, I suppose that it will fail if you try to call a base class member function on an instance of a2dLuaWrapper. > %class %delete %noclassinfo a2dCentralCanvasCommandProcessor > a2dCentralCanvasCommandProcessor() > %endclass > > %class %delete %noclassinfo a2dLuaWrapper, a2dCommandLanguageWrapper > %define %pointer a2dLuaWP > a2dLuaWrapper( a2dCentralCanvasCommandProcessor* commandProcessor ) > > If i remove the %class .... a2dCentralCanvasCommandProcessor, i get the > following error. > > c:\data\art2d\a2dren9\modules\luawraps\src>genwxbind.bat > Generating wxWidgets Binding > loaded rules: luawraps.rules > Error: Expected Parameter '=3D', ')', or ',' got Tag=3D'*'. > (Name=3Da2dCentralCanvasCo > mmandProcessor; Undefined DataType) File: > C:/data/art2d/wxArt2D/modules/luawraps > /src/luawraps.i:(line 14) > > So i think i don't understand when something has to be know upfront or > when not? > And when something has to be knwo, how to make it know without > generating code for a complete class. > I just need pointer to it. genwxbind.lua tries to figure out if what's in the wrappers are data types or typos. You should always try to forward declare your data types. If you want a user to be able to create that class in lua you can just have a dummy class with no members, like your a2dCentralCanvasCommandProcessor, otherwise you can stick a line like this at the bottom of your "rules" file, but if you do I don't think that you can do anything with it in lua. dataTypes["wxCursor"] =3D AllocDataType("wxCursor", "class", false) Regards, John Labenski |
From: klaas.holwerda <kho...@xs...> - 2006-01-04 20:36:16
|
John Labenski wrote: >>Interesting enough, a2dCommandLanguageWrapper is not knwo, but that is oke?? >> >> > >This is probably an oversight, I suppose that it will fail if you try >to call a base class member function on an instance of a2dLuaWrapper. > > I see many *.i files, which have things in it which are not forward declared? Does genwxbind.lua parse the headers included with %include? That would explain it, but i got the feeling it is not doing anything with %include, it is just for putting it in the C++ generated code? > > >>%class %delete %noclassinfo a2dCentralCanvasCommandProcessor >> a2dCentralCanvasCommandProcessor() >>%endclass >> >> > > No members at all did the job, i saw it used somewhere in the *.i of wxLua. %class %delete %noclassinfo a2dCentralCanvasCommandProcessor %endclass This seems to not generate any code in C++, or at least it does not conflict. >dataTypes["wxCursor"] = AllocDataType("wxCursor", "class", false) > > > Oke good to know. Thanks, Klaas |
From: John L. <jla...@gm...> - 2006-01-10 04:54:20
|
On 1/4/06, klaas.holwerda <kho...@xs...> wrote: > I see many *.i files, which have things in it which are not forward > declared? > Does genwxbind.lua parse the headers included with %include? > That would explain it, but i got the feeling it is not doing anything > with %include, it is just for putting it in the C++ generated code? genwxbind.lua reads all the .i files in an generates a list of all the classes that were defined. Any class not defined will generate an error. Regards, John Labenski |
From: k. h. <kla...@nl...> - 2006-01-11 10:12:30
|
John Labenski wrote: >On 1/4/06, klaas.holwerda <kho...@xs...> wrote: > > >>I see many *.i files, which have things in it which are not forward >>declared? >>Does genwxbind.lua parse the headers included with %include? >>That would explain it, but i got the feeling it is not doing anything >>with %include, it is just for putting it in the C++ generated code? >> >> > >genwxbind.lua reads all the .i files in an generates a list of all the >classes that were defined. Any class not defined will generate an >error. > > I see, so if i understand well, each call to genwxbind.lua should be one a set of *.i files which are selfcontained. Meaning all class names should be somewhere in there. What if one uses classes from an other module/library, e.g derived classes. The base class is wrapped already (with a seperate call to genwxbind.lua) , the baseclass of the derived class in the new module needs to be know too. So in that case one needs the empty class defenition as a sort of forward declaration right? What i conclude from this is that we need soem sort of *.ih files for module, being a header of know types from another module. Something like filling the list of know types. Maybe we should have a %forward class classname, to achieve the next from the rules file, but from a *.i file. dataTypes["wxCursor"] = AllocDataType("wxCursor", "class", false) Did would make it a bit more moduler. regards, Klaas -- Unclassified |
From: John L. <jla...@gm...> - 2006-01-11 14:45:10
|
> >>I see many *.i files, which have things in it which are not forward > >>declared? > >>Does genwxbind.lua parse the headers included with %include? > >>That would explain it, but i got the feeling it is not doing anything > >>with %include, it is just for putting it in the C++ generated code? > > > >genwxbind.lua reads all the .i files in an generates a list of all the > >classes that were defined. Any class not defined will generate an > >error. > > > > > I see, so if i understand well, each call to genwxbind.lua > should be one a set of *.i files which are selfcontained. Meaning all cla= ss names should be somewhere in there. > What if one uses classes from an other module/library, e.g derived class= es. The base class is wrapped already (with a seperate call to genwxbind.lu= a) , the baseclass of the derived class in the new module needs to be know = too. > So in that case one needs the empty class defenition as a sort of forward= declaration right? > > What i conclude from this is that we need soem sort of *.ih files for mod= ule, being a header of know types from another module. Something like filli= ng the list of know types. > > Maybe we should have a %forward class classname, to achieve the next from= the rules file, but from a *.i file. > > dataTypes["wxCursor"] =3D AllocDataType("wxCursor", "class", false) > > Did would make it a bit more moduler. Yes it would, there is a DataTypes.Cache.lua file created in the bindings/wxwidgets directory that can be used for this, but I haven't been able to look into it. You're right that some sort of "precompiled" header from a set of .i files should be generated to take the burden off of other bindings. I will look into the DataTypes.Cache.lua file to understand how and if it's actually used. Regards, John Labenski |
From: John L. <jla...@gm...> - 2006-01-19 04:51:45
|
I have updated the genwxbind.lua and bindings/wxwidgets/wx.rules file to use the data types cache data. I have not been able to test it with external wrappers, but it should work. Read the comments in wx.rules. Basicly, you have a table of the cache files, which are automatically generated by genwxbind.lua, that you "include" in your rules file. Regards, John Labenski On 1/11/06, John Labenski <jla...@gm...> wrote: > > >>I see many *.i files, which have things in it which are not forward > > >>declared? > > >>Does genwxbind.lua parse the headers included with %include? > > >>That would explain it, but i got the feeling it is not doing anything > > >>with %include, it is just for putting it in the C++ generated code? > > > > > >genwxbind.lua reads all the .i files in an generates a list of all the > > >classes that were defined. Any class not defined will generate an > > >error. > > > > > > > > I see, so if i understand well, each call to genwxbind.lua > > should be one a set of *.i files which are selfcontained. Meaning all c= lass names should be somewhere in there. > > What if one uses classes from an other module/library, e.g derived cla= sses. The base class is wrapped already (with a seperate call to genwxbind.= lua) , the baseclass of the derived class in the new module needs to be kno= w too. > > So in that case one needs the empty class defenition as a sort of forwa= rd declaration right? > > > > What i conclude from this is that we need soem sort of *.ih files for m= odule, being a header of know types from another module. Something like fil= ling the list of know types. > > > > Maybe we should have a %forward class classname, to achieve the next fr= om the rules file, but from a *.i file. > > > > dataTypes["wxCursor"] =3D AllocDataType("wxCursor", "class", false) > > > > Did would make it a bit more moduler. > > Yes it would, there is a DataTypes.Cache.lua file created in the > bindings/wxwidgets directory that can be used for this, but I haven't > been able to look into it. You're right that some sort of > "precompiled" header from a set of .i files should be generated to > take the burden off of other bindings. > > I will look into the DataTypes.Cache.lua file to understand how and if > it's actually used. > > Regards, > John Labenski > |