Mac OS 9
Resources.h File Reference

Resource Manager Interfaces. More...

#include <MacTypes.h>
#include <MixedMode.h>
#include <Files.h>

Go to the source code of this file.

Macros

#define NewResErrUPP(userRoutine)
 
#define DisposeResErrUPP(userUPP)   DisposeRoutineDescriptor(userUPP)
 
#define InvokeResErrUPP(thErr, userUPP)    CALL_ONE_PARAMETER_UPP((userUPP), uppResErrProcInfo, (thErr))
 
#define NewResErrProc(userRoutine)   NewResErrUPP(userRoutine)
 
#define CallResErrProc(userRoutine, thErr)   InvokeResErrUPP(thErr, userRoutine)
 

Typedefs

typedef Boolean currentlyNativeEndian
 
typedef SInt16 RsrcChainLocation
 
typedef short ResFileRefNum
 
typedef short ResID
 
typedef short ResAttributes
 
typedef short ResFileAttributes
 

Enumerations

enum  {
  resSysHeap = 64 , resPurgeable = 32 , resLocked = 16 , resProtected = 8 ,
  resPreload = 4 , resChanged = 2 , mapReadOnly = 128 , mapCompact = 64 ,
  mapChanged = 32
}
 
enum  {
  resSysRefBit = 7 , resSysHeapBit = 6 , resPurgeableBit = 5 , resLockedBit = 4 ,
  resProtectedBit = 3 , resPreloadBit = 2 , resChangedBit = 1 , mapReadOnlyBit = 7 ,
  mapCompactBit = 6 , mapChangedBit = 5
}
 
enum  { kResFileNotOpened , kSystemResFile = 0 }
 
enum  { uppResErrProcInfo = 0x00001002 }
 
enum  { kRsrcChainBelowSystemMap = 0 , kRsrcChainBelowApplicationMap = 1 , kRsrcChainAboveApplicationMap = 2 , kRsrcChainAboveAllMaps = 4 }
 

Functions

typedef CALLBACK_API_REGISTER68K (void, ResErrProcPtr,(OSErr thErr))
 
typedef REGISTER_UPP_TYPE (ResErrProcPtr) ResErrUPP
 
ResErrUPP NewResErrUPP (ResErrProcPtr userRoutine)
 
void DisposeResErrUPP (ResErrUPP userUPP)
 
void InvokeResErrUPP (OSErr thErr, ResErrUPP userUPP)
 
typedef CALLBACK_API (OSErr, ResourceEndianFilterPtr)(Handle theResource
 
short InitResources (void)
 
void RsrcZoneInit (void)
 
void CloseResFile (short refNum)
 
OSErr ResError (void)
 Find if an error occurred in a resource operation. More...
 
short CurResFile (void)
 Get reference number of current resource file. More...
 
short HomeResFile (Handle theResource)
 Given a resource handle, return a file reference number. More...
 
void CreateResFile (ConstStr255Param fileName)
 
short OpenResFile (ConstStr255Param fileName)
 
void UseResFile (short refNum)
 Make specified resource file the "current file". More...
 
 for (j=1;j<=rTotal;j++)
 
short Count1Types (void)
 Get total number of resource types in current file. More...
 
void GetIndType (ResType *theType, short index)
 Get the ResType of a resource, given its index. More...
 
void Get1IndType (ResType *theType, short index)
 
void SetResLoad (Boolean load)
 Set state of automatic resource loading. More...
 
 SetResLoad (FALSE)
 
 SetResLoad (TRUE)
 
short Count1Resources (ResType theType)
 Get "1-deep" count of resources of selected type. More...
 
Handle GetIndResource (ResType theType, short index)
 
Handle Get1IndResource (ResType theType, short index)
 
Handle GetResource (ResType theType, short theID)
 
Handle Get1Resource (ResType theType, short theID)
 
Handle GetNamedResource (ResType theType, ConstStr255Param name)
 
Handle Get1NamedResource (ResType theType, ConstStr255Param name)
 
void MacLoadResource (Handle theResource)
 
void ReleaseResource (Handle theResource)
 
void DetachResource (Handle theResource)
 Prevent resource from being discarded when file is closed. More...
 
short UniqueID (ResType theType)
 Get unique resource ID (before adding a resource) More...
 
short Unique1ID (ResType theType)
 1-deep, get unique resource ID More...
 
short GetResAttrs (Handle theResource)
 
void GetResInfo (Handle theResource, short *theID, ResType *theType, Str255 name)
 Given a handle, obtain resource ID, type, and name. More...
 
void SetResInfo (Handle theResource, short theID, ConstStr255Param name)
 
void AddResource (Handle theData, ResType theType, short theID, ConstStr255Param name)
 Make arbitrary data in memory into a resource. More...
 
long GetResourceSizeOnDisk (Handle theResource)
 
long GetMaxResourceSize (Handle theResource)
 
long RsrcMapEntry (Handle theResource)
 Obtain offset in resource map for a handle's entry. More...
 
void SetResAttrs (Handle theResource, short attrs)
 Set resource attributes (purgeable, locked, etc.) More...
 
void ChangedResource (Handle theResource)
 
void RemoveResource (Handle theResource)
 
void UpdateResFile (short refNum)
 Write changed resource map and data to disk. More...
 
void SetResPurge (Boolean install)
 Write data of one resource to disk. More...
 
short GetResFileAttrs (short refNum)
 Obtain resource file attributes. More...
 
void SetResFileAttrs (short refNum, short attrs)
 Set resource file attributes. More...
 
short OpenRFPerm (ConstStr255Param fileName, short vRefNum, SInt8 permission)
 
Handle RGetResource (ResType theType, short theID)
 
short HOpenResFile (short vRefNum, long dirID, ConstStr255Param fileName, SInt8 permission)
 
void HCreateResFile (short vRefNum, long dirID, ConstStr255Param fileName)
 
short FSpOpenResFile (const FSSpec *spec, SignedByte permission)
 Open resource file specified by an FSSpec. More...
 
void FSpCreateResFile (const FSSpec *spec, OSType creator, OSType fileType, ScriptCode scriptTag)
 
void ReadPartialResource (Handle theResource, long offset, void *buffer, long count)
 
void WritePartialResource (Handle theResource, long offset, const void *buffer, long count)
 
void SetResourceSize (Handle theResource, long newSize)
 
Handle GetNextFOND (Handle fondHandle)
 
OSErr RegisterResourceEndianFilter (ResType theType, ResourceEndianFilterPtr theFilterProc)
 
void TempInsertROMMap (Boolean tempResLoad)
 
OSErr InsertResourceFile (SInt16 refNum, RsrcChainLocation where)
 
OSErr DetachResourceFile (SInt16 refNum)
 
Boolean FSpResourceFileAlreadyOpen (const FSSpec *resourceFile, Boolean *inChain, SInt16 *refNum)
 
OSErr FSpOpenOrphanResFile (const FSSpec *spec, SignedByte permission, SInt16 *refNum)
 
OSErr GetTopResourceFile (SInt16 *refNum)
 
OSErr GetNextResourceFile (SInt16 curRefNum, SInt16 *nextRefNum)
 
Handle getnamedresource (ResType theType, const char *name)
 
Handle get1namedresource (ResType theType, const char *name)
 
short openrfperm (const char *fileName, short vRefNum, char permission)
 
short openresfile (const char *fileName)
 
void createresfile (const char *fileName)
 
void getresinfo (Handle theResource, short *theID, ResType *theType, char *name)
 
void setresinfo (Handle theResource, short theID, const char *name)
 
void addresource (Handle theResource, ResType theType, short theID, const char *name)
 
short FSOpenResFile (const FSRef *ref, SInt8 permission)
 
void FSCreateResFile (const FSRef *parentRef, UniCharCount nameLength, const UniChar *name, FSCatalogInfoBitmap whichInfo, const FSCatalogInfo *catalogInfo, FSRef *newRef, FSSpec *newSpec)
 
Boolean FSResourceFileAlreadyOpen (const FSRef *resourceFileRef, Boolean *inChain, SInt16 *refNum)
 
OSErr FSCreateResourceFile (const FSRef *parentRef, UniCharCount nameLength, const UniChar *name, FSCatalogInfoBitmap whichInfo, const FSCatalogInfo *catalogInfo, UniCharCount forkNameLength, const UniChar *forkName, FSRef *newRef, FSSpec *newSpec)
 
OSErr FSOpenResourceFile (const FSRef *ref, UniCharCount forkNameLength, const UniChar *forkName, SInt8 permissions, SInt16 *refNum)
 

Variables

short rTotal = CountTypes()
 Get total number of resource types in open files. More...
 
short j
 
ResType rt
 
char * rtp
 
</pre > *par Copyright
 
 rCount = CountResources('DRVR')
 Find how many of a selected resource type exist. More...
 
FileAttributes
 

Detailed Description

Resource Manager Interfaces.

Introduced In: Mac OS 8.1
Avaliable From: Universal Interfaces 3.4.1
Copyright: © 1985-2001 by Apple Computer, Inc., all rights reserved

For bug reports, consult the following page on the World Wide Web:

http://developer.apple.com/bugreporter/

Macro Definition Documentation

◆ NewResErrUPP

#define NewResErrUPP (   userRoutine)
Value:
(ResErrUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppResErrProcInfo, \
GetCurrentArchitecture())
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)

Typedef Documentation

◆ ResFileRefNum

typedef short ResFileRefNum

These typedefs were originally created for the Copland Resource Mangager

◆ RsrcChainLocation

typedef SInt16 RsrcChainLocation

© RESOURCE CHAIN LOCATION - for use with the Resource Manager chain manipulation routines under Carbon.


Function Documentation

◆ AddResource()

void AddResource ( Handle  theData,
ResType  theType,
short  theID,
ConstStr255Param  name 
)

Make arbitrary data in memory into a resource.

  
Note
AddResource converts an existing handle (either one that points to any
existing data or even an empty handle) into a handle recognized by the
Resource Manager and saved in the resource map . This affects the
map of the current resource file (see UseResFile ).
This function automatically sets the resChanged bit of the resource
attribute. Thus, when the current resource file is closed or updated the
resource data and map will be written to disk (see ChangedResource ).
All other attributes are cleared; use SetResAttrs before writing the
resource if you want different attributes.
This is the opposite of DetachResource , which converts a resource
handle into a generic handle. To duplicate a resource, use DetachResource
followed by AddResource .
Example
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ addresource()

void addresource ( Handle  theResource,
ResType  theType,
short  theID,
const char *  name 
)

addresource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ ChangedResource()

void ChangedResource ( Handle  theResource)

ChangedResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ CloseResFile()

void CloseResFile ( short  refNum)

CloseResFile()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ Count1Resources()

short Count1Resources ( ResType  theType)

Get "1-deep" count of resources of selected type.

Count1Resources returns the number of resources of a specified type
which exist in the current resource file.
rTypeis a 4-byte ResType value identifying the resource type you wish to
count (e.g. 'FONT', 'MENU', etc.).
Returns
a positive integer; the number of resources of the specified type in
the current resource file. Returns 0 if none found.
Note
This function is the "1-deep" version of CountResources . To generate a
list of resources of type rType for the current resource file, use
Get1IndResource with an index ranging from 1 to the value obtained via
Count1Resources .
Refer to CountTypes and GetIndResource for related details.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ Count1Types()

short Count1Types ( void  )

Get total number of resource types in current file.

Count1Types returns the number of resource types in the current resource
file. It can be used as a first step in "1-deep" examination of resources.
Returns
a positive integer; it is the total number of distinct resource types
in the current resource file.
Note
Count1Types works exactly like CountTypes except that it limits the
type search to the current resource file.  This is normally followed by a
series of calls to Get1IndType .
Refer to CountTypes for related details.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ createresfile()

void createresfile ( const char *  fileName)

createresfile()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ CreateResFile()

void CreateResFile ( ConstStr255Param  fileName)

CreateResFile()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ CurResFile()

short CurResFile ( void  )

Get reference number of current resource file.

CurResFile returns the file reference number of the "current resource
file" - the first file searched during a resource request.
Returns
an integer; the reference number of the current resource file.
Note
You can use this function early in an application to determine the reference
number of the application's resource file.
The global variable CurMap (at 0x0A5A) contains the same information
that this call returns. Thus, the following are the same except that the
latter generates less code:
fRef= CurResFile ();
fRef= CurMap;
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ DetachResource()

void DetachResource ( Handle  theResource)

Prevent resource from being discarded when file is closed.

DetachResource removes a resource handle from the resource map
without releasing it from memory. This can be used to keep one or more
resources in memory after closing a resource file.
rHandle is a handle leading to some variable length resource data. This
should be a valid handle obtained via GetResource ,
GetNamedResource , etc.
Returns
none (if rHandle is not a handle to a resource, or if detachment is
disallowed, ResError will return an error).
Note
DetachResource causes rHandle 's resource map pointer to be set to
NIL while maintaining the resource in memory and keeping the handle's
master pointer valid. One significant effect is that when a resource's file is
closed (see CloseResFile ), the resource data is not purged from memory.
After this call, rHandle is no longer considered to be a resource handle.
Calls such as ReleaseResource and GetResInfo will not respond. If you
call GetResource (et. al.) for the same handle, the resource will be read
into memory again. You can copy the detached resource and install the
duplicate into the resource list via AddResource . To discard the detached
resource data, use DisposHandle .
This function is not valid for resources tagged with the resChanged
attribute ( ResError returns resAttrErr ).
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ DetachResourceFile()

OSErr DetachResourceFile ( SInt16  refNum)

If the file is not currently in the resource chain, this returns resNotFound Otherwise, the resource file is removed from the resource chain. DetachResourceFile()

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ DisposeResErrUPP()

void DisposeResErrUPP ( ResErrUPP  userUPP)

DisposeResErrUPP()

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ FSCreateResFile()

void FSCreateResFile ( const FSRef parentRef,
UniCharCount  nameLength,
const UniChar *  name,
FSCatalogInfoBitmap  whichInfo,
const FSCatalogInfo catalogInfo,
FSRef newRef,
FSSpec *  newSpec 
)

FSCreateResFile()

Non-Carbon CFM: in InterfaceLib 9.1 and later
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ FSCreateResourceFile()

OSErr FSCreateResourceFile ( const FSRef parentRef,
UniCharCount  nameLength,
const UniChar *  name,
FSCatalogInfoBitmap  whichInfo,
const FSCatalogInfo catalogInfo,
UniCharCount  forkNameLength,
const UniChar *  forkName,
FSRef newRef,
FSSpec *  newSpec 
)

FSCreateResourceFile()

Summary: Creates a new resource file.

Discussion: This function creates a new file and initializes the specified named fork as an empty resource fork. This function allows for the creation of data fork only files which can be used for storing resources. Passing in a null name defaults to using the data fork.

Parameters:

parentRef: The directory where the file is to be created

nameLength: Number of Unicode characters in the file's name

name: A pointer to the Unicode name

whichInfo: Which catalog info fields to set

catalogInfo: The values for catalog info fields to set; may be NULL

forkNameLength: The length of the fork name (in Unicode characters)

forkName: The name of the fork to initialize (in Unicode); may be NULL

newRef: A pointer to the FSRef for the new file; may be NULL

newSpec: A pointer to the FSSpec for the new directory; may be NULL

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ FSOpenResFile()

short FSOpenResFile ( const FSRef ref,
SInt8  permission 
)

FSOpenResFile()

Non-Carbon CFM: in InterfaceLib 9.1 and later
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ FSOpenResourceFile()

OSErr FSOpenResourceFile ( const FSRef ref,
UniCharCount  forkNameLength,
const UniChar *  forkName,
SInt8  permissions,
SInt16 *  refNum 
)

FSOpenResourceFile()

Summary: Opens the specified named fork as a resource fork.

Discussion: This function allows any named fork of a file to be used for storing resources. Passing in a null forkname will result in the data fork being used.

Parameters:

ref: The file containing the fork to open

forkNameLength: The length of the fork name (in Unicode characters)

forkName: The name of the fork to open (in Unicode); may be NULL

permissions: The access (read and/or write) you want

refNum: On exit the reference number for accessing the open fork

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ FSpCreateResFile()

void FSpCreateResFile ( const FSSpec *  spec,
OSType  creator,
OSType  fileType,
ScriptCode  scriptTag 
)

FSpCreateResFile()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ FSpOpenOrphanResFile()

OSErr FSpOpenOrphanResFile ( const FSSpec *  spec,
SignedByte  permission,
SInt16 *  refNum 
)

FSpOpenOrphanResFile should be used to open a resource file that is persistent across all contexts, because using OpenResFile normally loads a map and all preloaded resources into the application context. FSpOpenOrphanResFile loads everything into the system context and detaches the file from the context in which it was opened. If the file is already in the resource chain and a new instance is not opened, FSpOpenOrphanResFile will return a paramErr. Use with care, as can and will fail if the map is very large or a lot of preload resources exist. FSpOpenOrphanResFile()

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ FSpOpenResFile()

short FSpOpenResFile ( const FSSpec *  spec,
SignedByte  permission 
)

Open resource file specified by an FSSpec.

The FSpOpenResFile function creates the file named in the spec parameter.
The FSpOpenResFile function lets you open a resource file without creating a
working directory. The permission parameter can contain any one of the
following constants:
fsCurPerm whatever is currently allowed
fsRdPerm request for read permission only
fsWrPerm request for write permission
fsRdWrPerm request for exclusive read/write permission
fsRdWrShPerm request for shared read/write permission
More information about these constants can be found in the
Low-Level File Manager section of the File Manager . If the
FSpOpenResFile function failed to open the resource file, the reference
number returned is -1. Call the ResError function to check for errors.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ FSpResourceFileAlreadyOpen()

Boolean FSpResourceFileAlreadyOpen ( const FSSpec *  resourceFile,
Boolean inChain,
SInt16 *  refNum 
)

Returns true if the resource file is already open and known by the Resource Manager (i.e., it is either in the current resource chain or it's a detached resource file.) If it's in the resource chain, the inChain Boolean is set to true on exit and true is returned. If it's an open file, but the file is currently detached, inChain is set to false and true is returned. If the file is open, the refNum to the file is returned. FSpResourceFileAlreadyOpen()

Non-Carbon CFM: in InterfaceLib 9.0 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ FSResourceFileAlreadyOpen()

Boolean FSResourceFileAlreadyOpen ( const FSRef resourceFileRef,
Boolean inChain,
SInt16 *  refNum 
)

FSResourceFileAlreadyOpen()

Non-Carbon CFM: in InterfaceLib 9.1 and later
Carbon Lib: in CarbonLib 1.1 and later
Mac OS X: in version 10.0 and later

◆ Get1IndResource()

Handle Get1IndResource ( ResType  theType,
short  index 
)

Get1IndResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ Get1IndType()

void Get1IndType ( ResType *  theType,
short  index 
)

Get1IndType()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ get1namedresource()

Handle get1namedresource ( ResType  theType,
const char *  name 
)

get1namedresource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ Get1NamedResource()

Handle Get1NamedResource ( ResType  theType,
ConstStr255Param  name 
)

Get1NamedResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ Get1Resource()

Handle Get1Resource ( ResType  theType,
short  theID 
)

Get1Resource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetIndResource()

Handle GetIndResource ( ResType  theType,
short  index 
)

GetIndResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetIndType()

void GetIndType ( ResType *  theType,
short  index 
)

Get the ResType of a resource, given its index.

GetIndType obtains the 4-byte ResType of a resource, given an
arbitrarily-defined index number.
rTypeis the address of a 4-byte ResType value. Upon return, it will
contain the resource type code associated with the resource identified
by index ; e.g., 'FONT', 'ICON', 'ICN#', etc. A value of 0 (four ASCII
NULs) indicates that index was an invalid value.
indexis a positive integer. It should range from 1 to the total number of
distinct resources available (see CountTypes ).
Returns
none
Note
GetIndType is usually only needed by resource-management utilities
such as ResEdit. This function is the second step (following CountTypes )
in generating a list of all the different resource types, thus making it
possible to look up each individual resource.
Note: All the types obtained via this call are not necessarily available for
access. The "indexed ResType list" contains ALL resource types while calls
such as GetResource may search a subset of this list (i.e., the list of files
starting with the current resource file and working chronologically
backward toward the system file).
See CountTypes for an example of usage.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetMaxResourceSize()

long GetMaxResourceSize ( Handle  theResource)

GetMaxResourceSize()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ getnamedresource()

Handle getnamedresource ( ResType  theType,
const char *  name 
)

getnamedresource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ GetNamedResource()

Handle GetNamedResource ( ResType  theType,
ConstStr255Param  name 
)

GetNamedResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetNextFOND()

Handle GetNextFOND ( Handle  fondHandle)

GetNextFOND()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetNextResourceFile()

OSErr GetNextResourceFile ( SInt16  curRefNum,
SInt16 *  nextRefNum 
)

GetNextResourceFile can be used to iterate over resource files in the resource chain. By passing a valid refNum in curRefNum it will return in nextRefNum the refNum of the next file in the chain. If curRefNum is not found in the resource chain, GetNextResourceFile returns resFNotFound. When the end of the chain is reached GetNextResourceFile will return noErr and nextRefNum will be NIL. GetNextResourceFile()

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.0.2 and later
Mac OS X: in version 10.0 and later

◆ GetResAttrs()

short GetResAttrs ( Handle  theResource)

GetResAttrs()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetResFileAttrs()

short GetResFileAttrs ( short  refNum)

Obtain resource file attributes.

GetResFileAttrs returns a value representing the bit record that holds a
resource file's attributes. In doing so, it tests whether a resource file is
marked as read-only, has changed, or needs compacting.
rfRefNum identifies the resource file to query. It is a value obtained from
OpenResFile , HomeResFile , or CurResFile . A value of 0
refers to the system resource file.
Returns
a signed short; a bit record identifying the current resource file
attributes of rfRefNum  (see below). Note: Use ResError to check
whether this function succeeded before assuming a valid return value.
Note
You will want to use this function before calling SetResFileAttrs , in
order to modify one or two attributes while leaving others unchanged.
Resource file attributes are defined as follows:
7  6  5 4  3  2  1  0
0x01
0x02
0x04
0x08
0x10
0x20
0x40
0x80(reserved)
(reserved)
(reserved)
(reserved)
(reserved)
mapChanged
mapCompact
mapReadOnly1= resource map will be written on update
1= file will be compacted upon update
1= file can’t be written
The mapChanged attribute is set by commands such as AddResource ,
RmveResource , SetResAttrs and SetResInfo , and when
ChangedResource tags a resource whose size has been changed. When
set, the resource map will be written to the file.
The mapCompact bit is set on all operations that change the size of the file
(Note: on the 64K ROMs, this bit was not set if a resource simply got
smaller). When set, the entire resource file is reorganized as it is
rewritten and all empty space in the file is removed.
The mapReadOnly attribute overrides all resource resChanged attributes in
that WriteResource , UpdateResFile , and CloseResFile will NOT cause
data to be written to the file.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ getresinfo()

void getresinfo ( Handle  theResource,
short *  theID,
ResType *  theType,
char *  name 
)

getresinfo()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ GetResInfo()

void GetResInfo ( Handle  theResource,
short *  theID,
ResType *  theType,
Str255  name 
)

Given a handle, obtain resource ID, type, and name.

  @par Non-Carbon CFM:   in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetResource()

Handle GetResource ( ResType  theType,
short  theID 
)

GetResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetResourceSizeOnDisk()

long GetResourceSizeOnDisk ( Handle  theResource)

GetResourceSizeOnDisk()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetTopResourceFile()

OSErr GetTopResourceFile ( SInt16 *  refNum)

GetTopResourceFile returns the refNum of the top most resource map in the current resource chain. If the resource chain is empty it returns resFNotFound. GetTopResourceFile()

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.0.2 and later
Mac OS X: in version 10.0 and later

◆ HCreateResFile()

void HCreateResFile ( short  vRefNum,
long  dirID,
ConstStr255Param  fileName 
)

HCreateResFile()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ HomeResFile()

short HomeResFile ( Handle  theResource)

Given a resource handle, return a file reference number.

Parameters
rHandlegeneric Handle of resource of interest
In the 64K ROMs, HomeResFile can be used to make sure a resource is
from the application's resource file. The "one-deep" functions
(Get1Resource , Get1IndResource , etc.) of the 128K ROMs make this
usage unnecessary.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ HOpenResFile()

short HOpenResFile ( short  vRefNum,
long  dirID,
ConstStr255Param  fileName,
SInt8  permission 
)

HOpenResFile()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ InitResources()

short InitResources ( void  )

InitResources()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ InsertResourceFile()

OSErr InsertResourceFile ( SInt16  refNum,
RsrcChainLocation  where 
)

If the file is already in the resource chain, it is removed and re-inserted at the specified location If the file has been detached, it is added to the resource chain at the specified location Returns resFNotFound if it's not currently open. InsertResourceFile()

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ InvokeResErrUPP()

void InvokeResErrUPP ( OSErr  thErr,
ResErrUPP  userUPP 
)

InvokeResErrUPP()

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ MacLoadResource()

void MacLoadResource ( Handle  theResource)

[Mac]LoadResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ NewResErrUPP()

ResErrUPP NewResErrUPP ( ResErrProcPtr  userRoutine)

NewResErrUPP()

Non-Carbon CFM: available as macro/inline
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ openresfile()

short openresfile ( const char *  fileName)

openresfile()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ OpenResFile()

short OpenResFile ( ConstStr255Param  fileName)

OpenResFile()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ openrfperm()

short openrfperm ( const char *  fileName,
short  vRefNum,
char  permission 
)

openrfperm()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ OpenRFPerm()

short OpenRFPerm ( ConstStr255Param  fileName,
short  vRefNum,
SInt8  permission 
)

OpenRFPerm()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ ReadPartialResource()

void ReadPartialResource ( Handle  theResource,
long  offset,
void *  buffer,
long  count 
)

ReadPartialResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ RegisterResourceEndianFilter()

OSErr RegisterResourceEndianFilter ( ResType  theType,
ResourceEndianFilterPtr  theFilterProc 
)

RegisterResourceEndianFilter()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ ReleaseResource()

void ReleaseResource ( Handle  theResource)

ReleaseResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ RemoveResource()

void RemoveResource ( Handle  theResource)

RemoveResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ ResError()

OSErr ResError ( void  )

Find if an error occurred in a resource operation.

You can use ResError to read that code and see if the most recent operation
caused an error, and if so, what the error was.
Returns
an integer; the Error Code of the most recent resource-related
operation. It may be a file system error or one of the following
resource error constants:
noErr(0)No Error (this constant is defined in MacTypes.h)
resNotFound (-192)Resource not found
resFNotFound (-193)Resource file not found
addResFailed (-194)AddResource failed
rmvResFailed (-196)RmveResource failed
(-197)(not used)
resAttrErr (-198)Attribute does not permit operation
mapReadErr (-199)Error reading resource map
Note
ResError is functionally equivalent to reading the low-memory global,
ResErr; i.e., the following are the same, except the latter generates less
code and is faster:
if ( ResError () ){ ... an error occurred ... }
if ( ResErr ) { ... an error occurred ... }
ResError may return other system errors, for instance, dskFulErr or
memFullErr . See Error Codes for a full list.
A few Resource Manager functions indicate errors by returning a NIL
handle (e.g., GetResource ). When these calls fail, ResError returns
noErr, so be sure to check for NIL handles!
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ RGetResource()

Handle RGetResource ( ResType  theType,
short  theID 
)

RGetResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ RsrcMapEntry()

long RsrcMapEntry ( Handle  theResource)

Obtain offset in resource map for a handle's entry.

RsrcMapEntry returns an offset from the start of the resource map . The
offset specifies the location of a particular resource entry.
rHandle is a valid resource handle. It is a value obtained via GetResource ,
GetIndResource , et. al.
Returns
a 32-bit long integer; the offset from the start of the resource
map which contains the start of the resource entry for rHandle . A
return value of NIL indicates an error and ResError will return
resNotFound .
Note
The low-memory global variable TopMapHndl (0xA50) contains a handle
leading to the start of the resource map of the current resource file.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ RsrcZoneInit()

void RsrcZoneInit ( void  )

RsrcZoneInit()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ SetResAttrs()

void SetResAttrs ( Handle  theResource,
short  attrs 
)

Set resource attributes (purgeable, locked, etc.)

SetResAttrs sets resource attributes in the resource map . The modified
attributes will not take effect until the next time the resource is loaded.
rHandle is a resource handle. It is a handle obtained via GetResource ,
GetIndResource , et. al.
rAttrsis a 16-bit resource attribute word - a bit record which specifies
how the resource is to be handled when loaded subsequently (see
below).
Returns
none
Note
SetResAttrs is normally needed only by resource-management utilities
such as ResEdit; it is a rare application that needs to modify attributes by
using this function.
The rAttrs parameter specifies resource attributes as follows:
7  6  5 4  3  2  1  0
0x01
0x02
0x04
0x08
0x10
0x20
0x40
0x80(reserved)
resChanged
resPreload
resProtected
resLocked
resPurgeable
resSysHeap
(reserved)1= has changed; UpdateResFile will write to disk
1= is preloaded when file is opened
1= can’t change ID, name, contents, etc.
1= won’t be moved or purged
1= purgeable (call LoadResource before access)
1= load in system heap; 0= use application heap
The new setting of resProtected takes effect immediately, so make sure you
have already written any changes out to disk; other attributes take effect
the next time the resource is loaded. We are warned specifically against
modifying the state of the resChanged attribute directly. Use
ChangedResource to flag a resource for update.
A normal sequence is to use GetResAttrs to find the current settings,
modifying one or more bits (without changing bit 1), then use SetResAttrs
to update the resource map . This is illustrated in the following example:
Example
#include < Resources.h >
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ SetResFileAttrs()

void SetResFileAttrs ( short  refNum,
short  attrs 
)

Set resource file attributes.

SetResFileAttrs sets resource file attributes. It specifies whether a
resource file is marked as read-only, has changed, or needs compacting. This
is needed rarely, since file attributes are modified automatically by the
Resource Manager .
rfRefNum identifies the resource file whose attributes you wish to modify. It
is a value obtained from OpenResFile , HomeResFile ,
CurResFile or OpenRFPerm . A value of 0 refers to the system
resource file.
rfAttrsidentifies the desired attributes you wish to apply to the resource
file. See below..
Returns
none (use ResError to check for success/failure)
Note
Resource file attributes are defined as follows:
7  6  5 4  3  2  1  0
0x01
0x02
0x04
0x08
0x10
0x20
0x40
0x80(reserved)
(reserved)
(reserved)
(reserved)
(reserved)
mapChanged
mapCompact
mapReadOnly1= resource map will be written on update
1= file will be compacted upon update
1= file can’t be written
See GetResFileAttrs for related information.
In the 64K ROMs, it was necessary to set mapCompact manually if you
wanted to recover the file space that had been occupied by a resource after it
was shortened. Since this was fixed, there was little reason to modify
resource file attributes.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ setresinfo()

void setresinfo ( Handle  theResource,
short  theID,
const char *  name 
)

setresinfo()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ SetResInfo()

void SetResInfo ( Handle  theResource,
short  theID,
ConstStr255Param  name 
)

SetResInfo()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ SetResLoad()

void SetResLoad ( Boolean  load)

Set state of automatic resource loading.

After using SetResLoad (FALSE), be sure to use SetResLoad (TRUE) as
soon as possible. Some toolbox calls malfunction when resources do not
automatically load. Furthermore, remember to use SetResLoad (TRUE)
before exiting from your application; otherwise the Finder's code resource
will not be loaded.
The low-memory global variable ResLoad echoes the status of this call, but
remember that any non-zero value indicates that resource loading is
disabled.
The following calls set ResLoad to TRUE (enable auto-loading) as a
side-effect: GetFNum , GetFontName , RealFont and AddResMenu .
See CountResources for an example of usage.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ SetResourceSize()

void SetResourceSize ( Handle  theResource,
long  newSize 
)

SetResourceSize()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ SetResPurge()

void SetResPurge ( Boolean  install)

Write data of one resource to disk.

  
Note
WriteResource is called automatically by UpdateResFile and
CloseResFile .
Remember that if a resource has been purged, these file operations will
write a 0-length resource to the file. Thus, a typical use of this function is
in a sequence that locks a resource, changes it, writes the changes, and
unlocks the resource:
HNoPurge ( rHandle ); /* inhibit purging */
  /*... modify the handle data... */
  ChangedResource(rHandle); /* tag as changed */
  if (ResError() == noErr)
  {                         /* always check this! */
    WriteResource(rHandle); /* record changes to disk */
  }
  HPurge(rHandle); /* allow purge */
  Make sure you check ResError after calling ChangedResource(or
                                                             AddResource) and
      before calling WriteResource.</ pre>
                
Copyright: THINK Reference © 1991 -
          1992 Symantec Corporation
                   
Non-Carbon CFM: in InterfaceLib 7.1 and
      later
               
Carbon Lib: in CarbonLib 1.0 and
      later
               
Mac OS X: in version 10.0 and
      later
                /
          void WriteResource(Handle theResource);

  /**

Force resource changes to be written before purge

  
  
Note
 
SetResPurge is an attempt to avoid the "silent error" of writing a
0-length resource to disk when a resource file is updated. It is needed only
by applications that modify a resource tagged as resPurgeable (see
GetResAttrs ).
In a memory shortage situation the Memory Manager will discard all
purgeable resources and compact memory. Then, when you
WriteResource , UpdateResFile , or CloseResFile , a 0-length
resource is sent to disk. By calling SetResPurge (TRUE), you can avoid
this problem. Another way is to set the address of a custom "purge warning
handler" into the purgeProc field of the memory manager's Zone structure
obtained via ApplicZone . Yet another way is: avoid changing purgeable
resources altogether!
Note that this does NOT keep the resource from getting purged. You must
use LoadResource before each access of an unlocked purgeable resource.
See HNoPurge for a way to force any purgeable handle to remain in
memory.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
        
Non-Carbon CFM: in InterfaceLib 7.1 and later
     
Carbon Lib: in CarbonLib 1.0 and later
     
Mac OS X: in version 10.0 and later

◆ TempInsertROMMap()

void TempInsertROMMap ( Boolean  tempResLoad)

TempInsertROMMap()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ Unique1ID()

short Unique1ID ( ResType  theType)

1-deep, get unique resource ID

Unique1ID returns a unique, unused resource ID that will not collide with
any resource of the specified type in the current resource file.
rTypeis a 4-byte ResType value. It identifies the resource type for which
you wish a unique resource ID (e.g., 'FONT', 'WIND', etc.)
Returns
an integer; a resource ID number that is unique with respect to
resources of type rType in the current resource file.
Note
This function is the "1-deep" version of UniqueID . It generates a
resource ID that is unique with respect to resources in the current resource
file (see UseResFile ).  Refer to UniqueID for related details.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ UniqueID()

short UniqueID ( ResType  theType)

Get unique resource ID (before adding a resource)

UniqueID returns a unique, unused resource ID that will not collide with any
resource of the specified type in any open resource file.
rTypeis a 4-byte ResType value. It identifies the resource type for which
you wish a unique resource ID (e.g., 'FONT', 'WIND', etc.)
Returns
an integer; a resource ID number that is unique with respect to all
resources of type rType in all currently-open resource files.
Note
UniqueID and Unique1ID are used by applications that create resources;
especially temporary resources that are removed when the program
terminates. After making this call, you can safely add to the resource list,
e.g.,:
newID = UniqueID ( 'MENU' );
AddResource ( myHand, 'MENU', newID, "\pMy New Menu" );
To avoid colliding with IDs of ROM-based resources (i.e., get a truly
unique ID), set the RomMapInsert flag directly before calling:
RomMapInsert = mapTrue ;
newID = UniqueID ( 'MENU' );
See GetResource for information about ROM-based resources.
This call may return IDs less than 128 which, by convention, are reserved
for system resources. Just call it again until you get an ID greater than
127.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ UpdateResFile()

void UpdateResFile ( short  refNum)

Write changed resource map and data to disk.

UpdateResFile writes the resource map and all changed data of the
specified resource file to disk. Data is written only if one or more resources
are tagged as having been modified.
rfRefNum identifies the resource file to update. It is a value obtained from
OpenResFile , HomeResFile , or CurResFile . A value of 0
refers to the system resource file.
Returns
none (use ResError to determine success/failure)
Note
All changed resource data (as tagged with the resChanged attribute set via
ChangedResource ) is written to disk as described in WriteResource .
All changes to the resource map of the file are recorded, including changes
made by AddResource and RmveResource . The file data is compacted, if
necessary. The resChanged attribute of all resources written to disk is
reset. You might wish to call FlushVol to ensure that the information is
really written out to disk.
Be aware that using DetachResource sets the resource's handle to NIL in
the resource map .  Similarly, any purged resource will be saved as an
empty resource (see WriteResource ).
You may use CurResFile , early in your program, to obtain the rfRefNum
of your application's resource file.
This function is called automatically when the file is closed via
CloseResFile .
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ UseResFile()

void UseResFile ( short  refNum)

Make specified resource file the "current file".

UseResFile selects a different file (already open) as the current resource
file. On subsequent resource requests, the specified file will be searched first
and none of the more recently opened resource files will be searched.
rfRefNum is a resource file reference number; typically a value obtained from
OpenResFile , HomeResFile , or CurResFile . Use 0 to specify
the system resource file.
Returns
none (use ResError to determine success/failure)
Note
Open resource files are arranged as a linked list; the most recently opened
file is at the end of the list and is the first one the Resource Manager
searches when looking for a resource. UseResFile lets you start the search
with a file opened earlier; the file(s) following it in the list are then left out
of the search process. When a new resource file is opened, it's added to the
end of the list; this overrides any previous calls to UseResFile , causing
the entire list of open resource files to be searched. For example, assume
that there are four open resource files (R0 through R3) and the search
order is R3, R2, R1, R0. If you call UseResFile (R2), the search order
becomes R2, R1, R0. Note that R3 is no longer searched. If you then open a
fifth resource file (R4), it is added to the end of the list and the search
order becomes R4, R3, R2, R1, R0.
UseResFile does not re-order the resource file list; it causes resource
searching to start at a specified file and work backwards (chronologically)
down the list if it fails to find a resource in the current file.
For instance, after UseResFile (0), calls such as GetResource or
GetPicture will search only the system resource file.
The application's resource file is implicitly set as the current file when an
application is started. The OpenResFile function also sets the current
resource file, thereby overriding any previous call to UseResFile .
The resource search order is affected by the setting of the low-memory
globals RomMapInsert and TmpResLoad . These affect whether ROM-based
resources are considered to be in the normal lookup list.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ WritePartialResource()

void WritePartialResource ( Handle  theResource,
long  offset,
const void *  buffer,
long  count 
)

WritePartialResource()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

Variable Documentation

◆ rCount

rCount = CountResources('DRVR')

Find how many of a selected resource type exist.

CountResources returns the number of resources of a specified resource
type that exist among the currently-open resource files.
rTypeis a 4-byte ResType value identifying the resource type you wish to
count (e.g. 'FONT', 'MENU', etc.).
Returns
a positive integer; the number of resources of the specified type
contained in all currently-open resource files. Returns 0 if none are
found.
Note
This function is used as the first step in generating a list of
currently-available resources of a particular type. To generate the list,
use GetIndResource with an index ranging from 1 to the
CountResources return value.
Use Count1Types and Get1IndResource to count and access only the
resources in the current resource file.
The following example prints a list of the names of all resources of type
'DRVR' (i.e., desk accessories).
Example
#include < Resources.h >
short rCount, rID, j;
Handle rHandle;
ResType rType;
Str255 rName;
printf("\n"); /* ensure printf can get fonts 

◆ rTotal

rTotal = CountTypes()

Get total number of resource types in open files.

CountTypes returns the total number of resource types in all
currently-opened resource files. It can be used as a first step in a
system-wide examination of resources.
Returns
a positive integer; it is the total number of distinct resource types
in all open resource files.
Note
CountTypes is only needed by resource-management utilities such as
ResEdit or Resorcerer. This function is the first step in generating a list of
all the different resource types, thus making it possible to look up each
individual resource. Subsequent calls to GetIndType will return the
ResType value for types from 1 to the return value of this call.
This function operates across all open resource files while the similar
Count1Types function counts just the resource types in the current
resource file.
The following example displays a list of resource types along with the
number of such resources, contained in all open resource files.
Example
#include < Resources.h >
#include <stdio.h> /* for printf()