/* ECP: FILEname=fig10_17.c */ /* 1*/ int /* 2*/ QuIsEmpty( const Queue Q ) /* 3*/ { /* 4*/ QuInsistGood( Q ); /* 5*/ return Q->Size == 0; /* 6*/ } /* 1*/ static int /* 2*/ Increment( int QParam, int QSize ) /* 3*/ { /* 4*/ if( ++QParam == QSize ) /* 5*/ return 0; /* 6*/ else /* 7*/ return QParam; /* 8*/ } /* 1*/ void /* 2*/ Dequeue( QuEtype *X, Queue Q ) /* 3*/ { /* 4*/ if( QuIsEmpty( Q ) ) /* 5*/ printf( "Error: can not pop an empty queue\n" ); /* 6*/ else /* 7*/ { /* 8*/ *X = Q->Array[ Q->Front ]; /* 9*/ Q->Front = Increment( Q->Front, Q->MaxSize ); /*10*/ Q->Size--; /*11*/ } /*12*/ }