mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
introduce PRC_SAVE_DESCRIPTIONS and PRC_DESC to strip out config descriptions in release build
This commit is contained in:
parent
77f6853877
commit
dfb734893d
@ -198,6 +198,11 @@
|
||||
// (empty) to explicitly enable or disable this feature.
|
||||
#defer PRC_RESPECT_TRUST_LEVEL $[= $[OPTIMIZE],4]
|
||||
|
||||
// Similarly, the descriptions are normally saved only in a
|
||||
// development build, not in a release build. Set this value true to
|
||||
// explicitly save them anyway.
|
||||
#defer PRC_SAVE_DESCRIPTIONS $[< $[OPTIMIZE],4]
|
||||
|
||||
// This is the end of the PRC variable customization section. The
|
||||
// remaining variables are of general interest to everyone.
|
||||
|
||||
|
@ -279,6 +279,9 @@ $[cdefine LINK_IN_PHYSICS]
|
||||
above. */
|
||||
$[cdefine PRC_RESPECT_TRUST_LEVEL]
|
||||
|
||||
/* Define if you want to save the descriptions for ConfigVariables. */
|
||||
$[cdefine PRC_SAVE_DESCRIPTIONS]
|
||||
|
||||
|
||||
/* Define if your processor stores words with the most significant
|
||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
|
@ -33,9 +33,11 @@ ConfigVariableBase(const string &name,
|
||||
if (value_type != VT_undefined) {
|
||||
_core->set_value_type(value_type);
|
||||
}
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
if (!description.empty()) {
|
||||
_core->set_description(description);
|
||||
}
|
||||
#endif // PRC_SAVE_DESCRIPTIONS
|
||||
if (flags != 0) {
|
||||
_core->set_flags(flags);
|
||||
}
|
||||
|
@ -26,6 +26,16 @@
|
||||
#include "configVariableManager.h"
|
||||
#include "vector_string.h"
|
||||
|
||||
// Use this macro to wrap around a description passed to a
|
||||
// ConfigVariable constructor. This allows the description to be
|
||||
// completely compiled out, so that it won't even be a part of the
|
||||
// string table, in the absence of PRC_SAVE_DESCRIPTIONS.
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
#define PRC_DESC(description) description
|
||||
#else
|
||||
#define PRC_DESC(description) ""
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : ConfigVariableBase
|
||||
// Description : This class is the base class for both
|
||||
|
@ -29,6 +29,24 @@ ConfigVariableDouble(const string &name) :
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableDouble::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariableDouble::
|
||||
ConfigVariableDouble(const string &name, double default_value,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariable(name, ConfigVariableCore::VT_double, description, flags)
|
||||
#else
|
||||
ConfigVariable(name, ConfigVariableCore::VT_double, string(), flags)
|
||||
#endif
|
||||
{
|
||||
set_default_value(default_value);
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableDouble::operator =
|
||||
// Access: Published
|
||||
|
@ -19,18 +19,14 @@
|
||||
#include "configVariableDouble.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableDouble::Constructor
|
||||
// Access: Published
|
||||
// Function: ConfigVariableDouble::set_default_value
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ConfigVariableDouble::
|
||||
ConfigVariableDouble(const string &name, double default_value,
|
||||
const string &description, int flags) :
|
||||
ConfigVariable(name, ConfigVariableCore::VT_double, description, flags)
|
||||
{
|
||||
void ConfigVariableDouble::
|
||||
set_default_value(double default_value) {
|
||||
ostringstream strm;
|
||||
strm << default_value;
|
||||
|
||||
_core->set_default_value(strm.str());
|
||||
_core->set_used();
|
||||
}
|
||||
|
@ -30,8 +30,9 @@
|
||||
class EXPCL_DTOOLCONFIG ConfigVariableDouble : public ConfigVariable {
|
||||
PUBLISHED:
|
||||
INLINE ConfigVariableDouble(const string &name);
|
||||
ConfigVariableDouble(const string &name, double default_value,
|
||||
const string &description = string(), int flags = 0);
|
||||
INLINE ConfigVariableDouble(const string &name, double default_value,
|
||||
const string &description = string(),
|
||||
int flags = 0);
|
||||
|
||||
INLINE void operator = (double value);
|
||||
INLINE operator double () const;
|
||||
@ -45,6 +46,9 @@ PUBLISHED:
|
||||
|
||||
INLINE double get_word(int n) const;
|
||||
INLINE void set_word(int n, double value);
|
||||
|
||||
private:
|
||||
void set_default_value(double default_value);
|
||||
};
|
||||
|
||||
#include "configVariableDouble.I"
|
||||
|
@ -26,7 +26,11 @@ template<class EnumType>
|
||||
INLINE ConfigVariableEnum<EnumType>::
|
||||
ConfigVariableEnum(const string &name, EnumType default_value,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariable(name, ConfigVariableCore::VT_enum, description, flags),
|
||||
#else
|
||||
ConfigVariable(name, ConfigVariableCore::VT_enum, string(), flags),
|
||||
#endif
|
||||
_value_seq(-1),
|
||||
_value(default_value),
|
||||
_got_default_value(true),
|
||||
|
@ -38,8 +38,9 @@
|
||||
template<class EnumType>
|
||||
class ConfigVariableEnum : public ConfigVariable {
|
||||
public:
|
||||
ConfigVariableEnum(const string &name, EnumType default_value,
|
||||
const string &description = string(), int flags = 0);
|
||||
INLINE ConfigVariableEnum(const string &name, EnumType default_value,
|
||||
const string &description = string(),
|
||||
int flags = 0);
|
||||
INLINE ~ConfigVariableEnum();
|
||||
|
||||
INLINE void operator = (EnumType value);
|
||||
|
@ -39,7 +39,11 @@ ConfigVariableFilename(const string &name) :
|
||||
INLINE ConfigVariableFilename::
|
||||
ConfigVariableFilename(const string &name, const Filename &default_value,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariable(name, VT_filename, description, flags)
|
||||
#else
|
||||
ConfigVariable(name, VT_filename, string(), flags)
|
||||
#endif
|
||||
{
|
||||
_core->set_default_value(default_value);
|
||||
_core->set_used();
|
||||
|
@ -29,6 +29,24 @@ ConfigVariableInt(const string &name) :
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableInt::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariableInt::
|
||||
ConfigVariableInt(const string &name, int default_value,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariable(name, ConfigVariableCore::VT_int, description, flags)
|
||||
#else
|
||||
ConfigVariable(name, ConfigVariableCore::VT_int, string(), flags)
|
||||
#endif
|
||||
{
|
||||
set_default_value(default_value);
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableInt::operator =
|
||||
// Access: Published
|
||||
|
@ -19,18 +19,14 @@
|
||||
#include "configVariableInt.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableInt::Constructor
|
||||
// Access: Published
|
||||
// Function: ConfigVariableInt::set_default_value
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ConfigVariableInt::
|
||||
ConfigVariableInt(const string &name, int default_value,
|
||||
const string &description, int flags) :
|
||||
ConfigVariable(name, ConfigVariableCore::VT_int, description, flags)
|
||||
{
|
||||
void ConfigVariableInt::
|
||||
set_default_value(int default_value) {
|
||||
ostringstream strm;
|
||||
strm << default_value;
|
||||
|
||||
_core->set_default_value(strm.str());
|
||||
_core->set_used();
|
||||
}
|
||||
|
@ -30,8 +30,9 @@
|
||||
class EXPCL_DTOOLCONFIG ConfigVariableInt : public ConfigVariable {
|
||||
PUBLISHED:
|
||||
INLINE ConfigVariableInt(const string &name);
|
||||
ConfigVariableInt(const string &name, int default_value,
|
||||
const string &description = string(), int flags = 0);
|
||||
INLINE ConfigVariableInt(const string &name, int default_value,
|
||||
const string &description = string(),
|
||||
int flags = 0);
|
||||
|
||||
INLINE void operator = (int value);
|
||||
INLINE operator int () const;
|
||||
@ -45,6 +46,9 @@ PUBLISHED:
|
||||
|
||||
INLINE int get_word(int n) const;
|
||||
INLINE void set_word(int n, int value);
|
||||
|
||||
private:
|
||||
void set_default_value(int default_value);
|
||||
};
|
||||
|
||||
#include "configVariableInt.I"
|
||||
|
@ -26,6 +26,29 @@ INLINE ConfigVariableList::
|
||||
~ConfigVariableList() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableList::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariableList::
|
||||
ConfigVariableList(const string &name,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariableBase(name, VT_list, description, flags)
|
||||
#else
|
||||
ConfigVariableBase(name, VT_list, string(), flags)
|
||||
#endif
|
||||
{
|
||||
// A list variable implicitly defines a default value of the empty
|
||||
// string. This is just to prevent the core variable from
|
||||
// complaining should anyone ask for its solitary value.
|
||||
if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
|
||||
_core->set_default_value("");
|
||||
}
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableList::get_num_values
|
||||
// Access: Published
|
||||
|
@ -18,25 +18,6 @@
|
||||
|
||||
#include "configVariableList.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableList::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ConfigVariableList::
|
||||
ConfigVariableList(const string &name,
|
||||
const string &description, int flags) :
|
||||
ConfigVariableBase(name, VT_list, description, flags)
|
||||
{
|
||||
// A list variable implicitly defines a default value of the empty
|
||||
// string. This is just to prevent the core variable from
|
||||
// complaining should anyone ask for its solitary value.
|
||||
if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
|
||||
_core->set_default_value("");
|
||||
}
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableList::output
|
||||
// Access: Published
|
||||
|
@ -38,8 +38,9 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_DTOOLCONFIG ConfigVariableList : public ConfigVariableBase {
|
||||
PUBLISHED:
|
||||
ConfigVariableList(const string &name,
|
||||
const string &description = string(), int flags = 0);
|
||||
INLINE ConfigVariableList(const string &name,
|
||||
const string &description = string(),
|
||||
int flags = 0);
|
||||
INLINE ~ConfigVariableList();
|
||||
|
||||
INLINE int get_num_values() const;
|
||||
|
@ -17,6 +17,31 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableSearchPath::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariableSearchPath::
|
||||
ConfigVariableSearchPath(const string &name,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariableBase(name, VT_search_path, description, flags),
|
||||
#else
|
||||
ConfigVariableBase(name, VT_search_path, string(), flags),
|
||||
#endif
|
||||
_value_seq(-1),
|
||||
_value_stale(true)
|
||||
{
|
||||
// A SearchPath variable implicitly defines a default value of the empty
|
||||
// string. This is just to prevent the core variable from
|
||||
// complaining should anyone ask for its solitary value.
|
||||
if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
|
||||
_core->set_default_value("");
|
||||
}
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableSearchPath::Destructor
|
||||
// Access: Published
|
||||
|
@ -19,27 +19,6 @@
|
||||
#include "configVariableSearchPath.h"
|
||||
#include "executionEnvironment.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableSearchPath::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ConfigVariableSearchPath::
|
||||
ConfigVariableSearchPath(const string &name,
|
||||
const string &description, int flags) :
|
||||
ConfigVariableBase(name, VT_search_path, description, flags),
|
||||
_value_seq(-1),
|
||||
_value_stale(true)
|
||||
{
|
||||
// A SearchPath variable implicitly defines a default value of the empty
|
||||
// string. This is just to prevent the core variable from
|
||||
// complaining should anyone ask for its solitary value.
|
||||
if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
|
||||
_core->set_default_value("");
|
||||
}
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableSearchPath::get_value
|
||||
// Access: Published
|
||||
|
@ -45,8 +45,9 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_DTOOLCONFIG ConfigVariableSearchPath : public ConfigVariableBase {
|
||||
PUBLISHED:
|
||||
ConfigVariableSearchPath(const string &name,
|
||||
const string &description = string(), int flags = 0);
|
||||
INLINE ConfigVariableSearchPath(const string &name,
|
||||
const string &description = string(),
|
||||
int flags = 0);
|
||||
INLINE ~ConfigVariableSearchPath();
|
||||
|
||||
INLINE operator const DSearchPath & () const;
|
||||
|
@ -37,7 +37,11 @@ ConfigVariableString(const string &name) :
|
||||
INLINE ConfigVariableString::
|
||||
ConfigVariableString(const string &name, const string &default_value,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariable(name, VT_string, description, flags)
|
||||
#else
|
||||
ConfigVariable(name, VT_string, string(), flags)
|
||||
#endif
|
||||
{
|
||||
_core->set_default_value(default_value);
|
||||
_core->set_used();
|
||||
|
Loading…
x
Reference in New Issue
Block a user