I want to create a custom dictionary which can be used by
Dictionary.app with Dictionary Manager.
Sorry, currently there is no public information to create
dictionaries usable by Dictionary.app. It is considered being
published in the future system release.
4) DCMGetDictionaryFieldInfo(), AEGetDescDataSize() and
AEGetDescData() returns a "field info record", whose
'descriptorType' field is 'list' and the 'dataHandle field' points
to a 420 bytes lengthed memory block. So, what is "field info
record"?
"Field info record" consists of various information of each "field"
data category corresponding to name and address in an address book.
Each field is represented by four characters "tag" and has various
information such as data type and maximum length. Dictionaries must
have at least one "key field" which is indexed and can be used for
searching.
DCMGetNextRecord(dictRef, '****', 0, NULL, 0, maxKeySize,
&nextKeySize, dataBuf, &nextUniqueID); should return the 1st
record in this dictionary. But I always get a -7113 error, which
means "no such field exists".
Unfortunately, you cannot iterate all records in Oxford dictionaries
by this function since those dictionaries have kDCMProhibitListing
(=1) value in pDCMListing (='list') property as you found. Please
see: <http://developer.apple.com/documentation/Carbon/Reference/
Dictionary_Manager/dm_refchap/chapter_38.4_section_11.html#//
apple_ref/doc/uid/TP30000141-DontLinkChapterID_4-C008792>
Of course, you can search Oxford dictionaries with a particular
keyword using Dictionary Manager API. The key field of Oxford
dictionaries is 'dsky' and body text is stored in 'dsbd' field as
xml. Followings are sample code of searching Oxford dictionary for
your information.
// Iterate found records
while ( true )
{
// Iterate a key from found key list
err = DCMIterateFoundRecord( recordIterator, sizeof
(keyBuffer), &keySize,
keyBuffer, &uniqueID, NULL);
if ( err != noErr ) break;
// Retrieve data record which belongs to iterated key
err = DCMGetFieldData( dictionaryRef, keyFieldTag, keySize,
keyBuffer,
uniqueID, 1, &dataFieldTag,
&dataDescList);
if ( err != noErr ) break;
// Retrieve XML body text which belongs to retrieved data
record
AESizeOfKeyDesc( &dataDescList, dataFieldTag, &dataType,
&dataSize);
dataBuffer = (UniChar*)malloc( dataSize);
err = AEGetKeyPtr( &dataDescList, dataFieldTag,
typeUnicodeText,
&dataType, dataBuffer, dataSize, &dataSize);
dataString = CFStringCreateWithCharacters( NULL, dataBuffer,
dataSize / sizeof(UniChar));
CFShow( dataString);
----
Keisuke Hara
Senior Software Engineer
Apple Japan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden