home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Aliases.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  5.5 KB  |  161 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Aliases.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Aliases;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __ALIASES__}
  27. {$SETC __ALIASES__ := 1}
  28.  
  29. {$I+}
  30. {$SETC AliasesIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __APPLETALK__}
  40. {$I AppleTalk.p}
  41. {$ENDC}
  42. {    OSUtils.p                                                    }
  43. {        MixedMode.p                                                }
  44. {        Memory.p                                                }
  45.  
  46. {$IFC UNDEFINED __FILES__}
  47. {$I Files.p}
  48. {$ENDC}
  49.  
  50. {$PUSH}
  51. {$ALIGN MAC68K}
  52. {$LibExport+}
  53.  
  54. CONST
  55.     rAliasType                    = 'alis';                        { Aliases are stored as resources of this type }
  56. { define alias resolution action rules mask }
  57.     kARMMountVol                = $00000001;                    { mount the volume automatically }
  58.     kARMNoUI                    = $00000002;                    { no user interface allowed during resolution }
  59.     kARMMultVols                = $00000008;                    { search on multiple volumes }
  60.     kARMSearch                    = $00000100;                    { search quickly }
  61.     kARMSearchMore                = $00000200;                    { search further }
  62.     kARMSearchRelFirst            = $00000400;                    { search target on a relative path first }
  63. { define alias record information types }
  64.     asiZoneName                    = -3;                            { get zone name }
  65.     asiServerName                = -2;                            { get server name }
  66.     asiVolumeName                = -1;                            { get volume name }
  67.     asiAliasName                = 0;                            { get aliased file/folder/volume name }
  68.     asiParentName                = 1;                            { get parent folder name }
  69.  
  70. { define the alias record that will be the blackbox for the caller }
  71.  
  72. TYPE
  73.     AliasRecord = RECORD
  74.         userType:                OSType;                                    { appl stored type like creator type }
  75.         aliasSize:                INTEGER;                                { alias record size in bytes, for appl usage }
  76.     END;
  77.     AliasPtr = ^AliasRecord;
  78.     AliasHandle = ^AliasPtr;
  79.  
  80. { alias record information type }
  81.     AliasInfoType = INTEGER;
  82.  
  83.     AliasFilterProcPtr = ProcPtr;  { FUNCTION AliasFilter(cpbPtr: CInfoPBPtr; VAR quitFlag: BOOLEAN; myDataPtr: Ptr): BOOLEAN; }
  84.     AliasFilterUPP = UniversalProcPtr;
  85.  
  86. CONST
  87.     uppAliasFilterProcInfo = $00000FD0; { FUNCTION (4 byte param, 4 byte param, 4 byte param): 1 byte result; }
  88.  
  89. FUNCTION NewAliasFilterProc(userRoutine: AliasFilterProcPtr): AliasFilterUPP;
  90.     {$IFC NOT GENERATINGCFM }
  91.     INLINE $2E9F;
  92.     {$ENDC}
  93.  
  94. FUNCTION CallAliasFilterProc(cpbPtr: CInfoPBPtr; VAR quitFlag: BOOLEAN; myDataPtr: Ptr; userRoutine: AliasFilterUPP): BOOLEAN;
  95.     {$IFC NOT GENERATINGCFM}
  96.     INLINE $205F, $4E90;
  97.     {$ENDC}
  98.  
  99. FUNCTION NewAlias(fromFile: ConstFSSpecPtr; {CONST}VAR target: FSSpec; VAR alias: AliasHandle): OSErr;
  100.     {$IFC NOT GENERATINGCFM}
  101.     INLINE $7002, $A823;
  102.     {$ENDC}
  103. { create a minimal new alias for a target and return alias record handle }
  104. FUNCTION NewAliasMinimal({CONST}VAR target: FSSpec; VAR alias: AliasHandle): OSErr;
  105.     {$IFC NOT GENERATINGCFM}
  106.     INLINE $7008, $A823;
  107.     {$ENDC}
  108. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  }
  109. FUNCTION NewAliasMinimalFromFullPath(fullPathLength: INTEGER; fullPath: UNIV Ptr; zoneName: ConstStr32Param; serverName: ConstStr31Param; VAR alias: AliasHandle): OSErr;
  110.     {$IFC NOT GENERATINGCFM}
  111.     INLINE $7009, $A823;
  112.     {$ENDC}
  113. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  114. FUNCTION ResolveAlias(fromFile: ConstFSSpecPtr; alias: AliasHandle; VAR target: FSSpec; VAR wasChanged: BOOLEAN): OSErr;
  115.     {$IFC NOT GENERATINGCFM}
  116.     INLINE $7003, $A823;
  117.     {$ENDC}
  118. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  119. FUNCTION GetAliasInfo(alias: AliasHandle; index: AliasInfoType; VAR theString: Str63): OSErr;
  120.     {$IFC NOT GENERATINGCFM}
  121.     INLINE $7007, $A823;
  122.     {$ENDC}
  123.   Given a file spec, return target file spec if input file spec is an alias.
  124.   It resolves the entire alias chain or one step of the chain.  It returns
  125.   info about whether the target is a folder or file; and whether the input
  126.   file spec was an alias or not. 
  127. }
  128. FUNCTION ResolveAliasFile(VAR theSpec: FSSpec; resolveAliasChains: BOOLEAN; VAR targetIsFolder: BOOLEAN; VAR wasAliased: BOOLEAN): OSErr;
  129.     {$IFC NOT GENERATINGCFM}
  130.     INLINE $700C, $A823;
  131.     {$ENDC}
  132. FUNCTION FollowFinderAlias(fromFile: ConstFSSpecPtr; alias: AliasHandle; logon: BOOLEAN; VAR target: FSSpec; VAR wasChanged: BOOLEAN): OSErr;
  133.     {$IFC NOT GENERATINGCFM}
  134.     INLINE $700F, $A823;
  135.     {$ENDC}
  136.    Low Level Routines 
  137.  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  138. }
  139. FUNCTION MatchAlias(fromFile: ConstFSSpecPtr; rulesMask: LONGINT; alias: AliasHandle; VAR aliasCount: INTEGER; aliasList: FSSpecArrayPtr; VAR needsUpdate: BOOLEAN; aliasFilter: AliasFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  140.     {$IFC NOT GENERATINGCFM}
  141.     INLINE $7005, $A823;
  142.     {$ENDC}
  143. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  144. FUNCTION UpdateAlias(fromFile: ConstFSSpecPtr; {CONST}VAR target: FSSpec; alias: AliasHandle; VAR wasChanged: BOOLEAN): OSErr;
  145.     {$IFC NOT GENERATINGCFM}
  146.     INLINE $7006, $A823;
  147.     {$ENDC}
  148.  
  149. {$ALIGN RESET}
  150. {$POP}
  151.  
  152. {$SETC UsingIncludes := AliasesIncludes}
  153.  
  154. {$ENDC} {__ALIASES__}
  155.  
  156. {$IFC NOT UsingIncludes}
  157.  END.
  158. {$ENDC}
  159.