2015-01-29

TclOO Past Present Future

TclOO Past Present Future - Tcl Community Association


在網路上找到的關於 TclOO 的簡報,簡介了 TclOO 的來由以及發展。

2015-01-26

FreeWrap 6.64 released

在 com.lang.tcl 上看到訊息:
ANNOUNCE: FreeWrap 6.64 released


Tcl/Tk 版本已更新到 8.6.3,Tcllib 更新到 v1.16。下面是更新的內容:
 
Changes implemented in version 6.64
------------------------------

  1. FreeWrap 6.64 is based on TCL/TK 8.6.3
  2. The 64-bit Windows version has tcllib1.16 included (instead of tcllib1.15).
  3. FreeWrap 6.64 now returns the correct time stamp for a file contained within a wrapped application or within a ZIP archive.
  4. The following additional ttk themes are now installed into freeWrap.
    - aquablue
    - aquativo
    - black
    - blue
    - clearlooks
    - keramik
    - keramik_alt
    - plastik
    - radiance
    - winxpblue

2015-01-24

tdbc::sqlite3 test script

只是測試用的 script。

#!/usr/bin/tclsh

package require tdbc::sqlite3
tdbc::sqlite3::connection create db "sample.db" 


set statement [db prepare {drop table if exists person}]
$statement execute
$statement close

set statement [db prepare {create table person (id integer, name varchar(40))}]
$statement execute
$statement close

set statement [db prepare {insert into person values(1, 'leo')}]
$statement execute
$statement close

set statement [db prepare {insert into person values(2, 'yui')}]
$statement execute
$statement close

set statement [db prepare {SELECT * FROM person}]

$statement foreach row {
    puts [dict get $row id]
    puts [dict get $row name]
}

$statement close
db close

2015-01-18

SQLite extension

Tcl 的 source package 已經有內建 SQLite,放置在 pkgs 的目錄裡。


如果要自己編譯一份最新的 (使用 MinGW/MSYS),我目前的做法是這樣:

首先去 SQLite 的下載網頁,下載 C source code as an amalgamation. Also includes a "configure" script and TEA makefiles for the TCL Interface. 這一個檔案。以目前的版本為例,就是 sqlite-autoconf-3080800.tar.gz。

再來是建好一個 SQLite 的目錄,以目前的版本為例,就是 sqlite3.8.8。

解壓縮從 SQLite 下載網頁下載的檔案以後,可以看到裡面有一個 tea 目錄,將 tea 目錄下的全部檔案都複製到剛好建立的 sqlite3.8.8 下,然後將 sqlite3.c 複製到 sqlite3.8.8 下的 generic 目錄。

接下來就使用

./configure
make
make install

就可以了。

2014-12-27

Get the exact version ot Tcl

記錄一下,如何得到 Tcl 目前的版本號。(可以參考 Get the version of TCL from the command-line?)


使用下列的 command:
info patchlevel

2014-12-07

Tclgumbo v0.1

Gumbo

Gumbo is an implementation of the [HTML5 parsing algorithm] implemented as a pure C99 library with no outside dependencies. It's designed to serve as a building block for other tools and libraries such as linters, validators, templating languages, and refactoring and analysis tools.
Goals and features:
* Fully conformant with the [HTML5 spec].
* Robust and resilient to bad input.
* Simple API that can be easily wrapped by other languages.
* Support for source locations and pointers back to the original text.
* Relatively lightweight, with no outside dependencies.
* Passes all [html5lib-0.95 tests].
* Tested on over 2.5 billion pages from Google's index.

Download Gumbo from:
https://github.com/google/gumbo-parser
 

Tclgumbo commands and variables

Tclgumbo is Gumbo Tcl bindings.

Implement commands:
gumbo::parse
gumbo::destroy_output
gumbo::output_get_root
gumbo::node_get_type
gumbo::element_get_tag_name
gumbo::element_get_children
gumbo::text_get_text
gumbo::element_get_attributes
gumbo::element_get_tag_open
gumbo::element_get_tag_close

Add variables:
gumbo::GUMBO_NODE_DOCUMENT
gumbo::GUMBO_NODE_ELEMENT
gumbo::GUMBO_NODE_TEXT
gumbo::GUMBO_NODE_CDATA
gumbo::GUMBO_NODE_COMMENT
gumbo::GUMBO_NODE_WHITESPACE

Installation

Installation (Linux/GCC):
cd tclgumbo
./configure
make
make install

Installation (Winodws/MSYS/MinGW):
cd tclgumbo
./configure
make
make install

Installation (Winodws/Visual Studio):
VS does not support C std99. I don't know how to use VS to build this package.


網站:
Tclgumbo

這是我自我練習的程式。我使用 tests 下的 tclgumbo.test 進行基本功能的測試。因為只有很簡單的測試,所以我不確定有沒有沒改好的部份,不過按照 GumboPHP 的說明文件,我已經把我會實作的部份都做完了。

Tcltaglib v0.2

Tcl interface for taglib (Abstract API only).

實作 taglib C binding 的 Tcl command 對映。 測試的 script 是 examples 下的 reader.tcl。


網頁位址:
https://sites.google.com/site/ray2501/tcltaglib 


更新:
整體的 source code 和 v0.1 相同,我只是清除了一些看起來錯誤的註解跟 label 錯誤的地方,然後我的 openSUSE 環境因為已經升到了 13.2,所以 RPM  是用 13.2 的環境製作的。

2014-12-02

Tcl-lzf: Tcl interface for LibLZF

LZF is an extremely fast (not that much slower than a pure memcpy) compression algorithm. It is ideal for applications where you want to save *some* space but not at the cost of speed. It is ideal for repetitive data as well. The module is self-contained and very small.

It's written in ISO-C with no external dependencies other than what C provides and can easily be #include'd into your code, no makefile changes or library builds requires.

LibLZF this library was written by Marc Lehmann (See also http://software.schmorp.de/pkg/liblzf).


This package (Tcl-lzf) provides a simple Tcl interface to the LibLZF Library.
Implement commands:
lzf::compress - accepts a string to compress.
lzf::decompress - accepts a string and a size in which the uncompressed result must fit.


網址:
Tcl-lzf

2014-11-01

TLS and Openssl - Static libraries (w32, mingw/msys)

首先是 OpenSSL,按照這篇的資訊,下載目前的版本 openssl-1.0.1j,然後使用下面的設定:

./Configure no-asm mingw --prefix=/c/OpenSSL

而在 test 的部份會有一些編譯失敗,我刪除掉以後繼續編譯,就可以成功編譯 OpenSSL。


再來是 TLS,source code 是從 CVS 下載最新的 tarball。configure 的命令我是這樣下:

./configure --with-tcl=/opt/tcl/lib --with-ssl-dir=/c/OpenSSL --with-gcclib

但是仍然需要修改 Makefile。找到 -lssleay32 -llibeay32,改成 -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32,這樣就可以編譯成功了。


但是這樣編譯出來的 tls DLL 會非常的大,不知道我是不是哪裡有做錯。

2014-10-07

Build TclVFS, using MinGW (on Windows platform)

去 Download GNU tarball 下載最新的 code,按照 configure/make 的方法做就可以了,只是需要做一點小修改。

generic\vfs.c,找到 tcl.h,針對 stat 的部份修改如下:

#define _USE_32BIT_TIME_T
#include <sys/stat.h>
#ifndef _stat32i64
# define _stat32i64 _stati64
#endif
#include <tcl.h>

這樣就可以編譯成功了。