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>

這樣就可以編譯成功了。

2014-09-28

Komodo Edit

Komodo Edit (維基百科)


Powerful free editor for Python, PHP, Perl, Ruby, Tcl, Javascript and other major web languages.


上一次我試著使用的時候(在一開始很久很久以前),Tcl Syntax 的部份需要另外安裝,不過目前的版本已經直接支援了。


下載點:
Download Komodo Edit

2014-09-09

Build tDom 0.8.3 on Windows x86 platform, using MinGW/MSYS

沒有特別需要設定的,只是要注意下列這點:

如果是 Tcl/Tk 8.6.x 系列的,需要使用 GitHub 上的 source code,直接下載 tDom 0.8.3 的 source code package 可能會編譯失敗。

2014-08-31

Build TclX 8.4.1 on Windows x86 platform, using MinGW/MSYS

編譯的環境為 Windows XP SP3 32bit,編譯器為 MinGW/MSYS。

使用 configure 的時候,因為沒有 random/srandom function,使用下列的方式定義:
CPPFLAGS="-Drandom=rand -Dsrandom=srand" ./configure --enable-threads --with-tcl=/opt/tcl/lib


造出 Makefile 以後,需要進行一些修改:
找到 PKG_OBJECTS,然後移除 random.o (不然會編譯錯誤)
random/srandom function 不是標準的 C standard function,所以 TclX 會預設有一個 random.c 要編譯,但是我使用了在 CPPFLAGS 定義的方式,所以移除 random.o,這是不需要的(總不能造一個空的給 GCC 吧,雖然應該也可以)。

再來修改 win\tclXwinPort.h,將 random 的定義修改如下(由 long 改為 int):
extern int    random(void);

再來 TclX 就可以編譯成功了。


執行 make test,會在 profile.test crash 掉,如果移掉 profile.test 不測試,下面是進行 test 以後的結果:
all.tcl:        Total   1481    Passed  1447    Skipped 23      Failed  11

2014-08-23

透過 WMI 取得目前 BIOS 的版本資料 (on WIndows platform)

使用 TWAPI 透過 WMI 取得目前 BIOS 的版本資料,下面是一個測試的 sample code:
package require twapi_wmi
package require twapi_process
namespace path twapi

set wmi [comobj_object winmgmts:root/cimv2]
set wql {SELECT * FROM Win32_BIOS}
set BIOS [$wmi ExecQuery $wql]

$BIOS -iterate bios_info {    
    puts -nonewline "Description: "
    set DescriptionVal [$bios_info -with {Properties_ {Item Description}} Value]          
    puts $DescriptionVal
    
    puts -nonewline "BIOS Manufacturer: "
    set ManufacturerVal [$bios_info -with {Properties_ {Item Manufacturer}} Value]          
    puts $ManufacturerVal
    
    puts -nonewline "Name: "
    set NameVal [$bios_info -with {Properties_ {Item Name}} Value]          
    puts $NameVal        
    
    puts -nonewline "SMBIOSBIOSVersion: "
    set SMBIOSBIOSVersionVal [$bios_info -with {Properties_ {Item SMBIOSBIOSVersion}} Value]          
    puts $SMBIOSBIOSVersionVal
    
    puts -nonewline "Version: "
    set VersionVal [$bios_info -with {Properties_ {Item Version}} Value]          
    puts $VersionVal        

    $bios_info -destroy
}

$BIOS -destroy
$wmi -destroy

2014-08-04

Tclqrencode v0.2

更新了libqrencode 的 code base,所以版本升為 v0.2。 


連結網址:
Tclqrencode


我只有使用 Tclqrencode v0.1 這篇文章的範例進行測試,希望不會有什麼問題。