// common.hh: this file is part of the Vaucanson project.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2006, 2007 The Vaucanson Group.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
// The Vaucanson Group consists of people listed in the `AUTHORS' file.
//

#ifndef COMMON_HH
# define COMMON_HH

/**
 * @file common.hh
 * @author Michaël Cadilhac <michael.cadilhac@lrde.org>
 *
 * This file contains common declarations for all files.
 */

# ifdef HAVE_CONFIG_H
#  include <config.h>
# endif

# include <vaucanson/config/system.hh>

# include <iostream>

# define echo(S) std::cout << S << std::endl
# define echo_(S) std::cout << S
# define warn(S) std::cerr << S << std::endl
# define warn_(S) std::cerr << S

# ifndef CONTEXT
#  error "CONTEXT has to be declared."
# endif

# define CONTEXT_HEADER    <vaucanson/CONTEXT.hh>
# define CONTEXT_NAMESPACE vcsn::CONTEXT

# if 0 /* @bug Should use this with dynamic libraries. */
#  define VCSN_USE_INTERFACE_ONLY 1
# endif /* 0 */

/* Turn VCSN traps into exception. */
# define EXCEPTION_TRAPS 1

# include <string>

// Use a global timer and bencher.
# define GLOBAL_TIMER global_timer
# define GLOBAL_BENCHER bencher
# include <vaucanson/misc/usual_macros.hh>
extern vcsn::misc::Timer global_timer;
extern vcsn::misc::Bencher bencher;

// Use a global command result.
# include "pipe.hh"
# define GLOBAL_RESULT last_command_output
extern command_output last_command_output;

struct arguments_t
{
    arguments_t (const std::string& name)
      : progname (name),
	n_args (0),
	alphabet (0),
	epsilon (0),
# ifdef WITH_TWO_ALPHABETS
	alphabet2 (0),
	epsilon2 (0),
# endif /* ! WITH_TWO_ALPHABETS */
	verbose (false),
	bench (false),
	nb_iterations (1),
	report_time (false),
	export_time_dot (false),
	export_time_xml (false),
	input_type (INPUT_TYPE_XML),
	output_type (OUTPUT_TYPE_XML)
    {}

    std::string	progname;
    const char*	args[3];
    int		n_args;
    const char*	alphabet;
    char	epsilon;
# ifdef WITH_TWO_ALPHABETS
    const char*	alphabet2;
    char	epsilon2;
# endif /* ! WITH_TWO_ALPHABETS */
    bool	verbose;
    bool	bench;
    unsigned	nb_iterations;
    std::string plot_output_filename;
    bool        report_time;
    int         report_degree;

    bool        export_time_dot;
    int         export_dot_degree;

    bool        export_time_xml;

    input_format_t	input_type;
    output_format_t	output_type;
};

#endif /* !COMMON_HH */
