1. Rob, Gurus, Question for You...

Got this email from somebody browsing the FAQ:

"I'm bioinformatics programmer and prefer Python or to a lesser extent
Perl because I have to deliver fast. But I'm a bit disappointed by the
speed of those, especially Python. Now I'm planning to program a lot of
this in Euphoria (and maybe event start a bioEuphoria project similar
to bioPython or bioPerl).

What I want to do is integrating fast Euphoria code into Python code.
I know I can translate Euphoria to C and do it that via C-compiler. But
is there another way?"

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: Rob, Gurus, Question for You...

On Thu, 03 Feb 2005 10:13:16 -0800, cklester <guest at rapideuphoria.com> wrote:
> 
> Got this email from somebody browsing the FAQ:
> 
> "I'm bioinformatics programmer and prefer Python or to a lesser extent
> Perl because I have to deliver fast. But I'm a bit disappointed by the
> speed of those, especially Python. Now I'm planning to program a lot of
> this in Euphoria (and maybe event start a bioEuphoria project similar
> to bioPython or bioPerl).
> 
> What I want to do is integrating fast Euphoria code into Python code.
> I know I can translate Euphoria to C and do it that via C-compiler. But
> is there another way?"

I'm stumped. Unless, you create a shared-memory lib with a Euphoria
and a Python version, and pass things back-and-forth with that. Sounds
like a bit of work though...

-- 
MrTrick

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

3. Re: Rob, Gurus, Question for You...

Patrick Barnes wrote:
> On Thu, 03 Feb 2005 10:13:16 -0800, cklester <guest at rapideuphoria.com>
> wrote:
> > 
> > "I'm bioinformatics programmer and prefer Python or to a lesser extent
> > Perl because I have to deliver fast. But I'm a bit disappointed by the
> > speed of those, especially Python. Now I'm planning to program a lot of
> > this in Euphoria (and maybe event start a bioEuphoria project similar
> > to bioPython or bioPerl).
> > 
> > What I want to do is integrating fast Euphoria code into Python code.
> > I know I can translate Euphoria to C and do it that via C-compiler. But
> > is there another way?"
> 
> I'm stumped. Unless, you create a shared-memory lib with a Euphoria
> and a Python version, and pass things back-and-forth with that. Sounds
> like a bit of work though...

I wonder if creating a dll with Euphoria code would work...?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

4. Re: Rob, Gurus, Question for You...

cklester wrote:
> I wonder if creating a dll with Euphoria code would work...?

You can call Windows .dll's and (Linux/FreeBSD) shared libraries
written in Euphoria, from other languages. The only problem is
that you are limited to passing integers (31-bit) as arguments,
assuming you need to pass any arguments. An advantage is that
the Euphoria code should be even faster (than interpreted Euphoria)
once it's translated/compiled into a .dll.

Also, I'm sure Python and Perl have the equivalent of the
Euphoria system() or system_exec() for running programs written
in other languages.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

5. Re: Rob, Gurus, Question for You...

Robert Craig wrote:
> 
> cklester wrote:
> > I wonder if creating a dll with Euphoria code would work...?
> 
> You can call Windows .dll's and (Linux/FreeBSD) shared libraries
> written in Euphoria, from other languages. The only problem is
> that you are limited to passing integers (31-bit) as arguments,

Can you explain the reason behind this?

If this really can't be avoided, then one could use structs to 
pass other kinds of data? But the addresses may not fit in 31
bits?


-- Another Euphoric, since Nov. 18, 2004 --

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

6. Re: Rob, Gurus, Question for You...

Georg Wrede wrote:
> 
> Robert Craig wrote:
> > 
> > cklester wrote:
> > > I wonder if creating a dll with Euphoria code would work...?
> > 
> > You can call Windows .dll's and (Linux/FreeBSD) shared libraries
> > written in Euphoria, from other languages. The only problem is
> > that you are limited to passing integers (31-bit) as arguments,
> 
> Can you explain the reason behind this?
> 
> If this really can't be avoided, then one could use structs to 
> pass other kinds of data? But the addresses may not fit in 31
> bits?

The only bit patterns that Euphoria and the rest of the world
agree on, are the integers from minus one billion (roughly),
to plus one billion. Other values cannot be passed directly from
another language to a Euphoria-coded .dll (or shared library) 
as arguments.
(A Euphoria program can pass *any* Euphoria values, atoms or
complex sequences, to a Euphoria .dll)

Of course, if you manage to pass a pointer to a block of memory, 
you can store any values you want in that block,
and have your Euphoria program peek() the values according to 
any pre-arranged format that you've decided on. But when you pass 
that initial pointer from another language, make sure it only 
needs 31 bits, or else pass it as say two 16-bit values to be 
combined by the .dll routine into a proper 32-bit (atom) pointer 
that Euphoria can use for peek/poke.
(If you know the pointer must be aligned on say a 4-byte boundary,
you could pass it shifted down 2 bits, and solve the problem that way.
C's malloc() always returns aligned pointers.)

This was discussed many months ago as I recall.
You might dig up some more ideas on this by searching.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

7. Re: Rob, Gurus, Question for You...

There is numerous ways to do that.
One is to run the euphoria program from the python as a child process and share
the environment, so information can be exchanged using environment variable. 
Simple an good for small data volume.
another way is using DDE (Dynamic data exchange).
To name other methods:  shared files, pipes, mailslot, ...

regards,
Jacques D.

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

8. Re: Rob, Gurus, Question for You...

Robert Craig wrote:
> 
> Georg Wrede wrote:
> > 
> > Robert Craig wrote:
> > > 
> > > cklester wrote:
> > > > I wonder if creating a dll with Euphoria code would work...?
> > > 
> > > You can call Windows .dll's and (Linux/FreeBSD) shared libraries
> > > written in Euphoria, from other languages. The only problem is
> > > that you are limited to passing integers (31-bit) as arguments,
> > 
> > Can you explain the reason behind this?
> > 
> > If this really can't be avoided, then one could use structs to 
> > pass other kinds of data? But the addresses may not fit in 31
> > bits?
> 
> The only bit patterns that Euphoria and the rest of the world
> agree on, are the integers from minus one billion (roughly),
> to plus one billion. Other values cannot be passed directly from
> another language to a Euphoria-coded .dll (or shared library) 
> as arguments.

Why is that? I've seen many dll's that do accept pointers, and thus can 
accept full 32-bit integers. Why cannot euphoria dll's accept those values?

Regards, Alexander Toresson

Assembly. Push 'till you pop.

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

9. Re: Rob, Gurus, Question for You...

Robert Craig wrote:
> 
> cklester wrote:
> > I wonder if creating a dll with Euphoria code would work...?
> 
> You can call Windows .dll's and (Linux/FreeBSD) shared libraries
> written in Euphoria, from other languages. The only problem is
> that you are limited to passing integers (31-bit) as arguments,
> assuming you need to pass any arguments. 

I figured out a way around this.  I'll dig up the code and post it later.

Matt Lewis

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

10. Re: Rob, Gurus, Question for You...

Matt Lewis wrote:

> Robert Craig wrote:
>>
>> cklester wrote:
>>> I wonder if creating a dll with Euphoria code would work...?
>>
>> You can call Windows .dll's and (Linux/FreeBSD) shared libraries
>> written in Euphoria, from other languages. The only problem is
>> that you are limited to passing integers (31-bit) as arguments,
>> assuming you need to pass any arguments.
>
> I figured out a way around this.  I'll dig up the code and post it later.

You are making me curious ... blink
Improved abilities to communicate with the rest of the "programming
world" would IMHO be important for Euphoria!

Regards,
   Juergen

-- 
Have you read a good program lately?

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

Search



Quick Links

User menu

Not signed in.

Misc Menu