home *** CD-ROM | disk | FTP | other *** search
- #include "go.h"
- #include "xfer.h"
- #include <string.h>
-
- #include "fontda.h"
-
- /* Locks the handle h and returns a pointer to the first generic_map_t
- contained in h. */
-
- static generic_map_t *
- first_map (in_use_hand h)
- {
- generic_map_t *retval;
-
- HLock ((Handle) h);
- retval = (generic_map_t *) *h;
- return retval->type ? retval : 0;
- }
-
- /* Returns the next generic_map_t that follows mapp. If there there is none,
- 0 is returned and h is unlocked. */
-
- static generic_map_t *
- next_map (in_use_hand h, generic_map_t *mapp)
- {
- generic_map_t *retval;
-
- retval = (generic_map_t *)
- ((char *) mapp + sizeof(generic_map_t) - SHIM_FOR_GENERIC_MAP_TO_COMPILE
- + CHARS_NEEDED(mapp->max));
-
- if (!retval->type)
- {
- HUnlock((Handle) h);
- retval = 0;
- }
- return retval;
- }
-
- /* Exactly the same as CountTypes, except only the resource file with the
- refnum of rn is consulted. */
-
- static short
- CountTypesRN (short rn)
- {
- short savern, retval;
-
- savern = CurResFile ();
- UseResFile (rn);
- retval = Count1Types ();
- UseResFile (savern);
- return retval;
- }
-
- /* Exactly the same as CountResources, except only the resource file with the
- refnum rn is consulted. */
-
- static short
- CountResourcesRN (short rn, ResType type)
- {
- short savern, retval;
-
- savern = CurResFile ();
- UseResFile (rn);
- retval = Count1Resources (type);
- UseResFile (savern);
- return retval;
- }
-
- /* Calls PBGetFCBInfo to fill what fcbrp points to with the appropriate values
- for rn. The return value is whatever PBGetFCBInfo returns. */
-
- static OSErr
- getfcbinfo (short rn, FCBPBRec *fcbrp)
- {
- OSErr retval;
-
- fcbrp->ioCompletion = 0;
- fcbrp->ioVRefNum = 0;
- fcbrp->ioRefNum = rn;
- fcbrp->ioFCBIndx = 0;
- fcbrp->ioNamePtr = 0;
-
- retval = PBGetFCBInfo (fcbrp, false);
- return retval;
- }
-
- enum { writableFlag = 1 };
-
- /* Returns noErr if rn is a writable file,
- otherwise returns appropriate error. */
-
- static OSErr
- is_writable (short rn)
- {
- OSErr retval;
- FCBPBRec fcbr;
-
- retval = getfcbinfo (rn, &fcbr);
- if (retval == noErr)
- #define IOFCBFLAGS_LOOKS_LIKE_A_BYTE_TO_ME
- #if defined(IOFCBFLAGS_LOOKS_LIKE_A_BYTE_TO_ME)
- retval = fcbr.ioFCBFlags & (writableFlag << 8) ? noErr : fLckdErr;
- #else
- retval = fcbr.ioFCBFlags & writableFlag ? noErr : fLckdErr;
- #endif
- return retval;
- }
-
- /* Returns the number of 512 byte blocks free on the volume that contains
- the file with refnum rn. An error results in 0 free blocks reported. */
-
- static unsigned long
- room_on_volume_with_file (short rn)
- {
- OSErr err;
- FCBPBRec fcbr;
- unsigned long retval;
-
- err = getfcbinfo (rn, &fcbr);
- if (err != noErr)
- retval = 0;
- else
- {
- #if 1
- ParamBlockRec pb;
-
- pb.volumeParam.ioNamePtr = 0;
- pb.volumeParam.ioVRefNum = fcbr.ioVRefNum;
- pb.volumeParam.ioVolIndex = 0;
-
- PBGetVInfo(&pb, false);
- retval = pb.volumeParam.ioVFrBlk * pb.volumeParam.ioVAlBlkSiz / 512;
- #else /* 1 */
- VCB *vcbp;
-
- vcbp = fcbr.fcbVPtr;
- retval = vcbp->vcbFreeBks * vcbp->vcbAlBlkSiz / 512;
- #endif /* 1 */
- }
- return retval;
- }
-
- /* Returns the number of 512 byte blocks taken up by the file with refnum
- rn. An error results in (LONGINT) -1L being returned. */
-
- static unsigned long
- file_length (short rn)
- {
- OSErr err;
- FCBPBRec fcbr;
- unsigned long retval;
-
- err = getfcbinfo (rn, &fcbr);
- if (err != noErr)
- retval = (unsigned long) -1L;
- else
- retval = fcbr.ioFCBPLen / 512;
- return retval;
- }
-
- /* Exactly like GetResource, except limited to the file specified by rn. */
-
- static Handle
- GetResourceRN (short rn, ResType type, short id)
- {
- short savern;
- Handle retval;
-
- savern = CurResFile ();
- UseResFile (rn);
- retval = Get1Resource (type, id);
- UseResFile (savern);
- return retval;
- }
-
- /* Exactly the same as AddResource, except its action is limited to the file
- with the refnum rn. */
-
- static void
- AddResourceRN (short rn, Handle h, ResType type, short id, Str255 name)
- {
- short savern;
-
- if (HandleZone (h) != SysZone)
- {
- Handle save_hand;
-
- save_hand = h;
- HandToHand (&h);
- DisposHandle (save_hand);
- }
- savern = CurResFile ();
- UseResFile (rn);
- AddResource (h, type, id, name);
- UseResFile (savern);
- }
-
- /* Exactly the same as GetIndType, except its action is limited to the file
- with the refnum rn. */
-
- static void
- GetIndTypeRN (short rn, ResType *typep, short type_num)
- {
- short savern;
-
- savern = CurResFile ();
- UseResFile (rn);
- Get1IndType (typep, type_num);
- UseResFile (savern);
- }
-
- /* Exactly the same as GetIndResource except limited to resources from the
- file with refnum rn. */
-
- static Handle
- GetIndResourceRN (short rn, ResType type, short id)
- {
- short savern;
- Handle retval;
-
- savern = CurResFile ();
- UseResFile (rn);
- retval = Get1IndResource (type, id);
- UseResFile (savern);
- return retval;
- }
-
- /* Puts the bit bitnum in *valuep. Returns noErr when successful,
- rangeErr when out of range. */
-
- static OSErr
- bit_test (generic_map_t *gp, unsigned long bitnum, boolean_t *valuep)
- {
- OSErr retval;
- boolean_t val;
-
- if (bitnum <= gp->max)
- {
- val = BitTst ((Ptr) gp->bitmap, bitnum) ? true : false;
- *valuep = val;
- retval = noErr;
- }
- else
- retval = rangeErr;
- return retval;
- }
-
- /* Scans through bitmap looking for the first bit with value tofind. The bit that
- we find is returned in *ulp. The return value is noErr on success, rangeErr
- when a bit isn't found in the proper range. */
-
- static OSErr
- find_first_bit (generic_map_t *gp, int tofind, unsigned long *ulp)
- {
- OSErr retval;
- unsigned char not_set;
- unsigned char *ucp;
- unsigned char u;
- unsigned long val;
- unsigned char mask;
-
- if (tofind)
- not_set = 0;
- else
- not_set = 0xff;
- for (val = 0, ucp = gp->bitmap; *ucp == not_set; ++ucp, val += 8)
- ;
- u = *ucp;
- for (mask = (1 << 7), tofind = (tofind & 1) << 7;
- (u & mask) != tofind; mask >>= 1, tofind >>= 1, ++val)
- ;
-
- if (val <= gp->max)
- {
- *ulp = val;
- retval = noErr;
- }
- else
- retval = rangeErr;
-
- return retval;
- }
-
- /* Sets to value toset the bit bitnum in bitmap. Returns noErr when toset is valid.
- Returns rangeErr otherwise. */
-
- static OSErr
- bit_set_to_value (generic_map_t *gp, unsigned long bitnum, unsigned long toset)
- {
- OSErr retval;
-
- if (toset > gp->max)
- retval = rangeErr;
- else
- {
- retval = noErr;
- if (toset)
- BitSet ((Ptr) gp->bitmap, bitnum);
- else
- BitClr ((Ptr) gp->bitmap, bitnum);
- }
- return retval;
- }
-
- /* Fill in initial values for the generic_map_t pointed to by gmp.
- The type and max fields are set directly from type and max. The
- bitmap is set to all zeros, except with ones in all the locations
- less than min. We also scan the system file for types that are
- already in use and mark them. */
-
- static void
- init_in_use_info (generic_map_t *gmp, ResType type, short min, short max)
- {
- int i, n_res;
- short save_resload;
-
- gmp->type = type;
- gmp->max = max;
- gmp->free = (long) max - (long) min + 1;
- memset (gmp->bitmap, 0, CHARS_NEEDED(max));
- for (i = 0; i < min; ++i)
- {
- OSErr err;
-
- err = bit_set_to_value (gmp, i, 1);
- if (err != noErr)
- DebugStr ((StringPtr) "\pshouldn't happen");
- }
-
- save_resload = ResLoad;
- SetResLoad (false);
-
- n_res = CountResourcesRN (SysMap, type);
- for (i = 1; i <= n_res; ++i)
- {
- Handle h;
- short id;
- ResType t;
- Str255 name;
- boolean_t val;
-
- h = GetIndResourceRN (SysMap, type, i);
- GetResInfo (h, &id, &t, name);
- if (bit_test (gmp, id, &val) == noErr && !val)
- {
- OSErr err;
-
- err = bit_set_to_value (gmp, id, 1);
- if (err != noErr)
- DebugStr ((StringPtr) "\pshouldn't happen");
- --gmp->free;
- }
- }
-
- SetResLoad (save_resload);
- }
-
- #define IN_USE_TYPE 'nUSE'
- enum { IN_USE_ID = 0 };
-
- /* Picks up the in use info for the file rn. Usually this is just the
- resource 'nUSE' with id 0, but if that resource doesn't exist, the
- information has to be created based on what's in the System file.
- The return value is noErr, unless an error occurs. */
-
- static OSErr
- get_in_use_info (short rn, in_use_hand *usehandp)
- {
- Handle h;
- OSErr retval;
-
- h = GetResourceRN (rn, IN_USE_TYPE, IN_USE_ID);
- if (h)
- {
- LoadResource (h);
- retval = noErr;
- }
- else
- {
- h = NewHandle (sizeof(***usehandp));
- if (!h)
- retval = MemError ();
- else
- {
- in_use_ptr iup;
-
- HLock (h);
- iup = (in_use_ptr) *h;
- init_in_use_info ((generic_map_t *) &iup->drvr_map, 'DRVR',
- DRVR_MIN, DRVR_MAX);
-
- init_in_use_info ((generic_map_t *) &iup->font_map, 'FONT',
- FONT_MIN, FONT_MAX);
-
- init_in_use_info ((generic_map_t *) &iup->nfnt_map, 'NFNT',
- NFNT_MIN, NFNT_MAX);
-
- init_in_use_info ((generic_map_t *) &iup->fond_map, 'FOND',
- FOND_MIN, FOND_MAX);
-
- iup->sentinel = 0;
- HUnlock (h);
- AddResourceRN (rn, h, IN_USE_TYPE, IN_USE_ID, (StringPtr) 0);
- retval = ResError ();
- }
- }
- *usehandp = (in_use_hand) h;
- return retval;
- }
-
- /* Allocate room for a new link, then fill in its fields with old_id,
- new_id and next. Store the pointer to the new link to where newpp
- points and return noErr if successful. Don't modify *newpp on
- failure. */
-
- static OSErr
- new_map_link (mapping_link_t **newpp, short old_id, short new_id,
- mapping_link_t *next)
- {
- OSErr retval;
- mapping_link_t *linkp;
-
- linkp = (mapping_link_t *) NewPtr(sizeof(*linkp));
- if (!linkp)
- retval = MemError();
- else
- {
- retval = noErr;
- linkp->old_id = old_id;
- linkp->new_id = new_id;
- linkp->next = next;
- *newpp = linkp;
- }
- return retval;
- }
-
- /* Adds a mapping to the mapping_t pointed to by mappingp. The mapping
- consists of a type, and old_id and a new_id. Returns noErr when
- successful, a Mac error value otherwise. */
-
- static OSErr
- add_mapping (ResType type, mapping_t *mappingp, short old_id, short new_id)
- {
- int i;
- OSErr retval;
-
- for (i = 0; (i < NELEM(mappingp->list) &&
- mappingp->list[i].type && mappingp->list[i].type != type); ++i)
- ;
- if (i == NELEM(mappingp->list))
- {
- DebugStr((StringPtr) "\ptried to map too many types");
- retval = fsDSIntErr;
- }
- else
- {
- mappingp->list[i].type = type;
- retval = new_map_link (&mappingp->list[i].head, old_id, new_id,
- mappingp->list[i].head);
- }
- return retval;
- }
-
- /* Sets the mapping_t pointed to by mappingp to zeros so that we can add
- information to it. */
-
- static void init_map (mapping_t *mappingp)
- {
- memset (mappingp, 0, sizeof(*mappingp));
- }
-
- /*
- * Makes sure all resources that need to be copied can have a proper
- * mapping. If it succeeds, enough information is stored in *mappingp
- * so that the mapping doesn't need to be done again. Parameter
- * from_rn is the refnum of the file that is being merged with the
- * master file. Parameter master_rn is the refnum of the master file
- * itself. Returns noErr on success, or an error value if something
- * goes wrong.
- */
-
- static OSErr
- setup_map (short from_rn, short master_rn, mapping_t *mappingp)
- {
- OSErr retval;
-
- init_map (mappingp);
- retval = is_writable (master_rn);
- if (retval == noErr)
- {
- if (room_on_volume_with_file (master_rn) < file_length (from_rn))
- retval = dskFulErr;
- else
- {
- in_use_hand in_useh;
-
- retval = get_in_use_info (master_rn, &in_useh);
- if (retval == noErr)
- {
- generic_map_t *gp;
- short save_resload;
-
- save_resload = ResLoad;
- SetResLoad (false);
- for (gp = first_map (in_useh); gp; gp = next_map (in_useh, gp))
- {
- short n_res, n;
-
- n_res = CountResourcesRN (from_rn, gp->type);
- if (n_res > gp->free)
- retval = tooManyResources;
- else
- {
- for (n = 1; retval == noErr && n <= n_res; ++n)
- {
- Handle h;
- short id;
- short new_id;
- ResType t;
- Str255 name;
- boolean_t val;
-
- h = GetIndResourceRN (from_rn, gp->type, n);
- GetResInfo (h, &id, &t, name);
- if (bit_test (gp, id, &val) == noErr && !val)
- new_id = id;
- else
- {
- unsigned long ul;
-
- retval = find_first_bit (gp, 0, &ul);
- if (retval != noErr)
- DebugStr ((StringPtr) "\pshouldn't happen");
- else
- new_id = ul;
- }
- if (retval == noErr)
- {
- retval = bit_set_to_value (gp, new_id, 1);
- if (retval == noErr)
- retval = add_mapping (gp->type, mappingp, id, new_id);
- }
- }
- }
- gp->free -= n_res;
- }
- ChangedResource ((Handle) in_useh);
- SetResLoad (save_resload);
- }
- }
- }
- return retval;
- }
-
- enum { OWNED_MASK = 0xF800, DRVR_ID = 0xC000 };
-
- /* Returns true if a given ID represents a
- resource that is owned by a DRVR. */
-
- static boolean_t
- owned_drvr_id_p (short id)
- {
- return (id & OWNED_MASK) == DRVR_ID;
- }
-
- enum { OWNER_SHIFT = 5, OWNER_MASK = 0x3F << OWNER_SHIFT };
-
- /* Returns the id of the owner of an owned id. */
-
- static short
- owned_id (short id)
- {
- return (id & OWNER_MASK) >> OWNER_SHIFT;
- }
-
- /* Use the mapping_t pointed to by mappingp to map type, old_id into a new
- id which is returned. If there is no map, -1L is returned, which is an
- impossible id. */
-
- static long
- find_map (ResType type, short old_id, const mapping_t *mappingp)
- {
- long retval;
- int i;
-
- retval = -1L;
-
- for (i = 0; i < NELEM(mappingp->list) && mappingp->list[i].type != type; ++i)
- ;
-
- if (i < NELEM(mappingp->list))
- {
- mapping_link_t *mp;
-
- for (mp = mappingp->list[i].head; mp && mp->old_id != old_id;
- mp = mp->next)
- ;
- if (mp)
- retval = (long) (unsigned int) mp->new_id;
- }
-
- return retval;
- }
-
- enum { VAR_MASK = 0x1F };
-
- /* Given an owned_id and an id, construct a new id that is tagged as an
- owned by DRVR id. */
-
- static short
- make_owned_drvr_id (short owned_id, short id)
- {
- return DRVR_ID | ((owned_id & VAR_MASK) << OWNER_SHIFT) | (id & VAR_MASK);
- }
-
- /* Returns whether a given resource should be copied into the master file.
- If it should, then *idp is updated to contain the new id of this resource.
- The id number pointed to by idp will only change when there's a conflict
- with a preexisting id number. The parametr from_rn is the refnum
- of the file being added to the master file, master_rn is the refnum of
- the master file itself. The parameter mappingp points to the mapping
- information that was already determined and saved for later. */
-
- static short
- map_id (ResType type, short *idp, const mapping_t *mappingp)
- {
- short retval;
-
- if (owned_drvr_id_p (*idp))
- {
- short old_owned;
- long new_id;
-
- old_owned = owned_id (*idp);
- new_id = find_map ('DRVR', old_owned, mappingp);
- if (new_id >= 0)
- {
- *idp = make_owned_drvr_id (new_id, *idp);
- retval = TRUE;
- }
- else
- retval = FALSE;
- }
- else
- {
- long new_id;
-
- switch (type)
- {
- case 'DRVR':
- case 'FONT':
- case 'NFNT':
- case 'FOND':
- new_id = find_map (type, *idp, mappingp);
- if (new_id >= 0)
- {
- *idp = new_id;
- retval = TRUE;
- }
- else
- retval = FALSE;
- break;
- default:
- retval = FALSE;
- }
- }
- return retval;
- }
-
- typedef struct
- {
- Rect boundsRect;
- INTEGER procID;
- char visible;
- char ignored;
- char goAwayFlag;
- char ignored2;
- LONGINT refcon;
- INTEGER id;
- /* more ... */
- } dlog_res_t;
-
- typedef struct
- {
- Rect boundsRect;
- INTEGER id;
- /* more ... */
- } alrt_res_t;
-
- /* Maps the data of certain resource types (currently only FONDs) that
- incorporate ids that may have been mapped. The Handle h is a handle
- to the resource, mappingp points to previously determined mapping info. */
-
- static void
- map_data (ResType type, Handle h, const mapping_t *mappingp)
- {
- SignedByte state;
-
- state = HGetState (h);
- HLock (h);
-
- switch (type)
- {
- case 'FOND':
- {
- short *ip;
- short n_items;
- font_assoc_t *fap;
-
- ip = (short *) ((char *) *h + 20 * sizeof(short) +
- 3 * sizeof(long));
- n_items = *ip + 1;
- fap = (font_assoc_t *) (ip + 1);
- while (--n_items >= 0)
- {
- short old_id;
- long new_id;
-
- old_id = fap->id;
- if (old_id <= FONT_MAX)
- new_id = find_map ('FONT', old_id, mappingp);
- else
- new_id = -1;
- if (new_id < 0)
- new_id = find_map ('NFNT', old_id, mappingp);
- if (new_id >= 0)
- fap->id = new_id;
- }
- }
- break;
- case 'DLOG':
- {
- dlog_res_t **dp;
-
- dp = (dlog_res_t **) h;
- map_id ('DLOG', &(*dp)->id, mappingp);
- }
- break;
- case 'ALRT':
- {
- alrt_res_t **ap;
-
- ap = (alrt_res_t **) h;
- map_id ('ALRT', &(*ap)->id, mappingp);
- }
- break;
- }
- HSetState (h, state);
- }
-
- /* Frees up any memory that may have been allocated and stuck in the mapping_t
- pointed to by mappingp. */
-
- static void
- teardown_map (mapping_t *mappingp)
- {
- int i;
-
- for (i = 0; i < NELEM(mappingp->list); ++i)
- {
- mapping_link_t *mp, *next;
-
- for (mp = mappingp->list[i].head; mp; mp = next)
- {
- next = mp->next;
- DisposPtr((Ptr) mp);
- }
- }
- /* memset(mappingp, 0, sizeof(*mappingp)); */
- }
-
- /* Merges all the Font and DA resources from the file with refnum from_file_rn
- into the file with refnum master_file_rn. On success noErr is returned.
- On failure an error value is returned. */
-
- OSErr
- AddToMasterFile (short from_file_rn, short master_file_rn)
- {
- OSErr err;
- mapping_t mapping;
- THz save_zone;
-
- save_zone = GetZone ();
- SetZone (SysZone);
- err = setup_map (from_file_rn, master_file_rn, &mapping);
- if (err == noErr)
- {
- short type_num, type_num_max;
- short save_resload;
-
- type_num_max = CountTypesRN (from_file_rn);
- save_resload = ResLoad;
- SetResLoad (false);
- for (type_num = 1; type_num <= type_num_max; ++type_num)
- {
- ResType type;
- short res_num, res_num_max;
-
- GetIndTypeRN (from_file_rn, &type, type_num);
- res_num_max = CountResourcesRN (from_file_rn, type);
- for (res_num = 1; res_num <= res_num_max; ++res_num)
- {
- Handle h;
- short id;
- ResType t;
- Str255 name;
-
- h = GetIndResourceRN (from_file_rn, type, res_num);
- GetResInfo (h, &id, &t, name);
- if (map_id (type, &id, &mapping))
- {
- LoadResource (h);
- DetachResource (h);
- map_data (type, h, &mapping);
- AddResourceRN (master_file_rn, h, type, id, name);
- }
- }
- }
- SetResLoad (save_resload);
- }
- teardown_map (&mapping);
- SetZone (save_zone);
- return err;
- }
-
- #if defined( REMOVE_FROM_MASTER_FILE_SUPPORT )
-
- /* Sets up the info needed to recognize which resources from the
- master file with refnum master_rn need to be removed as part of the
- process of getting rid of all font and DA resources that were
- originally copied into the master file from the file with the
- refnum from_rn. The parameter unmappingp points to where this
- "unmapping" information should be stored. For simplicity we use
- the mapping_t routines and just know that if there is any mapping
- at all, this means that resource will be deleted. */
-
- static OSErr
- setup_unmap (short from_rn, short master_rn, mapping_t *unmappingp)
- {
- OSErr retval;
-
- init_map (unmappingp);
- retval = is_writable (master_rn);
- if (retval == noErr)
- {
- /* TODO: There are a few different ways that we can do the
- unmapping. One way would be to log the mappings as part of
- the mapping process. We could put the log in the master
- file, then all that would be needed here would be to identify
- which file from_rn represents and use that to look up a list
- of resources to nuke. Another way would be to checksum all
- of the resources in the file with refnum from_rn and then use
- that to identify which resources to nuke. A third way would
- be to punt all the code for removing a file from the master
- file and just rebuild the master file from scratch, using all
- the files that are already there, except the one we're
- removing. This method requires less code in this file and
- also has the benefit of forcing a periodic rebuild, which
- might be useful by itself. */
- }
- return retval;
- }
-
- /* A predicate that returns true if a given resource should be deleted as
- part of the process of removing the contents of one file from the master
- file. */
-
- static boolean_t
- delete_p (ResType type, short id, const mapping_t *unmappingp)
- {
- boolean_t retval;
-
- retval = false;
- if (owned_drvr_id_p (id))
- {
- short owner_id;
-
- owner_id = owned_id (id);
- if (find_map ('DRVR', owner_id, unmappingp) >= 0)
- retval = true;
- }
- if (!retval && find_map (type, id, unmappingp))
- retval = true;
- return retval;
- }
-
- /* Undoes the action of AddToMasterFile and returns noErr on success, or an
- error code if there is trouble. All the font and da resources present
- in the file with refnum from_file_rn are removed from the master file,
- which has a refnum of master_file_rn. */
-
- static OSErr
- RemoveFromMasterFile (short from_file_rn, short master_file_rn)
- {
- mapping_t unmapping;
- OSErr err;
-
- err = setup_unmap (from_file_rn, master_file_rn, &unmapping);
- if (err == noErr)
- {
- link_t *headp;
-
- type_num_max = CountTypesRN (master_file_rn);
- save_resload = ResLoad;
- SetResLoad (false);
- headp = 0;
- for (type_num = 1; type_num <= type_num_max; ++type_num)
- {
- GetIndTypeRN (master_file_rn, &type, type_num);
- res_num_max = CountResourcesRN (master_file_rn, type);
- for (res_num = 1; res_num <= res_num_max; ++res_num)
- {
- Handle h;
- short id;
- ResType t;
- Str255 name;
-
- h = GetIndResourceRN (master_file_rn, type, res_num);
- GetResInfo (h, &id, &t, name);
- if (delete_p (type, id, &unmapping))
- {
- link_t *newlinkp;
- newlinkp = (link_t *) NewPtr (sizeof(link_t));
- assert (newlinkp);
- newlinkp->next = headp;
- newlinkp->resource = h;
- headp = newlinkp;
- }
- }
- }
- while (headp)
- {
- oldp = headp;
- headp = headp->next;
- RmveResource (oldp->resource);
- DisposPtr (oldp);
- }
- }
- return err;
- }
-
- #endif /* defined( REMOVE_FROM_MASTER_FILE_SUPPORT ) */
-