Exemple #1
0
bool import_FrameKit_frames(istream &input,ostream &output)
{
   FrObject *obj ;
   FrFrame *fr ;
   FrSymbol *symbolMAKEFRAME = FrSymbolTable::add(stringMAKEFRAME) ;
   FrSymbol *symbolMAKEFROLD = FrSymbolTable::add(stringMAKEFR_OLD) ;

   if (output)
      output << "Importing frames" << endl ;
   bool oldvirt = read_virtual_frames(true) ;
   if (!VFrame_Info)
      read_virtual_frames(oldvirt) ;
   while (!input.eof())
      {
      input >> obj ;
      if (obj)
	 {
	 if (obj->consp() &&
	     (((FrCons*)obj)->first() == symbolMAKEFRAME ||
	      ((FrCons*)obj)->first() == symbolMAKEFROLD))
	    {
	    fr = FrameKit_to_FramepaC((FrList*)obj) ;
	    if (!fr)
	       {
	       read_virtual_frames(oldvirt) ;
	       return false ;	// error reading stream
	       }
	    if (output)
	       output << stringREAD << fr->frameName() << endl ;
	    }
	 else if (output)
	    {
	    output << stringREAD << obj->objTypeName() << ' ' ;
	    if (obj->framep())
	       output << ((FrFrame*)obj)->frameName() ;
	    else if (obj->consp())
	       output << "(" << obj->car() << " ... )" ;
	    else
	       output << obj ;
	    output << endl ;
	    }
	 obj->freeObject() ;
	 }
      }
   read_virtual_frames(oldvirt) ;
   return true ;
}
Exemple #2
0
static bool discard_dirty_frame(const FrObject *obj, va_list args)
{
   FrVarArg(uint32_t,thres) ;
   FrVarArg(int *,discarded) ;
   FrFrame *frame = ((FrSymbol*)obj)->symbolFrame() ;
   // throw out any and all unlocked virtual frames, even if dirty, that were
   // last used before the threshold value of the clock
   if (frame && frame->isVFrame() && !frame->isLocked() &&
       frame->getLRUclock() < thres)
      {
      if (frame->dirtyFrame())
	 frame->frameName()->commitFrame() ;
      frame->discard() ;	// discard the frame
      (*discarded)++ ;
      }
   return true ;
}