Updated 2011-07-05 21:56:22 by steveb

The following is a list of extensions available for Jim. Note that all the extensions are shipped directly with the core, so you will find they inside the Jim tar.gz ready to be compiled.

News on this page:

  • 18Apr2004: new event loop extension. Already present ANSI I/O extension is now complete. An UDP extension is work in progress.

Event loop

Provides vwait and after commands, togheter with the C-level API for time/file event registering.

Status: mostly complete, need some refinement. There is a work in progress UDP extension that's the first C-level API user of the event system and is serving as a tester for the event loop library. Also the win32 port is high-priority.

Platforms: only POSIX, win32 port is a work in progress.

Ansi I/O

Goal: Pure ANSI/C file I/O capabilities, mainly useful for embedded systems or if you plan to use Jim in context where only an ANSI/C compiler may be assumed (for example to replace autoconf/automake with a Jim script).

Status: This extension is now complete.

Platforms: tested under POSIX systems and win32.

Sqlite

Goal: To provide sqlite bindings. This extension exports a command-based interface to access the database (Tk alike), supports format-alike auto escape of special chars in queries, returns rows as lists of dicts so you in Jim it is possible to access row elements like this:
    . set res [$db query "SELECT * from tbl1"]
    {one hello! two 10} {one goodbye two 20}
    . foreach row $res {puts "One: $row(one), Two: $row(two)"}
    One: hello!, Two: 10
    One: goodbye, Two: 20

The subcommands supported are close, query, lastid, changes. It is possible to specify what string to use to represent SQL NULL.

Status: This lib is complete.

Platforms: tested under POSIX, should work under win32 without problems.

SDL

Goal: To provide SDL bindings for 2D graphics.

Status: this library is experimental, but some GLX primitive are supported. This is an example script:
 package require sdl

 set xres 200
 set yres 200
 set s [sdl.screen $xres $yres]

 set i 0
 while 1 {
     set x1 [rand $xres]
     set y1 [rand $yres]
     set x2 [rand $xres]
     set y2 [rand $yres]
     set rad [rand 40]
     set r [rand 256]
     set g [rand 256]
     set b [rand 256]
     $s fcircle $x1 $y1 $rad $r $g $b 100
     incr i
     if {$i > 2000} {$s flip}
     if {$i == 3000} exit
 }

That's the result:

Platforms: only tested under Linux, works for sure under other POSIX systems, and should under win32.

Posix

Goal: bindings for POSIX system calls.

Status: currently just some basic command is supported, but there are a few that can be useful like fork.

This is a list of supported commands:
 . package require posix
 1.0
 . info commands os*
 os.sethostname os.fork os.gethostname os.getids os.sleep

Platforms: POSIX only

Win32

Goal: bindings to the WIN32 API.

Status: a lot of calls are missing, being WIN32 very big, but there are already many interesting things available. There is just to hack a bit more but this extension is a good start. Commands currently supported:
 . info commands win32.*
 win32.GetVersion win32.GetModuleFileName win32.GetUserName win32.GetActiveWindow win32.GetCursor win32.FreeLibrary
 win32.SetCursor win32.LoadLibrary win32.GetCursorPos  win32.GetCursorInfo win32.ShellExecute
 win32.GetComputerName win32.GetModuleHandle win32.SetCursorPos win32.CloseWindow win32.GetSystemTime win32.GetTickCount
 win32.SetActiveWindow win32.Beep win32.FindWindow win32.CreateWindow win32.SetForegroundWindow win32.SetComputerName
 win32.LoadCursor

Platforms: WIN32 only

Win32 COM

Goal: to provide Windows COM access from Jim.

Status: this is a work in progress, but it should already be able to do some real work. More later.

Platforms: WIN32 only.

abu - 2011-06-28 07:58:01

ABU Is there a guideline for converting existing tcl-extensions to jim-extensions ? I'm wondering about tclblend...

steveb There is no guide as such, but if you are familiar with the Tcl C API you should be able to make good progress by using the other extensions as a starting point. But does tclblend make sense as an extension? Wouldn't you want to simply create an interpreter and provide access to the Jim C API via Java?

abu - 2011-07-05 05:17:54

I just need the tcl --> java side provided by tclblend My main programming language is tcl, and I just wish to call java-libraries from tcl. I'm not interested in java --> tcl integration.

Why I need jim --> java ? Well, I'm quite satisfied with tcl, but its oo-extensions (snit, tcloo, ...) lack of garbage collection, and this is a big obstacle for the development of large, always running, oo-systems.

Jim and Jim Object System (JOS) seem very interesting - they have a strong foundation on GC. Therefore Jim + JOS + tclblend could be the basis for developing large oo-systems integrated with java-libraries.

steveb I see. That makes sense. Yes, a java extension for Jim which provides access to the Java VM seems quite doable. Ask on the Jim mailing list if you have any specific questions.