#include "scltypes.h"
#include "sclerror.h"

using namespace std;
using namespace scl;

void dummy(char);

int main(int argc, char* argp[], char* envp[])
{
  std::cout<<"\nSome constants:\n";

  std::cout<<"  "<<REAL_RADIX      <<"\tREAL_RADIX     \n"; 
  std::cout<<"  "<<REAL_ROUNDS     <<"\tREAL_ROUNDS    \n";
  std::cout<<"  "<<REAL_MANT_DIG   <<"\tREAL_MANT_DIG  \n";
  std::cout<<"  "<<REAL_DIG        <<"\tREAL_DIG       \n";
  std::cout<<"  "<<REAL_MIN_EXP    <<"\tREAL_MIN_EXP   \n";
  std::cout<<"  "<<REAL_MIN_10_EXP <<"\tREAL_MIN_10_EXP\n";
  std::cout<<"  "<<REAL_MAX_EXP    <<"\tREAL_MAX_EXP   \n";
  std::cout<<"  "<<REAL_MAX_10_EXP <<"\tREAL_MAX_10_EXP\n";
  std::cout<<"  "<<REAL_MAX        <<"\tREAL_MAX       \n";
  std::cout<<"  "<<REAL_EPSILON    <<"\tREAL_EPSILON   \n";
  std::cout<<"  "<<REAL_MIN        <<"\tREAL_MIN       \n";
  std::cout<<"  "<<EPS             <<"\tEPS            \n\n";

  if(argc==1) {
    scl::warn("Need a character argument, use h for usage message");
    scl::error("Need a character argument, use h for usage message");
  }

  try {
   dummy(argp[1][0]);
  }
  catch (scl::lib_error e) {
    std::cerr << "Caught an error.  Here is the message.\n";
    std::cerr << e.msg;
    std::cerr << e.what();
    std::cerr 
      << "First is from\n\tcerr << e.msg;\nsecond from\n\tcerr << e.what();\n";
    std::cerr << "Return 1 from main.\n";
    return 1;
  } 

  catch (scl::lib_warn e) {
    std::cerr << "Caught a warn.  Here is the message.\n";
    std::cerr << e.msg;
    std::cerr << e.what();
    std::cerr 
      << "First is from\n\tcerr << e.msg;\nsecond from\n\tcerr << e.what();\n";
    std::cerr << "Return 0 from main.\n";
    return 0;
  } 


}

