#ifndef SETUP_H
#define SETUP_H

#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <signal.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>

#ifdef E
#undef E
#endif

#ifdef SETUP
#define E extern
#else
#define E
#endif

/* colors */
#define COLORS		30
#define Back		0
#define Fore		1
#define Line		2
#define Star1		3
#define Star2		4
#define Star3		5
#define Black		6
#define White		7
#define Blue1		8
#define Blue2		9
#define Blue3		10
#define Blue4		11
#define Blue5		12
#define Blue6		13
#define Blue7		14
#define Blue8		15
#define Blue9		16
#define Blue10		17
#define Blue11		18
#define Blue12		19
#define Blue13		20
#define Blue14		21
#define Blue15		22
#define Blue16		23
#define Easy		24
#define Normal		25
#define Hard		26
#define Expert		27
#define Quit		28
#define Title		29

#define Yes		Easy
#define No		Expert
#define Pause		Normal
#define Ver		White
#define Gameover	Expert

/* error codes */
#define SyntaxErr	0
#define TooFewArgs	1
#define WrongArg	2

typedef struct {
  KeySym rot;
  KeySym up;
  KeySym down;
  KeySym drop;
  KeySym fall;
  KeySym left;
  KeySym right;
  KeySym star;
  KeySym yes;
  KeySym no;
  KeySym decide;
  KeySym quit;
  KeySym pause;
} Keymap;

typedef struct {
  char name[32];
  void (*func)(char *,int);
} COMMAND;

E char colors[COLORS][32];	/* カラー */
E char home_dir[1024];		/* user のホームディレクトリ */
E char rc_file[1024];		/* .cosmorc のファイル名 */

E char display[64];		/* display name */
E Keymap keys;			/* キー割り当て */
E int priv_cmap;		/* private colormap を使う？ */
E char bgfn[1024];		/* 背景画のファイル名 */
E int ALRM_PAR_SEC;		/* 1sec 当たりの割り込み回数 */
E int rough;			/* 64/ALRM_PAR_SEC */

/* macro(s) */
#define show_error(Err,Buf,Line,Column)\
  fprintf(stderr,".cosmorc:%d.%d:%s:%s\n",Line,Column,Err,Buf)

/* function(s) */
E void setup();

#endif
