2020-05-26

tcl-crc32c v0.1

tcl-crc32c: Tcl bindings for crc32c library.

只是一個練習,因為我太久沒用 C 寫 Tcl extension,剛好 Tcl 沒有這方面的實作,所以寫了一個 Tcl bindings。

PS.
crc32c 我有做一個 openSUSE RPM spec,用來產生 crc32c library 相關的檔案。

2020-05-10

Tcl: List Rotation

#!/usr/bin/tclsh
#
# Given a length-n list like (a b c d e), the rotations of the list are
# the n lists (a b c d e), (b c d e a), (c d e a b), (d e a b c), and (e a b c d), 
# in any order.
#
if {$argc == 0} {
    puts "Please input a string"
    exit
}

set len [llength $argv]
set rorateList $argv
for {set index 0} {$index < $len} {incr index} {
    puts $rorateList
    set first [lindex $rorateList 0]
    set rorateList2 [lrange $rorateList 1 [expr $len - 1]]
    lappend rorateList2 $first
    set rorateList $rorateList2
}

使用 lindex 取得頭以後,中間部份使用 lrange 取得,然後再排列出來。

2020-05-09

tcl.mqttc v0.7

我發現 paho.mqtt.c 有一個新的版本 1.3.2,所以我做了 tcl.mqttc 相關的更新,同時將版本設成 v0.7。

不過我只有簡單的測試 tcp 部份,使用 ActiveMQ 測試 MQTT 3.1 未加密的傳送與接收。