home *** CD-ROM | disk | FTP | other *** search
- /* C O P Y R I G H T N O T I C E : */
- /* Copyright 1986 Eric Jul. May not be used for any */
- /* purpose without written permission from the author. */
-
- /* MAX(i,j) MIN(i,j) return the maximimum or minimum of two numbers */
- #define MAX(i,j) ((i) > (j) ? i : j)
- #define MIN(i,j) ((i) < (j) ? i : j)
-
- /* PUSHIT(stackPtr, newElement) pushes an int element onto a stack whose
- stackPtr is kept in a variable. */
-
- #define PUSHIT(stackPtr, newElem) \
- (* ( -- (int *) (stackPtr)) = (int) (newElem))
-
- #define POPIT(stackPtr, newElem) \
- ( * ((int *) &(newElem)) = * (((int *) (stackPtr))++))
-
- /* mPLURAL generates a plural s, if necessary. */
- #define mPLURAL(value) ((value) == 1 ? "" : "s")
- #define mPLURALY(value) ((value) == 1 ? "y" : "ies")
-
- /* Queueing macros.
- * These macros maintain FIFO queues using only one link field.
- * The queues are circular, single link with the head being a single
- * variable pointing to the LAST element in the queue.
- * Assumption: NULL == 0
- */
-
- #define QueueIns(QHead, newElt, Next) \
- { \
- if ( QHead ) { /* Insert into non-empty queue. */ \
- (newElt)->Next = (QHead)->Next; \
- (QHead)->Next = newElt; \
- (QHead) = newElt; \
- } else { /* New element in empty queue. */ \
- (QHead) = (newElt)->Next = newElt; \
- } \
- }
-
- #define QueueRmv(QHead, Element, Next) \
- { \
- if ((QHead) == (QHead)->Next) { \
- (Element) = (QHead); QHead = NULL; \
- } else { \
- (Element) = (QHead)->Next; (QHead)->Next = (Element)->Next; \
- }; \
- }
-
- #define QueueInit(Q) Q = NULL
-
- /**********************************************************************/
-