1. RE: Question about includes

> From: George Henry
 
> >I'm writting
> >a win32lib program and want
> >to make part of the menus and then
> >the rest based on text files.
> ...
> >One of the menus is a song list which
> >the users can edit. It takes alot of code
> >and I also have other menus that can be edited.

<snip>
 
> ...need to 
> essentially embed a Euphoria interpreter into my program - 
> which I submit, is insanity.

Maybe...but this is exactly what I (and some others) have requested in the
form of a DLL...

> I very earnestly believe there is an imperative need to allow 
> limited user programming via unshrouded, unbound Euphoria 
> source files, to be included with an otherwise shrouded and 
> bound program. I realize this would be non-trivial to 
> implement, however it should be manageable provided that 
> shroud and bind are told which entities (variables and 
> routines) the user code will be allowed to access. The 
> specified identifiers, of course, could not be shrouded. 
> ("Variable and routine names are converted into short 
> meaningless names" - with specified exceptions, I propose.)

I believe that this is currently possible (shrouded, but unbound), although
I've not done much with shrouded code.

> Euphoria's syntax is sufficiently simple that it is not 
> unreasonable to expect users, with a little guidance and 
> documentation, to be able to assign values to variables and 
> make simple routine calls; perhaps even to write simple 
> routines and "install" them via facilities provided for the 
> purpose. (I mean, facilities that the originators of large 
> and complex programs would provide to the users.)

I absolutely agree.  A 'Euphoria for Applications', a la VBA, if you will.
I'm currently working on a project that does exactly this.

> Don't want your users cobbling up code using Notepad or their 
> other text editor of choice? (Hmm, this COULD be a way of 
> initiating zillions of new users into the Joys of Euphoria. 
> When they see how EASY and SIMPLE it is to write limited 
> snippets of code, they might become interested in learning 
> more....) Fine and dandy, and I prolly agree with you, 
> although I think it would be unbearably cool and *involving* 
> to at least let them read and (believe they) understand bits 
> of the code that controls the program they're using - without 
> revealing any vital secrets about the guts, of course.
> 
> So let the users do their "programming" via dialogs or 
> whatever cool "visual programming system" you want to set up, 
> then have your program write the desired code, to be 
> interpreted the next time the program is invoked - or perhaps 
> even more immediately, using the chaining facility ("program 
> overlays") that Mike Sabal previously suggested.

Right now I'm using David Cuny's (with some other contributors over the
years) Euphoria emulator (this is pre-Py) with some hacks to make it a
scripting engine.  I've taken out all the low level (peek/poke, etc) and I/O
(print, get, etc) routines, and added some things that enable the user
written code to interface with the main program.

I haven't worked with Ox at all, but has anyone tried converting the output
to a scripting engine?  And has anyone written an Eu clone (minus the Py
enhancements)?  I store all the code, along with other stuff that goes along
with the code, in an EDS database, where I can load on demand.  I've even
added a debug feature to my 'editor', so the user can get instant feedback.
I'll be ready for a real release in a few weeks, but I could send it
privately or post what I have on my web page if anyone's interested...

Matt Lewis

____________________________________________________________
T O P I C A  -- Learn More. Surf Less. 
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01

new topic     » topic index » view message » categorize

2. RE: Question about includes

On 29 Jan 2001, at 12:41, Matthew Lewis wrote:

<snip>

> Right now I'm using David Cuny's (with some other contributors over the
> years) Euphoria emulator (this is pre-Py) with some hacks to make it a
> scripting engine.  I've taken out all the low level (peek/poke, etc) and I/O
> (print, get, etc) routines, and added some things that enable the user
> written code to interface with the main program.

I was looking at David's Eu about 3am today too. It would be a way to get a goto
as
well. You realise that if we had the ability to execute variables, this wouldn't
be a
problem?

> I haven't worked with Ox at all, but has anyone tried converting the output
> to a scripting engine?  And has anyone written an Eu clone (minus the Py
> enhancements)?  I store all the code, along with other stuff that goes along
> with the code, in an EDS database, where I can load on demand.  I've even
> added a debug feature to my 'editor', so the user can get instant feedback.
> I'll be ready for a real release in a few weeks, but I could send it
> privately or post what I have on my web page if anyone's interested...

I am interested in how you get David's Eu to interact with the main program's
variables.

Kat

____________________________________________________________
T O P I C A  -- Learn More. Surf Less. 
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01

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

3. RE: Question about includes

> From: Kat

<SNIP>
 
> I was looking at David's Eu about 3am today too. It would be 
> a way to get a goto as 
> well. You realise that if we had the ability to execute 
> variables, this wouldn't be a 
> problem?

Yes and no.  As my code works, if there is an error in the script code
executed by Eu, the program doesn't crash, but I can return an error from
the script and keep running.

<SNIP>
 
> I am interested in how you get David's Eu to interact with 
> the main program's variables.

Basically, I set up new 'built-in' routines to be called from within the
script.  

I have a couple of functions that allow me to pass the subscripts as
sequences/integers (mostly borrowed from some stuff Jiri posted a while
ago):

function seq_fetch(object a, sequence b)

    for i = 1 to length(b) do

        a = a[b[i]]

    end for

    return a
end function

function seq_store(object a, object b, object c)
    integer len

    len = length(c)
    if len > 1 then
        -- recursively go into the sequence
        return seq_store(a, b[c[1]], c[2..len] )
    end if

    -- get the index
    c = c[1]

    if c then
        b[c] = a
    else
        b = a
    end if

    return b
end function

Then, to modify sequence x:

function get_x( object a )
	return seq_fetch( x, a )
end function

procedure set_x( object a, object b, object c )
	x = seq_store( a, b, c)
end procedure

Then, in the sequence 'builtin', add these elements:

{ "get_x",          FUNC,   1,  routine_id("get_x") }
{ "set_x",          PROC,   3,  routine_id("set_x") }

This scheme probably won't allow the kind of dynamic stuff you're after,
Kat, at least without doing some major restructuring of your code.  In
another part of this project, I've created an internal heap (just an a-list
of var's and values) to allow me to pass things by reference.  You could do
something like this, and it should work.

There were lots of other things I had to change (no support for includes,
since all the code is fed by a proc call) to get everything to work, but I'm
pretty happy with the results.

Matt Lewis

____________________________________________________________
T O P I C A  -- Learn More. Surf Less. 
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01

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

4. RE: Question about includes

On Mon, 29 Jan 2001 13:51:03 Kat wrote:
.. [skipping to item of particular interest] ...

>I am interested in how you get David's Eu to interact with the main program's
>variables.

Me too. It's worthless for my purposes unless it does that. Let me also add,
"... and routines."

George


Get your small business started at Lycos Small Business at
http://www.lycos.com/business/mail.html

____________________________________________________________
T O P I C A  -- Learn More. Surf Less. 
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01

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

Search



Quick Links

User menu

Not signed in.

Misc Menu