QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

Ydict的内存池结构

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). ...

Reply
 
LinkBack Thread Tools
Old 01-17-2006, 09:06 AM   #1
 
Join Date: Jan 2006
Posts: 7
Trader Feedback: 0
Default Ydict的内存池结构(YDict memory pool structure)

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释义对应 的大字符串。
Attached Thumbnails
Ydict的内存池结构-ydict-memory-pool-structure.jpg  

Last edited by xwh1225; 01-17-2006 at 06:26 PM..
xwh1225 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 09:08 AM   #2
 
Captain Bodymod's Avatar
 
Join Date: Jan 2006
Location: Ireland
Posts: 9,126
Trader Feedback: 0
Default

Come again?
Captain Bodymod is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 09:23 AM   #3
Think, Do, Gloat.
 
TPTaylor's Avatar
 
Join Date: Nov 2005
Location: England, Norwich
Posts: 1,422
Trader Feedback: 0
Default

i can pick up that you are talking about uo_dictionary uo_dict . the rest is a blur i'm afriad
TPTaylor is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 09:55 AM   #4
 

 
Join Date: Aug 2005
Location: Your Nightmares
Posts: 1,164
Trader Feedback: 0
Default

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]
filberto is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 10:02 AM   #5
 
FrozenIpaq's Avatar
 
Join Date: Jun 2005
Posts: 2,986
Trader Feedback: 0
Default

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
FrozenIpaq is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 10:18 AM   #6
 
Join Date: Nov 2005
Location: Low Gap
Posts: 246
Trader Feedback: 0
Default

I hate to say this, but I gathered that most people on this forum don't know many foreign languages. Regarding the first poster, I would suggest going to a forum that is more multilingual.
Anotsu is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 10:33 AM   #7
 
Jake's Avatar
 
Join Date: May 2005
Location: Oklahoma
Posts: 4,848
Trader Feedback: 0
Default

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]
Jake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 10:39 AM   #8
hii
 
Join Date: Jan 2006
Location: NY
Posts: 58
Trader Feedback: 0
Default

why don't he use his chinese--english dictionary that he made

Last edited by hii; 01-17-2006 at 10:42 AM..
hii is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 10:42 AM   #9

Wake up the sleepers.
 
Synyster gates's Avatar
 
Join Date: Jun 2005
Real First Name: Esteban
Location: Dayton, Ohio.
Just Played: Need For Speed: Shift
Posts: 433
Trader Feedback: 0
Default

Quote:
Originally Posted by MalumEnSe
Besides, that's half the fun of living in a technological world where there are no borders.
infierno sí!!!!
Synyster gates is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 12:34 PM   #10
Think, Do, Gloat.
 
TPTaylor's Avatar
 
Join Date: Nov 2005
Location: England, Norwich
Posts: 1,422
Trader Feedback: 0
Default

Quote:
Originally Posted by hii
why don't he use his chinese--english dictionary that he made
now theres a thought!
ah well, if you can understand, congrats on working on it!
TPTaylor is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 03:24 PM   #11
 
Join Date: Jul 2005
Posts: 18
Trader Feedback: 0
Default

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 |
philpw99 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 03:25 PM   #12
 
FrozenIpaq's Avatar
 
Join Date: Jun 2005
Posts: 2,986
Trader Feedback: 0
Default

Quote:
Originally Posted by MalumEnSe
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.
Hey..but we do have a China.PSPupdates right? They have their own forum as well :P
FrozenIpaq is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 05:58 PM   #13
 
Join Date: Jan 2006
Posts: 7
Trader Feedback: 0
Thumbs up

Thank you philpw99. You translation is so great ! By the way, I come here because I think it's the right place to find enough good coders. Next time I will translate before making a new thread.
xwh1225 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-17-2006, 06:04 PM   #14
 
Join Date: Jun 2005
Location: London
Posts: 1,384
Trader Feedback: 0
Default

Quote:
Originally Posted by T-baggins
infierno sí!!!!
let me add to that...

!!!لا شك

Translation: No Doubt!!!
Transliteration: Laa Shak!!!
-Z-MAN is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
ydict&#&#&#&#&#&#

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 05:16 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us