''Source code is now at http://www.equi4.com/critlib/ - [JCW]'' * Version 0.18 now runs on Linux and Windows (MinGW) * As of 0.22, you can store the binaries generated in a specific directory with a more meaningful name * source is now up to 0.28 (2001-Nov-21) (See also Richard Suchenwirth's [C code generators] page.) ---- The '''C Runtime In Tcl''' is a self-contained package to build C code into an extension on the fly. It is somewhat inspired by Brian Ingerson's Inline for Perl, but Critcl is considerably more lightweight. [[While [Python] also has an Inline [http://pyinline.sourceforge.net/], it apparently has no direct genetic connection to Critcl.] The idea is to wrap C code into something that will compile into a Tcl extension, and then also fire up the compiler. Compiled chunks will be cached in your ~/.critcl/ directory, so subsequent use will be instant. ---- '''Critcl Wiki Resources''': [Critcl] [[to be more closely integrated]] [Critcl FAQ] [Critcl Discussion] [Critcl Code] [Critcl Examples] ---- '''Using Critcl''': The main definition is "critcl::cproc", which lets you define a (surprise) C proc, with C code as body. Args and return values must be typed. There are no default args or ways to pass more sophisticated data items than int/long/float/double/char* for now. There is also a "critcl::ccode" call, to inject C code as is, and a "ccommand" call, which ties code to the Tcl_CreateObjCommand without further wrapping. The use of Tcl stubs, and the fact that this extension has all include files it needs to make compilation self-contained, means that this is a pure Tcl package, which should work with any (8.1 and up) installation of Tcl. Most importantly, Critcl does not care a bit where Tcl was installed, nor even whether it was built as a static or as a dynamic executable. This is a working demo, but it is still young. It will for now blindly use "gcc" to do the compile and has somewhat rudimentary error handling. Critcl has been verified to work on Linux and Win NT4 (MinGW) so far. Oh, one more thing: this code assumes the md5 command is available. There's a new [CritLib] package with several extensions (blowfish, hexdump, ihash, lazy, lzrw1, md5c, mvector, noop, rchan, zlib) - see http://www.equi4.com/critlib/ More news on newer rev's of Critcl, or rather the "CritLib" where it is included: * There's a '''critcl::config''' to specify things like: '''outdir''' - putting all compiled extensions in a fixed dir, using a normal (non-MD5-ized name), and '''keepsrc''' - do not delete the generated intermediate C source code * There's a '''critbind''' script which takes one or more Critcl packages, and turns them into a single deliverable: either a loadable extension, or a static lib (for linking later), or an application. The latter is usually called a "custom tclsh", it can be built either as small main linked to Tcl dynamically, or as bigger exe with all of Tcl linked in statically [JCW] ---- '''Critcl Articles''': Conference paper by Steve Landers and Jean-Claude Wippler is at [http://www.digital-smarties.com/Tcl2002/critcl.pdf] (PDF) and [http://www.equi4.com/papers/ctpaper1.html] (HTML online), with slides from [JCW]'s presentation at [http://www.equi4.com/docs/vancouver/pres2.htm]. A dated article [http://www.itworld.com/AppDev/710/swol-0818-regex/] has background information on interpreted C. ---- [AK]: [Larry Virden] provided this pointer: http://www.purl.org/NET/Tcl-FAQ/part4.html What: Embedded C (EC) Where: ftp://ftp.reed.edu/pub/users/greaber/ec-0.1.tar.gz Description: Allows you to include C code in your Tcl scripts, compiling and dynamically loading it on the fly. The code will also be cached so the next time you run the program, you don't wait for it to compile. Known to work on DEC OSF/1 V3.2 and SunOS 5.5. Not yet ported to Macintosh or Windows. Updated: 09/1996 Contact: mailto:greaber@reed.edu (Grant Reaber) ---- [[ [Category Package] | [Category Critcl] ]]