mirror of
https://github.com/zlgopen/awtk.git
synced 2025-05-09 03:51:08 +08:00
format code
This commit is contained in:
parent
72c3618e26
commit
bc94a34a82
25
design/default/ui/kb_foo.xml
Normal file
25
design/default/ui/kb_foo.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<keyboard theme="keyboard" x="0" y="bottom" w="100%" h="40%">
|
||||
<column style="placeholder" x="0" y="0" w="100%" h="30">
|
||||
<button name="close" style="close" x="r:1" y="1" w="28" h="28" text="x" />
|
||||
</column>
|
||||
<pages x="0" y="30" w="100%" h="-30" active="0">
|
||||
<view name="upper" x="0" y="0" w="100%" h="100%" children_layout="default(r=4,c=4,s=2,m=4)">
|
||||
<button repeat="300" name="1" text="1"/>
|
||||
<button repeat="300" name="2" text="2"/>
|
||||
<button repeat="300" name="3" text="3"/>
|
||||
<button repeat="300" name="4" text="4"/>
|
||||
<button repeat="300" name="5" text="5"/>
|
||||
<button repeat="300" name="6" text="6"/>
|
||||
<button repeat="300" name="7" text="7"/>
|
||||
<button repeat="300" name="8" text="8"/>
|
||||
<button repeat="300" name="9" text="9"/>
|
||||
<button repeat="300" name="-" style="highlight" text="-"/>
|
||||
<button repeat="300" name="0" text="0"/>
|
||||
<button repeat="300" name="key:backspace" style="highlight"><image draw_type="icon" image="backspace" x="center" y="middle" w="100%" h="100%"/></button>
|
||||
<button name="clear" text="Clear"/>
|
||||
<button name="cancel" text="Cancel"/>
|
||||
<button name="close" text="Close"/>
|
||||
<button name="back" text="Back"/>
|
||||
</view>
|
||||
</pages>
|
||||
</keyboard>
|
101
res/assets/default/inc/ui/kb_foo.data
Normal file
101
res/assets/default/inc/ui/kb_foo.data
Normal file
@ -0,0 +1,101 @@
|
||||
TK_CONST_DATA_ALIGN(const unsigned char ui_kb_foo[]) = {
|
||||
0x04,0x00,0x01,0x01,0xa0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x6b,0x62,0x5f,0x66,0x6f,0x6f,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x6b,0x65,0x79,0x62,0x6f,0x61,0x72,0x64,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,
|
||||
0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x30,0x2c,
|
||||
0x79,0x3d,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,0x68,0x3d,0x34,0x30,
|
||||
0x25,0x29,0x00,0x74,0x68,0x65,0x6d,0x65,0x00,0x6b,0x65,0x79,0x62,0x6f,0x61,0x72,0x64,0x00,0x00,0x63,
|
||||
0x6f,0x6c,0x75,0x6d,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,
|
||||
0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,
|
||||
0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x30,0x2c,0x79,0x3d,0x30,0x2c,0x77,0x3d,0x31,0x30,0x30,
|
||||
0x25,0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x70,0x6c,0x61,0x63,0x65,0x68,
|
||||
0x6f,0x6c,0x64,0x65,0x72,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,
|
||||
0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x72,0x3a,0x31,
|
||||
0x2c,0x79,0x3d,0x31,0x2c,0x77,0x3d,0x32,0x38,0x2c,0x68,0x3d,0x32,0x38,0x29,0x00,0x6e,0x61,0x6d,0x65,
|
||||
0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x78,0x00,0x00,0x00,0x00,0x70,0x61,0x67,0x65,0x73,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0xe2,0xff,0xff,0xff,0x73,0x65,0x6c,
|
||||
0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x30,
|
||||
0x2c,0x79,0x3d,0x33,0x30,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,0x68,0x3d,0x2d,0x33,0x30,0x29,0x00,
|
||||
0x61,0x63,0x74,0x69,0x76,0x65,0x00,0x30,0x00,0x00,0x76,0x69,0x65,0x77,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x73,0x65,
|
||||
0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,
|
||||
0x30,0x2c,0x79,0x3d,0x30,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,0x68,0x3d,0x31,0x30,0x30,0x25,0x29,
|
||||
0x00,0x6e,0x61,0x6d,0x65,0x00,0x75,0x70,0x70,0x65,0x72,0x00,0x63,0x68,0x69,0x6c,0x64,0x72,0x65,0x6e,
|
||||
0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x72,0x3d,0x34,0x2c,
|
||||
0x63,0x3d,0x34,0x2c,0x73,0x3d,0x32,0x2c,0x6d,0x3d,0x34,0x29,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x31,0x00,
|
||||
0x74,0x65,0x78,0x74,0x00,0x31,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x65,0x70,
|
||||
0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x32,0x00,0x74,0x65,0x78,0x74,0x00,
|
||||
0x32,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,
|
||||
0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x33,0x00,0x74,0x65,0x78,0x74,0x00,0x33,0x00,0x00,0x00,0x62,
|
||||
0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,
|
||||
0x6d,0x65,0x00,0x34,0x00,0x74,0x65,0x78,0x74,0x00,0x34,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x35,0x00,
|
||||
0x74,0x65,0x78,0x74,0x00,0x35,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x65,0x70,
|
||||
0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x36,0x00,0x74,0x65,0x78,0x74,0x00,
|
||||
0x36,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,
|
||||
0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x37,0x00,0x74,0x65,0x78,0x74,0x00,0x37,0x00,0x00,0x00,0x62,
|
||||
0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,
|
||||
0x6d,0x65,0x00,0x38,0x00,0x74,0x65,0x78,0x74,0x00,0x38,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x39,0x00,
|
||||
0x74,0x65,0x78,0x74,0x00,0x39,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x65,0x70,
|
||||
0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x2d,0x00,0x73,0x74,0x79,0x6c,0x65,
|
||||
0x00,0x68,0x69,0x67,0x68,0x6c,0x69,0x67,0x68,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x2d,0x00,0x00,0x00,
|
||||
0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,
|
||||
0x61,0x6d,0x65,0x00,0x30,0x00,0x74,0x65,0x78,0x74,0x00,0x30,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,
|
||||
0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x72,0x65,0x70,0x65,0x61,0x74,0x00,0x33,0x30,0x30,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6b,
|
||||
0x65,0x79,0x3a,0x62,0x61,0x63,0x6b,0x73,0x70,0x61,0x63,0x65,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x68,
|
||||
0x69,0x67,0x68,0x6c,0x69,0x67,0x68,0x74,0x00,0x00,0x69,0x6d,0x61,0x67,0x65,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x73,0x65,
|
||||
0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,
|
||||
0x63,0x65,0x6e,0x74,0x65,0x72,0x2c,0x79,0x3d,0x6d,0x69,0x64,0x64,0x6c,0x65,0x2c,0x77,0x3d,0x31,0x30,
|
||||
0x30,0x25,0x2c,0x68,0x3d,0x31,0x30,0x30,0x25,0x29,0x00,0x64,0x72,0x61,0x77,0x5f,0x74,0x79,0x70,0x65,
|
||||
0x00,0x69,0x63,0x6f,0x6e,0x00,0x69,0x6d,0x61,0x67,0x65,0x00,0x62,0x61,0x63,0x6b,0x73,0x70,0x61,0x63,
|
||||
0x65,0x00,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,
|
||||
0x65,0x61,0x72,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x6c,0x65,0x61,0x72,0x00,0x00,0x00,0x62,0x75,0x74,
|
||||
0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x61,0x6e,0x63,0x65,0x6c,0x00,0x74,0x65,0x78,
|
||||
0x74,0x00,0x43,0x61,0x6e,0x63,0x65,0x6c,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,
|
||||
0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x6c,0x6f,0x73,0x65,
|
||||
0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x62,0x61,0x63,0x6b,
|
||||
0x00,0x74,0x65,0x78,0x74,0x00,0x42,0x61,0x63,0x6b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*2000*/
|
BIN
res/assets/default/raw/ui/kb_foo.bin
Normal file
BIN
res/assets/default/raw/ui/kb_foo.bin
Normal file
Binary file not shown.
@ -103,7 +103,7 @@ static ret_t system_info_normalize_app_root_try_path(system_info_t* info, char*
|
||||
return system_info_set_app_root(info, app_root);
|
||||
} else {
|
||||
path_build(app_root, MAX_PATH, path, "demos", NULL);
|
||||
log_debug("try set app_root:%s\n", app_root);
|
||||
log_debug("try set app_root:%s\n", app_root);
|
||||
if (app_root_is_valid(app_root)) {
|
||||
return system_info_set_app_root(info, app_root);
|
||||
} else {
|
||||
|
@ -523,5 +523,5 @@ ret_t vgcanvas_clear_cache(vgcanvas_t* vg) {
|
||||
return_value_if_fail(vg != NULL && vg->vt != NULL, RET_BAD_PARAMS);
|
||||
return_value_if_fail(vg->vt->clear_cache != NULL, RET_BAD_PARAMS);
|
||||
|
||||
return vg->vt->clear_cache(vg);
|
||||
return vg->vt->clear_cache(vg);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#ifdef WIN32
|
||||
#include "win_iconv.inc"
|
||||
#define WITH_ICONV 1
|
||||
#endif/*WIN32*/
|
||||
#endif /*WIN32*/
|
||||
|
||||
#if defined(LINUX) || defined(MACOS)
|
||||
#include <iconv.h>
|
||||
|
@ -30,26 +30,26 @@
|
||||
* Max
|
||||
* Return the maximum of two numbers.
|
||||
*/
|
||||
#define Max(x, y) ((x) > (y) ? (x) : (y))
|
||||
#define Max(x, y) ((x) > (y) ? (x) : (y))
|
||||
|
||||
/*
|
||||
* Min
|
||||
* Return the minimum of two numbers.
|
||||
*/
|
||||
#define Min(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define Min(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
/*
|
||||
* Abs
|
||||
* Return the absolute value of the argument.
|
||||
*/
|
||||
#define Abs(x) ((x) >= 0 ? (x) : -(x))
|
||||
#define Abs(x) ((x) >= 0 ? (x) : -(x))
|
||||
|
||||
typedef bool_t bool;
|
||||
typedef uint32_t uint32;
|
||||
#define lengthof(array) (sizeof (array) / sizeof ((array)[0]))
|
||||
#define lengthof(array) (sizeof(array) / sizeof((array)[0]))
|
||||
|
||||
#define HIGHBIT (0x80)
|
||||
#define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT)
|
||||
#define HIGHBIT (0x80)
|
||||
#define IS_HIGHBIT_SET(ch) ((unsigned char)(ch)&HIGHBIT)
|
||||
|
||||
/*
|
||||
* The pg_wchar type
|
||||
@ -59,13 +59,13 @@ typedef unsigned int pg_wchar;
|
||||
/*
|
||||
* Maximum byte length of multibyte characters in any backend encoding
|
||||
*/
|
||||
#define MAX_MULTIBYTE_CHAR_LEN 4
|
||||
#define MAX_MULTIBYTE_CHAR_LEN 4
|
||||
|
||||
/*
|
||||
* various definitions for EUC
|
||||
*/
|
||||
#define SS2 0x8e /* single shift 2 (JIS0201) */
|
||||
#define SS3 0x8f /* single shift 3 (JIS0212) */
|
||||
#define SS2 0x8e /* single shift 2 (JIS0201) */
|
||||
#define SS3 0x8f /* single shift 3 (JIS0212) */
|
||||
|
||||
/*
|
||||
* SJIS validation macros
|
||||
@ -131,114 +131,123 @@ typedef unsigned int pg_wchar;
|
||||
/*
|
||||
* Charset IDs for official single byte encodings (0x81-0x8e)
|
||||
*/
|
||||
#define LC_ISO8859_1 0x81 /* ISO8859 Latin 1 */
|
||||
#define LC_ISO8859_2 0x82 /* ISO8859 Latin 2 */
|
||||
#define LC_ISO8859_3 0x83 /* ISO8859 Latin 3 */
|
||||
#define LC_ISO8859_4 0x84 /* ISO8859 Latin 4 */
|
||||
#define LC_TIS620 0x85 /* Thai (not supported yet) */
|
||||
#define LC_ISO8859_7 0x86 /* Greek (not supported yet) */
|
||||
#define LC_ISO8859_6 0x87 /* Arabic (not supported yet) */
|
||||
#define LC_ISO8859_8 0x88 /* Hebrew (not supported yet) */
|
||||
#define LC_JISX0201K 0x89 /* Japanese 1 byte kana */
|
||||
#define LC_JISX0201R 0x8a /* Japanese 1 byte Roman */
|
||||
#define LC_ISO8859_1 0x81 /* ISO8859 Latin 1 */
|
||||
#define LC_ISO8859_2 0x82 /* ISO8859 Latin 2 */
|
||||
#define LC_ISO8859_3 0x83 /* ISO8859 Latin 3 */
|
||||
#define LC_ISO8859_4 0x84 /* ISO8859 Latin 4 */
|
||||
#define LC_TIS620 0x85 /* Thai (not supported yet) */
|
||||
#define LC_ISO8859_7 0x86 /* Greek (not supported yet) */
|
||||
#define LC_ISO8859_6 0x87 /* Arabic (not supported yet) */
|
||||
#define LC_ISO8859_8 0x88 /* Hebrew (not supported yet) */
|
||||
#define LC_JISX0201K 0x89 /* Japanese 1 byte kana */
|
||||
#define LC_JISX0201R 0x8a /* Japanese 1 byte Roman */
|
||||
/* Note that 0x8b seems to be unused as of Emacs 20.7.
|
||||
* However, there might be a chance that 0x8b could be used
|
||||
* in later versions of Emacs.
|
||||
*/
|
||||
#define LC_KOI8_R 0x8b /* Cyrillic KOI8-R */
|
||||
#define LC_ISO8859_5 0x8c /* ISO8859 Cyrillic */
|
||||
#define LC_ISO8859_9 0x8d /* ISO8859 Latin 5 (not supported yet) */
|
||||
#define LC_ISO8859_15 0x8e /* ISO8859 Latin 15 (not supported yet) */
|
||||
#define LC_KOI8_R 0x8b /* Cyrillic KOI8-R */
|
||||
#define LC_ISO8859_5 0x8c /* ISO8859 Cyrillic */
|
||||
#define LC_ISO8859_9 0x8d /* ISO8859 Latin 5 (not supported yet) */
|
||||
#define LC_ISO8859_15 0x8e /* ISO8859 Latin 15 (not supported yet) */
|
||||
/* #define CONTROL_1 0x8f control characters (unused) */
|
||||
|
||||
/* Is a leading byte for "official" single byte encodings? */
|
||||
#define IS_LC1(c) ((unsigned char)(c) >= 0x81 && (unsigned char)(c) <= 0x8d)
|
||||
#define IS_LC1(c) ((unsigned char)(c) >= 0x81 && (unsigned char)(c) <= 0x8d)
|
||||
|
||||
/*
|
||||
* Charset IDs for official multibyte encodings (0x90-0x99)
|
||||
* 0x9a-0x9d are free. 0x9e and 0x9f are reserved.
|
||||
*/
|
||||
#define LC_JISX0208_1978 0x90 /* Japanese Kanji, old JIS (not supported) */
|
||||
#define LC_GB2312_80 0x91 /* Chinese */
|
||||
#define LC_JISX0208 0x92 /* Japanese Kanji (JIS X 0208) */
|
||||
#define LC_KS5601 0x93 /* Korean */
|
||||
#define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */
|
||||
#define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */
|
||||
#define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */
|
||||
#define LC_JISX0213_1 0x97/* Japanese Kanji (JIS X 0213 Plane 1) (not
|
||||
#define LC_JISX0208_1978 0x90 /* Japanese Kanji, old JIS (not supported) */
|
||||
#define LC_GB2312_80 0x91 /* Chinese */
|
||||
#define LC_JISX0208 0x92 /* Japanese Kanji (JIS X 0208) */
|
||||
#define LC_KS5601 0x93 /* Korean */
|
||||
#define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */
|
||||
#define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */
|
||||
#define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */
|
||||
#define LC_JISX0213_1 \
|
||||
0x97 /* Japanese Kanji (JIS X 0213 Plane 1) (not
|
||||
* supported) */
|
||||
#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not supported) */
|
||||
#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not supported) */
|
||||
#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not supported) */
|
||||
#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not supported) */
|
||||
|
||||
/* Is a leading byte for "official" multibyte encodings? */
|
||||
#define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99)
|
||||
#define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99)
|
||||
|
||||
/*
|
||||
* Postgres-specific prefix bytes for "private" single byte encodings
|
||||
* (According to the MULE docs, we should be using 0x9e for this)
|
||||
*/
|
||||
#define LCPRV1_A 0x9a
|
||||
#define LCPRV1_B 0x9b
|
||||
#define IS_LCPRV1(c) ((unsigned char)(c) == LCPRV1_A || (unsigned char)(c) == LCPRV1_B)
|
||||
#define IS_LCPRV1_A_RANGE(c) \
|
||||
((unsigned char)(c) >= 0xa0 && (unsigned char)(c) <= 0xdf)
|
||||
#define IS_LCPRV1_B_RANGE(c) \
|
||||
((unsigned char)(c) >= 0xe0 && (unsigned char)(c) <= 0xef)
|
||||
#define LCPRV1_A 0x9a
|
||||
#define LCPRV1_B 0x9b
|
||||
#define IS_LCPRV1(c) ((unsigned char)(c) == LCPRV1_A || (unsigned char)(c) == LCPRV1_B)
|
||||
#define IS_LCPRV1_A_RANGE(c) ((unsigned char)(c) >= 0xa0 && (unsigned char)(c) <= 0xdf)
|
||||
#define IS_LCPRV1_B_RANGE(c) ((unsigned char)(c) >= 0xe0 && (unsigned char)(c) <= 0xef)
|
||||
|
||||
/*
|
||||
* Postgres-specific prefix bytes for "private" multibyte encodings
|
||||
* (According to the MULE docs, we should be using 0x9f for this)
|
||||
*/
|
||||
#define LCPRV2_A 0x9c
|
||||
#define LCPRV2_B 0x9d
|
||||
#define IS_LCPRV2(c) ((unsigned char)(c) == LCPRV2_A || (unsigned char)(c) == LCPRV2_B)
|
||||
#define IS_LCPRV2_A_RANGE(c) \
|
||||
((unsigned char)(c) >= 0xf0 && (unsigned char)(c) <= 0xf4)
|
||||
#define IS_LCPRV2_B_RANGE(c) \
|
||||
((unsigned char)(c) >= 0xf5 && (unsigned char)(c) <= 0xfe)
|
||||
#define LCPRV2_A 0x9c
|
||||
#define LCPRV2_B 0x9d
|
||||
#define IS_LCPRV2(c) ((unsigned char)(c) == LCPRV2_A || (unsigned char)(c) == LCPRV2_B)
|
||||
#define IS_LCPRV2_A_RANGE(c) ((unsigned char)(c) >= 0xf0 && (unsigned char)(c) <= 0xf4)
|
||||
#define IS_LCPRV2_B_RANGE(c) ((unsigned char)(c) >= 0xf5 && (unsigned char)(c) <= 0xfe)
|
||||
|
||||
/*
|
||||
* Charset IDs for private single byte encodings (0xa0-0xef)
|
||||
*/
|
||||
#define LC_SISHENG 0xa0/* Chinese SiSheng characters for
|
||||
#define LC_SISHENG \
|
||||
0xa0 /* Chinese SiSheng characters for
|
||||
* PinYin/ZhuYin (not supported) */
|
||||
#define LC_IPA 0xa1/* IPA (International Phonetic Association)
|
||||
#define LC_IPA \
|
||||
0xa1 /* IPA (International Phonetic Association)
|
||||
* (not supported) */
|
||||
#define LC_VISCII_LOWER 0xa2/* Vietnamese VISCII1.1 lower-case (not
|
||||
#define LC_VISCII_LOWER \
|
||||
0xa2 /* Vietnamese VISCII1.1 lower-case (not
|
||||
* supported) */
|
||||
#define LC_VISCII_UPPER 0xa3/* Vietnamese VISCII1.1 upper-case (not
|
||||
#define LC_VISCII_UPPER \
|
||||
0xa3 /* Vietnamese VISCII1.1 upper-case (not
|
||||
* supported) */
|
||||
#define LC_ARABIC_DIGIT 0xa4 /* Arabic digit (not supported) */
|
||||
#define LC_ARABIC_1_COLUMN 0xa5 /* Arabic 1-column (not supported) */
|
||||
#define LC_ASCII_RIGHT_TO_LEFT 0xa6 /* ASCII (left half of ISO8859-1) with
|
||||
#define LC_ARABIC_DIGIT 0xa4 /* Arabic digit (not supported) */
|
||||
#define LC_ARABIC_1_COLUMN 0xa5 /* Arabic 1-column (not supported) */
|
||||
#define LC_ASCII_RIGHT_TO_LEFT \
|
||||
0xa6 /* ASCII (left half of ISO8859-1) with
|
||||
* right-to-left direction (not
|
||||
* supported) */
|
||||
#define LC_LAO 0xa7/* Lao characters (ISO10646 0E80..0EDF) (not
|
||||
#define LC_LAO \
|
||||
0xa7 /* Lao characters (ISO10646 0E80..0EDF) (not
|
||||
* supported) */
|
||||
#define LC_ARABIC_2_COLUMN 0xa8 /* Arabic 1-column (not supported) */
|
||||
#define LC_ARABIC_2_COLUMN 0xa8 /* Arabic 1-column (not supported) */
|
||||
|
||||
/*
|
||||
* Charset IDs for private multibyte encodings (0xf0-0xff)
|
||||
*/
|
||||
#define LC_INDIAN_1_COLUMN 0xf0/* Indian charset for 1-column width glyphs
|
||||
#define LC_INDIAN_1_COLUMN \
|
||||
0xf0 /* Indian charset for 1-column width glyphs
|
||||
* (not supported) */
|
||||
#define LC_TIBETAN_1_COLUMN 0xf1/* Tibetan 1-column width glyphs (not
|
||||
#define LC_TIBETAN_1_COLUMN \
|
||||
0xf1 /* Tibetan 1-column width glyphs (not
|
||||
* supported) */
|
||||
#define LC_UNICODE_SUBSET_2 0xf2/* Unicode characters of the range
|
||||
#define LC_UNICODE_SUBSET_2 \
|
||||
0xf2 /* Unicode characters of the range
|
||||
* U+2500..U+33FF. (not supported) */
|
||||
#define LC_UNICODE_SUBSET_3 0xf3/* Unicode characters of the range
|
||||
#define LC_UNICODE_SUBSET_3 \
|
||||
0xf3 /* Unicode characters of the range
|
||||
* U+E000..U+FFFF. (not supported) */
|
||||
#define LC_UNICODE_SUBSET 0xf4/* Unicode characters of the range
|
||||
#define LC_UNICODE_SUBSET \
|
||||
0xf4 /* Unicode characters of the range
|
||||
* U+0100..U+24FF. (not supported) */
|
||||
#define LC_ETHIOPIC 0xf5 /* Ethiopic characters (not supported) */
|
||||
#define LC_CNS11643_3 0xf6 /* CNS 11643-1992 Plane 3 */
|
||||
#define LC_CNS11643_4 0xf7 /* CNS 11643-1992 Plane 4 */
|
||||
#define LC_CNS11643_5 0xf8 /* CNS 11643-1992 Plane 5 */
|
||||
#define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */
|
||||
#define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */
|
||||
#define LC_INDIAN_2_COLUMN 0xfb/* Indian charset for 2-column width glyphs
|
||||
#define LC_ETHIOPIC 0xf5 /* Ethiopic characters (not supported) */
|
||||
#define LC_CNS11643_3 0xf6 /* CNS 11643-1992 Plane 3 */
|
||||
#define LC_CNS11643_4 0xf7 /* CNS 11643-1992 Plane 4 */
|
||||
#define LC_CNS11643_5 0xf8 /* CNS 11643-1992 Plane 5 */
|
||||
#define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */
|
||||
#define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */
|
||||
#define LC_INDIAN_2_COLUMN \
|
||||
0xfb /* Indian charset for 2-column width glyphs
|
||||
* (not supported) */
|
||||
#define LC_TIBETAN 0xfc /* Tibetan (not supported) */
|
||||
#define LC_TIBETAN 0xfc /* Tibetan (not supported) */
|
||||
/* #define FREE 0xfd free (unused) */
|
||||
/* #define FREE 0xfe free (unused) */
|
||||
/* #define FREE 0xff free (unused) */
|
||||
@ -265,54 +274,53 @@ typedef unsigned int pg_wchar;
|
||||
* encoding IDs are effectively part of libpq's ABI as far as 8.2 initdb and
|
||||
* psql are concerned.
|
||||
*/
|
||||
typedef enum pg_enc
|
||||
{
|
||||
PG_SQL_ASCII = 0, /* SQL/ASCII */
|
||||
PG_EUC_JP, /* EUC for Japanese */
|
||||
PG_EUC_CN, /* EUC for Chinese */
|
||||
PG_EUC_KR, /* EUC for Korean */
|
||||
PG_EUC_TW, /* EUC for Taiwan */
|
||||
PG_EUC_JIS_2004, /* EUC-JIS-2004 */
|
||||
PG_UTF8, /* Unicode UTF8 */
|
||||
PG_MULE_INTERNAL, /* Mule internal code */
|
||||
PG_LATIN1, /* ISO-8859-1 Latin 1 */
|
||||
PG_LATIN2, /* ISO-8859-2 Latin 2 */
|
||||
PG_LATIN3, /* ISO-8859-3 Latin 3 */
|
||||
PG_LATIN4, /* ISO-8859-4 Latin 4 */
|
||||
PG_LATIN5, /* ISO-8859-9 Latin 5 */
|
||||
PG_LATIN6, /* ISO-8859-10 Latin6 */
|
||||
PG_LATIN7, /* ISO-8859-13 Latin7 */
|
||||
PG_LATIN8, /* ISO-8859-14 Latin8 */
|
||||
PG_LATIN9, /* ISO-8859-15 Latin9 */
|
||||
PG_LATIN10, /* ISO-8859-16 Latin10 */
|
||||
PG_WIN1256, /* windows-1256 */
|
||||
PG_WIN1258, /* Windows-1258 */
|
||||
PG_WIN866, /* (MS-DOS CP866) */
|
||||
PG_WIN874, /* windows-874 */
|
||||
PG_KOI8R, /* KOI8-R */
|
||||
PG_WIN1251, /* windows-1251 */
|
||||
PG_WIN1252, /* windows-1252 */
|
||||
PG_ISO_8859_5, /* ISO-8859-5 */
|
||||
PG_ISO_8859_6, /* ISO-8859-6 */
|
||||
PG_ISO_8859_7, /* ISO-8859-7 */
|
||||
PG_ISO_8859_8, /* ISO-8859-8 */
|
||||
PG_WIN1250, /* windows-1250 */
|
||||
PG_WIN1253, /* windows-1253 */
|
||||
PG_WIN1254, /* windows-1254 */
|
||||
PG_WIN1255, /* windows-1255 */
|
||||
PG_WIN1257, /* windows-1257 */
|
||||
PG_KOI8U, /* KOI8-U */
|
||||
/* PG_ENCODING_BE_LAST points to the above entry */
|
||||
typedef enum pg_enc {
|
||||
PG_SQL_ASCII = 0, /* SQL/ASCII */
|
||||
PG_EUC_JP, /* EUC for Japanese */
|
||||
PG_EUC_CN, /* EUC for Chinese */
|
||||
PG_EUC_KR, /* EUC for Korean */
|
||||
PG_EUC_TW, /* EUC for Taiwan */
|
||||
PG_EUC_JIS_2004, /* EUC-JIS-2004 */
|
||||
PG_UTF8, /* Unicode UTF8 */
|
||||
PG_MULE_INTERNAL, /* Mule internal code */
|
||||
PG_LATIN1, /* ISO-8859-1 Latin 1 */
|
||||
PG_LATIN2, /* ISO-8859-2 Latin 2 */
|
||||
PG_LATIN3, /* ISO-8859-3 Latin 3 */
|
||||
PG_LATIN4, /* ISO-8859-4 Latin 4 */
|
||||
PG_LATIN5, /* ISO-8859-9 Latin 5 */
|
||||
PG_LATIN6, /* ISO-8859-10 Latin6 */
|
||||
PG_LATIN7, /* ISO-8859-13 Latin7 */
|
||||
PG_LATIN8, /* ISO-8859-14 Latin8 */
|
||||
PG_LATIN9, /* ISO-8859-15 Latin9 */
|
||||
PG_LATIN10, /* ISO-8859-16 Latin10 */
|
||||
PG_WIN1256, /* windows-1256 */
|
||||
PG_WIN1258, /* Windows-1258 */
|
||||
PG_WIN866, /* (MS-DOS CP866) */
|
||||
PG_WIN874, /* windows-874 */
|
||||
PG_KOI8R, /* KOI8-R */
|
||||
PG_WIN1251, /* windows-1251 */
|
||||
PG_WIN1252, /* windows-1252 */
|
||||
PG_ISO_8859_5, /* ISO-8859-5 */
|
||||
PG_ISO_8859_6, /* ISO-8859-6 */
|
||||
PG_ISO_8859_7, /* ISO-8859-7 */
|
||||
PG_ISO_8859_8, /* ISO-8859-8 */
|
||||
PG_WIN1250, /* windows-1250 */
|
||||
PG_WIN1253, /* windows-1253 */
|
||||
PG_WIN1254, /* windows-1254 */
|
||||
PG_WIN1255, /* windows-1255 */
|
||||
PG_WIN1257, /* windows-1257 */
|
||||
PG_KOI8U, /* KOI8-U */
|
||||
/* PG_ENCODING_BE_LAST points to the above entry */
|
||||
|
||||
/* followings are for client encoding only */
|
||||
PG_SJIS, /* Shift JIS (Windows-932) */
|
||||
PG_BIG5, /* Big5 (Windows-950) */
|
||||
PG_GBK, /* GBK (Windows-936) */
|
||||
PG_UHC, /* UHC (Windows-949) */
|
||||
PG_GB18030, /* GB18030 */
|
||||
PG_JOHAB, /* EUC for Korean JOHAB */
|
||||
PG_SHIFT_JIS_2004, /* Shift-JIS-2004 */
|
||||
_PG_LAST_ENCODING_ /* mark only */
|
||||
/* followings are for client encoding only */
|
||||
PG_SJIS, /* Shift JIS (Windows-932) */
|
||||
PG_BIG5, /* Big5 (Windows-950) */
|
||||
PG_GBK, /* GBK (Windows-936) */
|
||||
PG_UHC, /* UHC (Windows-949) */
|
||||
PG_GB18030, /* GB18030 */
|
||||
PG_JOHAB, /* EUC for Korean JOHAB */
|
||||
PG_SHIFT_JIS_2004, /* Shift-JIS-2004 */
|
||||
_PG_LAST_ENCODING_ /* mark only */
|
||||
|
||||
} pg_enc;
|
||||
|
||||
@ -322,17 +330,15 @@ typedef enum pg_enc
|
||||
* Please use these tests before access to pg_encconv_tbl[]
|
||||
* or to other places...
|
||||
*/
|
||||
#define PG_VALID_BE_ENCODING(_enc) \
|
||||
((_enc) >= 0 && (_enc) <= PG_ENCODING_BE_LAST)
|
||||
#define PG_VALID_BE_ENCODING(_enc) ((_enc) >= 0 && (_enc) <= PG_ENCODING_BE_LAST)
|
||||
|
||||
#define PG_ENCODING_IS_CLIENT_ONLY(_enc) \
|
||||
((_enc) > PG_ENCODING_BE_LAST && (_enc) < _PG_LAST_ENCODING_)
|
||||
((_enc) > PG_ENCODING_BE_LAST && (_enc) < _PG_LAST_ENCODING_)
|
||||
|
||||
#define PG_VALID_ENCODING(_enc) \
|
||||
((_enc) >= 0 && (_enc) < _PG_LAST_ENCODING_)
|
||||
#define PG_VALID_ENCODING(_enc) ((_enc) >= 0 && (_enc) < _PG_LAST_ENCODING_)
|
||||
|
||||
/* On FE are possible all encodings */
|
||||
#define PG_VALID_FE_ENCODING(_enc) PG_VALID_ENCODING(_enc)
|
||||
#define PG_VALID_FE_ENCODING(_enc) PG_VALID_ENCODING(_enc)
|
||||
|
||||
/*
|
||||
* Table for mapping an encoding number to official encoding name and
|
||||
@ -342,12 +348,11 @@ typedef enum pg_enc
|
||||
* if (PG_VALID_ENCODING(encoding))
|
||||
* pg_enc2name_tbl[ encoding ];
|
||||
*/
|
||||
typedef struct pg_enc2name
|
||||
{
|
||||
const char *name;
|
||||
pg_enc encoding;
|
||||
typedef struct pg_enc2name {
|
||||
const char* name;
|
||||
pg_enc encoding;
|
||||
#ifdef WIN32
|
||||
unsigned codepage; /* codepage for WIN32 */
|
||||
unsigned codepage; /* codepage for WIN32 */
|
||||
#endif
|
||||
} pg_enc2name;
|
||||
|
||||
@ -356,10 +361,9 @@ extern const pg_enc2name pg_enc2name_tbl[];
|
||||
/*
|
||||
* Encoding names for gettext
|
||||
*/
|
||||
typedef struct pg_enc2gettext
|
||||
{
|
||||
pg_enc encoding;
|
||||
const char *name;
|
||||
typedef struct pg_enc2gettext {
|
||||
pg_enc encoding;
|
||||
const char* name;
|
||||
} pg_enc2gettext;
|
||||
|
||||
extern const pg_enc2gettext pg_enc2gettext_tbl[];
|
||||
@ -367,32 +371,27 @@ extern const pg_enc2gettext pg_enc2gettext_tbl[];
|
||||
/*
|
||||
* pg_wchar stuff
|
||||
*/
|
||||
typedef int (*mb2wchar_with_len_converter) (const unsigned char *from,
|
||||
pg_wchar *to,
|
||||
int len);
|
||||
typedef int (*mb2wchar_with_len_converter)(const unsigned char* from, pg_wchar* to, int len);
|
||||
|
||||
typedef int (*wchar2mb_with_len_converter) (const pg_wchar *from,
|
||||
unsigned char *to,
|
||||
int len);
|
||||
typedef int (*wchar2mb_with_len_converter)(const pg_wchar* from, unsigned char* to, int len);
|
||||
|
||||
typedef int (*mblen_converter) (const unsigned char *mbstr);
|
||||
typedef int (*mblen_converter)(const unsigned char* mbstr);
|
||||
|
||||
typedef int (*mbdisplaylen_converter) (const unsigned char *mbstr);
|
||||
typedef int (*mbdisplaylen_converter)(const unsigned char* mbstr);
|
||||
|
||||
typedef bool (*mbcharacter_incrementer) (unsigned char *mbstr, int len);
|
||||
typedef bool (*mbcharacter_incrementer)(unsigned char* mbstr, int len);
|
||||
|
||||
typedef int (*mbverifier) (const unsigned char *mbstr, int len);
|
||||
typedef int (*mbverifier)(const unsigned char* mbstr, int len);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
mb2wchar_with_len_converter mb2wchar_with_len; /* convert a multibyte
|
||||
typedef struct {
|
||||
mb2wchar_with_len_converter mb2wchar_with_len; /* convert a multibyte
|
||||
* string to a wchar */
|
||||
wchar2mb_with_len_converter wchar2mb_with_len; /* convert a wchar
|
||||
wchar2mb_with_len_converter wchar2mb_with_len; /* convert a wchar
|
||||
* string to a multibyte */
|
||||
mblen_converter mblen; /* get byte length of a char */
|
||||
mbdisplaylen_converter dsplen; /* get display width of a char */
|
||||
mbverifier mbverify; /* verify multibyte sequence */
|
||||
int maxmblen; /* max bytes for a char in this encoding */
|
||||
mblen_converter mblen; /* get byte length of a char */
|
||||
mbdisplaylen_converter dsplen; /* get display width of a char */
|
||||
mbverifier mbverify; /* verify multibyte sequence */
|
||||
int maxmblen; /* max bytes for a char in this encoding */
|
||||
} pg_wchar_tbl;
|
||||
|
||||
extern const pg_wchar_tbl pg_wchar_table[];
|
||||
@ -409,39 +408,35 @@ extern const pg_wchar_tbl pg_wchar_table[];
|
||||
*
|
||||
* UTF-8 to local code conversion map
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32 utf; /* UTF-8 */
|
||||
uint32 code; /* local code */
|
||||
typedef struct {
|
||||
uint32 utf; /* UTF-8 */
|
||||
uint32 code; /* local code */
|
||||
} pg_utf_to_local;
|
||||
|
||||
/*
|
||||
* local code to UTF-8 conversion map
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32 code; /* local code */
|
||||
uint32 utf; /* UTF-8 */
|
||||
typedef struct {
|
||||
uint32 code; /* local code */
|
||||
uint32 utf; /* UTF-8 */
|
||||
} pg_local_to_utf;
|
||||
|
||||
/*
|
||||
* UTF-8 to local code conversion map (for combined characters)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32 utf1; /* UTF-8 code 1 */
|
||||
uint32 utf2; /* UTF-8 code 2 */
|
||||
uint32 code; /* local code */
|
||||
typedef struct {
|
||||
uint32 utf1; /* UTF-8 code 1 */
|
||||
uint32 utf2; /* UTF-8 code 2 */
|
||||
uint32 code; /* local code */
|
||||
} pg_utf_to_local_combined;
|
||||
|
||||
/*
|
||||
* local code to UTF-8 conversion map (for combined characters)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32 code; /* local code */
|
||||
uint32 utf1; /* UTF-8 code 1 */
|
||||
uint32 utf2; /* UTF-8 code 2 */
|
||||
typedef struct {
|
||||
uint32 code; /* local code */
|
||||
uint32 utf1; /* UTF-8 code 1 */
|
||||
uint32 utf2; /* UTF-8 code 2 */
|
||||
} pg_local_to_utf_combined;
|
||||
|
||||
/*
|
||||
@ -449,7 +444,7 @@ typedef struct
|
||||
*
|
||||
* if function returns zero, it does not know how to convert the code
|
||||
*/
|
||||
typedef uint32 (*utf_local_conversion_func) (uint32 code);
|
||||
typedef uint32 (*utf_local_conversion_func)(uint32 code);
|
||||
|
||||
/*
|
||||
* Support macro for encoding conversion functions to validate their
|
||||
@ -457,75 +452,58 @@ typedef uint32 (*utf_local_conversion_func) (uint32 code);
|
||||
* here, but we don't want to do that because this header file is also
|
||||
* used by frontends.)
|
||||
*/
|
||||
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding,destencoding) \
|
||||
check_encoding_conversion_args(PG_GETARG_INT32(0), \
|
||||
PG_GETARG_INT32(1), \
|
||||
PG_GETARG_INT32(4), \
|
||||
(srcencoding), \
|
||||
(destencoding))
|
||||
|
||||
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding) \
|
||||
check_encoding_conversion_args(PG_GETARG_INT32(0), PG_GETARG_INT32(1), PG_GETARG_INT32(4), \
|
||||
(srcencoding), (destencoding))
|
||||
|
||||
/*
|
||||
* These functions are considered part of libpq's exported API and
|
||||
* are also declared in libpq-fe.h.
|
||||
*/
|
||||
extern int pg_char_to_encoding(const char *name);
|
||||
extern const char *pg_encoding_to_char(int encoding);
|
||||
extern int pg_valid_server_encoding_id(int encoding);
|
||||
extern int pg_char_to_encoding(const char* name);
|
||||
extern const char* pg_encoding_to_char(int encoding);
|
||||
extern int pg_valid_server_encoding_id(int encoding);
|
||||
|
||||
extern int pg_utf_mblen(const unsigned char *);
|
||||
extern int pg_utf_mblen(const unsigned char*);
|
||||
|
||||
extern unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc);
|
||||
extern unsigned short BIG5toCNS(unsigned short big5, unsigned char* lc);
|
||||
extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc);
|
||||
|
||||
extern void UtfToLocal(const unsigned char *utf, int len,
|
||||
unsigned char *iso,
|
||||
const pg_utf_to_local *map, int mapsize,
|
||||
const pg_utf_to_local_combined *cmap, int cmapsize,
|
||||
utf_local_conversion_func conv_func,
|
||||
int encoding);
|
||||
extern void LocalToUtf(const unsigned char *iso, int len,
|
||||
unsigned char *utf,
|
||||
const pg_local_to_utf *map, int mapsize,
|
||||
const pg_local_to_utf_combined *cmap, int cmapsize,
|
||||
utf_local_conversion_func conv_func,
|
||||
int encoding);
|
||||
extern void UtfToLocal(const unsigned char* utf, int len, unsigned char* iso,
|
||||
const pg_utf_to_local* map, int mapsize,
|
||||
const pg_utf_to_local_combined* cmap, int cmapsize,
|
||||
utf_local_conversion_func conv_func, int encoding);
|
||||
extern void LocalToUtf(const unsigned char* iso, int len, unsigned char* utf,
|
||||
const pg_local_to_utf* map, int mapsize,
|
||||
const pg_local_to_utf_combined* cmap, int cmapsize,
|
||||
utf_local_conversion_func conv_func, int encoding);
|
||||
|
||||
extern bool pg_verifymbstr(const char *mbstr, int len, bool noError);
|
||||
extern bool pg_verify_mbstr(int encoding, const char *mbstr, int len,
|
||||
bool noError);
|
||||
extern int pg_verify_mbstr_len(int encoding, const char *mbstr, int len,
|
||||
bool noError);
|
||||
extern bool pg_verifymbstr(const char* mbstr, int len, bool noError);
|
||||
extern bool pg_verify_mbstr(int encoding, const char* mbstr, int len, bool noError);
|
||||
extern int pg_verify_mbstr_len(int encoding, const char* mbstr, int len, bool noError);
|
||||
|
||||
extern void check_encoding_conversion_args(int src_encoding,
|
||||
int dest_encoding,
|
||||
int len,
|
||||
int expected_src_encoding,
|
||||
int expected_dest_encoding);
|
||||
extern void check_encoding_conversion_args(int src_encoding, int dest_encoding, int len,
|
||||
int expected_src_encoding, int expected_dest_encoding);
|
||||
|
||||
extern void report_invalid_encoding(int encoding, const char *mbstr, int len) ;
|
||||
extern void report_untranslatable_char(int src_encoding, int dest_encoding,
|
||||
const char *mbstr, int len) ;
|
||||
extern void report_invalid_encoding(int encoding, const char* mbstr, int len);
|
||||
extern void report_untranslatable_char(int src_encoding, int dest_encoding, const char* mbstr,
|
||||
int len);
|
||||
|
||||
extern void local2local(const unsigned char *l, unsigned char *p, int len,
|
||||
int src_encoding, int dest_encoding, const unsigned char *tab);
|
||||
extern void pg_ascii2mic(const unsigned char *l, unsigned char *p, int len);
|
||||
extern void pg_mic2ascii(const unsigned char *mic, unsigned char *p, int len);
|
||||
extern void latin2mic(const unsigned char *l, unsigned char *p, int len,
|
||||
int lc, int encoding);
|
||||
extern void mic2latin(const unsigned char *mic, unsigned char *p, int len,
|
||||
int lc, int encoding);
|
||||
extern void latin2mic_with_table(const unsigned char *l, unsigned char *p,
|
||||
int len, int lc, int encoding,
|
||||
const unsigned char *tab);
|
||||
extern void mic2latin_with_table(const unsigned char *mic, unsigned char *p,
|
||||
int len, int lc, int encoding,
|
||||
const unsigned char *tab);
|
||||
extern void local2local(const unsigned char* l, unsigned char* p, int len, int src_encoding,
|
||||
int dest_encoding, const unsigned char* tab);
|
||||
extern void pg_ascii2mic(const unsigned char* l, unsigned char* p, int len);
|
||||
extern void pg_mic2ascii(const unsigned char* mic, unsigned char* p, int len);
|
||||
extern void latin2mic(const unsigned char* l, unsigned char* p, int len, int lc, int encoding);
|
||||
extern void mic2latin(const unsigned char* mic, unsigned char* p, int len, int lc, int encoding);
|
||||
extern void latin2mic_with_table(const unsigned char* l, unsigned char* p, int len, int lc,
|
||||
int encoding, const unsigned char* tab);
|
||||
extern void mic2latin_with_table(const unsigned char* mic, unsigned char* p, int len, int lc,
|
||||
int encoding, const unsigned char* tab);
|
||||
|
||||
extern bool pg_utf8_islegal(const unsigned char *source, int length);
|
||||
extern bool pg_utf8_islegal(const unsigned char* source, int length);
|
||||
|
||||
#ifdef WIN32
|
||||
extern WCHAR *pgwin32_message_to_UTF16(const char *str, int len, int *utf16len);
|
||||
extern WCHAR* pgwin32_message_to_UTF16(const char* str, int len, int* utf16len);
|
||||
#endif
|
||||
|
||||
#endif /* PG_WCHAR_H */
|
||||
#endif /* PG_WCHAR_H */
|
||||
|
@ -455,9 +455,7 @@ ret_t conf_node_set_value(conf_node_t* node, const value_t* v) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return RET_NOT_IMPL;
|
||||
}
|
||||
default: { return RET_NOT_IMPL; }
|
||||
}
|
||||
node->node_type = CONF_NODE_SIMPLE;
|
||||
|
||||
@ -521,9 +519,7 @@ ret_t conf_node_get_value(conf_node_t* node, value_t* v) {
|
||||
value_set_str(v, node->value.small_str);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return RET_NOT_IMPL;
|
||||
}
|
||||
default: { return RET_NOT_IMPL; }
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
@ -560,7 +556,7 @@ static conf_node_t* conf_doc_get_node(conf_doc_t* doc, const char* path,
|
||||
iter = conf_node_find_child_by_index(node, index);
|
||||
if (iter == NULL) {
|
||||
if (index == conf_node_count_children(node)) {
|
||||
if(index == 0) {
|
||||
if (index == 0) {
|
||||
node->node_type = CONF_NODE_ARRAY;
|
||||
}
|
||||
/*append*/
|
||||
|
@ -144,7 +144,7 @@ static ret_t candidates_relayout_children(widget_t* widget) {
|
||||
canvas_set_font(c, font, font_size);
|
||||
for (i = 0; i < nr; i++) {
|
||||
iter = children[i];
|
||||
child_w = candidates_calc_child_width(c, iter) + child_margin* 2;
|
||||
child_w = candidates_calc_child_width(c, iter) + child_margin * 2;
|
||||
if (iter->text.size) {
|
||||
widget_set_visible(iter, TRUE, FALSE);
|
||||
} else {
|
||||
|
@ -311,15 +311,15 @@ static ret_t input_engine_t9ext_set_lang(input_engine_t* engine, const char* lan
|
||||
event_t e = event_init(EVT_IM_LANG_CHANGED, engine->im);
|
||||
|
||||
log_debug("input_engine_t9ext_set_lang: %s\n", lang);
|
||||
if(tk_str_eq (lang, "123")){
|
||||
if (tk_str_eq(lang, "123")) {
|
||||
t9->mode = INPUT_MODE_DIGIT;
|
||||
}else if (tk_str_eq (lang, "abc")){
|
||||
} else if (tk_str_eq(lang, "abc")) {
|
||||
t9->mode = INPUT_MODE_LOWER;
|
||||
}else if (tk_str_eq (lang, "ABC")){
|
||||
} else if (tk_str_eq(lang, "ABC")) {
|
||||
t9->mode = INPUT_MODE_UPPER;
|
||||
}else if (tk_str_eq (lang, "pinyin")){
|
||||
} else if (tk_str_eq(lang, "pinyin")) {
|
||||
t9->mode = INPUT_MODE_ZH;
|
||||
}else {
|
||||
} else {
|
||||
log_debug("not support lang:%s\n", lang);
|
||||
}
|
||||
|
||||
|
@ -424,7 +424,7 @@ static ret_t edit_update_status(widget_t* widget) {
|
||||
}
|
||||
} else {
|
||||
if (edit->cancelable) {
|
||||
if(!wstr_equal(&(edit->saved_text), &(widget->text))) {
|
||||
if (!wstr_equal(&(edit->saved_text), &(widget->text))) {
|
||||
widget_set_state(widget, WIDGET_STATE_CHANGED);
|
||||
return RET_OK;
|
||||
}
|
||||
|
@ -68,7 +68,9 @@ TEST(ConfNode, set_get_str) {
|
||||
ASSERT_EQ(conf_doc_set(doc, "names.[2]", value_set_str(&v, "anny")), RET_OK);
|
||||
|
||||
ASSERT_EQ(conf_doc_save_json(doc, &str), RET_OK);
|
||||
ASSERT_STREQ(str.str, "{\n \"names\" : [\n \"jim\",\n \"tom\",\n \"anny\"\n ]\n}");
|
||||
ASSERT_STREQ(
|
||||
str.str,
|
||||
"{\n \"names\" : [\n \"jim\",\n \"tom\",\n \"anny\"\n ]\n}");
|
||||
|
||||
conf_doc_destroy(doc);
|
||||
}
|
||||
|
@ -9,4 +9,3 @@ TEST(Encoding, basic) {
|
||||
ASSERT_EQ(encoding_gbk_to_utf8(gbk, strlen(gbk), utf8, sizeof(utf8)), RET_OK);
|
||||
ASSERT_STREQ(str, utf8);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,8 @@ TEST(ScrollBar, to_xml) {
|
||||
str_init(&str, 1024);
|
||||
|
||||
ASSERT_EQ(widget_to_xml(w, &str), RET_OK);
|
||||
ASSERT_EQ(string(str.str), string("<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<scroll_bar_d x=\"10\" y=\"20\" w=\"30\" h=\"400\" "
|
||||
ASSERT_EQ(string(str.str), string("<?xml version='1.0' encoding='UTF-8' standalone='yes' "
|
||||
"?>\r\n<scroll_bar_d x=\"10\" y=\"20\" w=\"30\" h=\"400\" "
|
||||
"animatable=\"true\">\n</scroll_bar_d>\n"));
|
||||
|
||||
str_reset(&str);
|
||||
|
@ -83,7 +83,6 @@ TEST(SList, tail_pop) {
|
||||
ASSERT_EQ(slist_append(s, TO_POINTER(4)), RET_OK);
|
||||
ASSERT_EQ(slist_append(s, TO_POINTER(5)), RET_OK);
|
||||
|
||||
|
||||
ASSERT_EQ(TO_INT(slist_tail_pop(s)), 5);
|
||||
ASSERT_EQ(TO_INT(slist_head_pop(s)), 1);
|
||||
|
||||
|
@ -33,13 +33,12 @@ TEST(SpinBox, to_xml) {
|
||||
|
||||
str_init(&str, 1024);
|
||||
ASSERT_EQ(widget_to_xml(w1, &str), RET_OK);
|
||||
ASSERT_EQ(
|
||||
string(str.str),
|
||||
string(
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<spin_box x=\"10\" y=\"20\" w=\"30\" h=\"40\" focusable=\"true\" min=\"0\" max=\"1024\" "
|
||||
"input_type=\"0\" readonly=\"false\" auto_fix=\"false\" left_margin=\"2\" "
|
||||
"right_margin=\"21\" top_margin=\"2\" bottom_margin=\"2\" action_text=\"done\" "
|
||||
"password_visible=\"false\">\n</spin_box>\n"));
|
||||
ASSERT_EQ(string(str.str),
|
||||
string("<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<spin_box x=\"10\" "
|
||||
"y=\"20\" w=\"30\" h=\"40\" focusable=\"true\" min=\"0\" max=\"1024\" "
|
||||
"input_type=\"0\" readonly=\"false\" auto_fix=\"false\" left_margin=\"2\" "
|
||||
"right_margin=\"21\" top_margin=\"2\" bottom_margin=\"2\" action_text=\"done\" "
|
||||
"password_visible=\"false\">\n</spin_box>\n"));
|
||||
|
||||
str_reset(&str);
|
||||
widget_destroy(w1);
|
||||
|
@ -17,7 +17,9 @@ TEST(UISerializer, basic) {
|
||||
str_init(&str, 1024);
|
||||
widget_to_xml(w, &str);
|
||||
|
||||
ASSERT_EQ(string(str.str), "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<button x=\"10\" y=\"20\" w=\"30\" h=\"40\">\n</button>\n");
|
||||
ASSERT_EQ(string(str.str),
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<button x=\"10\" y=\"20\" "
|
||||
"w=\"30\" h=\"40\">\n</button>\n");
|
||||
|
||||
str_reset(&str);
|
||||
widget_destroy(w);
|
||||
@ -31,7 +33,8 @@ TEST(UISerializer, repeat) {
|
||||
widget_to_xml(w, &str);
|
||||
|
||||
ASSERT_EQ(string(str.str),
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<button x=\"10\" y=\"20\" w=\"30\" h=\"40\" repeat=\"100\">\n</button>\n");
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<button x=\"10\" y=\"20\" "
|
||||
"w=\"30\" h=\"40\" repeat=\"100\">\n</button>\n");
|
||||
|
||||
str_reset(&str);
|
||||
widget_destroy(w);
|
||||
@ -45,7 +48,8 @@ TEST(UISerializer, layout_self) {
|
||||
widget_to_xml(w, &str);
|
||||
|
||||
ASSERT_EQ(string(str.str),
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<button x=\"10\" y=\"20\" w=\"30\" h=\"40\" "
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<button x=\"10\" y=\"20\" "
|
||||
"w=\"30\" h=\"40\" "
|
||||
"self_layout=\"default(x=r:100,y=m:10,w=0,h=10%)\">\n</button>\n");
|
||||
|
||||
str_reset(&str);
|
||||
@ -61,7 +65,8 @@ TEST(UISerializer, layout_self1) {
|
||||
widget_to_xml(w, &str);
|
||||
|
||||
ASSERT_EQ(string(str.str),
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<button x=\"10\" y=\"20\" w=\"30\" h=\"40\" "
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<button x=\"10\" y=\"20\" "
|
||||
"w=\"30\" h=\"40\" "
|
||||
"self_layout=\"default(x=c:100,y=b:10,w=0,h=10%)\">\n</button>\n");
|
||||
|
||||
str_reset(&str);
|
||||
|
@ -47,7 +47,7 @@ ret_t font_gen(font_t* font, uint16_t font_size, const char* str, const char* ou
|
||||
|
||||
uint32_t size = font_gen_buff(font, font_size, str, &wbuffer);
|
||||
|
||||
if(strstr(output_filename, ".bin") != NULL) {
|
||||
if (strstr(output_filename, ".bin") != NULL) {
|
||||
file_write(output_filename, wbuffer.data, size);
|
||||
} else {
|
||||
output_res_c_source(output_filename, theme, ASSET_TYPE_FONT, ASSET_TYPE_FONT_BMP, wbuffer.data,
|
||||
|
Loading…
x
Reference in New Issue
Block a user