home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* */
- /* MFLDEFS Header file */
- /* */
- /* Miscellaneous utility definitions for use with the MicroFirm */
- /* Function Library */
- /* */
- /* Copyright 1989 by Robert B. Stout dba MicroFirm */
- /* All rights reserved */
- /* */
- /* Copyright 1986, 1987 by S.E. Margison */
- /* */
- /* Compiled by QC 2.0 for use with MSC 5.1 or QC 2.0 or later. */
- /* */
- /************************************************************************/
-
- #ifndef MFLDEFS_H
- #define MFLDEFS_H
-
- /************************************************************************/
- /* Miscellaneous #defines */
- /************************************************************************/
-
- #define Repeat(x) if (x) do
- #define Until(x) while(!(x))
-
- #ifndef EVER
- #define EVER (;;) /* e.g. "for EVER {...}" */
- #endif
-
- #define KB_flush() while(kbhit()) getch()
- #define Bputc(c) bdos(6,c,0)
- #define MAX_FLEN 67
-
- /*
- ** Use the following for "illegal" casts, e.g. structs or unions to
- ** simple data types of the same size, etc.
- */
-
- #define CAST(new_type,old_object) (*((new_type *)&old_object))
-
- #if 0
- *************************************************************************
- * *
- * /* Example of CAST macro at work */ *
- * *
- * union { *
- * char ch[4]; *
- * int i[2]; *
- * } my_union; *
- * *
- * long longvar; *
- * *
- * longvar = (long)my_union; /* Illegal cast */ *
- * longvar = CAST(long, my_union); /* Legal cast */ *
- * *
- *************************************************************************
- #endif /* 0 */
-
- #ifndef MK_FP
- #define MK_FP(seg,offset) \
- ((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset)))
- #endif
-
- #ifndef offsetof
- #define offsetof(st,el) (size_t)&(((st *)0)->el)
- #endif
-
- #ifndef NUL
- #define NUL '\000'
- #endif
-
- #ifndef BEL
- #define BEL '\007'
- #endif
-
- #ifndef EINVFNC
- #define EINVFNC 1
- #endif
-
- #define __PAGE(title)
-
- #ifdef TRUE
- #undef TRUE
- #endif
-
- #ifdef FALSE
- #undef FALSE
- #endif
-
- typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL;
-
- #ifndef BOOL
- #define BOOL(x) (!(!(x)))
- #endif
-
- #ifndef SUCCESS
- #define SUCCESS 0 /* e.g. if (SUCCESS == fclose(...)) */
- #endif
-
- #define BitSet(arg,posn) (arg | (1L << posn))
- #define BitClr(arg,posn) (arg & ~(1L << posn))
- #define BitTst(arg,posn) ((arg & (1L << posn)) ? TRUE : FALSE)
-
- #define LP1 0 /* printer numbers */
- #define LP2 1
- #define LP3 2
- #define SER1 0 /* COM1 port */
- #define SER2 1 /* COM2 port */
- #define SER3 2 /* COM3 port */
- #define SER4 3 /* COM4 port */
- #define NONE 0 /* no parity */
- #define ODD 1 /* odd parity */
- #define EVEN 2 /* even parity */
-
- #define GAMEPORT 0x201 /* gameport address */
- #define IDLE 0 /* state definitions for debouncer */
- #define INPROG 1
- #define WAITOPEN 2
-
- #endif /* MFLDEFS_H */
-