摘要: http://graphics.stanford.edu/~seander/bithacks.htmlBit Twiddling HacksBy Sean Eron Andersonseander@cs.stanford.eduIndividually, thecode snippets here are in the public domain(unless otherwise noted) — feel free to use them however you please. The aggregate collection and descriptions are ©1997- 阅读全文
posted @ 2013-05-27 00:21 IAmAProgrammer 阅读(204) 评论(0) 推荐(0) 编辑
摘要: http://stackoverflow.com/questions/11632219/c-preprocessor-macro-specialisation-based-on-an-argumentTuns out it is possible. This anwser is based on Pauls macros, but much simpler and does not need definition for each user.#define CAT(a,...) PRIMITIVE_CAT(a, __VA_ARGS__)#define PRIMITIVE_CAT(a,..... 阅读全文
posted @ 2013-05-26 17:54 IAmAProgrammer 阅读(587) 评论(0) 推荐(0) 编辑
摘要: 1. 宏可以像函数一样被定义,例如:#define min(x,y) (x 但是在实际使用时,只有当写上min(),必须加括号,min才会被作为宏展开,否则不做任何处理。2. 如果宏需要参数,你可以不传,编译器会给你警告(宏参数不够),但是这会导致错误。如C++书籍中所描述的,编译器(预处理器)对宏的语法检查不够,所以更多的检查性工作得你自己来做。3. 很多程序员不知道的#和###符号把一个符号直接转换为字符串,例如:#define STRING(x) #xconst char *str = STRING( test_string ); str的内容就是"test_string&qu 阅读全文
posted @ 2013-05-25 23:02 IAmAProgrammer 阅读(1812) 评论(0) 推荐(0) 编辑
摘要: http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzarg%2Fvariable_length_arrays.htmAflexible array memberis permitted as the last element of a structure even though it has incomplete type, provided that the structure has more than one named member. A flexible array member is a C99 阅读全文
posted @ 2013-05-25 15:01 IAmAProgrammer 阅读(353) 评论(0) 推荐(0) 编辑
摘要: http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzarg%2Fvariable_length_arrays.htmVariable length arrays (C++ only)A variable length array, which is a C99 feature, is an array of automatic storage duration whose length is determined at run time.Variable length array declarator sy 阅读全文
posted @ 2013-05-25 14:59 IAmAProgrammer 阅读(1039) 评论(0) 推荐(0) 编辑
摘要: In astructwith more than one member, the last member of thestructcan have incomplete array type. Such a member is called aflexible array memberof thestruct.NoteWhen astructhas a flexible array member, the entirestructitself has incomplete type.Flexible array members enable you to mimic dynamic type 阅读全文
posted @ 2013-05-25 02:20 IAmAProgrammer 阅读(2500) 评论(0) 推荐(0) 编辑
摘要: Returns NARG, the number of arguments contained in __VA_ARGS__ beforeexpansion as far as NARG is >0 and <64 (cpp limits):#define PP_RSEQ_N() 63,62,61,60,[..],9,8,7,6,5,4,3,2,1,0#define PP_ARG_N(_1,_2,_3,_4,_5,_6,_7,_8,_9,[..],_61,_62,_63,N,...) N#define PP_NARG_(...) PP_ARG_N(__VA_ARGS__)#defi 阅读全文
posted @ 2013-05-25 01:37 IAmAProgrammer 阅读(4490) 评论(0) 推荐(1) 编辑
摘要: http://blog.frankvh.com/2011/08/18/stm32f2xx-dma-controllers/If you’re moving a bunch of data around, the DMA controllers are going to be your best friends. However they have their quirks and undocumented features. This post will describe what I’ve learned about them, and hopefully others can contri 阅读全文
posted @ 2013-05-23 23:36 IAmAProgrammer 阅读(1280) 评论(0) 推荐(0) 编辑
摘要: /*************************************************************************** ftdi.c - description ------------------- begin : Fri Apr 4 2003 copyright : (C) 2003 by Intra2net AG email : opensource@intra2net.com Modified : April, 2007 : Craig Van... 阅读全文
posted @ 2013-05-22 22:55 IAmAProgrammer 阅读(1370) 评论(0) 推荐(0) 编辑
摘要: /*************************************************************************** ftdi.c - description ------------------- begin : Fri Apr 4 2003 copyright : (C) 2003 by Intra2net AG email : opensource@intra2net.com **********************************************... 阅读全文
posted @ 2013-05-22 22:33 IAmAProgrammer 阅读(991) 评论(0) 推荐(0) 编辑
摘要: Images are stored as an array of unsigned characters. Ideally, they would be in a structure, butthe limitations of C prevents an efficient definition of a structure for an image while still allowinga compile-time declaration of the data for an image. The effective definition of the structure is asfo 阅读全文
posted @ 2013-05-15 20:30 IAmAProgrammer 阅读(532) 评论(0) 推荐(0) 编辑
摘要: the rowswere connectedside-by-sideConsider thefollowing font glyph (for a non-existant character from a 14x8 font):................................................xx...........xxxx........xxxxxxxx......xxxxxxxx.................StoreGlyphby Bytes ( 18 bytes )........ ...... .. 0x00 0x00........ ..... 阅读全文
posted @ 2013-05-15 16:14 IAmAProgrammer 阅读(491) 评论(0) 推荐(0) 编辑
摘要: Controls file encoding. Choose between:Auto-detect character encoding Detects automatically which character encoding that should be used when you open an existing document.Default character encoding Selects the character encoding to be used by default for new files. Note that if you have speci... 阅读全文
posted @ 2013-05-14 19:40 IAmAProgrammer 阅读(1231) 评论(0) 推荐(0) 编辑
摘要: CodePagecharset语种708ASMO-708阿拉伯字符(ASMO708)720DOS-720阿拉伯字符(DOS)28596iso-8859-6阿拉伯字符(ISO)1256windows-1256阿拉伯字符(Windows)1257windows-1257波罗的海字符(Windows)852ibm852中欧字符(DOS)28592iso-8859-2中欧字符(ISO)1250windows-1250中欧字符(Windows)936gb2312简体中文(GB2312)950big5繁体中文(Big5)862DOS-862希伯来字符(DOS)866cp866西里尔字符(DOS)874wi 阅读全文
posted @ 2013-05-14 17:51 IAmAProgrammer 阅读(1427) 评论(0) 推荐(0) 编辑
摘要: http://www.crifan.com/files/doc/docbook/linux_nand_driver/release/html/linux_nand_driver.html简单说就是,常见的Nand Flash,内部只有一个chip,每个chip只有一个plane。而有些复杂的,容量更大的Nand Flash,内部有多个chip,每个chip有多个plane。这类的Nand Flash,往往也有更加高级的功能,比如下面要介绍的Multi Plane Program和Interleave Page Program等。概念上,由大到小来说,就是:Nand Flash ⇒ Chip ⇒ 阅读全文
posted @ 2013-05-14 00:54 IAmAProgrammer 阅读(8872) 评论(0) 推荐(3) 编辑
摘要: //----------------------------------------#define NAND_CMD_READ_A 0x00 #define NAND_CMD_READ_B 0x01#define NAND_CMD_READ_C 0x50 #define NAND_CMD_SIGNATURE 0x90#define NAND_CMD_STATUS 0x70 ... 阅读全文
posted @ 2013-05-13 17:16 IAmAProgrammer 阅读(1042) 评论(0) 推荐(0) 编辑
摘要: ASC12 ASCII字库文件 12X6ASC16 ASCII字库文件 16X8ASC48 ASCII字库文件 48X24Hzk12 汉字库宋体 12X12Hzk16 汉字库宋体 16X16hzk16F 汉字库仿宋 16X16HZK24F 汉字库仿宋 24X24HZK24H 汉字库黑体 24X24HZK24K 汉字库楷体 24X24HZK24S 汉字库宋体 24X24HZK24T 全角字符库 24X24HZK24Z 汉字库篆体 24X24HZK40S 汉字库宋体 40X40HZK40T 全角字符库 4... 阅读全文
posted @ 2013-05-13 15:37 IAmAProgrammer 阅读(1640) 评论(0) 推荐(0) 编辑
摘要: 所谓代码页 (codepage) 就是各国的文字编码和 Unicode 之间的映射表。例如 GBK 和 Unicode 的映射表就是 CP936,所以也常用 cp936 来指代 GBK。Code Pages Supported by WindowsThe lists below provide links to graphical representations and textual listings of each of the Windows codepages.SBCS (Single Byte Character Set) Codepages1250 (Central Europe) 阅读全文
posted @ 2013-05-13 03:04 IAmAProgrammer 阅读(526) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-05-12 19:39 IAmAProgrammer 阅读(180) 评论(0) 推荐(0) 编辑
摘要: http://www.russellcottrell.com/greek/utilities/UnicodeRanges.htmtypedef struct{ uint32_t FristCode; uint32_t LastCode; uint8_t * Description;} UNICODE_RANGE_T;const UNICODE_RANGE_T UnicodeRange[ ] ={{ 0x0000, 0x007F, "Basic Latin" },{ 0x0080, 0x00FF, "Latin, 0x1 Supplement" },{ 0 阅读全文
posted @ 2013-05-12 19:30 IAmAProgrammer 阅读(416) 评论(0) 推荐(0) 编辑
摘要: 点阵字体http://zh.wikipedia.org/wiki/%E7%82%B9%E9%98%B5%E5%AD%97%E4%BD%93点阵字体也叫位图字体,其中每个字形都以一组二维像素信息表示。这种文字显示方式于较早前的电脑系统(例如未有图形接口时的 DOS 操作系统)被普遍采用。由于位图的缘故,点阵字体很难进行缩放,特定的点阵字体只能清晰地显示在相应的字号下,否则文字只被强行放大而有损字形,产生成马赛克式的锯齿边缘。但对于字号 8-14px 的尺寸较小的汉字字体(即现今操作系统大多采用的默认字号)现今亦仍然被使用于荧幕显示上,能够提供更高的显示效果;不过现今该种点阵字体主要只作为“辅助” 阅读全文
posted @ 2013-05-12 12:57 IAmAProgrammer 阅读(3428) 评论(0) 推荐(0) 编辑
摘要: SBFX 和 UBFX有符号和无符号位域提取。将一个寄存器的相邻的位复制到另一个寄存器的最低有效位,并用符号或零扩展到 32 位。语法op{cond} Rd, Rn, #lsb, #width其中:op 是SBFX或UBFX。cond 是一个可选的条件代码(请参阅条件执行)。Rd 是目标寄存器。Rn 是源寄存器。lsb 是位域中的最低有效位的位编码,范围从 0 到 31。width 是位域宽度,范围从 1 到 (32-lsb)。不要将 r15 用作Rd或Rn。条件标记这些指令不更改任何标记。体系结构这些 ARM 指令可用于 ARMv6T2 及更高版本。这些 32 位 Thumb 指令可用... 阅读全文
posted @ 2013-05-12 10:04 IAmAProgrammer 阅读(10427) 评论(0) 推荐(0) 编辑
摘要: Ida Pro 的默认设置里对中文字串的支持比较差, 对于首字节大于'EO'的都显示成 ?打开IDA PRO 目录下的IDA.CFG// the following characters are allowed in ASCII strings, i.e.// in order to find end of a string IDA looks for a character// which doesn't belong to this array:// (cp866 version)//AsciiStringChars =// "\r\n\a\v\b\t\x 阅读全文
posted @ 2013-05-12 07:04 IAmAProgrammer 阅读(472) 评论(0) 推荐(0) 编辑
摘要: NOKIA 5110 <PCD8544 >https://www.sparkfun.com/datasheets/LCD/Monochrome/Nokia5110.pdfData is downloaded in bytes into the 48 by 84 bits RAMdata display matrix of PCD8544The columns are addressed by theaddress pointer. The address ranges are:X 0 to 83(1010011), Y 0 to 5 (101).Addresses outside 阅读全文
posted @ 2013-05-12 00:00 IAmAProgrammer 阅读(586) 评论(0) 推荐(0) 编辑
摘要: TStream 是一个抽象的基类, 不能直接生成对象TStream -->THandleStream-->TFileStreamTStream -->TCustomMemoryStream --> TMemoryStreamTStream -->TCustomMemoryStream --> TResourceStreamTFileStream: 文件流TStringStream: 字符串流TMemoryStream: 内存流TResourceStream: 资源文件流TStream 有 Seek() 方法, 它的子类们(TFileStream、TMemor 阅读全文
posted @ 2013-05-11 22:14 IAmAProgrammer 阅读(1794) 评论(0) 推荐(1) 编辑
摘要: http://www.codeguru.com/cpp/g-m/bitmap/specialeffects/article.php/c1739/Invert-mirror-a-bitmap-inplace.htmPosted byRoger OnslowonAugust 5th, 1998It is possible to invert a bitmap (laterally or vertically) IN-PLACE - ie. without creating any intermediate or temporary bitmaps. You can modify the origi 阅读全文
posted @ 2013-05-10 14:44 IAmAProgrammer 阅读(419) 评论(0) 推荐(0) 编辑
摘要: http://www.codeguru.com/cpp/g-m/bitmap/specialeffects/article.php/c1743/Rotate-a-bitmap-image.htmRotate a bitmap imagehttp://www.codeguru.com/cpp/g-m/bitmap/specialeffects/article.php/c1725/Invert-mirror-a-bitmap.htmInvert (mirror) a bitmapPosted byZafir AnjumonAugust 5th, 1998We can invert an image 阅读全文
posted @ 2013-05-10 14:04 IAmAProgrammer 阅读(517) 评论(0) 推荐(0) 编辑
摘要: http://www.codeguru.com/cpp/g-m/bitmap/specialeffects/article.php/c1725/Invert-mirror-a-bitmap.htmInvert (mirror) a bitmaphttp://www.efg2.com/Lab/ImageProcessing/RotateScanline.htmDiscussionIf one attempts to rotate a bitmap in the "forward" direction by selection Pixel (i, j) and rotating 阅读全文
posted @ 2013-05-09 22:19 IAmAProgrammer 阅读(2605) 评论(0) 推荐(0) 编辑
摘要: 位图和调色板自然界中的所有颜色都可以由红、绿、蓝(R,G,B)三基色组合而成。针对含有红、绿、蓝色成分的多少,可以对其分别分成0~255个等级,而红、绿、蓝的不同组合共有256×256×256种,因此约能表示1600万种颜色。对每个像素进行了(R,G,B)量化的图像就是位图,其在计算机中对应文件的扩展名一般为.bmp调色板横空的功能在于缓解位图文件存储空间过大的问题,完全利用(R,G,B)组合来存储一个800×600的位图所需要的空间为800×600×3 = 1440000(字节)= 1.37M(字节),假设位图为16色,只需要用4个bit就可 阅读全文
posted @ 2013-05-08 16:13 IAmAProgrammer 阅读(771) 评论(0) 推荐(0) 编辑
摘要: tmHeight指字符高度(不包括两行字符之间的间距),tmAscent表示字符基线以上部分的高度,tmDescent表示字符基线以下部分的高度。tmInternalLeading表示字符内预留的间距包含在tmAscent中(主要用于显示重音符号等)。tmExternalLeading标准两行字符之间的间距,tmAveCharWidth表示(小写 x)字符的加权平均宽度,tmMaxCharWidth表示字符的最大宽宽度。大写字符的平均宽度通常是字符平均宽度的1.5倍。大写字母平均宽度 = tmMaxCharWith * 1.5=(tm.tmPitchAndFamily&1?3:2)*c 阅读全文
posted @ 2013-05-08 14:31 IAmAProgrammer 阅读(3086) 评论(0) 推荐(0) 编辑
摘要: 信息交换用汉字编码字符集·基本集 GB2312概述GB 2312或GB 2312-80是中国国家标准简体中文字符集,全称《信息交换用汉字编码字符集·基本集》,又称GB0GB 2312标准共收录6763个汉字,其中一级汉字3755个,二级汉字3008个;同时收录了包括拉丁字母、希腊字母、日文平假名及片假名字母、俄语西里尔字母在内的682个字符。GB 2312的出现,基本满足了汉字的计算机处理需要,它所收录的汉字已经覆盖中国大陆99.75%的使用频率。对于人名、古汉语等方面出现的罕用字,GB 2312不能处理,这导致了后来GBK及GB 18030汉字字符集的出现。分区表示GB 阅读全文
posted @ 2013-05-07 20:38 IAmAProgrammer 阅读(3469) 评论(0) 推荐(1) 编辑
摘要: S-Record Format A file in Motorola S-record format is an ASCII file. There are three different formats: S19 for 16-bit address S2 for 24-bit address S3 for 32-bit address The files consist of optional symbol table information, data specifications... 阅读全文
posted @ 2013-05-07 00:16 IAmAProgrammer 阅读(576) 评论(0) 推荐(0) 编辑
摘要: 使用Dephi进行图像处理可以有多种方法,最常用的应该算是TBitmap,它提供方便的图像存取能力,结合Canvas可进行画线、画圆、图像拷贝等操作。不过在进行大量的图像处理操作时,为了获得更高的速度,我们希望能够直接对图像缓冲区进行读写。查阅Dephi的帮助手册没有发现直接取得整个图像缓冲区的功能,但提供的ScanLine属性可以取得指定行图像数据的指针,比较接近我们的要求,先看看ScanLine的描述:propertyScanLine[Row: Integer]: Pointer;Provides indexed access to each line of pixels.ScanLine 阅读全文
posted @ 2013-05-06 21:35 IAmAProgrammer 阅读(7277) 评论(0) 推荐(0) 编辑
摘要: Delphi有三种类型的字符:AnsiChar这是标准的1字节的ANSI字符,程序员都对它比较熟悉。WideChar这是2字节的Unicode字符。Char在目前相当于AnsiChar,但在Delphi 2010 以后版本中相当于WideChar.记住因为一个字符在长度上并不表示一个字节,所以不能在应用程序中对字符长度进行硬编码,而应该使用Sizeof()函数。注意Sizeof()标准函数返回类型或实例的字节长度。Delphi有下列几种不同的字符串类型 String:ShortString保留该类型是为了向后兼容 Delphi1.0,它的长度限制在255个字符内。 ShortString[0] 阅读全文
posted @ 2013-05-06 14:17 IAmAProgrammer 阅读(909) 评论(0) 推荐(0) 编辑
摘要: http://www.regexlab.com/zh/encoding.htm1. 编码问题的由来,相关概念的理解1.1 字符与编码的发展从计算机对多国语言的支持角度看,大致可以分为三个阶段: 系统内码说明系统阶段一ASCII计算机刚开始只支持英语,其它语言不能够在计算机上存储和显示。英文 DOS阶段二ANSI编码(本地化)为使计算机支持更多语言,通常使用 0x80~0xFF 范围的 2 个字节来表示 1 个字符。比如:汉字 '中' 在中文操作系统中,使用 [0xD6,0xD0] 这两个字节存储。不同的国家和地区制定了不同的标准,由此产生了 GB2312, BIG5, JIS 阅读全文
posted @ 2013-05-06 01:12 IAmAProgrammer 阅读(2622) 评论(0) 推荐(0) 编辑
摘要: http://www.efg2.com/Lab/ImageProcessing/FlipReverseRotate.htmThe purpose of this program, FlipReverseRotate.EXE, is to demonstrate how to flip (top-to-bottom) and/or reverse (left-to-right) a bitmap in memory and display the results on the screen. Three methods to flip/reverse are compared: Scanline 阅读全文
posted @ 2013-05-05 21:52 IAmAProgrammer 阅读(398) 评论(0) 推荐(0) 编辑
摘要: { Article: Most Recently Used (MRU) menu component - TMRU http://delphi.about.com/library/weekly/aa112503a.htm Full source code of a TMRU component, a non-visual component which simplifies implementing a "Most Recently Used" file list in a menu (or a popup menu). The TMRU component allows 阅读全文
posted @ 2013-05-05 12:01 IAmAProgrammer 阅读(1128) 评论(0) 推荐(0) 编辑
摘要: http://delphi.about.com/library/weekly/aa100703a.htm{ Article: Controling the number of application instances http://delphi.about.com/library/weekly/aa100703a.htm In this article you'll learn how to "run-once enable" a Delphi application that can check for its previous (running) instan 阅读全文
posted @ 2013-05-05 00:00 IAmAProgrammer 阅读(535) 评论(0) 推荐(0) 编辑
摘要: http://delphi.about.com/od/windowsshellapi/a/clipboard_spy_3.htmDo you know that, for example, MS Word has it's own format for storing data to the clipboard? Large number of applications paste information in other formats, for example Rich Text Format, HTML format and so forth. Why not use Delph 阅读全文
posted @ 2013-05-03 13:02 IAmAProgrammer 阅读(1377) 评论(0) 推荐(0) 编辑
摘要: Standard Clipboard FormatsThe clipboard formats defined by the system are calledstandard clipboard formats.Constant/valueDescriptionCF_BITMAP2A handle to a bitmap (HBITMAP).CF_DIB8A memory object containing aBITMAPINFOstructure followed by the bitmap bits.CF_DIBV517A memory object containing aBITMAP 阅读全文
posted @ 2013-05-02 20:01 IAmAProgrammer 阅读(2927) 评论(0) 推荐(1) 编辑