![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Ydict的内存池结构 within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Translation by philpw99: Title: YDict memory pool structure. This is the way I summarized when I was developing uo_ydict(unofficial ydict). ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
|
Translation by philpw99:
Title: YDict memory pool structure. This is the way I summarized when I was developing uo_ydict(unofficial ydict). Maybe it will be useful for programming dictionary apps: Explanation(please refering to the map): 1. Every entrance of the dictionary file copy has the corresponding explanation( a long string, not including the word itself, 0 in the middle is allowed, not fixed length). 2. Every entrance of the index file copy has the word itself(not fixed length, 0 as the end, just like the +9 in the source code is considering the last 0 and following 8 bytes.) followed by 8 bytes offset and the length of explanation (pending confirmation). 3. The space that Word array defined has saved N 32bit pointers in order(N is the total words), pointing to the corresponding index file copy addresses(every item has a fixed length of 32bit). The procedure of searching: According to the above data structure we know that the index file is not used for high-speed searching, because every item includes a not fixed length word and an offset. So if use it to search, every time to find a pointer we have to use "strlen" to to calculate the address of the next pointer. Wordarray is exactly the method used to do the highspeed search. It used "strlen" to calculate every word's pointer in the index file copy and save them in wordarray beforehand. So when searching it's just like direct addressing. Take searching for "Apple" as an example, starts as we find the first value in wordarray, then we find the address of the first word in the index file copy, and we compare the word "apple" with the first string(the word itself) pointed by index file copy, comparation will fail, then we look for the next value in wordarray. When "apple" is successfully paired with the first string pointed by the index file copy, we can get the offset and explanation length of "apple" in the dictionary file from index file copy. This way we can get the long string for the explanation of "apple". 这是我在做 uo_YDICT(UnOfficial YDICT) 的过程中总结的,可能对开发词典类软件有 用: 说明(请参考图): 1. 词典文件镜像的每个入口保存对应释义(一个大字符串, 不包含单词本身,中间可以含0,不定长) 。 2. 索引文件镜像每个入口保存单词本身(不定长,0结尾, 源程序中+9就是考虑到这个末尾0和随后的8字节), 随后紧跟8字节的偏移量和释义大小(待确 认)。 3. Wordarray所指空间依次保存总词汇量个32位 指针,分别指向对应位序单词的索引文件镜像地址(每项 定长32位)。 查询过程: 由以上数据结构可知索引文件镜像是不能直接用来高速检 索的,因为它的每一项包含不定长的单词本身和一个偏移 量,即是不定长的。如果直接用它来检索,每检索一个入 口都要调用一次strlen来计算下一个入口的地址。 Wordarray就是用来实现高速检索,它事先依次 调用strlen把所有单词的索引文件镜像入口指针都 计算出来保存在wordarray里,这样检索时就是 直接寻址了。 以查询单词apple为例,首先检查wordarra y的第一个值,从而找到词典第一个单词索引文件镜像的 地址,于是将apple与该索引文件镜像入口的第一个 字符串(该单词本身)进行对比,比对失败,则再检查w ordarray的下一个值。当apple与该索引文 件镜像入口的第一个字符串匹配成功时,从该索引文件镜 像入口取得apple在词典文件镜像中的偏移量和释义 大小,从而就可以获得apple释义对应 的大字符串。 Last edited by xwh1225; 01-17-2006 at 06:26 PM.. |
|
|
|
|
|
|
#4 |
![]() |
Yep! i understand you completley
do go on
__________________
[FIELDSET="Thanks to:"]Nights, Scorned. Thanks :D You guys rock![/FIELDSET] [SPOILER="Sig"][FIELDSET="Sig"]Success is getting what you want, happiness is wanting what you get. ;-)[/FIELDSET][/SPOILER] |
|
|
|
|
|
#5 |
![]() |
Guys..if you don't have anything constructive, do not say it.
From a translation, I can get that: This is an unofficial release of Ydict (The Chinese--English Dictionary for PSP). The major change includes the addition of wordarray and what may seem to be a faster method of retrieving the necessary information. You know who we need? Jeff Chen!! and someone who can understand software dictionary talk :P |
|
|
|
|
|
#7 |
![]() |
Many of you also need to realize that we do not have separate forums for our Chinese and Spanish versions of PSPUpdates - they all come here. Besides, that's half the fun of living in a technological world where there are no borders.
__________________
[center][b] [url="http://forums.qj.net/showthread.php?p=177883"][color=Orange] The Definitive MPH Firmware Downgrade FAQ [url="http://forums.qj.net/showthread.php?t=2641"][COLOR=DarkRed]Pre-Made Homebrew for 1.50!! [/COLOR][/url][/color][/url][/b][/center] [CENTER][b][url="http://forums.qj.net/showthread.php?t=2189"][color=Red]Ultimate Homebrew Guide[/color][/url][/b][/CENTER] [center][size=1][color=Gray]-------------------------------------[/color][/size][/center] [center][b]Read about[/b] [url="http://forums.qj.net/showthread.php?t=9708"][color=Purple][b]Operation: PSPositive Posting[/b][/color][/url] [b] Read the [url="http://forums.qj.net/showthread.php?t=2047"]Posting Guidelines[/url][/b] [center][b]Read the [url="http://forums.qj.net/showthread.php?t=4394"][color=Green]Piracy Policy[/color][/url][/b] [/center] [/center] [center][size=1][color=Gray]-------------------------------------[/color][/size][/center] [center][color=Navy][b][size=1]Check Out Our Sister Sites[/size][/b][/color][/center] [center][size=1][color=Navy][url="http://www.ps3updates.com/"][color=Teal]PS3Updates[/color][/url] [url="http://www.360updates.com/"][color=Teal]360Updates[/color][/url] [url="http://www.ndsupdates.com/"][color=Teal]NDSUpdates[/color][/url] [url="http://www.nrupdates.com/"][color=Teal]NRUpdates[/color][/url][/color][/size] [/center] |
|
|
|
|
|
#9 | |
![]() ![]() Wake up the sleepers.
Join Date: Jun 2005
Real First Name: Esteban
Location: Dayton, Ohio.
Just Played: Need For Speed: Shift
Posts: 433
Trader Feedback: 0
|
Quote:
|
|
|
|
|
|
|
#11 |
|
Translation:
Title: YDict memory pool structure. This is the way I summarized when I was developing uo_ydict(unofficial ydict). Maybe it will be useful for programming dictionary apps: Explanation(please refering to the map): 1. Every entrance of the dictionary file copy has the corresponding explanation( a long string, not including the word itself, 0 in the middle is allowed, not fixed length). 2. Every entrance of the index file copy has the word itself(not fixed length, 0 as the end, just like the +9 in the source code is considering the last 0 and following 8 bytes.) followed by 8 bytes offset and the length of explanation (pending confirmation). 3. The space that Word array defined has saved N 32bit pointers in order(N is the total words), pointing to the corresponding index file copy addresses(every item has a fixed length of 32bit). The procedure of searching: According to the above data structure we know that the index file is not used for high-speed searching, because every item includes a not fixed length word and an offset. So if use it to search, every time to find a pointer we have to use "strlen" to to calculate the address of the next pointer. Wordarray is exactly the method used to do the highspeed search. It used "strlen" to calculate every word's pointer in the index file copy and save them in wordarray beforehand. So when searching it's just like direct addressing. Take searching for "Apple" as an example, starts as we find the first value in wordarray, then we find the address of the first word in the index file copy, and we compare the word "apple" with the first string(the word itself) pointed by index file copy, comparation will fail, then we look for the next value in wordarray. When "apple" is successfully paired with the first string pointed by the index file copy, we can get the offset and explanation length of "apple" in the dictionary file from index file copy. This way we can get the long string for the explanation of "apple". Attached image: YDICT memory pool structure as following: |dictfilep(memory pool first address)| --- |Dictionary file mirror| |size: dictfilesize| |unused | idxfilep(xxxxxx000) ---- |index file copy(mirror) | |size: idxfilesize| |unused | wordarray(xxxxx000) ----|saving every word's pointer in index file copy in order (each address ) 32 bit | size: count of total words * 4 bytes | |
|
|
|
|
|
|
#12 | |
![]() |
Quote:
|
|
|
|
|
![]() |
| Tags |
| ydict |
| Thread Tools | |
|
|