Salvatore Sanfilippo

"antirez" on the chat


https://web.archive.org/web/20171020012127/www.invece.org/antirez3s.jpg

[L1 ] [L2 ] [L3 ] (no longer access to this second personal site!)

I'm here because I like Tcl! :)

Other languages I like are: C, Scheme, SmallTalk, FORTH, Joy.

I'm the author of The Jim Interpreter. A small footprint implementation of the Tcl programming languages with more support for functional programming and other differences. You can find more information about Jim in the Jim page of this wiki or in the Jim home page at http://jim.tcl.tk/

Tclwise

I'm writing a book about Tcl programming. Many chapters are online for free, you can find it at http://www.invece.org/tclwise/ .

Random Stuff

Picol
Category Platform Issues
Genetic Programming
Advantages of Tcl over Lisp
parsing expressions
cfile
object based file I/O for Tcl.
Tcl IRCd
a little IRC server I wrote in Tcl
Odys Object System
regmap
may be more secure (against malicious user input) and clean than the usual regsub+subst way, at least some time. Please tell me if something like this is already in some well known library.
Syncronized timer
Functions As Values
A different design for Tcl-like languages, with first-class functions:
let2
A let for Tcl: (the let wiki page was already used).
Tcl References in Tcl
(updated version, and C implementation under development)
A Joy implementation in Tcl
A Joy stackless/tailrecursive compiler/VM written in Tcl:
lsplit
is a useful command ripped from the Joy programming language.
Tcl_Obj types list
Alists for Tcl
TclRef
eDonkey
etprof
Sugar
ptparser
Arity corner cases in math commands
about TIP 174 , Math Operators as Commands
Gimp Client
Range
Permutations
bindlife
Tip187 in pure Tcl
hping3
set operations for Tcl lists

Tk code to handle the keyboard in a raw mode. Useful for games or to control real hardware. Uses a trick, don't know if it will work in future or past version of Tcl.

namespace eval RawKeys {}
set ::RawKeys::Flag 0
set ::RawKeys::LastEvent {-1 0 -1}
set ::RawKeys::Delay 50

proc ::RawKeys::Init {userPressHandler userReleaseHandler} {
    bind . <KeyPress> [list ::RawKeys::pressHandler %k $userPressHandler]
    bind . <KeyRelease> [list ::RawKeys::releaseHandler %k $userReleaseHandler]
} 

proc ::RawKeys::pressHandler {keycode userHandler} {
    variable LastEvent
    variable Delay
    variable Flag
    set Flag 1
    set deliver 1
    if {[lindex $LastEvent 0] == $keycode && \
        ([clock clicks -milliseconds] - [lindex $LastEvent 2]) < $Delay} {
        set deliver 0
    }
    set LastEvent [list $keycode 1 [clock clicks -milliseconds]]
    if {$deliver} {
        $userHandler $keycode
    }
}   

proc ::RawKeys::releaseHandler {keycode userHandler} {
    variable LastEvent
    variable Delay
    variable Flag
    set deliver 1
    set Flag 0
    set LastEvent [list $keycode 0 [clock clicks -milliseconds]]
    update
    if {$Flag} {
        set deliver 0
    }
    if {$deliver} {
        $userHandler $keycode
    }
}    

#################################### Example ################################### 

catch {console show}
puts "Enter the blank window and press/release random keys" 

array set ::pressed {}

proc press keycode {
    set ::pressed($keycode) {}
    puts "=== pressed $keycode! === ([lsort [array names ::pressed]])"
} 

proc release keycode {
    catch {unset ::pressed($keycode)}
    puts "=== release $keycode! === ([lsort [array names ::pressed]])"
}

::RawKeys::Init press release