1. Code Execution Problem
- Posted by idget3 at netzero.net
May 10, 2001
This is a multi-part message in MIME format.
------=_NextPart_000_0011_01C0D926.CB7C9CE0
charset="iso-8859-1"
Hello, my name is Trevor. I am a twelve year old programmer who isn't as =
good at it as you guys. I am trying to make a program that will open a =
saved file in win32lib.ew. It saves by just writing to a file using =
puts(). It writes setText(variable,text). When it opens, it reads the =
code, saves the code to a variable, then it's supposed to execute the =
code. But I don't know how to execute the code stored in the variable. =
Will someone please tell me how?
sequence FileTypes
FileTypes =3D{"Web Pager Files",".WP"}
=20
procedure onClick_MenuOpen()
=20
object temp
=20
integer handle
sequence fName, buffer
object data
=20
fName =3D getOpenFileName( mainwin, "", FileTypes )
=20
if length( fName ) =3D 0 then
return
end if
handle =3D open( fName, "r" )
buffer =3D {}
while 1 do
data =3D gets(handle)
if atom(data) then
exit
end if
=20
buffer =3D buffer & data
=20
end while
=20
close( handle )
=20
-- Problem: Execute code stored in "buffer"
=20
end procedure
onClick[ MenuOpen ] =3D routine_id( "onClick_MenuOpen" )
------=_NextPart_000_0011_01C0D926.CB7C9CE0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<DIV><FONT color=3D#000000 size=3D2>Hello, my name is Trevor. I am a =
twelve year old=20
programmer who isn't as good at it as you guys. I am trying to make a =
program=20
that will open a saved file in win32lib.ew. It saves by just writing to =
a file=20
using puts(). It writes setText(variable,text). When it opens, it reads =
the=20
code, saves the code to a variable, then it's supposed to execute the =
code. But=20
I don't know how to execute the code stored in the variable. Will =
someone please=20
tell me how?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=3D#000000=20
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>sequence FileTypes</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>FileTypes =3D{"Web Pager=20
Files",".WP"}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=3D#000000 size=3D2>procedure =
onClick_MenuOpen()</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>object temp</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2> =
<BR> =20
integer handle<BR> sequence fName,=20
buffer<BR> object=20
data<BR> </FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2> fName =3D =
getOpenFileName( mainwin,=20
"", FileTypes )<BR> <BR> =
if=20
length( fName ) =3D 0 then<BR> =
return<BR> end if</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT color=3D#000000=20
size=3D2><BR> handle =3D open( fName, "r"=20
)<BR> buffer =3D=20
{}<BR> while 1=20
do<BR> &=
nbsp; =20
data =3D gets(handle)<BR> if =
atom(data)=20
then<BR>  =
;=20
exit<BR> end if</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> <FONT color=3D#000000=20
size=3D2> =20
<BR> buffer =3D buffer &=20
data</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> end =
while</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> close( handle =
)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2><STRONG><FONT size=3D3><FONT =
color=3D#ff0000>--=20
Problem: Execute code stored in=20
"buffer"</FONT><BR></FONT></STRONG> <BR>end=20
procedure<BR>onClick[ MenuOpen ] =3D routine_id( =
"onClick_MenuOpen"=20
------=_NextPart_000_0011_01C0D926.CB7C9CE0--
NetZero Platinum
No Banner Ads and Unlimited Access
Sign Up Today - Only $9.95 per month!
http://www.netzero.net
2. Re: Code Execution Problem
It may be possible to take sequence.ew that comes with Matt Lewis's
EuDLL routines and Allyoop by Al Getz and create a self contained
runner.
Euman
----- Original Message -----
From: <Paul.Abbott at PSS.Boeing.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Code Execution Problem
>
>
> Is it possible to use the mini assembler and a function or var address to jump
to the code?
> The code in the var or function would have to return itself to be effective.
>
>
>
> -----Original Message-----
> From: sephiroth _ [mailto:euman2376 at yahoo.com]
> Sent: Thursday, May 10, 2001 8:51 AM
> To: EUforum
> Subject: RE: Code Execution Problem
>
>
>
> hey trevor! you can't execute euphoria code like that yet...what you
> need is a function like eval() in Perl, but Euphoria doesn't have
> that(hey robert, can you take a hint?)
>
>
>
>
>
>
3. Code Execution Problem
This didn't seem to make it either...
-----Original Message-----
From: Matthew Lewis
> -----Original Message-----
> From: sephiroth _ [mailto:euman2376 at yahoo.com]
> huh? if what you're thinking is to get the address of a string
> containing euphoria code and to execute it...BAHAHAHA!!!!!!! oh
> man...what a dumb idea. please tell me that's not what you're
> thinking.
That seems a little uncalled for. Besides, that's not really outside
the realm of possibility with the translator.
In any case, you could work up a scheme to do this in pure Euphoria.
You could create your own heap within a sequence/a-list and use
routine_id's. Then you parse the command and execute it. It's more
work, and it would be slower than using native variables, but that
doesn't mean it couldn't work. The extra flexibility could definitely
be worth it.
> Paul.Abbott at PSS.Boeing.com wrote:
> > Is it possible to use the mini assembler and a function or
> var address
> > to jump to the code?
> > The code in the var or function would have to return itself to be
> > effective.
Or you could just tweak Dave's Eu/Ox/Py to do this kind of stuff (I
believe it's called scripting:).
Matt Lewis
4. Re: Code Execution Problem
Hmmmm, I thought I remembered DOCGEN that was written by
Junko (RDS).
I think you can parse html and use <eu_code> to execute your program.
Im not entirely sure but you might get some ideas how to parse an html
and render the code.
Just another idea......
Euman
----- Original Message -----
From: "Euman" <euman at bellsouth.net>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, May 10, 2001 13:40
Subject: Re: Code Execution Problem
>
>
> It may be possible to take sequence.ew that comes with Matt Lewis's
> EuDLL routines and Allyoop by Al Getz and create a self contained
> runner.
>
> Euman
>
> ----- Original Message -----
> From: <Paul.Abbott at PSS.Boeing.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Thursday, May 10, 2001 11:08
> Subject: RE: Code Execution Problem
>
>
> >
> >
> > Is it possible to use the mini assembler and a function or var address to
jump
> to the code?
> > The code in the var or function would have to return itself to be effective.
> >
> >
> >
> > -----Original Message-----
> > From: sephiroth _ [mailto:euman2376 at yahoo.com]
> > Sent: Thursday, May 10, 2001 8:51 AM
> > To: EUforum
> > Subject: RE: Code Execution Problem
> >
> >
> >
> > hey trevor! you can't execute euphoria code like that yet...what you
> > need is a function like eval() in Perl, but Euphoria doesn't have
> > that(hey robert, can you take a hint?)
> >
> >
> >
> >
> >
> >
>
>
>
>
>
>
>
5. Re: Code Execution Problem
- Posted by jjnick at cvn.com
May 10, 2001
This is a multi-part message in MIME format.
------=_NextPart_000_002A_01C0D9B2.9EC9B840
charset="iso-8859-1"
Just a suggestion . . . I recommend using the API calls for =
input/output to files . . . Some combatibility issues with Win2000 . . =
. In theory, if you use API calls, you can be rest assured that your =
program won't break down the road, in theory of course . . .
----- Original Message -----=20
From: idget3 at netzero.net=20
To: EUforum=20
Sent: Thursday, May 10, 2001 7:57 AM
Subject: Code Execution Problem
as good at it as you guys. I am trying to make a program that will open =
a saved file in win32lib.ew. It saves by just writing to a file using =
puts(). It writes setText(variable,text). When it opens, it reads the =
code, saves the code to a variable, then it's supposed to execute the =
code. But I don't know how to execute the code stored in the variable. =
Will someone please tell me how?
sequence FileTypes
FileTypes =3D{"Web Pager Files",".WP"}
procedure onClick_MenuOpen()
object temp
=20
integer handle
sequence fName, buffer
object data
=20
fName =3D getOpenFileName( mainwin, "", FileTypes )
=20
if length( fName ) =3D 0 then
return
end if
handle =3D open( fName, "r" )
buffer =3D {}
while 1 do
data =3D gets(handle)
if atom(data) then
exit
end if
=20
buffer =3D buffer & data
end while
close( handle )
-- Problem: Execute code stored in "buffer"
=20
end procedure
onClick[ MenuOpen ] =3D routine_id( "onClick_MenuOpen" )
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
------=_NextPart_000_002A_01C0D9B2.9EC9B840
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3Diso-8859-1>
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Just a suggestion . . . I =
recommend using the=20
API calls for input/output to files . . . Some combatibility =
issues with=20
Win2000 . . . In theory, if you use API calls, you can be rest assured =
that your=20
program won't break down the road, in theory of course . . =
.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A title=3Didget3 at netzero.net=20
href=3D"mailto:idget3 at netzero.net">idget3 at netzero.net</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3DEUforum at topica.com=20
href=3D"mailto:EUforum at topica.com">EUforum</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Thursday, May 10, 2001 =
7:57=20
AM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Code Execution =
Problem</DIV>
<A =
writing=20
to a file using puts(). It writes setText(variable,text). When it =
opens, it=20
reads the code, saves the code to a variable, then it's supposed to =
execute=20
the code. But I don't know how to execute the code stored in the =
variable.=20
Will someone please tell me how?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=3D#000000 <DIV><FONT color=3D#000000 =
size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>sequence FileTypes</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>FileTypes =3D{"Web Pager=20
Files",".WP"}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=3D#000000 size=3D2>procedure =
onClick_MenuOpen()</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2>object temp</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2> =
<BR> =20
integer handle<BR> sequence fName,=20
buffer<BR> object=20
data<BR> </FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2> fName =3D =
getOpenFileName( mainwin,=20
"", FileTypes )<BR> <BR> if =
length( fName=20
) =3D 0 then<BR> =20
return<BR> end if</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT color=3D#000000=20
size=3D2><BR> handle =3D open( fName, "r"=20
)<BR> buffer =3D=20
{}<BR> while 1=20
=
do<BR> &=
nbsp; =20
data =3D gets(handle)<BR> if =
atom(data)=20
=
then<BR>  =
;=20
exit<BR> end if</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> <FONT color=3D#000000 =
size=3D2> =20
<BR> buffer =3D buffer & =
data</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> end =
while</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2> close( handle=20
)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT color=3D#000000 size=3D2><STRONG><FONT size=3D3><FONT =
color=3D#ff0000>--=20
Problem: Execute code stored in =
"buffer"</FONT><BR></FONT></STRONG> =20
<BR>end procedure<BR>onClick[ MenuOpen ] =3D routine_id( =
"onClick_MenuOpen"=20
Wanna Throw That PC Out the Window?
Not yet. First, check our technology forum for help.
<A =
href=3D"http://topica.com/u/?b1dd66.b2A1yr">http://topica.com/u/?b1dd66.b=
2A1yr</A>
Or send an email To: EUforum-unsubscribe at topica.com
This email was sent to: jjnick at cvn.com
<A =
------=_NextPart_000_002A_01C0D9B2.9EC9B840--