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 這篇文章的範例進行測試,希望不會有什麼問題。