Searching for Disabled SResource Data Structures
Whereas earlier Slot Manager routines act only on enabled sResource data structures, you can use system 7.0 or later Slot Manager routines to search for both enabled and disabled sResource data structures. The system 7.0 or
later Slot Manager also allows you to specify whether the search should be for the specified sResource data structure or the next sResource data structure
and whether the search should include only the specified slot or should include
the specified slot plus all slots with higher numbers. In addition, you can
specify the type of the sResource data structure for which you want to search;
then the Slot Manager ignores all sResource data structures that do not match the specified type.
The following Table summarizes the Slot Manager search routines and the options available for each.
State of Which Type of
sResource it Slots it sResource it sResource it
Function searches for searches searches for searches for
SNextSRsrc Enabled only Specified slot Next sResource Any type
and higher slots only
SGetSRsrc* Your choice of Your choice of Your choice of Any type
enabled only or one slot only or specified
both enabled specified slot and sResource or
and disabled higher slots next sResource
SNextTypeSRsrc Enabled only Specified slot Next sResource Specified type
and higher slots only only
SGetTypeSRsrc* Your choice of Your choice of Next sResource Specified type
enabled only or one slot only or only only
both enabled specified slot and
and disabled higher slots
The code example below shows how to search all slots for all sResource data
structures with a specific value in the Category and cType fields, whether
enabled or disabled. The Slot Manager ignores the DrvrSW and DrvrHW fields of the resource type.
Restoring Deleted SResources
Some NuBus cards have sResource data structures to support a variety of
combinations of system configurations or modes. The Slot Manager loads all of the sResource data structures during system initialization, and then the
PrimaryInit code in the declaration ROM deletes from the Slot Resource Table
any sResource data structures that are not appropriate for the system as
con figured. The system 7.0 or later Slot Manager gives you the option of reinstalling a deleted sResource data structure if, for example, the user
changes the system configuration or selects a different mode of operation. The
SDeleteSRTRec function deletes sResource data structures; the
// Searching for sResource data structures
// Assuming inclusion of
#include
#include
void DoError (OSErr myErr); // Set required values in parameter block.
mySpBlk.spParamData = 1; [TOKEN:12079] fAll flag set to 1 to include
// disabled resources; fOneslot
// flag set to 0 to search specified
// slot plus higher- numbered slots
mySpBlk.spCategory = catDisplay; // Category field of sRsrcType
// entry in sResource
mySpBlk.spCType = typeVideo; [TOKEN:12079] cType field of sRsrcType entry in
// sResource
mySpBlk.spDrvrSW = 0; [TOKEN:12079] DrvrSW field of sRsrcType entry
// in sResource; this field is not
// being matched
mySpBlk.spDrvrHW = 0; [TOKEN:12079] DrvrHW field of sRsrcType entry
// in sResource; this field is not
// being matched
mySpBlk.spTBMask = 3; [TOKEN:12079] match only spCategory and // spcType fields
mySpBlk.spSlot = 0; [TOKEN:12079] start search from here
mySpBlk.spID = 128; // start search from here
mySpBlk.spExtDev = 0; [TOKEN:12079] ID of the external device
myErr = 0;
while (!myErr) { // loop to search sResources
MysRsrcProc(mySpBlk); [TOKEN:12079] your routine to process results
}
if ( myErr != smNoMoresRsrcs )
DoError(myErr);
Because none of the Slot Manager functions can search for sResource data structures that have been deleted from the Slot Resource Table, you must keep
a record of all sResource data structures that you have deleted so that you will
have the appropriate parameter values available if you want to reinstall one.
When you reinstall an sResource data structure, you can also update the
structure. The dCtlDevBase field holds the address of the sResource data
structure that is used by that device driver. For a video driver, for example,
the dCtlDevBase field might contain the address of the frame buffer. Use the