`
阿尔萨斯
  • 浏览: 4109744 次
社区版块
存档分类
最新评论

X Window研究笔记(21)

 
阅读更多
<iframe align="center" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog336280.html" frameborder="0" width="336" scrolling="no" height="280"></iframe>
X Window研究笔记(21)

转载时请注明出处和作者联系方式
作者联系方式:李先静 <xianjimli at hotmail dot com><br><br><font size="4" style="font-weight: bold;">21.X Window 字符串与Atom</font><br><br>Atom是X Window中的一大特色,不把它弄清楚,可能会对阅读其它代码形成障碍。X Window把常用的字串用一个hash表来管理,并给这些字符串赋与一个ID,客户端通过ID引用字符串,避免在客户端和服务器端之间来回传递这些它们,这样可以大大提高传输效率。另外Atom是一个整数,对整数的比较也比对字符串的比较有更快的速度。管理Atom的主要函数有:<br><br><div style="border: 0.5pt solid windowtext; padding: 4px 5.4pt; background: rgb(230, 230, 230) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 95%;"><div><font><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><span style="color: rgb(0, 0, 0);">Atom<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">MakeAtom(</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">,len,makeit)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">unsignedlen;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">Boolmakeit;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">NameForAtom(atom)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">Atomatom;<br><img align="top" onclick="this.style.display='none'; document.getElementById('_130_293_Open_Text').style.display='none'; document.getElementById('_130_293_Closed_Image').style.display='inline'; document.getElementById('_130_293_Closed_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" id="_130_293_Open_Image" alt=""><img align="top" onclick="this.style.display='none'; document.getElementById('_130_293_Closed_Text').style.display='none'; document.getElementById('_130_293_Open_Image').style.display='inline'; document.getElementById('_130_293_Open_Text').style.display='inline';" style="display: none;" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" id="_130_293_Closed_Image" alt=""></span><span style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;" id="_130_293_Closed_Text">...</span><span id="_130_293_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">NodePtrnode;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(atom</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">lastAtom)</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">((node</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">nodeTable[atom])</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">(NodePtr)NULL)</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">node</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">FreeAtom(NodePtrpatom)<br><img align="top" onclick="this.style.display='none'; document.getElementById('_338_537_Open_Text').style.display='none'; document.getElementById('_338_537_Closed_Image').style.display='inline'; document.getElementById('_338_537_Closed_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" id="_338_537_Open_Image" alt=""><img align="top" onclick="this.style.display='none'; document.getElementById('_338_537_Closed_Text').style.display='none'; document.getElementById('_338_537_Open_Image').style.display='inline'; document.getElementById('_338_537_Open_Text').style.display='inline';" style="display: none;" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" id="_338_537_Closed_Image" alt=""></span><span style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;" id="_338_537_Closed_Text">...</span><span id="_338_537_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(patom</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(0, 0, 0);">left)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">FreeAtom(patom</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(0, 0, 0);">left);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(patom</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(0, 0, 0);">right)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">FreeAtom(patom</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(0, 0, 0);">right);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(patom</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(0, 0, 0);">a</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">XA_LAST_PREDEFINED)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">xfree(patom</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">xfree(patom);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span></font></div></div> <br>(待续)<br></xianjimli>


分享到:
评论

相关推荐

    X Window研究笔记

    X Window研究笔记 虽然X Window是一个非常复杂的系统,但只要静下心来分析,通常遇到的问题也是很容易解决的,前年我花了一段时间去研究X Window的实现,我发现了解它的实现后,很多问题都迎刃而解了

    X-window简略笔记

    X-window简略笔记

    X-Window程式设计入门 教程

    X Window 程式设计入门--第一章 什么是 X Window X Window 程式设计入门--第二章 X Programming 的第一步 X Window 程式设计入门--第三章 绘图(Graphic) X Window 程式设计入门--第三章 绘图(Graphic) X Window 程...

    Xwindow程序设计入门

    Xwindow程序设计入门,网上收藏,很好的资料,对了解xwindow编程很有帮助

    X Window 系统使用指南

    X Window System 是一套在各种位元映像显示器 (bitmapped dispalys) 上具有极大可携性 (portable) 的视窗系统 (window system), 它是由麻省理工学院 (MIT)所发展出来. X Windows System ( 本书以後部 份简称为...

    OpenGL for x window (1)

    This practical guide shows X programmers how to construct working 3D applications using OpenGL and how to tightly integrate OpenGL applications with the X Window System. Written by a Silicon Graphics...

    X window 直接渲染架构

    描述X window 直接渲染架构的概念,实现

    X window介绍及启动流程

    对Linux操作系统的桌面环境软件X window的介绍及启动流程

    Linux与X Window系统基础

    Linux与X Window系统基础 Linux与X Window系统基础

    xwindow程序设计相关资料

    X Window System 是一套在各种位元映像显示器 (bitmapped dispalys) 上具有极大可携性 (portable) 的视窗系统 (window system), 它是由麻省理工学院 (MIT)所发展出来. X Windows System ( 本书以後部 份简称为...

    X Window 用户指南

    这个文档为Linux用户提供了一些基本的关于理解和配置X-Window系统的信息。 这只是一个入门级别的文档。假设已经有了一个安装好的并且正在工作的 X-Window系统。

    Linux下X-Window系统程序设计简介.pdf

    Linux下X-Window系统程序设计简介.pdf

    window manager for x

    window manager for x window manager for x window manager for x

    X-Window介绍

    关于X window的介绍。让你了解并熟悉X window。

    xwindow相关包

    Xwindow 是一个非常出色的图形系统,你应该抱怨的是那些不稳定的包装,而不是 Xwindow 本身。

    Xming-X window 工具

    Xming, windows操作系统连接Linux, Unix的x window 工具。

    Unix_Linux环境下的窗口系统X Window(上).pdf

    Unix_Linux环境下的窗口系统X Window(上).pdf

    X Window架构与启动代码分析

    一份课程报告,介绍了X-Window的架构体系,并对启动代码做了分析

Global site tag (gtag.js) - Google Analytics