/* コンパイラオプションでEXTCLIPHを定義しておくと、
 * (CLiP Library)/clip.h の代りに (Application)/extclip.h がインクルードされます。
 */

#define STRICT
#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <assert.h>

#define TRACE_ON	1

#ifndef PIECE
#define SPEAKER_FREQUENCY	16000
#define DIE()			abort()
#define ASSERT(e)		assert(e)
#define trace			printf
#if defined(TRACE_ON) && (TRACE_ON)
#define TRACE			printf
#else /*TRACE_ON*/
#define TRACE			1 ? (void)0 : trace
#endif /*TRACE_ON*/
#define stream_play(a,b,c,d)	((void)0)
#define stream_stop()		((void)0)
#endif /*PIECE*/

/* DDA(Digital Differential Analysis)構造体 */
typedef struct _DDA {
	int n;			/* + 0,4 端数の増加量     */
	int d;			/* + 4,4 端数             */
	int u;			/* + 8,4 毎回の変化量     */
	int v;			/* +12,4 繰上げ時の変化量 */
				/* =16                    */
} DDA;

#define LEBYTE(p)	((unsigned char )(((unsigned char*)(p))[0] <<  0))
#define LEHALF(p)	((unsigned short)(((unsigned char*)(p))[0] <<  0 | ((unsigned char*)(p))[1] <<  8))
#define LEWORD(p)	((unsigned int  )(((unsigned char*)(p))[0] <<  0 | ((unsigned char*)(p))[1] <<  8 | ((unsigned char*)(p))[2] << 16 | ((unsigned char*)(p))[3] << 24))
#define BEBYTE(p)	((unsigned char )(((unsigned char*)(p))[0] <<  0))
#define BEHALF(p)	((unsigned short)(((unsigned char*)(p))[0] <<  8 | ((unsigned char*)(p))[1] <<  0))
#define BEWORD(p)	((unsigned int  )(((unsigned char*)(p))[0] << 24 | ((unsigned char*)(p))[1] << 16 | ((unsigned char*)(p))[2] <<  8 | ((unsigned char*)(p))[3] <<  0))

#include <clipit.h>
