コード例 #1
0
ファイル: framekit.C プロジェクト: ralfbrown/framepac
bool export_FrameKit_frames(ostream &output, FrList *frames)
{
   if (!output)
      return false ;
   output << stringEXPORTED << "FrameKit format" << endl ;
   while (frames)
      {
      FrSymbol *frame = (FrSymbol *)(frames->first()) ;
      if (frame && frame->symbolp())
         {
         if (frame->isFrame())
	    {
   	    FrList *fkit = FramepaC_to_FrameKit(frame->findFrame()) ;
	    output << fkit << endl ;
	    free_object(fkit) ;
	    }
         else if (frame->isDeletedFrame())
	    output << stringDELFRAME << frame << endl ;
	 else
	    output << stringNONFRAME << frame << endl ;
	 }
      else
         return false ;
      frames = frames->rest() ;
      }
   return true ;
}
コード例 #2
0
ファイル: test.C プロジェクト: tripleee/la-strings
void display_object_info(ostream &out, const FrObject *obj)
{
   FramepaC_bgproc() ;		// handle any asynchronous operations
   FramepaC_bgproc() ;
   size_t objlen = FrObject_string_length(obj) ;
   out << "\n\nYou entered " ;
   if (objlen > 68)
      out << endl ;
   out << obj << endl ;
   if (obj)
      out << "That object is of type " << obj->objTypeName()
          << "; it takes " << objlen << " bytes to print" << endl ;
   else
      return ;
   if (obj->framep())
      {
      FrList *framekit = FramepaC_to_FrameKit((FrFrame *)obj) ;
      
      out << "As a FrameKit frame, it would be:\n" << framekit << endl ;
      free_object(framekit) ;
      }
   else if (obj->arrayp())
      {
      if (obj->length() > 0)
	 out << "This "
	     << ((obj->objType() == OT_FrSparseArray) ? "sparse " : "")
	     << "array's last element is "
	     << (*(FrArray*)obj)[obj->length()-1] << endl ;
      }
   else if (obj->queuep())
      {
      out << "This queue contains " << ((FrQueue*)obj)->queueLength()
	  << " items" << endl ;
      }
   else if (obj->hashp())
      {
      FrList *matches = ((FrHashTable*)obj)->prefixMatches("A") ;
      out << "This hash table contains " << matches->listlength()
	  << " items matching the prefix 'A'" << endl ;
      free_object(matches) ;
      }
   else if (obj->stringp())
      out << "This string uses " << ((FrString*)obj)->charWidth()
	  << "-byte characters." << endl ;
   else if (obj->consp())
      {
      out << "Its length is " << obj->length() << " cons cells.\n"
	  << "Its head is " << obj->car() << " and its tail is "
	  << obj->cdr() << endl << endl ;
      FrObject *obj_car = obj->car() ;
      if (obj_car && obj_car->symbolp() &&
	  (obj_car == findSymbol("MAKE-FRAME") ||
	   obj_car == findSymbol("MAKE-FRAME-OLD")))
	 {
	 FrFrame *frame = FrameKit_to_FramepaC((FrList *)obj) ;
	 out << "It is a FrameKit frame; as a FramepaC frame, it would be:\n"
	     << frame << endl ;
	 free_object(frame) ;
	 }
      }
   else if (obj->vectorp())
      {
      out << "This vector contains " << obj->length() << " bits, of which "
	  << ((FrBitVector*)obj)->countBits() << " are set." << endl ;
      }
   FramepaC_bgproc() ;		// handle any asynchronous operations
}