예제 #1
0
파일: time.c 프로젝트: AshishKumar4/acess2
/**
 * \brief Delete a timer from the running list
 */
void Time_RemoveTimer(tTimer *Timer)
{
	tTimer	*t;
	tTimer	**prev_next;

	if( !Timer )	return ;
	
	SHORTLOCK(&gTimers_ListLock);
	for( prev_next = &gTimers, t = gTimers; t; prev_next = &t->Next, t = t->Next )
	{
		ASSERT( prev_next != &t->Next );
		ASSERT( CheckMem(t, sizeof(tTimer)) );
		if( t == Timer )
		{
			*prev_next = t->Next;
			break ;
		}
	}
	SHORTREL(&gTimers_ListLock);

	if( t ) {
		Timer->bActive = 0;
		LOG("%p removed %p", __builtin_return_address(0), Timer);
	}
	else
		LOG("%p tried to remove %p (already complete)", __builtin_return_address(0), Timer);
}
예제 #2
0
static void GetTrainingDescs( // get the descriptors for all points and images for one pyr lev
    TRAIN_DISTS&     train_dists, // out: [ipoint] [idesc] distances from true landmark
    TRAIN_DESCS&     train_descs, // out: [ipoint] [idesc] training descriptors
    int              ilev,        // in: pyramid level (0 is full scale)
    const ShapeFile& sh)          // in
{
    clock_t start_time = clock();
    lprintf("Pyramid level %d reading %d training images ", ilev, sh.nshapes_);
    logprintf("\n");
    const int npoints = sh.shapes_[0].rows;
    train_dists.resize(npoints);
    train_descs.resize(npoints);
    Pacifier pacifier(sh.nshapes_);
    for (int ishape = 0; ishape < sh.nshapes_; ishape++)
    {
        GenTrainingDescsForOneImg(train_dists, train_descs, ilev, sh, ishape);
        CheckMem(); // warn if are about to run out of memory
        if (print_g)
            pacifier.Print_(ishape);
    }
    if (print_g) // no tasm -q flag?
    {
        pacifier.End_();
        printf(" ");
    }
    CheckUnusedPoints(train_dists, sh.nshapes_);
    lprintf("[%.1f secs]\n", double(clock() - start_time) / CLOCKS_PER_SEC);
}
예제 #3
0
size_t IPStack_Buffer_GetData(tIPStackBuffer *Buffer, void *Dest, size_t MaxBytes)
{
	ASSERT(Buffer);
	Uint8	*dest = Dest;
	size_t	rem_space = MaxBytes;
	size_t	len;
	
	for( int i = Buffer->nSubBuffers; i -- && rem_space != 0; )
	{
		len = MIN(Buffer->SubBuffers[i].PreLength, rem_space);
		#if !DISABLE_ASSERTS
		if( !CheckMem(Buffer->SubBuffers[i].Data, len) ) {
			Log_Error("IPStack", "Buffer pre %i invalid (%p+0x%x)",
				i, Buffer->SubBuffers[i].Data, len);
			return 0;
		}
		#endif
		memcpy(dest,
			Buffer->SubBuffers[i].Data,
			len
			);
		dest += len;
		rem_space -= len;
	}
	for( int i = 0; i < Buffer->nSubBuffers && rem_space; i ++ )
	{
		if( Buffer->SubBuffers[i].PostLength == 0  )
			continue ;
		
		len = MIN(Buffer->SubBuffers[i].PostLength, rem_space);
		void *ptr = (Uint8*)Buffer->SubBuffers[i].Data + Buffer->SubBuffers[i].PreLength;
		ASSERT( CheckMem(ptr, len) );
		memcpy(dest, ptr, len);
		dest += len;
		rem_space -= len;
	}
	
	return MaxBytes - rem_space;
}
예제 #4
0
/**
 * \brief IOCtl for /Devices/ip/routes/
 */
int IPStack_RouteDir_IOCtl(tVFS_Node *Node, int ID, void *Data)
{
	tRoute	*rt;
	ENTER("pNode iID pData", Node, ID, Data);
	switch(ID)
	{
	// --- Standard IOCtls (0-3) ---
	BASE_IOCTLS(DRV_TYPE_MISC, STR(IDENT), VERSION, casIOCtls_RouteDir)
	
	case 4:	// Locate Route
		{
			struct {
				 int	Type;
				Uint8	Addr[];
			}	*data = Data;
			
			if( !CheckMem(Data, sizeof(int)) )
				LEAVE_RET('i', -1);
			if( !CheckMem(Data, sizeof(int) + IPStack_GetAddressSize(data->Type)) )
				LEAVE_RET('i', -1);
			
			Log_Debug("IPStack", "Route_RouteDir_IOCtl - FindRoute %i, %s",
				data->Type, IPStack_PrintAddress(data->Type, data->Addr) );
			rt = IPStack_FindRoute(data->Type, NULL, data->Addr);
			
			if( !rt )
				LEAVE_RET('i', 0);
			
			LEAVE('i', rt->Node.Inode);
			return rt->Node.Inode;
		}
		break;
	}
	LEAVE('i', 0);
	return 0;
}
예제 #5
0
/* Draw a line */
static int
mac_draw_line (register gx_device *dev,
				  int x0, int y0,
				  int x1, int y1,
				  gx_color_index color)
{
	gx_device_macos		* mdev = (gx_device_macos *)dev;
	
	CheckMem(1024, 100*1024);
	ResetPage();
	
	GSSetFgCol(dev, mdev->currPicPos, color);
	PICT_Line(mdev->currPicPos, x0, y0, x1, y1);
	
	PICT_OpEndPicGoOn(mdev->currPicPos);
	
	return 0;
}
예제 #6
0
/* Copy a monochrome bitmap. */
static int
mac_copy_mono (register gx_device *dev,
				  const unsigned char *base, int data_x, int raster, gx_bitmap_id id,
				  int x, int y, int w, int h,
				  gx_color_index color_0, gx_color_index color_1)
{
	gx_device_macos		* mdev = (gx_device_macos *)dev;
	
	int				byteCount = raster * h;
	short			copyMode;
	
	// this case doesn't change the picture -> return without wasting time
	if (color_0 == gx_no_color_index && color_1 == gx_no_color_index)
		return 0;
	
	fit_copy(dev, base, data_x, raster, id, x, y, w, h);
	
	CheckMem(10*1024 + byteCount*10,  100*1024 + byteCount*10);
	ResetPage();
	
	if (color_0 == gx_no_color_index)
		copyMode = srcOr;
	else if (color_1 == gx_no_color_index)
		copyMode = notSrcBic;	// this mode is untested ! (no file found which is using it)
	else
		copyMode = srcCopy;
	
	copyMode += ditherCopy;
	
	GSSetBkCol(dev, mdev->currPicPos, color_0);
	GSSetFgCol(dev, mdev->currPicPos, color_1);
	
	PICTWriteOpcode(mdev->currPicPos, 0x0098);
	PICTWriteInt(mdev->currPicPos, raster);
	PICTWriteRect(mdev->currPicPos, 0, 0, raster*8, h);
	PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
	PICTWriteRect(mdev->currPicPos, x, y, w, h);
	PICTWriteInt(mdev->currPicPos, copyMode);
	PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
	
	PICT_OpEndPicGoOn(mdev->currPicPos);
	
	return 0;
}
예제 #7
0
static int
mac_render_char(gx_xfont *xf, gx_xglyph xg, gx_device *dev,
				int xo, int yo, gx_color_index color, int required)
{
#pragma unused(dev,required)
	mac_xfont			* macxf = (mac_xfont*) xf;
	gx_device_macos		* mdev = (gx_device_macos*) macxf->dev;
	
	Str255				character;
	int					i, found;
	
	CheckMem(10*1024, 100*1024);
	ResetPage();
	
	character[0] = 1;
	character[1] = xg;
	
	GSSetFgCol(macxf->dev, mdev->currPicPos, color);
	
	found = 0;
	for (i=0; i<mdev->numUsedFonts; i++)
		if (mdev->usedFontIDs[i] == macxf->fontID)	found = 1;
	
	if (!found) {
		mdev->usedFontIDs[mdev->numUsedFonts++] = macxf->fontID;
		PICT_fontName(mdev->currPicPos, macxf->fontID, macxf->fontName);
	}
	if (mdev->lastFontID != macxf->fontID) {
		PICT_TxFont(mdev->currPicPos, macxf->fontID);
		mdev->lastFontID = macxf->fontID;
	}
	if (mdev->lastFontSize != macxf->fontSize) {
		PICT_TxSize(mdev->currPicPos, macxf->fontSize);
		mdev->lastFontSize = macxf->fontSize;
	}
	if (mdev->lastFontFace != macxf->fontFace) {
		PICT_TxFace(mdev->currPicPos, macxf->fontFace);
		mdev->lastFontFace = macxf->fontFace;
	}
	PICT_LongText(mdev->currPicPos, xo, yo, character);
	PICT_OpEndPicGoOn(mdev->currPicPos);
	
	return 0;
}
예제 #8
0
파일: time.c 프로젝트: AshishKumar4/acess2
/**
 * \brief Schedule a timer to fire
 */
void Time_ScheduleTimer(tTimer *Timer, int Delta)
{
	tTimer	*t;
	tTimer	**prev_next;

	// Sanity checks
	if( !Timer )	return ;

	if( Timer->bActive )	return;
	
	// Set time
	Timer->FiresAfter = now() + Delta;
	
	// Debug
	LOG("%p added timer %p - %i ms (ts=%lli)",
		__builtin_return_address(0), Timer, Delta, Timer->FiresAfter);

	// Add into list (sorted)
	SHORTLOCK(&gTimers_ListLock);
//	Mutex_Release( &Timer->Lock );	// Prevent deadlocks
	for( prev_next = &gTimers, t = gTimers; t; prev_next = &t->Next, t = t->Next )
	{
		ASSERT( prev_next != &t->Next );
		ASSERT( CheckMem(t, sizeof(tTimer)) );
		if( t == Timer )
		{
			LOG("Double schedule - increasing delta");
			SHORTREL(&gTimers_ListLock);
			return ;
		}
		LOG(" t = %p ts:%lli", t, t->FiresAfter);
		if( t->FiresAfter > Timer->FiresAfter )	break;
	}
	Timer->Next = t;
	*prev_next = Timer;
	Timer->bActive = 1;
	LOG(" prev_next=%p Timer=%p next=%p", prev_next, Timer, t);
	SHORTREL(&gTimers_ListLock);
}
예제 #9
0
/* Fill a rectangle with a color. */
static int
mac_fill_rectangle(register gx_device *dev,
					  int x, int y, int w, int h,
					  gx_color_index color)
{
	gx_device_macos		* mdev = (gx_device_macos *)dev;
	
	/* ignore a fullpage rect directly after an output_page, this would clear the pict */
	if (mdev->outputPage &&
			(x == 0) && (y == 0) && (w == mdev->width) && (h == mdev->height)) {
		return 0;
	}
	
	CheckMem(1024, 100*1024);
	ResetPage();
	
	GSSetFgCol(dev, mdev->currPicPos, color);
	PICT_fillRect(mdev->currPicPos, x, y, w, h);
	
	PICT_OpEndPicGoOn(mdev->currPicPos);
	
	return 0;
}
예제 #10
0
/* Copy a color bitmap. */
static int
mac_copy_color (register gx_device *dev,
				const unsigned char *base, int data_x, int raster,  gx_bitmap_id id,
				int x, int y, int w, int h)
{
	gx_device_macos		* mdev = (gx_device_macos *)dev;
	
	int				byteCount = raster * h, color;
	gx_color_value	rgb[3];
	
	fit_copy(dev, base, data_x, raster, id, x, y, w, h);
	
	CheckMem(10*1024 + byteCount*4, 100*1024 + byteCount*4);
	ResetPage();
	
	GSSetStdCol(mdev->currPicPos);		// Sets FgCol to Black and BkCol to White
	
	if (mdev->color_info.depth == 24) {
		PICTWriteOpcode(mdev->currPicPos, 0x009A);
		PICTWriteLong(mdev->currPicPos, 0x000000FF);
		PICTWritePixMap(mdev->currPicPos, 0, 0, raster/4, h, raster, 2, 0,
						X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), 32);
		PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
		PICTWriteRect(mdev->currPicPos, x, y, w, h);
		PICTWriteInt(mdev->currPicPos, srcCopy);
		
/*		memcpy(mdev->currPicPos, base, byteCount);
		(char*)(mdev->currPicPos) += byteCount;*/
		
		{
			short	i;
			byteCount = 0;
			
			for (i=0; i<raster/4*h; i++) {
			//	PICTWriteByte(mdev->currPicPos, 0x00);
				PICTWriteByte(mdev->currPicPos, 0x00);
				PICTWriteByte(mdev->currPicPos, 0x00);
				PICTWriteByte(mdev->currPicPos, 0x00);
				byteCount += 3;
			}
		}
		
		if (byteCount % 2)
			PICTWriteFillByte(mdev->currPicPos);
		
	} else if (mdev->color_info.depth <= 8) {
		ColorSpec		*colorTable;
		
		colorTable = (ColorSpec*) malloc(sizeof(ColorSpec) * (1 << mdev->color_info.depth));
		for (color=0; color < (1 << mdev->color_info.depth); color++) {
			(*dev_proc(dev, map_color_rgb))(dev, color, rgb);
			colorTable[color].value		= color;
			colorTable[color].rgb.red	= rgb[0];
			colorTable[color].rgb.green	= rgb[1];
			colorTable[color].rgb.blue	= rgb[2];
		}
		
		PICTWriteOpcode(mdev->currPicPos, 0x0098);
		PICTWritePixMap(mdev->currPicPos, 0, 0, raster*8/mdev->color_info.depth, h, raster, 1, 0,
						X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch),
						mdev->color_info.depth);
		PICTWriteColorTable(mdev->currPicPos, 0, (1 << mdev->color_info.depth), colorTable);
		PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
		PICTWriteRect(mdev->currPicPos, x, y, w, h);
		PICTWriteInt(mdev->currPicPos, srcCopy);
		
		PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
		
		free(colorTable);
	} else {
		gx_default_copy_color( dev, base, data_x, raster, id, x, y, w, h );
	}
	
	PICT_OpEndPicGoOn(mdev->currPicPos);
	
	return 0;
}
예제 #11
0
/* that's why this will only work on a fully white background!!!! */
static int
mac_copy_alpha(gx_device *dev, const unsigned char *base, int data_x,
		   int raster, gx_bitmap_id id, int x, int y, int w, int h,
		   gx_color_index color, int depth)
{
	gx_device_macos		* mdev = (gx_device_macos *)dev;
	
	ColorSpec			*colorTable;
	short				copyMode, shade, maxShade = (1 << depth) - 1, byteCount = raster * h;
	gx_color_value		rgb[3];
	colorHSV			colHSV;
	colorRGB			colRGB;
	float				saturation, value;
	
	fit_copy(dev, base, data_x, raster, id, x, y, w, h);
	
	CheckMem( byteCount*4 + 200*1024, byteCount*4 + 500*1024 );
	ResetPage();
	
	colorTable = (ColorSpec*) malloc(sizeof(ColorSpec) * (maxShade+1));
	if (colorTable == NULL)
		return gs_error_VMerror;
	
	(*dev_proc(dev, map_color_rgb))(dev, color, rgb);
	colRGB.red = rgb[0];
	colRGB.green = rgb[1];
	colRGB.blue = rgb[2];
	mac_convert_rgb_hsv(&colRGB, &colHSV);
	saturation = colHSV.s;
	value = colHSV.v;
	
	for (shade=0; shade <= maxShade; shade++) {
		colorTable[shade].value = maxShade -  shade;
		
		colHSV.s = saturation * (1.0 - (float)shade/(float)maxShade);
		colHSV.v = value + ((1.0 - value) * (float)shade/(float)maxShade);
		
		mac_convert_hsv_rgb(&colHSV, &colRGB);
		colorTable[shade].rgb.red   = colRGB.red;
		colorTable[shade].rgb.green = colRGB.green;
		colorTable[shade].rgb.blue  = colRGB.blue;
	}
	copyMode = srcCopy + ditherCopy;
	
	GSSetStdCol(mdev->currPicPos);
	
	if (raster < 8) {
		PICTWriteOpcode(mdev->currPicPos, 0x0090);
	} else {
		PICTWriteOpcode(mdev->currPicPos, 0x0098);
	}
	PICTWritePixMap(mdev->currPicPos, 0, 0, raster*8/depth, h, raster, 0, 0,
					X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), depth);
	PICTWriteColorTable(mdev->currPicPos, 0, maxShade+1, colorTable);
	PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
	PICTWriteRect(mdev->currPicPos, x, y, w, h);
	PICTWriteInt(mdev->currPicPos, copyMode);
	PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
	
	PICT_OpEndPicGoOn(mdev->currPicPos);
	
	free(colorTable);
	
	return 0;
}
예제 #12
0
/**
 * \brief IOCtl for /Devices/ip/routes/#
 */
int IPStack_Route_IOCtl(tVFS_Node *Node, int ID, void *Data)
{
	tRoute	*rt = Node->ImplPtr;
	 int	addrSize = IPStack_GetAddressSize(rt->AddressType);

	ENTER("pNode iID pData", Node, ID, Data);
	
	switch(ID)
	{
	// --- Standard IOCtls (0-3) ---
	BASE_IOCTLS(DRV_TYPE_MISC, STR(IDENT), VERSION, casIOCtls_Route)
	
	// Get Next Hop
	case 4:
		if( !CheckMem(Data, addrSize) )	LEAVE_RET('i', -1);
		memcpy(Data, rt->NextHop, addrSize);
		LEAVE_RET('i', 1);
	// Set Next Hop
	case 5:
		if( Threads_GetUID() != 0 )	LEAVE_RET('i', -1);
		if( !CheckMem(Data, addrSize) )	LEAVE_RET('i', -1);
		memcpy(rt->NextHop, Data, addrSize);
		LEAVE_RET('i', 1);

	// Get interface name
	case 6:
		if( !rt->Interface ) {
			if(Data && !CheckMem(Data, 1) )
				LEAVE_RET('i', -1);
			if(Data)
				*(char*)Data = 0;
			LEAVE_RET('i', 0);
		}
		if( Data ) {
			if( !CheckMem(Data, strlen(rt->Interface->Name) + 1) )
				LEAVE_RET('i', -1);
			strcpy(Data, rt->Interface->Name);
		}
		LEAVE_RET('i', strlen(rt->Interface->Name));
	// Set interface name
	case 7:
		if( Threads_GetUID() != 0 )
			LEAVE_RET('i', -1);
		if( !CheckString(Data) )
			LEAVE_RET('i', -1);
		else
		{
			tInterface	*iface;
			tVFS_Node	*tmp;
			tmp = IPStack_Root_FindDir(NULL, Data);
			if(!tmp)
				LEAVE_RET('i', -1);
			iface = tmp->ImplPtr;
			if(tmp->Type->Close)	tmp->Type->Close(tmp);
			
			if( iface->Type != rt->AddressType )
				LEAVE_RET('i', -1);

			// TODO: Other checks?		
	
			rt->Interface = iface;
		}
		LEAVE_RET('i', 0);

	default:
		LEAVE_RET('i', -1);
	}
}
예제 #13
0
inline TBool CheckDes(TDes8 &aBuf, TInt aStartPos, TInt anEndPos, TUint aStartChar, TUint anEndChar, TInt aOffset=0)
	{
	return CheckMem((TUint8 *)aBuf.Ptr(), aStartPos, anEndPos, aStartChar, anEndChar, aOffset);
	}
/*************************** END OF SPECIFICATIONS **************************/
LONG IOProcGetHeader ( PMMIOINFO pmmioinfo,
                       PVOID pHeader,
                       LONG  lHeaderLength,
                       LONG  lCurrentTrack )

{
   LONG             rc;                       /* return code                */
   PTRACKI          ptracki;
   PINSTANCE        pinstance;                /* Local work structure.      */

   /**************************************************************************/
   /* Validates parameters passed:                                           */
   /* -- Must have valid pmmioinfo.                                          */
   /* -- File must be opened.                                                */
   /**************************************************************************/
   if (rc = ioGetPtrInstance(pmmioinfo,&pinstance))
      return(0L);

  if (pHeader == NULL) {
     pmmioinfo->ulErrorRet = MMIOERR_NO_BUFFER_ALLOCATED;
     return(0L);
     }

  if (CheckMem((PVOID)pHeader, lHeaderLength, PAG_WRITE)) {
     pmmioinfo->ulErrorRet = MMIOERR_INVALID_BUFFER_LENGTH;
     return(0L);
     }

   if (pinstance->lCurrentTrack == MMIO_RESETTRACKS){

      if(pmmioinfo->ulTranslate & MMIO_TRANSLATEHEADER){
         if (lHeaderLength < pinstance->ulMmHdrLength) {
            pmmioinfo->ulErrorRet = MMIOERR_INVALID_BUFFER_LENGTH;
            return(0L);
            }
         lHeaderLength = pinstance->ulMmHdrLength;
         memcpy(pHeader,pinstance->pmmhdr,lHeaderLength);  // copy all fields
         return (lHeaderLength);
         }

      else { /* not translateheader. */
         if (lHeaderLength < pinstance->ulRawHdrLength) {
            pmmioinfo->ulErrorRet = MMIOERR_INVALID_BUFFER_LENGTH;
            return(0L);
            }
         lHeaderLength = pinstance->ulRawHdrLength;
         memcpy(pHeader,pinstance->pRawHdr,lHeaderLength);
         return(lHeaderLength);
         }
      }

   else { /* Get a raw or translated track header */
      if (ptracki = ioFindTracki(pinstance,(ULONG)pinstance->lCurrentTrack)) {
         rc = ioGetTrackHeader(ptracki,
                               pHeader,
                               (ULONG)lHeaderLength,
                               pmmioinfo->ulTranslate & MMIO_TRANSLATEHEADER);
         if (rc)
            return(rc);      /* ok, return length */
         else {
            pmmioinfo->ulErrorRet = MMIOERR_INVALID_BUFFER_LENGTH;
            return(0L);
            }
         }

      else { /* lCurrrent Track is not a valid track. */
         pmmioinfo->ulErrorRet = MMIOERR_MATCH_NOT_FOUND;
         return(0L);
         }
      }
}
ULONG CheckForValidElement( INSTANCE   *ulpInstance,
                            PSZ        pszFileName,
                            ULONG      ulParam1 )

{

  ULONG  ulrc;           // return code
  ULONG  ulPathLength;   // Contains the max length
  LONG   lReturnCode;

  /* Did the caller pass a filename on MCI_OPEN/MCI_LOAD */

  if ( pszFileName )
     {

     /* Ensure that this filename is valid */

     if (ulrc = CheckMem ( (PVOID) pszFileName, 1, PAG_WRITE))
        {
        return (MCIERR_MISSING_PARAMETER);
        }

     /*************************************************
     * Store the filename for future reference -- i.e.
     * MCI_INFO can request the name of the file
     *************************************************/

     strcpy ( ulpInstance->pszAudioFile, pszFileName);

     /************************************************************
     * Set flag to say that we did not create a new file--thus
     * we do not have to clean up if the user doesn't save
     ************************************************************/

     ulpInstance->ulCreatedName = FALSE;

     }
   else
     {
     /**************************************
     * if the user requests a read only file
     * and we must create it, return error
     **************************************/

     if ( ulParam1 & MCI_READONLY )
        {
        return ( MCIERR_MISSING_PARAMETER );
        }

     /**********************************************
     * Query the default path to place temp files and
     * generate a temporary file name
     **********************************************/

     ulrc = mciQuerySysValue( MSV_WORKPATH, &ulpInstance->pszAudioFile );

     if ( !ulrc )
        {
        return ( MCIERR_INI_FILE );
        }

     ulrc = MCIERR_SUCCESS;

     ulPathLength = CCHMAXPATH;

     /* Have mmio generate a unique filename */

     lReturnCode = DBCSGenerateUniqueFile( ulpInstance->pszAudioFile,
                                           &ulPathLength,
                                           &ulpInstance->hTempFile );

     if ( lReturnCode != MMIO_SUCCESS )
        {
        return ( MCIERR_FILE_NOT_FOUND );
        }

     /***************************************************
     * Because we did create a temporary file we will
     * be responsible for cleaning up in case the
     * caller never calls MCI_SAVE (e.g. a bunch of
     * temp files will be left in the workpath
     * otherwise, so set a flag to indicate this fact.
     **************************************************/

     ulpInstance->ulCreatedName = TRUE;

     ObtainDefaults( ulpInstance );

     } /* else the user did not pass in a name */

  return ( ulrc );


} /* check for valid element */