#!/usr/bin/env tclsh
if {$argc >= 1} {
set countString [lindex $argv 0]
} elseif {$argc == 0} {
puts "Please input a string"
exit
}
package require md5
puts "String: $countString"
puts "Result: [md5::md5 -hex $countString]"
2020-03-09
Tcl: MD5
使用者在命令列輸入一個字串,然後程式計算字串 MD5 的值並且輸出:
2020-03-07
Tcl: file size
列出目前目錄的檔案與其檔案大小:
#!/usr/bin/env tclsh
foreach filename [glob -nocomplain -type f *] {
puts "$filename: [file size $filename] bytes"
}
2020-03-03
tcl-lmdb v0.4.1
檔案放置網頁
tcl-lmdb - Tcl interface to the Lightning Memory-Mapped DatabaseAbout
This is the Lightning Memory-Mapped Database (LMDB) extension for Tcl using the Tcl Extension Architecture (TEA).LMDB is a Btree-based database management library with an API similar to BerkeleyDB. The library is thread-aware and supports concurrent read/write access from multiple processes and threads. The DB structure is multi-versioned, and data pages use a copy-on-write strategy, which also provides resistance to corruption and eliminates the need for any recovery procedures. The database is exposed in a memory map, requiring no page cache layer of its own. This extension provides an easy to use interface for accessing LMDB database files from Tcl.
Main Change
- Update LMDB source code.
- Makefile.in: Remove workaround for glibc.
這是一個 checkpoint 版本,只是建立 tag 追蹤從上一個版本以來的變化。tcl-lmdb 本身是沒有變動的,只有在 Makefile.in 移除關於 glibc 的 workaround,以及更新 LMDB 的 source code。
2020-02-17
tklib 0.7
tklib 釋出了一個新的正式版 v0.7。
Overview
========
5 new packages in 5 modules
11 changed packages in 9 modules
2 internally changed packages in 1 modules
47 unchanged packages in 19 modules
79 packages, total in 31 modules, total
New in tklib 0.7
================
Module Package New Version Comments
--------------------- --------------------- ------------- ----------
canvas canvas::gradient 0.2
notifywindow notifywindow 1.0
persistentSelection persistentSelection 1.0b1
scrollutil scrollutil::common 1.5
widgetPlus widgetPlus 1.0b2
--------------------- --------------------- ------------- ----------
Changes from tklib 0.6 to 0.7
=============================
tklib 0.6 tklib 0.7
Module Package Old Version New Version Comments
--------------- -------------------- ------------- ------------- ----------------
controlwidget rdial 0.3 0.7 D EF EX
crosshair crosshair 1.1 1.2 B EF EX
datefield datefield 0.2 0.3 D EF
mentry mentry::common 3.6 3.10 B D EF I
plotchart Plotchart 2.1.0 2.4.1 B D EF I
--------------- -------------------- ------------- ------------- ----------------
tablelist tablelist::common 5.7 API B D EF I P
tablelist::common 6.8 API B D EF I P
--------------- -------------------- ------------- ------------- ----------------
tooltip tooltip 1.4.4 1.4.6 B D EF
--------------- -------------------- ------------- ------------- ----------------
wcb Wcb 3.4 3.6 B D EF I P
wcb 3.4 3.6 B D EF I P
--------------- -------------------- ------------- ------------- ----------------
widgetl widget::listentry 0.1.1 0.1.2 D I
widget::listsimple 0.1.1 0.1.2 D I
--------------- -------------------- ------------- ------------- ----------------
Invisible changes (documentation, testsuites)
=============================================
tklib 0.6 tklib 0.7
Module Package Old Version New Version Comments
--------------- --------------- ------------- ------------- ----------
controlwidget controlwidget 0.1 0.1 D
meter 1.0 1.0 EX
--------------- --------------- ------------- ------------- ----------
critcl 3.1.18
critcl
ChangeLog:
ChangeLog:
- Feature (Developer support). Merged pull request #96 from sebres/main-direct-invoke. Enables direct invokation of the "main.tcl" file for starkits from within a dev checkout, i.e. outside of a starkit, or starpack.
- Feature. Added channel types to the set of builtin argument and result types. The argument types are for simple channel access, access requiring unshared channels, and taking the channel fully into the C level, away from Tcl. The result type comes in variants for newly created channels, known channels, and to return taken channels back to Tcl. The first will register the returned value in the interpreter, the second assumes that it already is.
- Bugfix. Issue #96. Reworked the documentation around the argument type Tcl_Interp* to make its special status more visible, explain uses, and call it out from result types where its use will be necessary or at least useful.
- Feature. Package critcl::class bumped to version 1.1. Extended with the ability to create a C API for classes, and the ability to disable the generation of the Tcl API.
- Bugfix. Merged pull request #99 from pooryorick/master. Fixes to the target directory calculations done by the install code.
- Merged pull request #94 from andreas-kupries/documentation. A larger documentation cleanup. The main work was done by pooryorick, followed by tweaks done by myself.
- Extended the test suite with lots of cases based on the examples for the various generator packages. IOW the new test cases replicate/encapsulate the examples and demonstrate that the packages used by the examples generate working code.
- Bugfix. Issue #95. Changed the field critcl_bytes.s to unsigned char* to match Tcl's type. Further constified the field to make clear that read-only usage is the common case for it.
- Bugfix/Feature. Package critcl::cutil bumped to version 0.2. Fixed missing inclusion of header "string.h" in "critcl_alloc.h", needed for memcpy in macro STREP. Added macros ALLOC_PLUS and STRDUP. Moved documentation of STREP... macros into proper place (alloc section, not assert).
- Merged pull request #83 from apnadkarni/vc-fixes. Removed deprecated -Gs for MSVC builds, and other Windows fixups.
- Feature. Package critcl::iassoc bumped to version 1.1. Refactored internals to generate an include header for use by .c files. This now matches what other generator packages do. The template file is inlined and removed.
- Merged pull request #82 from gahr/home-symlink Modified tests to handle possibility of $HOME a symlink.
- Merged pull request #81 from gahr/test-not-installed Modified test support to find uninstalled critcl packages when running tests. Handles all but critcl::md5.
- Merged pull request #85 from snoe925/issue-84 to fix Issue #84 breaking installation on OSX.
- Merged pull request #87 from apnadkarni/tea-fixes to fix Issue #86, broken -tea option, generating an incomplete package.
- Feature. New package critcl::callback providing C-level functions and data structures to manage callbacks from C to Tcl.
- Feature. Package critcl::literals bumped to version 1.3. Added mode +list enabling the conversion of multiple literals into a list of their strings.
- Feature. Package critcl::enum bumped to version 1.1. Added basic mode handling, supporting tcl (default) and +list (extension enabling the conversion of multiple enum values into a list of their strings).
- Feature. Package critcl::emap bumped to version 1.2. Extended existing mode handling with +list extension enabling the conversion of multiple emap values into a list of their strings.
- Feature. Extended the set of available types by applying a few
range restrictions to the scalar types (int,
long, wideint, double, float).
Example: int > 0 is now a viable type name.
This is actually more limited than the description might let you believe.
See the package reference for the details.
2020-02-02
Guess the number
因為週末沒有外出,所以寫的練習小程式,猜測一個位於 1 - 1000 內的數字。
#!/usr/bin/env tclsh
proc rand_range {min max} {
return [expr int(rand()*($max-$min+1)) + $min]
}
set answer [rand_range 1 1000]
while {1} {
puts -nonewline "Please input a number to guess (1-1000): "
flush stdout
gets stdin guess
if {$guess == $answer} {
break;
} else {
if {$guess < $answer} {
puts "Please guess more higher"
} else {
puts "Please guess more lower"
}
}
}
2019-11-28
Tcl: Two Fer
Create a sentence of the form "One for X, one for me.".
#!/usr/bin/env tclsh
if {$argc >= 1} {
set name [lindex $argv 0]
} elseif {$argc == 0} {
set name "you"
}
puts "One for $name, one for me."
2019-11-17
Tcl: Group the strings to concatenate together
set s "Hello "
set t "Tcl"
set u "!"
puts $s$t$u
也可以先設到某個變數,再印出來:
set s "Hello "
set t "Tcl"
set u "!"
set str $s$t$u
puts $str
感覺還蠻有趣的。
2019-11-13
Twitter feed for news and Tcl
@TclLang - Twitter feed for news about happenings in the Tcl world.
我之前沒注意到,這是 Tclers's wiki 的官方帳號嗎?不是很確定。
我之前沒注意到,這是 Tclers's wiki 的官方帳號嗎?不是很確定。
2019-10-29
tablelist 6.7
ANNOUNCE: Multi-column listbox and tree widget package Tablelist 6.7
Tablelist 釋出了一個新版 6.7,所以我也更新了自己的 RPM spec 測試。
Tablelist 釋出了一個新版 6.7,所以我也更新了自己的 RPM spec 測試。
訂閱:
文章 (Atom)