1. Dynamic/Conditional Includes

I just submitted my simple dynamic/conditional include library for Euphoria v2.5
and beyond or prior.

Anyway, it should appear in the archive pretty soon. Make sure everyone reads
the docs before trying anything as the library can cause a nasty system crash if
used improperly.

Enjoy!


Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

new topic     » topic index » view message » categorize

2. Re: Dynamic/Conditional Includes

Vincent wrote:

> I just submitted my simple dynamic/conditional include library for
> Euphoria v2.5 and beyond or prior.

<snip>

In the 'Readme.txt' file it reads:
"Since the release of Euphoria v2.5, most Euphorians deemed
dynamic/conditional inclusion impossible, ..."

This is not quite right. It has been discussed here even before Eu 2.5
was released, and Rob had confirmed that it's possible a long time ago.

Regards,
   Juergen

-- 
Have you read a good program lately?

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

3. Re: Dynamic/Conditional Includes

Juergen Luethje wrote:
> 
> Vincent wrote:
> 
> > I just submitted my simple dynamic/conditional include library for
> > Euphoria v2.5 and beyond or prior.
> 
> <snip>
> 
> In the 'Readme.txt' file it reads:
> "Since the release of Euphoria v2.5, most Euphorians deemed
> dynamic/conditional inclusion impossible, ..."
> 
> This is not quite right. It has been discussed here even before Eu 2.5
> was released, and Rob had confirmed that it's possible a long time ago.
> 
> Regards,
>    Juergen
> 
> -- 
> Have you read a good program lately?
> 
> 

Oh really? tongue. Well I must of not read this post. But regardless, this is the
only dynamic/conditional include library available that works for Euphoria 2.5
(well at least that I could find).

Expect and update very soon though. I really want to improve the algrothmn, so
that it wont cause a crash when used incorrectly. I'm thinking I'll make it keep
track of the files it dynamically includes & deletes, and block the library from
trying to include the same files again and again (which causes the problem). This
will increase the overall overhead a little, but will hopefully make it safer to
use.

I'll change a few lines in Readme.txt, and do some quality spell checking too!
:P Hehe


Thanks,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

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

4. Re: Dynamic/Conditional Includes

Vincent wrote:

<snip>

> Expect and update very soon though. I really want to improve the
> algrothmn, so that it wont cause a crash when used incorrectly. I'm
> thinking I'll make it keep track of the files it dynamically includes
> & deletes, and block the library from trying to include the same files
> again and again (which causes the problem). This will increase the
> overall overhead a little, but will hopefully make it safer to use.

Have you tried to use system() instead of system_exec() in
'dyn_include.e'? When I currently call dynamic_include() n times,
I end up with n copies of my program in memory ...

> I'll change a few lines in Readme.txt, and do some quality spell
> checking too! :P Hehe

Yep, you really shouldn't give the impression that you discovered the
possibility of dynamic includes in Eu 2.5.

Regards,
   Juergen

-- 
Have you read a good program lately?

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

5. Re: Dynamic/Conditional Includes

Vincent wrote:
> 
> I just submitted my simple dynamic/conditional include library for Euphoria
> v2.5
> and beyond or prior.
> 
> Anyway, it should appear in the archive pretty soon. Make sure everyone reads
> the docs before trying anything as the library can cause a nasty system crash
> if used improperly.
> 
> Enjoy!
> 
> 
> Regards,
> Vincent
> 
> ----------------------------------------------
> 
>  	                 .``.
> 		         ',,'
> 
> 
Vincent:
   How is this any different than the other dynamic include
programs that are in the archive ?

Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.exw

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

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

6. Re: Dynamic/Conditional Includes

Juergen Luethje wrote:
> 
> Have you tried to use system() instead of system_exec() in
> 'dyn_include.e'? When I currently call dynamic_include() n times,
> I end up with n copies of my program in memory ...
> 

Thanks, thats fixed now:
if platform() = 1 or platform() = 3 then
    system(cmdLine[1] & " " & current, 0)
else
    system("start " & cmdLine[1] & " " & current, 0)
end if

I'm working on improving the library so its much more forgiving to use. It
should be done pretty soon.

> 
> Regards,
>    Juergen


Regards,
Vincent

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

7. Re: Dynamic/Conditional Includes

Bernie Ryan wrote:
> 
> How is this any different than the other dynamic include
> programs that are in the archive ?
> 

Hi Bernie,

Well there is only two or three other libraries in the archive, but zero of them
work with Euphoria 2.5 and above. My library is still being improved, and just
fixed a major issue today. It should be completed within a day or two.

With Euphoria 2.5 and above, there seems to be only one way to achieve an
dynamic/conditional inclusion system, and my library will be using it properly
when finished. So competing against my library with your own would be rather
pointless.


> Bernie
> 


Regards,
Vincent

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

8. Re: Dynamic/Conditional Includes

Vincent wrote:
> 
> Bernie Ryan wrote:
> > 
> > How is this any different than the other dynamic include
> > programs that are in the archive ?
> > 
> 
> Hi Bernie,
> 
> Well there is only two or three other libraries in the archive, but zero of
> them
> work with Euphoria 2.5 and above. My library is still being improved, and just
> fixed a major issue today. It should be completed within a day or two.
> 
> With Euphoria 2.5 and above, there seems to be only one way to achieve an
> dynamic/conditional
> inclusion system, and my library will be using it properly when finished. So
> competing
> against my library with your own would be rather pointless.
> 
> 
> > Bernie
> > 
> 
> Regards,
> Vincent
> 

Hi there Vincent,

I tried your dynamic include program and liked it, but found one small
detail i needed.  That is, if i close the current program out via the
upper 'x' to close the window, the 'includes.e' doesnt get cleared for
the next run.  I've updated my files to make this work better and present
the solution files here, but you're welcome to look for an easier way...



-- file: dyn_include.e
-- written by: Vincent Howell
-- date: 10/8/05
-- mods by Al Getz, 10/10/2005
-- for use with Euphoria v2.5 or higher
-----------------------------------------

--added GUID to keep track of when includes.e needs to be cleared:
constant DI_GUID="{1209C51A-E822-42CE-9BE2-1A9CD320CE74}"
sequence CmdLine
CmdLine=command_line()

global procedure clear_includes()
    integer fn
    fn = open("includes.e", "w")
    close(fn)
end procedure


if length(CmdLine)>2 then
  if equal(CmdLine[3],DI_GUID) then
    --startup was with system_exec so clear includes for next run:
    clear_includes()
  end if
end if


global procedure dynamic_include(sequence file, sequence current)
  integer fn

  machine_proc(54, 0) -- free_console
  fn = open("includes.e", "a")
  for i = 1 to length(file) do
    puts(fn, "include \"" & file[i] & "\"\n")
  end for
  close(fn)
  fn = system_exec(CmdLine[1] & " " & current & " "& DI_GUID, 0)
end procedure

--end_of_file----------------------------------------------------------------




-- next file: Example.exw
-- written by: Vincent Howell
-- date: 10/8/05
-- mods by Al Getz, 10/10/2005
-- run with Euphoria 2.5 or higher only
------------------------------------------

include "dyn_include.e"
include "includes.e"


constant MainFileName = "Example.exw"

sequence word

puts(1, "Type \"real\" or \"REAL\" to see what OS you are using, or type \"fun\"
or \"FUN\"\n" &
"to see something lame; Type anything else to terminate the
        program.\n\n")

procedure real()
    if platform() = 1 then
      dynamic_include({"File1.e"}, MainFileName)
    elsif platform() = 2 then
      dynamic_include({"File2.e"}, MainFileName)
    else
      dynamic_include({"File3.e"}, MainFileName)
    end if
end procedure

procedure fun()
    dynamic_include({
      "File1.e",
      "File2.e",
      "File3.e",
      "File4.e"
    }, MainFileName)
end procedure

while 1 do
    word = gets(0)
    word = word[1..length(word)-1]

    if equal(word, "fun") or equal(word, "FUN") then
      fun()
      exit
    elsif equal(word, "real") or equal(word, "REAL") then
      real()
      exit
    else
      abort(0)
    end if
end while

--end_of_file-----------------------------------------------------------



Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

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

9. Re: Dynamic/Conditional Includes

Al Getz wrote:
> 
> Vincent wrote:
> > 
> > Bernie Ryan wrote:
> > > 
> > > How is this any different than the other dynamic include
> > > programs that are in the archive ?
> > > 
> > 
> > Hi Bernie,
> > 
> > Well there is only two or three other libraries in the archive, but zero of
> > them
> > work with Euphoria 2.5 and above. My library is still being improved, and
> > just
> > fixed a major issue today. It should be completed within a day or two.
> > 
> > With Euphoria 2.5 and above, there seems to be only one way to achieve an
> > dynamic/conditional
> > inclusion system, and my library will be using it properly when finished. So
> > competing
> > against my library with your own would be rather pointless.
> > 
> > 
> > > Bernie
> > > 
> > 
> > Regards,
> > Vincent
> > 
> 
> Hi there Vincent,
> 
> I tried your dynamic include program and liked it, but found one small
> detail i needed.  That is, if i close the current program out via the
> upper 'x' to close the window, the 'includes.e' doesnt get cleared for
> the next run.  I've updated my files to make this work better and present
> the solution files here, but you're welcome to look for an easier way...
> 
> Take care,
> Al
> 
> And, good luck with your Euphoria programming!
> 
> My bumper sticker: "I brake for LED's"
> 

Hi Al,

Sorry for the late reply, I've been busy with college and havent had much free
time until today.

I dont wish to add anything special that the library couldnt use on all
platforms, but please feel free to add it again to your copy after I release the
new version!

The library is far more advanced internally now: scanning & preventing files
names from being used multiple times in includes.e, scanning routine parameters
to check for multiple uses, etc. The library no longer poses a threat to
lock/crash your computer, and you are now free to use dynamic_include() AND
clean_includes() top-level, in routines, conditional statements, loops...
anywhere with out locking/crashing problems.

I'm currently doing testing to make sure it works correctly on multiple versions
of Windows and DOS; others can test it on Linux and FreeBSD.
I'm also going to be testing it on multiple versions of Euphoria, prior to 2.5.
My plan is to get it work on all Euphoria supported OSes and Euphoria versions
2.0 and up (especially 2.5 and later).

I hope to release it by tommorow, but if I run into problems it might be delayed
a bit longer. Like all my "stuff", everything has to be perfect or I'm just not
going to be satisfied! smile


Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

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

10. Dynamic/Conditional Includes

Hi Euphorians,

I updated my dynamic/conditional include library, it is an significant
improvement over the first release. It should be completely safe to use, the new
duplicate file scanning system works great.

Unfortuantly I ran into trouble getting it to work on Euphoria 2.2 and older.
But it great on Euphoria 2.3 and newer, especially Euphoria 2.5 and later.

In order to call & use routines from dynamically included source files, you need
to use the dynamic call routines: routine_id(), call_proc(), and call_func()
[example included]. Because official Euphoria doesnt support dynamic variable
routines, you may have to write dummy functions whos sole purpose is to return
the value of variables or constants so that the main application or library can
retrieve or change the their values(an exception may be if you were using OOEU,
VEEU, or EG modified Euphoria interpreters, that have dynamic variable routines:
variable_id(), read_var(), write_var(), etc.). But that isnt really something to
be upset about, as you would have to use dynamic calls to routines anyway. smile


Enjoy,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

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

11. Re: Dynamic/Conditional Includes

Vincent wrote:
> 

If you use my library with your Windows or Linux/FreeBSD GUI apps and often
close the programs with the upper "X", you may want to consider writing a small
program to delete "includes.e" contents.

include dynamic.e

clear_includes()
-- end


Then run the program after each use. You can also manually delete the data in
"includes.e". This only applies to GUI programs you close with the "X" titlebar
button.

I may consider Al Getz's solution on using some value to keep track of the
window events, but only if someone can present me with a simple solution for
Linux and/or FreeBSD too... perhaps GUI apps created with euGTK+ or wxEuphoria.


Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

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

12. Re: Dynamic/Conditional Includes

Vincent wrote:
> 
> Vincent wrote:
> > 
> 
> If you use my library with your Windows or Linux/FreeBSD GUI apps and often
> close the programs with the upper "X", you may want to consider writing a
> small
> program to delete "includes.e" contents.
> 
> }}}
<eucode>
> include dynamic.e
> 
> clear_includes()
> -- end
> </eucode>
{{{

> 
> Then run the program after each use. You can also manually delete the data in
> "includes.e". This only applies to GUI programs you close with the "X"
> titlebar
> button.
> 
> I may consider Al Getz's solution on using some value to keep track of the
> window
> events, but only if someone can present me with a simple solution for Linux
> and/or FreeBSD too... perhaps GUI apps created with euGTK+ or wxEuphoria.

Actually I think the solution Al provided me is only useful for the DOS prompt
window? I should spend sometime learning Win32Lib and wxEuphoria + euGTK.


BTW, I have a C/C++ structure, union, array, data type library coming soon! 
I basically modifed Chris Bensler's and Jason Mirwald's latest C/C++ interfacing
library: structs.e to work without Chris's old & dead Empire foundation package
for Euphoria; I cleaned up their code as well.
I'm currently just finishing up updating the HTM documention for it, then will
release it, and may write an example program or two.


Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

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

Search



Quick Links

User menu

Not signed in.

Misc Menu