DisposePtr(currSName); DisposePtr(currSNameBuf);
PopulateSetupTypeWinKeys(char *cfgText){	OSErr 		err = noErr;	int			i, j, hunVal, tenVal, unitVal, compNum, cNumIdx;	Ptr			currSNameBuf, currSName, currKeyBuf, currKey, idxCh, currCompName, compIdx;	Str255		pSName, pkey, pidx;	char		eof[1];	Handle		currVal;		eof[0] = 0;		/* SetupTypeWin: types and their descriptions */	gControls->cfg->numSetupTypes = 0;	for (i=0;i<kMaxSetupTypes;i++)   /* init stComp[][] lists */	{		for(j=0; j<gControls->cfg->numComps; j++)		{			gControls->cfg->st[i].comp[j] = kNotInSetupType;		}	}	for (i=0; i<kMaxSetupTypes; i++)	{		GetIndString(pSName, rParseKeys, sSetupType);				currSNameBuf = PascalToC(pSName);		currSName = NewPtrClear(kKeyMaxLen);		strncpy(currSName, currSNameBuf, strlen(currSNameBuf));		unitVal = i;		GetIndString(pidx, rIndices, unitVal+1);		idxCh = PascalToC(pidx);		strncat(currSName, idxCh, 1);		DisposePtr(idxCh);		strncat(currSName, eof, 1);				/* short description */		GetIndString(pkey, rParseKeys, sDescShort);		currKey = PascalToC(pkey);		gControls->cfg->st[i].shortDesc = NewHandleClear(kValueMaxLen);		if (!FillKeyValueUsingName(currSName, currKey, gControls->cfg->st[i].shortDesc, cfgText))		{			DisposePtr(currKey);			break; // no more SetupTypes 		}		DisposePtr(currKey);		/* long description */		GetIndString(pkey, rParseKeys, sDescLong);		currKey = PascalToC(pkey);		gControls->cfg->st[i].longDesc = NewHandleClear(kValueMaxLen);		FillKeyValueUsingName(currSName, currKey, gControls->cfg->st[i].longDesc, cfgText);		DisposePtr(currKey);				/* now search for all components in this SetupType and fill its stComp[][] array */		gControls->cfg->st[i].numComps = 0;		for (j=0; j<gControls->cfg->numComps; j++)		{			GetIndString(pkey, rParseKeys, sC);			currKeyBuf = PascalToC(pkey);			currKey = NewPtrClear(kKeyMaxLen);			strncpy(currKey, currKeyBuf, strlen(currKeyBuf));						if(j>99) // concat 100's digit 			{				hunVal = j/100;				GetIndString(pidx, rIndices, hunVal+1);				idxCh = PascalToC(pidx);				strncat(currKey, idxCh, 1);				DisposePtr(idxCh);			}			else				hunVal = 0;					if(j>9)	// concat 10's digit 			{				tenVal = (j - (hunVal*100))/10;				GetIndString(pidx, rIndices, tenVal+1);				idxCh = PascalToC(pidx);				strncat(currKey, idxCh, 1);				DisposePtr(idxCh);			}			else				tenVal = 0;				unitVal = j - (hunVal*100) - (tenVal*10);			GetIndString(pidx, rIndices, unitVal+1);			idxCh = PascalToC(pidx);			strncat(currKey, idxCh, 1);			DisposePtr(idxCh);			strncat(currKey, eof, 1);						currVal = NewHandleClear(kValueMaxLen);			if (FillKeyValueUsingName(currSName, currKey, currVal, cfgText))			{				/* Parse the value to get the component index */				GetIndString(pSName, rParseKeys, sComponent);						currSNameBuf = PascalToC(pSName);				currCompName = NewPtrClear(kKeyMaxLen);				strncpy(currCompName, currSNameBuf, strlen(currSNameBuf));								HLock(currVal);				cNumIdx = strspn(currCompName, *currVal);				compIdx = *currVal+cNumIdx;				compNum = atoi(compIdx);				gControls->cfg->st[i].comp[compNum] = kInSetupType;				gControls->cfg->st[i].numComps++;				HUnlock(currVal);			}		}					DisposePtr(currKey);		DisposePtr(currKeyBuf);		DisposePtr(currSName);		DisposePtr(currSNameBuf);	}	gControls->cfg->numSetupTypes = i;		return err;}