#ifndef HEADER_DEFINE
#define HEADER_DEFINE

/**
 * @file 
 * File containing define module (all data program definition)
 */

/* Start declaration constant of define module */

/** Program name.*/  
static const char PRGNAME[] = "SMLabyrinth";

/** Program version. Using Year.Month.Day rule.*/
static const char PRGVERS[] = "9.10.26";

/** Program authors. */
static const char PRGAUTH[] = 
                "<private>\n"\
                "Email: <ask to: info[AT]pietris[DOT]net>\n"\
                "\n"\
                "MrC\n"\
                "Email: <info[AT]pietris[DOT]net>";

/** Program license.*/
static const char PRGLICS[] =
                "This program is free software:\n"\
                "you can redistribute it and/or modify it\n"\
                "not until you have contacted and received an authorization"\
                " replies from the authors\nand under the terms of the GNU"\
                " General Public License as published by\n"\
                "the Free Software Foundation, either version 3 of the"\
                " License.\nThis program is distributed in the hope that it"\
                " will be useful,\nbut WITHOUT ANY WARRANTY; without even the"\
                " implied warranty of\nMERCHANTABILITY or FITNESS FOR"\
                " A PARTICULAR PURPOSE. See the\nGNU General Public"\
                " License for more details.\nYou should have received a copy"\
                " of the GNU General Public License\nalong with this program."\
                " If not, see <http://www.gnu.org/licenses/>.";

/** Program copyright.*/ 
static const char PRGCPYR[] = "Copyright 2009 © MrC";

/** Program aims.*/
static const char PRGAIMS[] =
                "Simple game of labyrinth.\n"\
                "<private>";

/** Program web link.*/ 
static const char PRGWBLK[] = 
                "http://www.pietris.net";

/** Program logo.*/
static const char PRGLOGO[] = "../img/SMLabyrinth.png";

/** Null character*/
static const char NULLCHAR = '\0';

// Default setting for number of (r)ows and (c)olumns:
// WARNING: - Values must be between 3 and 255.
//          - A schema must be composed at least by 3 rows and 3 columns.
/** Maximum number of rows*/
static const unsigned short int MAXR = 100;
/** Maximum number of columns*/
static const unsigned short int MAXC = 100;
/** Minimum number of rows*/
static const unsigned short int MINR = 5;
/** Minimum number of columns*/
static const unsigned short int MINC = 5;


// Default setting for sche(M)a objects:

//schema descriptors:
/** Identify an open box*/
static const char FREE = '.';
/** Identify a close box*/
static const char CLOSE = 'X';
/** Identify a box containing a door*/
static const char DOOR = 'D';
/** Identify a box containing a start point*/
static const char START = 'S';

//visited cell:
// WARNING: Values must be between 0 and 255.
/** Identify an unvisited cell*/
static const unsigned short int UNVISITED = 0;
/** Identify a visited cell from 'VISIT2' or 'UNIVISITED'*/
static const unsigned short int VISIT1 = 1;
/** Identify a visited cell from 'VISIT1'*/
static const unsigned short int VISIT2 = 2;

// Characters controls, used as bit mask
// WARNING: values must be progressive positive 2th degrees that 
//          not exceeds 128 (2^7) or sum of already-established 
//          values beetween 0 and 255.
//          Eg. LETTERS = LOWERCASE + UPPERCASE = 3
//          Eg. ALL = 255 (Sum of all possible values)
//          Eg. NOLETTERS = ALL - LETTERS = 252
/**Identify the lowercase check.*/
static const unsigned short int LOWERCASE = 1; // 2^0
/**Identify the uppercase check.*/
static const unsigned short int UPPERCASE = 2; // 2^1
/**Identify the digits check.*/
static const unsigned short int DIGITS = 4;    // 2^2

// Default settings for file(s)
/** Record (game) file name.*/
static const char RECORD_FILE_NAME[] = "record.txt";
/** Directory that contains games.*/
static const char GAMES_DIR[] = "games";
/** Directory that contains games of certains level.*/ 
static const char GAMES_LEVEL_DIR[] = "level";


// Default settings for POINTS and similar:
// WARNING: Values must be between 0 and 255.
/** Minimum percentage to reach the bonus.*/
static const unsigned short int GIVE_BONUS_PERC = 100;
/** Number of games in a tournament.*/
static const unsigned short int NEW_GAME_ROUND = 10;
/** Bonus points score.*/
static const unsigned short int BONUS_POINTS = 10;
/** No bonus points score.*/
static const unsigned short int NO_BONUS_POINTS = 0;
/** Maximum repetitive time to decrease level score*/
static const unsigned short int SEC_PER_LEVEL = 9;

/** Minimum value of difficult in generated game. */
// WARNING: value must be between 0 and MAX_DIFFICULT.
static const unsigned short int MIN_DIFFICULT = 1;
/** Maximum value of difficult in generated game.*/
static const unsigned short int MAX_DIFFICULT = 10;


// Default setting for special characters
// WARNING if changed by default:
/** Character that identify a comment.*/
static const char COMMENT = '#';
/** Character that identify a new line.*/
static const char ENDLINE = '\n';


// Default settings for message(s) lenght:
// WARNING: Values must be between 0 and 65535.
/** Maximum length of error buffer.*/
static const unsigned int MAX_ERR_BUFFER_LEN = 1000;
/** Maximum length of other buffer.*/
static const unsigned int MAX_OTH_BUFFER_LEN = 250;
// WARNING: this two constant must be '#define'
/** Maximum record name length.*/
#define MAX_RECORDNAME_LEN 15  
/** Maximum shown record lines.*/
#define MAX_RECORD_SHOW 20 


// DEBUG (Tracing and assertions):
#ifdef DEBUG

    // See SMLabyrinth.c
    extern unsigned int MASK;
    
    /** Maximum bit MASK size
        Eg. with number of functions (8):
             - number of bits (8)
             - MASK value 2^(8)-1 = (255)
    */
    static const unsigned int BITMASK_MAX = 255;

    /** Tracing ON*/
    #define DBG(A, B) { if((A & MASK) != 0){B;} } 

#else
    /** No tracing*/
    #define DBG(A, B)   
    /** No assertions*/
    #define NDEBUG 

    static const unsigned int BITMASK_MAX = 0;
#endif

/** D1 title.*/
#define ID1 "Trace execution" 
/** D1 function.*/
#define D1(a) DBG(1,  a) 

/** D2 title.*/
#define ID2 "High-level info" 
/** D2 function.*/
#define D2(a) DBG(2,  a) 

/** D3 title.*/
#define ID3 "Main cycles info"
/** D3 function.*/
#define D3(a) DBG(4,  a)

/** D4 title.*/
#define ID4 "Medium-level info"
/** D4 function.*/
#define D4(a) DBG(8,  a)

/** D5 title.*/
#define ID5 "Low-level info"
/** D5 function.*/
#define D5(a) DBG(16, a)

/** D6 title.*/
#define ID6 "Programmers details - 1"
/** D6 function.*/
#define D6(a) DBG(32, a)

/** D7 title.*/
#define ID7 "Programmers details - 2"
/** D7 function.*/
#define D7(a) DBG(64, a)

/** D8 title.*/
#define ID8 "Programmers details - 3"
/** D8 function.*/
#define D8(a) DBG(128,a)

/* End declaration constant of define module */

#endif
