Mac-Carbon
view release on metacpan or search on metacpan
Resources/Resources.xs view on Meta::CPAN
DetachResource(theResource)
Handle theResource
CLEANUP:
ResErrorReturn;
=item UniqueID TYPE
=item Unique1ID TYPE
The UniqueID function returns as its function result a resource ID greater than 0
that isn't currently assigned to any resource of the specified type in any open
resource fork. You should use this function before adding a new resource to
ensure that you don't duplicate a resource ID and override an existing resource.
Unique1ID ensures uniqueness within the current resource fork.
$id = Unique1ID("DITL");
=cut
short
UniqueID(theType)
OSType theType
short
Unique1ID(theType)
OSType theType
=item GetResAttrs HANDLE
Given a handle to a resource, the GetResAttrs function returns the resource's
attributes as recorded in its entry in the resource map in memory. If the value
of the theResource parameter isn't a handle to a valid resource, undef is returned.
$resAttrs = GetResAttrs($HANDLE);
if ( defined $resAttrs ) {
# proceed
}
=cut
short
GetResAttrs(theResource)
Handle theResource
CLEANUP:
ResErrorCheck;
=item GetResInfo HANDLE
Given a handle to a resource, the GetResInfo procedure returns the resource's
resource ID, resource type, and resource name. If the handle isn't a valid handle
to a resource, undef is returned.
($id, $type, $name) = GetResInfo($HANDLE);
if ( defined $id ) {
# proceed
}
=cut
void
GetResInfo(theResource)
Handle theResource
PPCODE:
{
short theID;
OSType theType;
Str255 name;
GetResInfo(theResource, &theID, &theType, name);
ResErrorCheck;
EXTEND(sp, 3);
XS_PUSH(short, theID);
XS_PUSH(OSType, theType);
if (*name)
XS_PUSH(Str255, name);
}
=item SetResInfo HANDLE, ID, NAME
Given a handle to a resource, SetResInfo changes the resource ID and the resource
name of the specified resource to the values given in ID and NAME. If you pass
an empty string for the name parameter, the resource name is not changed.
=cut
void
SetResInfo(theResource, theID, name)
Handle theResource
short theID
Str255 name
CLEANUP:
ResErrorReturn;
=item AddResource HANDLE, TYPE, ID, NAME
Given a handle to any type of data in memory (but not a handle to an existing
resource), AddResource adds the given handle, resource type, resource ID, and
resource name to the current resource file's resource map in memory. The
AddResource procedure sets the resChanged attribute to 1; it does not set any of
the resource's other attributesÑthat is, all other attributes are set to 0.
=cut
void
AddResource(theData, theType, theID, name)
Handle theData
OSType theType
short theID
Str255 name
CLEANUP:
ResErrorReturn;
=item GetResourceSizeOnDisk HANDLE
Given a handle to a resource, the GetResourceSizeOnDisk function checks the
resource on disk (not in memory) and returns its exact size, in bytes. If the
handle isn't a handle to a valid resource, undef is returned.
$size = GetResourceSizeOnDisk($HANDLE);
if ( defined $size ) {
# proceed
}
=cut
( run in 0.434 second using v1.01-cache-2.11-cpan-5511b514fd6 )