2014-03-26

Build TclVfs on openSUSE 13.1

TclVfs


下載  tclvfs-20080503.tar.gz 來 build,結果 fail.

經過 Google 以及研究以後,要去 Source Forge 裡 CVS 目前的 code base (web-based CVS repository viewer) 去下載最新的 vfs.c,這樣就可以修正升到 Tcl 8.6 以後 build fail 的問題。


更新:
我發現我做了一件笨事情,其實按 Download GNU tarball 下載最新的 code 就好了。

2014-03-22

Tclqrencode v0.1

連結網址:
Tclqrencode


使用 libqrencode 這個函式庫提供的功能,可以用來造出 QR code file.

下面是一個使用的例子:
#!/usr/bin/tclsh

package require tclqrencode

qrencode::setsize  5
qrencode::setforeground  000000
qrencode::setbackground  ff8fff

qrencode::encode http://tcl-eval.blogspot.tw/ tcl-eval.png

結果:


2014/03/22更新:
qrspec.c and mqrspec.c 使用了 pthread,我改寫成 Tcl 所提供的 thread function.

2014-03-21

tcltest

Tcler's Wiki: tcltest
Getting started with tcltest

 
The tcltest package provides the user with utility tools for writing and running tests in the Tcl test suite. It can also be used to create a customized test harness for an extension.


所以一些 extension 下 tests 目錄裡的檔案,應該都是使用 tcltest 來進行測試的相關檔案。我記錄一下相關的連結。

2014-03-19

Tcllib/TKlib RPM spec @ openSUSE

Source code 裡的 RPM spec (tcllib.spec, tklib.spec),大致上的問題都一樣:

Copyright: BSD

改成:

License: BSD


然後如果要安裝附帶的 application,在 -pkg-path 之前加上一列:

    -app-path $RPM_BUILD_ROOT/usr/bin \


再來因為是 openSUSE,所以 library 的路徑要指向 /usr/share/tcl:

    -pkg-path $RPM_BUILD_ROOT/usr/lib/%{name}-%{version}\

改成:

-pkg-path $RPM_BUILD_ROOT/usr/share/tcl/%{name}-%{version}\

改完了以後,使用 rpmbuild 就可以造出來 RPM。

( * 如果是從網站下載,tcllib 的版本仍然是 1.15,需要自己改為 1.16)

(*  我用 rpm -e 移除以後,檔案還在 目錄還在,檔案則被移除了,苦笑中。)

RPM spec for Tcltaglib 0.1

我的測試環境是 openSUSE 13.1 (64 bit),所以安裝的目錄要特別設定,要放到 /usr/lib64/tcl,我放了一個 tcltaglib_SUSE.spec 到原始檔裡,應該可以用

 rpmbuild -bb tcltaglib_SUSE.spec 

來造出 rpm 檔。


檔案的內容:

%{!?directory:%define directory /usr}

%define buildroot %{_tmppath}/%{name}

Name:          tcltaglib
Summary:       Tcl interface for tablib
Version:       0.1
Release:       1
License:       BSD
Group:         Development/Libraries/Tcl
Source:        https://sites.google.com/site/ray2501/tcltaglib/tcltaglib_0.1.zip
URL:           https://sites.google.com/site/ray2501/tcltaglib 
Buildrequires: libtag1 tcl >= 8.1
BuildRoot:     %{buildroot}

%description
Tcl interface for taglib (Abstract API only).

%prep
%setup -q -n %{name}

%build
CFLAGS="%optflags" ./configure \
    --prefix=%{directory} \
    --exec-prefix=%{directory} \
    --libdir=%{directory}/%{_lib}
make 

%install
make DESTDIR=%{buildroot} pkglibdir=%{directory}/%{_lib}/tcl/%{name}%{version} install

%clean
rm -rf %buildroot

%files
%defattr(-,root,root)
%{directory}/%{_lib}/tcl

2014-03-15

Tcltaglib v0.1

Tcl interface for taglib (Abstract API only).

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



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

2014-03-14

Tclusb v0.3

沒什麼改進,只是我發現 tclusb.h 不用公開,所以從 configure.in 中的 TEA_ADD_HEADERS macro 移除。


網頁連結:
Tclusb


20140315 更新:
Update Windows rc file 
Remove tests folder 

2014-03-09

Tclusb v0.2

增加 USB hotplug 的 command:
usb::hotplug


主要是參考其它的 package 以後,使用 channel 實作 USB hotplug function,但是我不確定這樣做是不是好的做法。不過這樣的實作下可以使用 fileevent 來 detect event,所以當有 event 發生的時候,libusb callback function 就會通知 Channel 現在可以讀取了,然後傳回的是一個 handle 和 arrive or left event 的字串。

然後實作寫入 handle string,就會從 hash table 移除相關 entry 的功能(我會加 sleep 是因為有時候寫入的 function 在處理 hash table entry 時會發生 segmentation fault,加入 sleep 可以大幅度的降低發生頻律)。


Link:
Tclusb

2014-03-06

Tclusb v0.1

Tclusb


雖然我是寫 "The Tclusb extension provides an interface for libusb library.",不過實際上我實作的 Tcl command 大約只夠寫 USB listdevs 這類的程式。

用來學習 Tcl extension 怎麼加入外部的函式庫連結和一些 Tcl C function 的呼叫。也許對某些人有用,所以我把 source code 放一份到我自己的網站上,授權我選 BSD license.

2014-03-02

UDP and IPv6

來自於 comp.lang.tcl 的資料:

A new version 1.0.10 of tcludp is available with IPv6 support added. To obtain the snapshot and windows binaries, please read the following (bottom page):
http://wiki.tcl.tk/8493