Ejemplo n.º 1
0
static FrList *read_List(istream &input, const char *)
{
   FrList *list, *prev ;
   FrObject *curr ;

   list = prev = 0 ;
   input.get() ;		       // discard the initial left parenthesis
   FramepaC_read_nesting_level++ ;
   while (FrSkipWhitespace(input) != ')' && !input.eof() && !input.fail())
      {
      FrObject *obj = read_FrObject(input) ;
      if (obj == symbolPERIOD && FrSkipWhitespace(input) != ')')
	 {
	 // period is not last item, so check if it's a dotted pair
	 curr = read_FrObject(input) ;
	 // was period second-to-last in list?
	 if (FrSkipWhitespace(input) == ')')
	    {
	    if (!list)
	       prev = list = new FrList(0) ;
	    prev->replacd(curr) ;
	    break ;
	    }
	 else
	    {
            if (!list)
	       prev = list = new FrList(obj) ;
	    else
	       {
	       obj = new FrList(obj) ;
	       prev->replacd(obj) ;
	       prev = (FrList*)obj ;
	       }
	    obj = curr ;
            }
	 }
      curr = new FrList(obj) ;
      if (!list)
	 list = (FrList*)curr ;
      else
	 prev->replacd(curr) ;
      prev = (FrList*)curr ;
      }
   if (input.get() != ')')
      expected_right_paren(list) ;
   if (--FramepaC_read_nesting_level <= 0 && FramepaC_read_associations)
      {
      FramepaC_read_associations->freeObject() ;
      FramepaC_read_associations = 0 ;
      }
   return list ;
}
Ejemplo n.º 2
0
static FrObject *read_Queue(istream &input, const char *)
{
   FrObject *result = read_FrObject(input) ;
   if (result && result->consp())
      return new FrQueue((FrList*)result) ;
   else
      return new FrQueue(0) ;
}
Ejemplo n.º 3
0
static void read_Facet(istream &input,FrFrame *frame,FrSymbol *slot)
{
   input.get() ;		    // consume the left bracket
   FrSymbol *facet ;
   facet = read_Symbol(input) ;	    // get facet name
   if (!facet || !facet->symbolp()) // the name must be a symbol
      {
      FrWarning(errmsg_facet_symbol) ;
      free_object(facet) ;
      return ;
      }
   frame->createFacet(slot,facet) ;
   char ch ;
   while ((ch = FrSkipWhitespace(input)) != 0 && ch != ']')
      {
      frame->addFillerNoCopy(slot,facet,read_FrObject(input)) ;
      }
   if (input.get() != ']')
      FrWarning(errmsg_facet_malformed) ;
}