Panda3D
dconfig.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file dconfig.h
10  * @author cary
11  * @date 1998-07-14
12  */
13 
14 #ifndef DCONFIG_H
15 #define DCONFIG_H
16 
17 #include "dtoolbase.h"
18 #include "notifyCategoryProxy.h"
19 
20 // These macros are used in each directory to call an initialization function
21 // at static-init time. These macros may eventually be phased out in favor of
22 // a simpler interface that does not require static init.
23 
24 // NOTE: Having a macro called Configure proved to be problematic with some
25 // DX9 headers. To avoid that in the future we provide a new family of macros
26 // prefixed by DTool and deprecate the old ones, to be removed from the
27 // codebase sometime in the future.
28 
29 // This macro should appear in the config_*.h file.
30 
31 #define ConfigureDecl(name, expcl, exptp)
32 #define DToolConfigureDecl(name, expcl, exptp)
33 
34 // This macro defines the actual declaration of the object defined above; it
35 // should appear in the config_*.cxx file.
36 
37 #define ConfigureDef(name) \
38  class StaticInitializer_ ## name { \
39  public: \
40  StaticInitializer_ ## name(); \
41  }; \
42  static StaticInitializer_ ## name name;
43 #define DToolConfigureDef(name) \
44  class StaticInitializer_ ## name { \
45  public: \
46  StaticInitializer_ ## name(); \
47  }; \
48  static StaticInitializer_ ## name name;
49 
50 // This macro can be used in lieu of the above two when the Configure object
51 // does not need to be visible outside of the current C file.
52 
53 #define Configure(name) ConfigureDef(name)
54 #define DToolConfigure(name) DToolConfigureDef(name)
55 
56 // This one defines a block of code that will be executed at static init time.
57 // It must always be defined (in the C file), even if no code is to be
58 // executed.
59 
60 #define ConfigureFn(name) \
61  StaticInitializer_ ## name::StaticInitializer_ ## name()
62 #define DToolConfigureFn(name) \
63  StaticInitializer_ ## name::StaticInitializer_ ## name()
64 
65 #endif /* __CONFIG_H__ */
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.