1. Eval Script
- Posted by Vincent <darkvincentdude at yahoo.com> Dec 15, 2005
- 579 views
- Last edited Dec 16, 2005
Heh... I was just thinking about writing one, I guess you took care of that. 8-) Thanks Alex, Vincent
2. Re: Eval Script
- Posted by cklester <cklester at yahoo.com> Dec 15, 2005
- 561 views
- Last edited Dec 16, 2005
The thing is with scripting or plug-ins, I expect those things to modify data in the current program. For instance, if I've got a music player and I provide an interface for filtering, I expect that plug-in to be able to modify the stream of bits representing the music. The same for a graphics program. If I have an image and I want to run it through a plug-in filter, how would that program interact with the plug-in so that the internal data- the graphic- is modified by the plug-in? I can think of at least two ways: + Plug-ins are actual Euphoria program files. In this case, the program creates a file called "mod_this.dat". Then it opens and loads the plug-in file, which is actually just a Euphoria program. The program runs this code using scripting (like Alex C's Multiplatform Eval Script). The program reads the plug-in's output and continues with the new data... The plug-in can provide a progress bar and cancel button if desired. This way would not crash the original program. + Plug-ins are Euphoria include files, which can be dynamically included with Vincent's dynamic include library. They have to call a registration routine. This could cause the program to crash if the plug-in wasn't robust. + Other ways...? -=ck "Programming in a state of Euphoria." http://www.cklester.com/euphoria/
3. Re: Eval Script
- Posted by C Bouzy <eucoder at hotmail.com> Dec 15, 2005
- 558 views
- Last edited Dec 16, 2005
cklester wrote: > + Other ways...? > Yes...by coding your app to allow a custom script to interact with your code. This is real simple to do, you do not even need LUA or anything else for that matter. I code code my app to load a plain text file with special commands, and each of those commands controls a function in my app. Example: a script command "playfile" would tell my app to execute the Play_File() procedure. ----If you continue to do what you have always done, you will get what you have always gotten.----
4. Re: Eval Script
- Posted by cklester <cklester at yahoo.com> Dec 15, 2005
- 562 views
- Last edited Dec 16, 2005
C Bouzy wrote: > > cklester wrote: > > > + Other ways...? > > Yes...by coding your app to allow a custom script to interact with your code. Yes, you could create a customized scripting language for your specific program. Forgot to mention that one, and it may well be the easiest... You could do something like this: Combine Euphoria scripting with a specialized API: define script Rainbow() -- scripts are snippets of euphoria code that -- will be run by the script engine -- Rainbow(): push all pixels to the nearest rainbow color (ROYGBIV); -- no effect on grayscale pixels atom fn fn = open( "temp.out", "r" ) -- etc... close(fn) end proc define proc main() -- procs are API commands WritePic(temp.out) -- API command to send current graphic to a file Rainbow -- runs the script above on the picture Return( temp.out ) end main The main program would parse the plug-in file, load up the Euphoria scripts and API modules, and do its thing. The main() procedure is the one that gets run. Matt's euscript lets you disallow certain funcs/procs, so it could be safe. -=ck "Programming in a state of Euphoria." http://www.cklester.com/euphoria/
5. Re: Eval Script
- Posted by Alex Chamberlain <alex.chamberlain at tiscali.co.uk> Dec 16, 2005
- 558 views
cklester wrote: > > The thing is with scripting or plug-ins, I expect those things to modify data > in the current program. For instance, if I've got a music player and I provide > an interface for filtering, I expect that plug-in to be able to modify the > stream of bits representing the music. The same for a graphics program. If I > have an image and I want to run it through a plug-in filter, how would that > program interact with the plug-in so that the internal data- the graphic- is > modified by the plug-in? > > I can think of at least two ways: > <snip> > > + Other ways...? > > -=ck > "Programming in a state of Euphoria." > <a > href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a> Well ... I'm looking into using 'Interprocess Communications' by Thomas Parslow, not quite sure how it will be implemented yet ... but it will happen! Erm ... I forgot to mention that if you use my Eval script you must - yes must - include the RDS interpreter with any distribution etc etc etc Thanks, Alex -- Its Midnight!
6. Re: Eval Script
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Dec 16, 2005
- 585 views
cklester wrote: > > The thing is with scripting or plug-ins, I expect those things to modify data > in the current program. For instance, if I've got a music player and I provide > an interface for filtering, I expect that plug-in to be able to modify the > stream of bits representing the music. The same for a graphics program. If I > have an image and I want to run it through a plug-in filter, how would that > program interact with the plug-in so that the internal data- the graphic- is > modified by the plug-in? > > > + Other ways...? > If you use ooeu, you can use eval(). It won't protect you from machine crashes, but it shouldn't crash for normal euphoria errors. A safer way would be to use euscript, and wrap some routines to allow an api to change internal application data. Again, you wouldn't be safe from machine crashes (unless you disallowed any calls that might cause them), but you should be safe from normal errors. I've had some thoughts about how to make ooeu embeddable. I haven't figured out everything, but I think that most of the work is probably done, now that I've got an eval() that works. Matt Lewis