main.hh
author Manuele Conti <manuele.conti@sirius-es.it>
Thu, 30 Aug 2012 15:06:32 +0200
changeset 649 83688d55d1ad
parent 645 e01ede1c9862
child 654 7421cb63defa
permissions -rw-r--r--
Update configure script.
597
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     1
/*
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     3
 *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     4
 *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     5
 *
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     6
 *  This program is free software: you can redistribute it and/or modify
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     7
 *  it under the terms of the GNU General Public License as published by
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     8
 *  the Free Software Foundation, either version 3 of the License, or
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     9
 *  (at your option) any later version.
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    10
 *
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    11
 *  This program is distributed in the hope that it will be useful,
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    14
 *  GNU General Public License for more details.
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    15
 *
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    16
 *  You should have received a copy of the GNU General Public License
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    17
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    18
 *
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    19
 *
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    20
 * This code is made available on the understanding that it will not be
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    21
 * used in safety-critical situations without a full and competent review.
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    22
 */
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    23
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    24
/*
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    25
 * An IEC 61131-3 compiler.
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    26
 *
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    27
 * Based on the
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    28
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    29
 *
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    30
 */
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    31
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    32
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    33
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    34
#ifndef _MAIN_HH
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    35
#define _MAIN_HH
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    36
604
2989051a0a64 Fixing includes to define INTxx_MAX etc...
Mario de Sousa <msousa@fe.up.pt>
parents: 597
diff changeset
    37
2989051a0a64 Fixing includes to define INTxx_MAX etc...
Mario de Sousa <msousa@fe.up.pt>
parents: 597
diff changeset
    38
597
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    39
 /* Function used throughout the code --> used to report failed assertions (i.e. internal compiler errors)! */
604
2989051a0a64 Fixing includes to define INTxx_MAX etc...
Mario de Sousa <msousa@fe.up.pt>
parents: 597
diff changeset
    40
#include <stddef.h>  /* required for NULL */
2989051a0a64 Fixing includes to define INTxx_MAX etc...
Mario de Sousa <msousa@fe.up.pt>
parents: 597
diff changeset
    41
 
597
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    42
#define ERROR               error_exit(__FILE__,__LINE__)
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    43
#define ERROR_MSG(msg, ...) error_exit(__FILE__,__LINE__, msg)
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    44
// #define ERROR_MSG(msg, ...) error_exit(__FILE__,__LINE__, msg, __VA_ARGS__)
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    45
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    46
extern void error_exit(const char *file_name, int line_no, const char *errmsg = NULL, ...);
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    47
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    48
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    49
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    50
607
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    51
 /* Get the definition of INT16_MAX, INT16_MIN, UINT64_MAX, INT64_MAX, INT64_MIN, ... */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    52
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    53
#define __STDC_LIMIT_MACROS /* required to have UINTxx_MAX defined when including stdint.h from C++ source code. */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    54
#include <stdint.h>         
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    55
#include <limits>
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    56
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    57
#ifndef   UINT64_MAX 
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    58
  #define UINT64_MAX (std::numeric_limits< uint64_t >::max())
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    59
#endif
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    60
#ifndef    INT64_MAX 
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    61
  #define  INT64_MAX (std::numeric_limits<  int64_t >::max())
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    62
#endif
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    63
#ifndef    INT64_MIN
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    64
  #define  INT64_MIN (std::numeric_limits<  int64_t >::min()) 
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    65
#endif
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    66
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    67
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    68
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    69
/* Determine, for the current platform, which datas types (float, double or long double) use 64 and 32 bits. */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    70
/* NOTE: We cant use sizeof() in pre-processor directives, so we have to do it another way... */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    71
/* CURIOSITY: We can use sizeof() and offsetof() inside static_assert() but:
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    72
 *          - this only allows us to make assertions, and not #define new macros
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    73
 *          - is only available in the C standard [ISO/IEC 9899:2011] and the C++ 0X draft standard [Becker 2008]. It is not available in C99.
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    74
 *          https://www.securecoding.cert.org/confluence/display/seccode/DCL03-C.+Use+a+static+assertion+to+test+the+value+of+a+constant+expression
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    75
 *         struct {int a, b, c, d} header_t;
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    76
 *  e.g.:  static_assert(offsetof(struct header_t, c) == 8, "Compile time error message.");
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    77
 */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    78
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    79
#include <float.h>
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    80
#if    (LDBL_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    81
  #define long_double long double
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    82
  #define real64_t long_double /* so we can later use #if (real64_t == long_double) directives in the code! */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    83
  #define REAL64_MAX  LDBL_MAX
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    84
#elif  ( DBL_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    85
  #define real64_t double
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    86
  #define REAL64_MAX  DBL_MAX
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    87
#elif  ( FLT_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    88
  #define real64_t float
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    89
  #define REAL64_MAX  FLT_MAX
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    90
#else 
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    91
  #error Could not find a 64 bit floating point data type on this platform. Aborting...
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    92
#endif
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    93
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    94
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    95
#if    (LDBL_MANT_DIG == 24) /* NOTE: 32 bit IEC559 real has 24 bits for mantissa! */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    96
  #ifndef long_double 
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    97
    #define long_double long double
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    98
  #endif  
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
    99
  #define real32_t long_double /* so we can later use #if (real32_t == long_double) directives in the code! */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   100
  #define REAL32_MAX  LDBL_MAX
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   101
#elif  ( DBL_MANT_DIG == 24) /* NOTE: 32 bit IEC559 real has 24 bits for mantissa! */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   102
  #define real32_t double
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   103
  #define REAL32_MAX  DBL_MAX
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   104
#elif  ( FLT_MANT_DIG == 24) /* NOTE: 32 bit IEC559 real has 24 bits for mantissa! */
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   105
  #define real32_t float
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   106
  #define REAL32_MAX  FLT_MAX
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   107
#else 
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   108
  #error Could not find a 32 bit floating point data type on this platform. Aborting...
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   109
#endif
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   110
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   111
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   112
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   113
#include <math.h>
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   114
#ifndef INFINITY
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   115
  #error Could not find the macro that defines the value for INFINITY in the current platform.
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   116
#endif
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   117
#ifndef NAN
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   118
  #error Could not find the macro that defines the value for NAN in the current platform.
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   119
#endif
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   120
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   121
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   122
645
e01ede1c9862 Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
Mario de Sousa <msousa@fe.up.pt>
parents: 607
diff changeset
   123
/* get the printf format macros for printing variables of fixed data size
e01ede1c9862 Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
Mario de Sousa <msousa@fe.up.pt>
parents: 607
diff changeset
   124
 * e.g.  int64_t v; printf("value=%"PRId64" !!\n", v);
e01ede1c9862 Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
Mario de Sousa <msousa@fe.up.pt>
parents: 607
diff changeset
   125
 * e.g. uint64_t v; printf("value=%"PRIu64" !!\n", v);
e01ede1c9862 Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
Mario de Sousa <msousa@fe.up.pt>
parents: 607
diff changeset
   126
 * e.g. uint64_t v; printf("value=%"PRIx64" !!\n", v);  // hexadecimal format
e01ede1c9862 Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
Mario de Sousa <msousa@fe.up.pt>
parents: 607
diff changeset
   127
 */
e01ede1c9862 Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
Mario de Sousa <msousa@fe.up.pt>
parents: 607
diff changeset
   128
#define __STDC_FORMAT_MACROS
e01ede1c9862 Allow the use of PRId64, PRIu64 and PRIx64 printf formating macros globally.
Mario de Sousa <msousa@fe.up.pt>
parents: 607
diff changeset
   129
#include <inttypes.h>
607
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   130
be9ba3531afb cleaning up code. Changing HUGE_VAL to INFINITY.
Mario de Sousa <msousa@fe.up.pt>
parents: 604
diff changeset
   131
597
7326a0658104 Add file missing from previous commit.
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
   132
#endif // #ifndef _MAIN_HH