Package Name: aliases
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Extensions; use Interfaces.C.Extensions;
with Types; use Types;
with Files; use Files;
package Aliases is
--
-- File: Aliases.h
--
-- Contains: Alias Manager Interfaces.
--
-- Version: Technology: System 7.5
-- Package: Universal Interfaces 2.0 in ÒMPW LatestÓ on ETO #17
--
-- Copyright: © 1984-1995 by Apple Computer, Inc.
-- All rights reserved.
--
rAliasType : constant types.OSType:= types.ToRes("alis"); -- Aliases are stored as resources of this type
-- define alias resolution action rules mask
kARMMountVol : constant := 16#00000001#; -- mount the volume automatically
kARMNoUI : constant := 16#00000002#; -- no user interface allowed during resolution
kARMMultVols : constant := 16#00000008#; -- search on multiple volumes
kARMSearch : constant := 16#00000100#; -- search quickly
kARMSearchMore : constant := 16#00000200#; -- search further
kARMSearchRelFirst : constant := 16#00000400#; -- search target on a relative path first
-- define alias record information types
asiZoneName : constant := -3; -- get zone name
asiServerName : constant := -2; -- get server name
asiVolumeName : constant := -1; -- get volume name
asiAliasName : constant := 0; -- get aliased file/folder/volume name
asiParentName : constant := 1; -- get parent folder name
-- define the alias record that will be the blackbox for the caller
type AliasRecord is
record
userType : OSType; -- appl stored type like creator type
aliasSize : unsigned_short; -- alias record size in bytes, for appl usage
end record;
type AliasPtr is Access AliasRecord;
type AliasHandle is Access AliasPtr;
-- alias record information type
subtype AliasInfoType is Short_Integer;
type AliasFilterProcPtr is access function (cpbPtr
: in CInfoPBPtr; quitFlag
: access Boolean; myDataPtr
: in Ptr) return Boolean;
subtype AliasFilterUPP is UniversalProcPtr;
function NewAlias
(fromFile : in FSSpecPtr;
target : access FSSpec;
alias : access AliasHandle)
return OSErr;
pragma Import (C, NewAlias, "NewAlias", "NewAlias");
-- create a minimal new alias for a target and return alias record handle
function NewAliasMinimal
(target : access FSSpec;
alias : access AliasHandle)
return OSErr;
pragma Import (C, NewAliasMinimal, "NewAliasMinimal", "NewAliasMinimal");
-- create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle
function NewAliasMinimalFromFullPath
(fullPathLength : in Short_Integer;
fullPath : in Void_Ptr;
zoneName : access Str255;
serverName : access Str255;
alias : access AliasHandle)
return OSErr;
pragma Import (C, NewAliasMinimalFromFullPath, "NewAliasMinimalFromFullPath", "NewAliasMinimalFromFullPath");
-- given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag.
function ResolveAlias
(fromFile : in FSSpecPtr;
alias : in AliasHandle;
target : access FSSpec;
wasChanged : access Boolean)
return OSErr;
pragma Import (C, ResolveAlias, "ResolveAlias", "ResolveAlias");
-- given an alias handle and an index specifying requested alias information type, return the information from alias record as a string.
function GetAliasInfo
(alias : in AliasHandle;
index : in AliasInfoType;
theString : access Str255)
return OSErr;
pragma Import (C, GetAliasInfo, "GetAliasInfo", "GetAliasInfo");
-- Given a file spec, return target file spec if input file spec is an alias.
-- It resolves the entire alias chain or one step of the chain. It returns
-- info about whether the target is a folder or file; and whether the input
-- file spec was an alias or not.
function ResolveAliasFile
(theSpec : access FSSpec;
resolveAliasChains : in Boolean;
targetIsFolder : access Boolean;
wasAliased : access Boolean)
return OSErr;
pragma Import (C, ResolveAliasFile, "ResolveAliasFile", "ResolveAliasFile");
function FollowFinderAlias
(fromFile : in FSSpecPtr;
alias : in AliasHandle;
logon : in Boolean;
target : access FSSpec;
wasChanged : access Boolean)
return OSErr;
pragma Import (C, FollowFinderAlias, "FollowFinderAlias", "FollowFinderAlias");
-- Low Level Routines
-- Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
function MatchAlias
(fromFile : in FSSpecPtr;
rulesMask : in unsigned_long;
alias : in AliasHandle;
aliasCount : access Short_Integer;
aliasList : in FSSpecArrayPtr;
needsUpdate : access Boolean;
aliasFilter : in AliasFilterUPP;
yourDataPtr : in Void_Ptr)
return OSErr;
pragma Import (C, MatchAlias, "MatchAlias", "MatchAlias");
-- 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.
function UpdateAlias
(fromFile : in FSSpecPtr;
target : access FSSpec;
alias : in AliasHandle;
wasChanged : access Boolean)
return OSErr;
pragma Import (C, UpdateAlias, "UpdateAlias", "UpdateAlias");
end Aliases;