RE: Help with plugin concept
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Feb 12, 2004
- 628 views
> -----Original Message----- > From: Judith Evans [mailto:camping at txcyber.com] > To: Eu Forum > Subject: Help with plugin concept > > > > I've been working on a plugin for IDE as a test of concept. > I've worked up > the first plugin which will open a window in Code Editor to view code > statements for all windows/controls in the order exw would > generate them. It > all works very nice as long as in IDE.exw I hard-code the > statement "include > ViewCodeBase.plg". Since I will never know the plugin file > names the users > write for IDE or even if user is using any, what I wanted to > do was place > the plugin files in a subfolder named Plugins. After all the include > statements in IDE.exw I wanted to read the Plugins folder and > add an include > statement for each file name found as follows: > > --get includes from plugin folder > object files > > files=dir(the_current_dir & "//Plugins") > if sequence(files) then > if length(files) then > for i=1 to length(files) do > if not equal("d",files[i][D_ATTRIBUTES]) then > include viewCodeBase.plg <=== gets ex.err > end if > end for > end if > end if > > Ha. I forgot Euphoria would not allow the include statement > except at the > highest level. So am I out of luck? Any idea how to get > around the problem? > You have some important design considerations to settle on first. Do you want a plugin to be 'registered' when the IDE starts (the "include" method) or after it starts (via some type of load method)? The "include" method means that either someone needs to alter your code or must stick to a specific file naming convention so your code can 'hard-code' the include file name. The "load" method means that the plugin cannot be Euphoria code AND run in the same process space as the IDE. If you want it to run in the IDE's process, it needs to be a runtime-loadable file such as a DLL. If you want it to be interpretred Euphoria code, you could start up a new instance of Euphoria to run it in its own process space and then communicate with it via Inter-Process-Communications API. Each decision has its own good points and bad points. At some stage you need to make concessions/trade-offs. My choice would be to have plugins run in their own process space and use an IPC to pass data between the IDE and the plugin. After you have made this decision, you then have to develop a protocol or API that the plugin writer can use. The plugin writer needs to know how the IDE will communicate etc... This is not a trival task. I believe Mario Steele has got some experience with making this concept work with Euphoria programs. -- Derek