0408 tcl/tk 学习 1
找找资料,看看一些东西:
Tcl简介 http://www.arm8.com/cv/3/4/139.html
TCL/TK 与 C 程序的集成 http://www.arm8.com/cv/3/4/138.html
Tcl与SWIG http://www.arm8.com/cv/3/4/137.html
Tcl的历史 http://www.arm8.com/cv/3/4/136.html
http://www.arm8.com/cv/3/4/141.html Tcl/Tk 烹调书 – Tcl/Tk 和 C
XConnectionNumber:On most UNIXish
implementations, you can use XConnectionNumber to get the file descriptor of
the X connection and then use select() or something similar on that.
if(getsockname(XConnectionNumber(display), &raddr, &t) != 0)
在调用这个过程的时候,画布组件的路径名作为 argv[1] 参数来传递。Tk_NameToWindow 返回在叫做"mainwin"的主窗口中的画布组件的记号。
使用这个 "win" 记号来把必要的连接标识符赋予给 PHIGS 的画布。
Tk_Display 接受一个 Tk_Window 记号作为参数并返回一个指针,它指向结构显示器 – 画布组件的 X 显示器。
Tk_WindowId 返回画布窗口的 X 标识符。
win = Tk_NameToWindow(interp, (char *)argv[1], (Tk_Window) mainwin);
dsp= Tk_Display(win);
winid = Tk_WindowId(win);
conn_id.display = dsp;
conn_id.drawable_id = winid;
Tk_MainWindow – find the main window for an application
SYNOPSIS
#include <tk.h>
Tk_Window
Tk_MainWindow(interp)
ARGUMENTS
Tcl_Interp *interp (in/out)
Interpreter associated with the application.
DESCRIPTION
If interp is associated with a Tk application then Tk_MainWindow returns the application\’s main window. If there is no Tk application associated with interp then Tk_MainWindow returns NULL and leaves an error message in interp->result.
Tk_Display returns a pointer to the Xlib display structure corresponding to tkwin. Tk_DisplayName returns an ASCII string identifying tkwin\’s display. Tk_ScreenNumber returns the index of tkwin\’s screen among all the screens of tkwin\’s display. Tk_Screen returns a pointer to the Xlib structure corresponding to tkwin\’s screen.
Tcl_DoOneEvent – wait for events and invoke event handlers
NAME
Tcl_DoOneEvent – wait for events and invoke event handlers
SYNOPSIS
#include <tcl.h>
int
Tcl_DoOneEvent(flags)
ARGUMENTS
int flags (in)
This parameter is normally zero. It may be an OR-ed combination of any of the following flag bits: TCL_WINDOW_EVENTS, TCL_FILE_EVENTS, TCL_TIMER_EVENTS, TCL_IDLE_EVENTS, TCL_ALL_EVENTS, or TCL_DONT_WAIT.
DESCRIPTION
This procedure is the entry point to Tcl\’s event loop; it is responsible for waiting for events and dispatching event handlers created with procedures such as Tk_CreateEventHandler, Tcl_CreateFileHandler, Tcl_CreateTimerHandler, and Tcl_DoWhenIdle. Tcl_DoOneEvent checks to see if events are already present on the Tcl event queue; if so, it calls the handler(s) for the first (oldest) event, removes it from the queue, and returns. If there are no events ready to be handled, then Tcl_DoOneEvent checks for new events from all possible sources. If any are found, it puts all of them on Tcl\’s event queue, calls handlers for the first event on the queue, and returns. If no events are found, Tcl_DoOneEvent checks for Tcl_DoWhenIdle callbacks; if any are found, it invokes all of them and returns. Finally, if no events or idle callbacks have been found, then Tcl_DoOneEvent sleeps until an event occurs; then it adds any ew events to the Tcl event queue, calls handlers for the first event, and returns. The normal return value is 1 to signify that some event was processed (see below for other alternatives).
要使非阻塞模式正常工作,应用必须使用 Tcl 事件循环(例如,通过调用 Tcl_DoOneEvent 或调用 vwait 命令)。 服务器通道不能被用来输入或输出;它们唯一的用处是接受新的客户连接。为每个到来的客户连接建立的通道是为输入和输出而打开的。关闭服务器通道将关断服务器,这样就不能接受新连接了,不影响现存的连接。
服务器套接口依赖于 Tcl 事件机制来找出何时打开了新连接。如果应用未进入事件循环,例如通过调用 vwait 命令或调用 C 过程 Tcl_DoOneEvent,则不接受连接。
历史博文
- 令人抓狂的silverlight3开发环境构建 - 2009
- 20071120 sql server 端口 1433 防火墙 ubuntu root sudo - 2008
- 20070330 winxp tcp/ip fix 修复 - 2007
- iwas20-clsusual.php - 2005