NuSMV/code/nusmv/core/utils/error.h File Reference

#include <stdio.h>
#include "nusmv/core/utils/utils.h"
#include "nusmv/core/utils/portability.h"
#include "nusmv/core/node/node.h"
#include "nusmv/core/utils/NodeList.h"
#include "nusmv/core/prop/Prop.h"

Go to the source code of this file.

Defines

#define error_unreachable_code()
 header for the error.c file
#define error_unreachable_code_msg(...)
#define SNPRINTF_CHECK(chars, buffsize)
 Checks if the return value of a snprintf call is compatible with the size of the buffer passed as first argument to the snprintf function call.

Functions

void Error_init (NuSMVEnv_ptr env)
 Initializes the errro manager within the given environment.
void Error_quit (NuSMVEnv_ptr env)
 Deinitializes the errro manager within the given environment.
void init_memory (void)
 Initializes the memory routines.

Define Documentation

 
#define error_unreachable_code (  ) 
Value:
do {                                                                  \
    fprintf(stderr, "%s:%d:%s: reached invalid code\n",                 \
            __FILE__, __LINE__, __func__);                              \
    exit(4);                                                            \
  } while (0)

header for the error.c file

Author:
Marco Roveri header for the error.c file.
Todo:
Missing synopsis
Todo:
Missing description
#define error_unreachable_code_msg ( ...   ) 
Value:
do {                                                                  \
    printf(__VA_ARGS__);                                                \
    fprintf(stderr, "%s:%d:%s: reached invalid code\n",                 \
            __FILE__, __LINE__, __func__);                              \
    exit(4);                                                            \
  } while (0)
Todo:
Missing synopsis
Todo:
Missing description
#define SNPRINTF_CHECK ( chars,
buffsize   ) 
Value:
do {                                                          \
    if (chars < 0) {                                            \
      fprintf(stderr, "%s:%d:%s: Error in buffer writing",      \
              __FILE__, __LINE__, __func__);                    \
      exit(5);                                                  \
    }                                                           \
    else if ((unsigned int)chars >= buffsize) {                 \
      fprintf(stderr, "%s:%d:%s: String buffer overflow",       \
              __FILE__, __LINE__, __func__);                    \
      exit(5);                                                  \
    }                                                           \
    else {};                                                    \
  } while (0)

Checks if the return value of a snprintf call is compatible with the size of the buffer passed as first argument to the snprintf function call.

Checks if the return value of a snprintf call is compatible with the size of the buffer passed as first argument to the snprintf function call. An internal error is thrown if a buffer overflow is found.

An example of use:

char buf[40]; int chars = snprintf(buf, 40, "hello world"); SNPRINTF_CHECK(chars, 40);

WARNING: do no use this macro if you are using snprintf to actually truncate a string. The macro will always abort, because the return value of snprintf is always the length of the original string. See man snprintf.

See also:
snprintf

Function Documentation

void Error_init ( NuSMVEnv_ptr  env  ) 

Initializes the errro manager within the given environment.

Initializes the errro manager within the given environment. Conflicts if another instance is registered with key ENV_ERROR_MANAGER

void Error_quit ( NuSMVEnv_ptr  env  ) 

Deinitializes the errro manager within the given environment.

Deinitializes the errro manager within the given environment

void init_memory ( void   ) 

Initializes the memory routines.

This function deals with the memory routines taken form the CUDD. It initializes the pointer to function MMoutOfMemory which is used by the memory allocation functions when the USE_MM macro is not defined (the default). This pointer specifies the function to call when the allocation routines fails to allocate memory.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 14 Oct 2015 for NuSMV Developers Manual by  doxygen 1.6.1