#include "espresso.h"

/*
 *    Global Variable Declarations
 */

unsigned int debug;              /* debug parameter */
bool3 verbose_debug;              /* -v:  whether to print a lot */
/** MM: tato tabulka bola dodatocne vyrobena ako staticka a boli pridane vsetky retazce */
char *total_name[TIME_COUNT] = { /* basic function names */
    "READ       ", /* READ_TIME       0 */
    "COMPL      ", /* COMPL_TIME      1 */
    "ONSET      ", /* ONSET_TIME      2 */
    "ESSEN      ", /* ESSEN_TIME      3 */
    "EXPAND     ", /* EXPAND_TIME     4 */
    "IRRED      ", /* IRRED_TIME      5 */
    "REDUCE     ", /* REDUCE_TIME     6 */
    "EXPAND_GASP", /* GEXPAND_TIME    7 */
    "IRRED_GASP ", /* GIRRED_TIME     8 */
    "REDUCE_GASP", /* GREDUCE_TIME    9 */
    "PRIMES     ", /* PRIMES_TIME     10 */
    "MINCOV     ", /* MINCOV_TIME     11 */
    "MV_REDUCE  ", /* MV_REDUCE_TIME  12 */
    "RAISE_IN   ", /* RAISE_IN_TIME   13 */
    "VERIFY     ", /* VERIFY_TIME     14 */
    "WRITE      ", /* WRITE_TIME	15 */
    "FCC        ", /* FCC_TIME	16 */
    "ETR        ", /* ETR_TIME	17 */
    "EXTRAUX    ", /* ETRAUX_TIME	18 */
    "SIGMA      ", /* SIGMA_TIME	19 */
    "UCOMP      ", /* UCOMP_TIME	20 */
    "BW         " /* BW_TIME		21 */
};
long total_time[TIME_COUNT];     /* time spent in basic fcts */
int total_calls[TIME_COUNT];     /* # calls to each fct */


bool3 echo_comments;		 /* turned off by -eat option */
bool3 echo_unknown_commands;	 /* always true ?? */
bool3 force_irredundant;          /* -nirr command line option */
bool3 skip_make_sparse;
bool3 kiss;                       /* -kiss command line option */
bool3 recompute_onset;            /* -onset command line option */
bool3 remove_essential;           /* -ness command line option */
bool3 single_expand;              /* -fast command line option */
bool3 summary;                    /* -s command line option */
bool3 trace;                      /* -t command line option */
bool3 unwrap_onset;               /* -nunwrap command line option */
bool3 use_random_order;		 /* -random command line option */
bool3 use_super_gasp;		 /* -strong command line option */
char *filename;			 /* filename PLA was read from */

const char octtools_copyright[] = "Copyright (c) 1988, 1989, Regents of the University of California.  All rights reserved."; /* MM: OCCTOOLS copyright */
const char* VERSION = "UC Berkeley, Espresso Version #2.3, Release date 01/31/88";
char errorbuffer[512]; /** MM: pridane kvoli hlaske pre vynimku */

/** MM: added to support various outputs */
FILE* tracesumoutput;
FILE* debugoutput;
FILE* erroroutput;
FILE* eatoutput;
FILE* eatdotsoutput;
FILE* standardoutput;

struct pla_types_struct pla_types[] = {
    {"-f", F_type},
    {"-r", R_type},
    {"-d", D_type},
    {"-fd", FD_type},
    {"-fr", FR_type},
    {"-dr", DR_type},
    {"-fdr", FDR_type},
    {"-fc", F_type | CONSTRAINTS_type},
    {"-rc", R_type | CONSTRAINTS_type},
    {"-dc", D_type | CONSTRAINTS_type},
    {"-fdc", FD_type | CONSTRAINTS_type},
    {"-frc", FR_type | CONSTRAINTS_type},
    {"-drc", DR_type | CONSTRAINTS_type},
    {"-fdrc", FDR_type | CONSTRAINTS_type},
    {"-pleasure", PLEASURE_type},
    {"-eqn", EQNTOTT_type},
    {"-eqntott", EQNTOTT_type},
    {"-kiss", KISS_type},
    {"-cons", CONSTRAINTS_type},
    {"-scons", SYMBOLIC_CONSTRAINTS_type},
    {0, 0}
};


struct cube_struct *cube;
struct cdata_struct *cdata;

int bit_count[256] = {
  0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
  1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
  1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
  1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
  2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
  3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
};
