1. RE: Euphoria as an extension language

Hi All

Could you not use a message interface in Windows to pass variables? e.g.

- C program invokes Eu program
- Eu program sends custom message(s) to C program to get variables
e.g. var = SendMessage( hCProgram, UM_GET_VAR, var_id, 0 )
- C program returns variable value or pointer to struct etc.

This seems equivalent to calling functions in the parent program to 
me...

Phil

Derek Parnell wrote:
> This would work well in Windows, and would get rid of all that silly 
> console screens popping up and 
> down.
> 
> 18/11/2002 4:54:57 PM, dm31 at uow.edu.au wrote:
> 
> >
> >|1) Main program writes out the values of the variables required to a
> >disk file.
> >|2) Either it creates the script code at runtime or uses a pre-built
> >script.
> >|3) Runs a new instance of ex.exe using the script program. You could
> >include the names of the input-
> >|output files on the command line too.
> >|4) Starts waiting for the results to be signalled.
> >|5) The script reads in the stored values from the disk file.
> >|6) The script does it stuff.
> >|7) The script writes out the values to another disk file.
> >|8) The main program (that has been patiently waiting for the new disk
> >file to be written), loads 
> >|back in the updated variable values.
> >|9) And the show goes on, etc...
> >
> >You could even have the main program allocate memory for the vars,
> >have these addresses in the disk file, that way the script program
> >could use those instead of writing another file with the results.
> >
> >
> >
> ---------
> Cheers,
> Derek Parnell 
> ICQ# 7647806
> 
>

new topic     » topic index » view message » categorize

2. RE: Euphoria as an extension language

> From: Rom [mailto:kjehas at frisurf.no]
> From: "Ray Smith" <smithr at ix.net.au>

> > > Can Euphoria call a function in a C++ or Delphi 
> application(exe-file)?
> > > I am trying to figure it out and it seems to me it cannot be done.
> > 
> > Basically No. I guess it would be possible "if" the exe you 
> wanted to call was an 
> > automation server (ie. like ms word or excel).  

Actually, I think it can.  I've done this before using open_dll(),
define_c_func(), etc.  The problem with C++ is name
decoration/overloaded/virtual functions.  CDECL calling conventions can make
things a little more difficult, but not impossible.

> So what is the easiest way to create a scripting language 
> that can access important data/functions in a running application?

David Cuny (with someone's help--don't have the file/name here right now)
wrote an Eu emulator in Eu.  I've converted this to use as a scripting
language.  I added some special hooks (get_data(), set_data(), etc) to
change/read data that the script should have access to.  It was very simple.
I also removed all the low level stuff, like peek/poke
 
> 1) Euphoria can call a function only if the function is 
> inside a DLL. It doesn't help because the DLL cannot call the 
> application.

Untrue.  We use callbacks all the time.

> 3) LUA is especially constructed for this job (I decided I 
> would not use LUA because the interfacing isn't that easy (a 
> couple of days to figure it out?) and the application is not 
> in C++ either (so the C-code had to be wrapped up in an 
> ActiveX/VCL component... and the application becomes 0.5 MB heavier?).

I still haven't really looked at Lua, but it's definitely possible if Lua
comes in an ActiveX flavor.  One of my long term goals has been to port Eu
to ActiveX to allow it to be used as a scripting language in IIS.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

3. RE: Euphoria as an extension language

Except - duh - this won't work (except for returning atoms) as separate 
processes have separate memory spaces.  Serves me right for having an 
opinion on a Monday morning - always a bad idea...

However, could you use DDE...?

Phil


Phil Russell wrote:
> Hi All
> 
> Could you not use a message interface in Windows to pass variables? e.g.
> 
> - C program invokes Eu program
> - Eu program sends custom message(s) to C program to get variables
> e.g. var = SendMessage( hCProgram, UM_GET_VAR, var_id, 0 )
> - C program returns variable value or pointer to struct etc.
> 
> This seems equivalent to calling functions in the parent program to 
> me...
> 
> Phil
> 
> Derek Parnell wrote:
> > This would work well in Windows, and would get rid of all that silly 
> > console screens popping up and 
> > down.
> > 
> > 18/11/2002 4:54:57 PM, dm31 at uow.edu.au wrote:
> > 
> > >
> > >|1) Main program writes out the values of the variables required to a
> > >disk file.
> > >|2) Either it creates the script code at runtime or uses a pre-built
> > >script.
> > >|3) Runs a new instance of ex.exe using the script program. You could
> > >include the names of the input-
> > >|output files on the command line too.
> > >|4) Starts waiting for the results to be signalled.
> > >|5) The script reads in the stored values from the disk file.
> > >|6) The script does it stuff.
> > >|7) The script writes out the values to another disk file.
> > >|8) The main program (that has been patiently waiting for the new disk
> > >file to be written), loads 
> > >|back in the updated variable values.
> > >|9) And the show goes on, etc...
> > >
> > >You could even have the main program allocate memory for the vars,
> > >have these addresses in the disk file, that way the script program
> > >could use those instead of writing another file with the results.
> > >
> > >
> > >
> > ---------
> > Cheers,
> > Derek Parnell 
> > ICQ# 7647806
> > 
> >

new topic     » goto parent     » topic index » view message » categorize

4. RE: Euphoria as an extension language

Hi All,

Could you not implement the variable passing as message calls? e.g.

- eu script invoked by c++ / delphi program
- eu script sends user-defined msg to program

Derek Parnell wrote:
> This would work well in Windows, and would get rid of all that silly 
> console screens popping up and 
> down.
> 
> 18/11/2002 4:54:57 PM, dm31 at uow.edu.au wrote:
> 
> >
> >|1) Main program writes out the values of the variables required to a
> >disk file.
> >|2) Either it creates the script code at runtime or uses a pre-built
> >script.
> >|3) Runs a new instance of ex.exe using the script program. You could
> >include the names of the input-
> >|output files on the command line too.
> >|4) Starts waiting for the results to be signalled.
> >|5) The script reads in the stored values from the disk file.
> >|6) The script does it stuff.
> >|7) The script writes out the values to another disk file.
> >|8) The main program (that has been patiently waiting for the new disk
> >file to be written), loads 
> >|back in the updated variable values.
> >|9) And the show goes on, etc...
> >
> >You could even have the main program allocate memory for the vars,
> >have these addresses in the disk file, that way the script program
> >could use those instead of writing another file with the results.
> >
> >
> >
> ---------
> Cheers,
> Derek Parnell 
> ICQ# 7647806
> 
>

new topic     » goto parent     » topic index » view message » categorize

5. RE: Euphoria as an extension language

This is a multipart message in MIME format

--27286227-POCO-51627530

<HTML><HEAD>
</HEAD>
<BODY>
<div>&nbsp;</div>
<FONT FACE=3D"Arial" SIZE=3D3> </FONT><div><FONT FACE=3D"Arial" SIZE=3D3>=
 Phil Russell wrote:</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> &gt;Hi=
 All,</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080">=
 &gt;</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> &gt;Could you not=
 implement the variable passing as message calls?=
 e.g.</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080">=
 &gt;</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> &gt;- eu script=
 invoked by c++ / delphi program</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> &gt;- eu script=
 sends user-defined msg to program</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3> =A0</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> While working on=
 a debugger for Bach, I settled on anonymous pipes for=
 inter-process communication, because of their simplicity and=
 because they are implemented on both windows and=
 linux.</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3> =A0</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> I have attached=
 the (windows) demo code for those who are=
 interested.</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> A few=
 points:</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> 1) Should be fast=
 (in-memory)</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> 2) The pipes can=
 be passed to the child as STDIN and STDOUT, or as separate=
 handles (as here).</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> 3) Either the=
 parent or child can be translated easily to C.</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> 4) Written for=
 Bach but should translate to EU easily. (only minor features of=
 Bach used).</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3> =A0</FONT></div>
<div><FONT FACE=3D"Arial" SIZE=3D3 COLOR=3D"#000080"> Karl=
 Bochert</FONT></div>

--27286227-POCO-51627530
Content-Type: application/x-zip-compressed; name="Pipes.zip"

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu