1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Plugins for Lua and Idle

Discussion in 'Support' started by thomasl, Jul 3, 2008.

  1. thomasl

    Joined:
    Jun 10, 2008
    Messages:
    35
    Likes Received:
    0
    I've updated the 4NT/TCC plugins for Lua and for Idle to version 0.1.

    These new stable builds of lua4nt and idle4nt correct a few shortcomings
    of the previous version. They now:

    * support Ctrl-C/Ctrl-Break to terminate a running script

    * fully support command-line redirection for stdin, stdout and stderr

    * include further small changes

    Download addresses as given below.

    --- from the post for the previous version ---

    idle4nt is a ~200 KB plugin dll for 4NT/TCC which includes the Idle
    interpreter and the complete the runtime (for details about the language
    and the runtime library please see
    http://idle.thomaslauer.com ).

    This version is much faster on startup than the standalone Idle
    interpreter: a simple script, executed 100 times in batch file, takes
    about 0.1 sec whereas the standalone version needs 6.8 sec.

    A zip file with the dll and the source code can be downloaded here:
    http://thomaslauer.com/download/idle4nt01.zip

    I have also produced a similar plugin for the script language Lua (Idle
    is based on Lua, see http://lua.org ):
    http://thomaslauer.com/download/lua4nt01.zip

    The Lua version is based on the current 5.1.3 release of Lua.

    The source code for both versions is in the public domain.

    --
    cheers thomasl

    web: http://thomaslauer.com/start
     
  2. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,177
    Likes Received:
    11
    This is the first I've tried your plugin. It's pretty slick. I created an
    environment variable executable extension to run the idle scripts
    automatically.

    set .idle=`iidle <%1`

    So, given your 2 example scripts, I need only type test1 or utest1 at the
    command prompt to run them.

    Is there any facility within Idle to access TCC's internal variables or
    functions? How about TCC's environment variables?

    -Scott

    thomasl <> wrote on 07/03/2008 05:47:18 AM:


     
  3. thomasl

    Joined:
    Jun 10, 2008
    Messages:
    35
    Likes Received:
    0
    samintz <> wrote:

    iidle interprets the first argument given as the script file to execute,
    so simply setting 'set .idle=iidle' works just as well and is slightly
    more efficient (further arguments are handed to the script).


    Within Idle (and the Idle plugin) you can access environment variables
    as usual by querying 'os.ENV.*' (see the Idle runtime library docs,
    module os):

    iidle > print(os.ENV.USERNAME) -- query
    thomasl
    iidle > os.ENV.USERNAME='some other user' -- set

    Adding code to access TCC's internal variables doesn't make sense for
    Idle itself because Idle is a standalone app.

    However, given that I am using the plugin myself more often than
    standalone Idle these days, I may well add something along these lines
    to the plugin.

    --
    cheers thomasl

    web: http://thomaslauer.com/start
     
  4. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,177
    Likes Received:
    11
    thomasl <> wrote on 07/03/2008 12:16:52 PM:


    It's my understanding that the advantage of the built-in support for Perl
    is the access to 4NT variables. Plus the faster load times. So, Idle
    would benefit here as well.

    Since Idle can call C routines, it should be possible to call the
    TakeCmd.DLL interfaces from the scripting language, right? How would I do
    that (besides RTFM)?

    -Scott
     
  5. thomasl

    Joined:
    Jun 10, 2008
    Messages:
    35
    Likes Received:
    0
    samintz <> wrote:

    Sure. Adding this feature is not a matter of if but when. The next
    release will have support for 4NT/TCC internal variables and functions.
    (In fact, I already have a version that does that but there are further
    tests and a few things to clear up in the pipeline.)


    Well, there's already the function idle4nt.command() which allows the
    Idle plugin to call any of the *_Cmd functions:

    iidle > idle4nt.command('Dir_Cmd','*.idle')

    Further TakeCmd APIs can be integrated either at that level (which means
    that I would have to add some interface code to the plugin itself -- not
    difficult in itself but there are dozens of APIs).

    Or you could use Idle's os.getDynLink() and friends -- this allows you
    to call any DLL function in any DLL (though it's not the most
    straightforward API ever invented, so you'd have to do some RTFM, I am
    afraid).

    I will add some sort of documentation for the next release.

    --
    cheers thomasl

    web: http://thomaslauer.com/start
     

Share This Page