Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a forwarder in the MSG example.
[simgrid.git] / testsuite / msg / messages.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2002,2003,2004 Arnaud Legrand. All rights reserved.        */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #ifndef MESSAGES_H
9 #define MESSAGES_H
10
11 #include <stdio.h>
12 #include <stdarg.h>
13 #include "msg/datatypes.h"
14 #include "xbt/error.h"
15
16 static void DIE(const char *fmt, ...)
17 {
18   m_process_t self = MSG_process_self();
19   va_list ap;
20
21   va_start(ap, fmt);
22   if (self)
23     fprintf(stderr, "[%Lg] P%d | ", MSG_getClock(),
24             MSG_process_get_PID(self));
25   vfprintf(stderr, fmt, ap);
26   va_end(ap);
27
28   xbt_abort();
29   return;
30 }
31
32 static void PRINT_MESSAGE(const char *fmt, ...)
33 {
34 #ifdef VERBOSE
35   m_process_t self = MSG_process_self();
36   va_list ap;
37
38   va_start(ap, fmt);
39   if (self)
40     fprintf(stderr, "[%Lg] P%d | ", MSG_getClock(),
41             MSG_process_get_PID(self));
42   vfprintf(stderr, fmt, ap);
43   va_end(ap);
44 #endif
45   return;
46 }
47
48 static void PRINT_DEBUG_MESSAGE(const char *fmt, ...)
49 {
50 #ifdef VERBOSE
51   m_process_t self = MSG_process_self();
52   va_list ap;
53
54   va_start(ap, fmt);
55   if (self)
56     fprintf(stderr, "DEBUG [%Lg] P%d | ", MSG_getClock(),
57             MSG_process_get_PID(self));
58   vfprintf(stderr, fmt, ap);
59   va_end(ap);
60 #endif
61   return;
62 }
63
64 #endif