MPHELL  4.0.0
Data Structures | Macros | Typedefs | Enumerations | Functions
mphell-errors.h File Reference

Declaration of error functions. More...

#include <stdio.h>
#include <stdlib.h>
#include "mphell-define.h"
Include dependency graph for mphell-errors.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mphell_status_t
 The status is a couple (flag, information) More...
 

Macros

#define MPHELL_ASSERT_LINE   -1
 
#define MPHELL_ASSERT_FILE   ""
 
#define MPHELL_ASSERT_FAIL(info)
 
#define MPHELL_ASSERT_ALWAYS(expr, info)
 
#define MPHELL_ASSERT(expr, info)   do {} while (0)
 

Typedefs

typedef enum mphell_status_flag_enum mphell_status_flag
 Enumerate status flag.
 
typedef mphell_status_t mphell_status[1]
 The status is a couple (flag, information)
 

Enumerations

enum  mphell_status_flag_enum { MPHELL_SUCCESS, MPHELL_ERROR_RANDOM, MPHELL_CATASTROPHIC_ERROR_RANDOM, MPHELL_RESEED_REQUIRED }
 Enumerate status flag. More...
 

Functions

void mphell_assert_error (const char *filename, int line, const char *expr)
 Write in stderr, filename, line and expr, free mphell. More...
 
void mphell_error (char *expr)
 Write in stderr, filename, line and expr, free mphell. More...
 
void mphell_error_free (char *expr)
 Write in stderr, filename, line and expr, free expr and mphell. More...
 

Detailed Description

Declaration of error functions.

Definition in file mphell-errors.h.

Macro Definition Documentation

◆ MPHELL_ASSERT_ALWAYS

#define MPHELL_ASSERT_ALWAYS (   expr,
  info 
)
Value:
do { \
if (!(expr)) \
MPHELL_ASSERT_FAIL (info); \
} while (0)

Definition at line 49 of file mphell-errors.h.

◆ MPHELL_ASSERT_FAIL

#define MPHELL_ASSERT_FAIL (   info)
Value:
mphell_assert_error (MPHELL_ASSERT_FILE, \
MPHELL_ASSERT_LINE, info)
void mphell_assert_error(const char *filename, int line, const char *expr)
Write in stderr, filename, line and expr, free mphell.
Definition: mphell-errors.c:29

Definition at line 46 of file mphell-errors.h.

Enumeration Type Documentation

◆ mphell_status_flag_enum

Enumerate status flag.

Enumerator
MPHELL_SUCCESS 

Success

MPHELL_ERROR_RANDOM 

Error with the Random Number Generator

MPHELL_CATASTROPHIC_ERROR_RANDOM 

Error with the Random Number Generator, must stop

MPHELL_RESEED_REQUIRED 

The RNG need to be resseeded

Definition at line 66 of file mphell-errors.h.

Function Documentation

◆ mphell_assert_error()

void mphell_assert_error ( const char *  filename,
int  line,
const char *  expr 
)

Write in stderr, filename, line and expr, free mphell.

Parameters
filenameFile where the error occured
lineLine where the rrors occured
exprError description

Definition at line 29 of file mphell-errors.c.

◆ mphell_error()

void mphell_error ( char *  expr)

Write in stderr, filename, line and expr, free mphell.

Parameters
exprError description

Definition at line 45 of file mphell-errors.c.

◆ mphell_error_free()

void mphell_error_free ( char *  expr)

Write in stderr, filename, line and expr, free expr and mphell.

Parameters
exprError description, allocated dynamically

Definition at line 61 of file mphell-errors.c.