#ifdef IN_MAIN
#define GLOB         /* empty string if included by main program */
#else
#define GLOB extern  /* extern if included by anything else */
#endif

#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#ifndef PC
#include <sys/time.h>
#include <sys/resource.h>  
#endif

/****************************************
 *
 * Function prototype
 *
 ****************************************/

#include "proto.h"

/***************************************************
 *
 *  CONSTANT Declaration
 *
 ***************************************************/

#define SATBOX_VERSION "1.0"
#define VERSION_DATE "06/04/2004"
#define MAX_INT  2147483647             /* 32 bit integer */
#define MAX_SHORT     65535             /* 16 bit integer */
#define MAX_CHAR        255             /*  8 bit integer */
#define MAX_STACK     40000             /* maximal elements in a stack */
#define MAX_LENGTH     1000             /* maximal # of literals in a clause */
#define MAX_VAR     1048575             /* a 20 bit integer */
#define FF                0             /* false */
#define TT                1             /* true */
#define DC                2             /* Don't-Care value */
#define SAT               3
#define UNCHANGE          2
#define UNSAT             0
#define RESTART_NOW      -1

/* the following are clause types */
#define NORM              0
#define EQUL              1
#define LESS              2
#define LSEQ              3
#define GRTR              4
#define GTEQ              5
#define UNEQ              6
#define WEIG              7

#define STOP_FAIL         0
#define STOP_SUCC         1
#define STOP_PART         2
#define STOP_TIME         3
#define STOP_MEMO         4
#define STOP_ERR          5
#define STOP_REST         6

/* Parameters and Flags for satbox */
#define BINARY   0
#define CHOICE   1
#define DLENGTH  2
#define GROW     3
#define JUMP     4
#define NONHORN  5
#define TCLAUSE  6
#define RESTART  7
#define TRACE    8
#define MAX_FLAGS 10

#define OUTSIDE 1

/****************************************************
 *
 *  MACRO Declaration
 *
 ****************************************************/

#define make_lit(v,s) ((v)<<1)+(s)
#define lit_var(l)    ((l)>>1) 
#define lit_sign(l)   ((l)&1) 
#define NEG(v)        ((v)^1)

#ifdef MORETRACE
#define sbtrace(x,y) if (satbox_flag(TRACE)>=x) y
#define sbtrace1(x,y) if (satbox_flag(TRACE)==x || x>8) y
#define sbcheck(x,y) if (x) y
#else
#define sbtrace(x,y) 
#define sbtrace1(x,y) 
#define sbcheck(x,y) 
#endif
