Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 7 - Translation Manager


Summary of the Translation Manager

This section provides Pascal, C, and assembly-language summaries for the constants, data types, and routines provided by the Translation Manager for use by applications. For a summary of the constants, data types, and routines that you can use or need to define if you're writing a translation extension, see "Summary of Translation Extensions" beginning on page 7-68.

Pascal Summary

Constants

CONST
   {Gestalt selectors and response bit numbers}
   gestaltTranslationAttr                 = 'xlat';   {Translation Manager}
   gestaltTranslationMgrExists            = 0;        {TM is present}

   gestaltStandardFileAttr                = 'stdf';   {Standard File Package}
   gestaltStandardFile58                  = 0;
   gestaltStandardFileTranslationAware    = 1;
   gestaltStandardFileHasColorIcons       = 2;

   gestaltEditionMgrAttr                  = 'edtn';   {Edition Manager}
   gestaltEditionMgrPresent               = 0;
   gestaltEditionMgrTranslationAware      = 1;

   gestaltScrapMgrAttr                    = 'scra';   {Scrap Manager}
   gestaltScrapMgrTranslationAware        = 0;

Data Types

TYPE
   FileType                = OSType;                  {file types}
   ScrapType               = ResType;                 {scrap types}
   FileTypePtr             = ^FileType;
   FileTranslationSpec     = ARRAY[1..12] OF LongInt;
   TypesBlock              = ARRAY[0..63] OF FileType;
   TypesBlockPtr           = ^TypesBlock;
   DocOpenMethod           = (domCannot,
                              domNative,
                              domTranslateFirst,
                              domWildcard);

Translation Manager Routines

Getting Translation Information

FUNCTION GetFileTypesThatAppCanNativelyOpen
                              (appVRefNumHint: Integer; appSignature: OSType; 
                               VAR nativeTypes: TypesBlock): OSErr;
FUNCTION ExtendFileTypeList
                              (originalTypeList: FileTypePtr; 
                               numberOriginalTypes: Integer; 
                               extendedTypeList: FileTypePtr; 
                               VAR numberExtendedTypes: Integer): OSErr;
FUNCTION CanDocBeOpened       (targetDocument: FSSpec; 
                               appVRefNumHint: Integer; 
                               appSignature: OSType; 
                               nativeTypes: TypesBlockPtr; 
                               onlyNative: Boolean; 
                               VAR howToOpen: DocOpenMethod; 
                               VAR howToTranslate: FileTranslationSpec) 
                               : OSErr;

Translating Files

FUNCTION TranslateFile        (sourceDocument: FSSpec; 
                               destinationDocument: FSSpec; 
                               howToTranslate: FileTranslationSpec): OSErr;

C Summary

Constants

/*Gestalt selectors and response bit numbers*/
enum {
   #define gestaltTranslationAttr      'xlat'   /*Translation Manager*/
   gestaltTranslationMgrExists            = 0      /*TM is present*/
};
enum {
   #define gestaltStandardFileAttr              'stdf'   /*Std File Package*/
   gestaltStandardFile58                        = 0,
   gestaltStandardFileTranslationAware          = 1,
   gestaltStandardFileHasColorIcons             = 2
};
enum {
   #define gestaltEditionMgrAttr                'edtn'   /*Edition Manager*/
   gestaltEditionMgrPresent                     = 0,
   gestaltEditionMgrTranslationAware            = 1
};
enum {
   #define gestaltScrapMgrAttr                  'scra'   /*Scrap Manager*/
   gestaltScrapMgrTranslationAware              = 0
};
enum {domCannot, domNative, domTranslateFirst, domWildcard};

Data Types

typedef OSType             FileType;                  /*file types*/
typedef ResType            ScrapType;                 /*scrap types*/
typedef long               FileTranslationSpec[12];
typedef short              DocOpenMethod;

Translation Manager Routines

Getting Translation Information

pascal OSErr GetFileTypesThatAppCanNativelyOpen
                              (short appVRefNumHint, OSType appSignature, 
                               FileType* nativeTypes);
pascal OSErr ExtendFileTypeList
                              (const FileType* originalTypeList, 
                               short numberOriginalTypes, 
                               FileType* extendedTypeList, 
                               short* numberExtendedTypes);
pascal OSErr CanDocBeOpened
                              (const FSSpec* targetDocument, 
                               short appVRefNumHint, 
                               OSType appSignature, 
                               const FileType* nativeTypes, 
                               Boolean onlyNative, 
                               DocOpenMethod* howToOpen, 
                               FileTranslationSpec* howToTranslate);

Translating Files

pascal OSErr TranslateFile    (const FSSpec* sourceDocument, 
                               const FSSpec* destinationDocument, 
                               const FileTranslationSpec* howToTranslate);

Assembly-Language Summary

Data Structures

File Translation Specification
0data48 bytesprivate data used by the Translation Manager

Trap Macros

Trap Macros Requiring Routine Selectors

_TranslationDispatch
SelectorRoutine
$0009ExtendFileTypeList
$000CTranslateFile
$001CGetFileTypesThatAppCanNativelyOpen
$001ECanDocBeOpened

Result Codes
noErr0No error
dirFulErr-33Directory full
dskFulErr-34Not enough disk space to translate file
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename
tmfoErr-42Too many files open
fnfErr-43File not found
wPrErr-44Disk is write protected
fLckdErr-45File is locked
vLckdErr-46Volume is locked
dupFNErr-48Duplicate filename (rename)
opWrErr-49File already open with write permission
paramErr-50Parameter error
extFSErr-58External file system
noTypeErr-102Unrecognized file type
memFullErr-108Not enough RAM to translate file
dirNFErr-120Directory not found or incomplete pathname
wrgVolTypErr-123Volume does not support Desktop Manager
userCanceledErr-128The user canceled the translation
invalidTranslationPathErr-3025howToTranslate is invalid
noTransSysInstalledErr-3027No translation systems installed
noTranslationPathErr-3030Application cannot open document
badTranslationSpecErr-3031Translation path is invalid
noPrefAppErr-3032No translation preference available
afpItemNotFound-5012Could not determine kind string; or, application information not found


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996