source: box/trunk/lib/common/MainHelper.h @ 3030

Revision 3030, 1.1 KB checked in by chris, 7 months ago (diff)

Avoid recompiling everything on MSVC when BoxVersion?.h changes.

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    MainHelper.h
5//              Purpose: Helper stuff for main() programs
6//              Created: 2003/08/21
7//
8// --------------------------------------------------------------------------
9
10#ifndef MAINHELPER__H
11#define MAINHELPER__H
12
13#include <stdio.h>
14
15#ifdef NEED_BOX_VERSION_H
16#       include "BoxVersion.h"
17#endif
18
19#include "BoxException.h"
20#include "Logging.h"
21
22#define MAINHELPER_START                                                                        \
23        if(argc == 2 && ::strcmp(argv[1], "--version") == 0)    \
24        { printf(BOX_VERSION "\n"); return 0; }                                 \
25        MEMLEAKFINDER_INIT \
26        MEMLEAKFINDER_START                                                                             \
27        try {
28
29#define MAINHELPER_END                                                                                                                          \
30        } catch(std::exception &e) {                                                                                                    \
31                BOX_FATAL(e.what()); \
32                return 1;                                                                                                                                               \
33        } catch(...) {                                                                                                                                  \
34                BOX_FATAL("UNKNOWN"); \
35                return 1; \
36        }
37
38#ifdef BOX_MEMORY_LEAK_TESTING
39        #define MAINHELPER_SETUP_MEMORY_LEAK_EXIT_REPORT(file, marker)                          \
40                memleakfinder_setup_exit_report(file, marker);
41#else
42        #define MAINHELPER_SETUP_MEMORY_LEAK_EXIT_REPORT(file, marker)
43#endif // BOX_MEMORY_LEAK_TESTING
44
45
46#endif // MAINHELPER__H
47
Note: See TracBrowser for help on using the repository browser.