Ejemplo n.º 1
0
static List_t f_EnumeratorList( void )
{
   List_t List;
   Enumerator_t Enumerator;
   niveau++;
   step( 1 );

   List = f_ListCreate();

   while( True )
   {
      if(( Enumerator = f_Enumerator()))
      {
         f_ListAddLast( &List, (Elem_t) Enumerator );
      }
process:
      if( token( 0 ) == ',' )
      {
         step( 1 );
      }
      else if( token( 0 ) == RBRACE || token( 0 ) == 0 )
      {
         break;
      }
      else
      {
         f_StepTo( ',', '}', 0 );
         goto process;
      }
   }

   niveau--;
   return List;
}
Ejemplo n.º 2
0
extern void f_ListAddLast( List_t *pList, Elem_t Elem )
{
   if( Elem == 0 )
   {
      return;
   }

   if((*pList) == 0 )
   {
      (*pList) = f_ListCreate();
   }

   if((*pList)->ElemLast == 0 )
   {
      (*pList)->ElemFirst = Elem;
      (*pList)->ElemLast  = Elem;
      Elem->ElemNext = 0;
   }
   else
   {
      (*pList)->ElemLast->ElemNext = Elem;
      (*pList)->ElemLast = Elem;
      Elem->ElemNext = 0;
   }
}
Ejemplo n.º 3
0
extern List_t f_ListDuplicate( List_t List, Elem_t (*pfElemDuplicate)(Elem_t))
{
   List_t ListDuplicate;
   Elem_t Elem;
   Elem_t ElemDuplicate;

   if( List == 0 )
   {
      return 0;
   }

   if( List->iCheck != LIST_CHECK ) Abort();

   ListDuplicate = f_ListCreate();

   for( Elem = d_ElemFirst( List )
      ; Elem
      ; Elem = Elem->ElemNext
      )
   {
      ElemDuplicate = (*pfElemDuplicate)( Elem );
      f_ListAddLast( &ListDuplicate, ElemDuplicate );
   }

   return ListDuplicate;
}
Ejemplo n.º 4
0
extern List_t f_ArgumentDeclarationList( void )
{
   Save();
   List_t List;
   Declaration_t Declaration;

   if( token( 0 ) != '(' )
   {
      return 0;
   }

   step( 1 );

   List = f_ListCreate();

   if( token( 0 ) == ')' )
   {
      step( 1 );
      return List;   /* empty argument_declaration_list */
   }

   while( True )
   {
      if( token( 0 ) == SN_ELLIPSIS )
      {
         step( 1 );
         if( token( 0 ) == ')' )
         {
            step( 1 );
            Declaration = f_DeclarationCreate( DECLARATION_ARGUMENT );
            Declaration->s_ellipsis = True;
            f_ListAddLast( &List, (Elem_t) Declaration );
            return List;
         }
         else  /* csak az utolso argumentum lehet SN_ELLIPSIS */
         {
            f_ListDestroy( List, (void(*)()) f_DeclarationDestroy );
            Restore();
            return 0;
         }
      }

      if(( Declaration = f_ArgumentDeclaration()))
      {
         f_ListAddLast( &List, (Elem_t) Declaration );
         switch( token( 0 ))
         {
         case ','     : step( 1 ); break;
         case ')'     : step( 1 ); return List;
         case SN_ELLIPSIS: break;
         default      : 
            f_ListDestroy( List, (void(*)()) f_DeclarationDestroy );
            Restore();
            return 0;
         }
      }  
      else
      {
         f_ListDestroy( List, (void(*)()) f_DeclarationDestroy );
         Restore();
         return 0;
      }
   }
}