home *** CD-ROM | disk | FTP | other *** search
- #include "q2.h"
-
- #define TEST 1
-
- #ifdef TEST
- #define cksig(x) if(qpt->sigword!=0x756)exit();
- #else
- #define chsig(x)
- #endif
-
- static struct q_strct {
- qele_type queue[q_MAX];
- int next_in ;
- int next_out;
- int sigword ;
- } q1, q2;
-
- /* now initialization must be explicit */
- void q_init(qpt)
- struct q_strct *qpt;
- {
- qpt->next_in = 0;
- qpt->next_out = 0;
- qpt->sigword = 0x576;
- }
-
- /* fetch an item from the queue */
-
- qele_type q_get(qpt)
- struct q_strct *qpt;
- {
- qele_type rval;
- cksig(qpt);
- /* first test to see if there is an item */
- if (qpt->next_in == qpt->next_out) return EMPTY;
- qele_cpy(rval, qpt->queue[qpt->next_out++]);
- (qpt->next_out) &= q_WRAP;
- return rval;
- }
-
-