mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -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.
|
// (empty) to explicitly enable or disable this feature.
|
||||||
#defer PRC_RESPECT_TRUST_LEVEL $[= $[OPTIMIZE],4]
|
#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
|
// This is the end of the PRC variable customization section. The
|
||||||
// remaining variables are of general interest to everyone.
|
// remaining variables are of general interest to everyone.
|
||||||
|
|
||||||
|
@ -279,6 +279,9 @@ $[cdefine LINK_IN_PHYSICS]
|
|||||||
above. */
|
above. */
|
||||||
$[cdefine PRC_RESPECT_TRUST_LEVEL]
|
$[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
|
/* Define if your processor stores words with the most significant
|
||||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||||
|
@ -33,9 +33,11 @@ ConfigVariableBase(const string &name,
|
|||||||
if (value_type != VT_undefined) {
|
if (value_type != VT_undefined) {
|
||||||
_core->set_value_type(value_type);
|
_core->set_value_type(value_type);
|
||||||
}
|
}
|
||||||
|
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||||
if (!description.empty()) {
|
if (!description.empty()) {
|
||||||
_core->set_description(description);
|
_core->set_description(description);
|
||||||
}
|
}
|
||||||
|
#endif // PRC_SAVE_DESCRIPTIONS
|
||||||
if (flags != 0) {
|
if (flags != 0) {
|
||||||
_core->set_flags(flags);
|
_core->set_flags(flags);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,16 @@
|
|||||||
#include "configVariableManager.h"
|
#include "configVariableManager.h"
|
||||||
#include "vector_string.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
|
// Class : ConfigVariableBase
|
||||||
// Description : This class is the base class for both
|
// Description : This class is the base class for both
|
||||||
|
@ -29,6 +29,24 @@ ConfigVariableDouble(const string &name) :
|
|||||||
_core->set_used();
|
_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 =
|
// Function: ConfigVariableDouble::operator =
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -19,18 +19,14 @@
|
|||||||
#include "configVariableDouble.h"
|
#include "configVariableDouble.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ConfigVariableDouble::Constructor
|
// Function: ConfigVariableDouble::set_default_value
|
||||||
// Access: Published
|
// Access: Private
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ConfigVariableDouble::
|
void ConfigVariableDouble::
|
||||||
ConfigVariableDouble(const string &name, double default_value,
|
set_default_value(double default_value) {
|
||||||
const string &description, int flags) :
|
|
||||||
ConfigVariable(name, ConfigVariableCore::VT_double, description, flags)
|
|
||||||
{
|
|
||||||
ostringstream strm;
|
ostringstream strm;
|
||||||
strm << default_value;
|
strm << default_value;
|
||||||
|
|
||||||
_core->set_default_value(strm.str());
|
_core->set_default_value(strm.str());
|
||||||
_core->set_used();
|
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,9 @@
|
|||||||
class EXPCL_DTOOLCONFIG ConfigVariableDouble : public ConfigVariable {
|
class EXPCL_DTOOLCONFIG ConfigVariableDouble : public ConfigVariable {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE ConfigVariableDouble(const string &name);
|
INLINE ConfigVariableDouble(const string &name);
|
||||||
ConfigVariableDouble(const string &name, double default_value,
|
INLINE ConfigVariableDouble(const string &name, double default_value,
|
||||||
const string &description = string(), int flags = 0);
|
const string &description = string(),
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
INLINE void operator = (double value);
|
INLINE void operator = (double value);
|
||||||
INLINE operator double () const;
|
INLINE operator double () const;
|
||||||
@ -45,6 +46,9 @@ PUBLISHED:
|
|||||||
|
|
||||||
INLINE double get_word(int n) const;
|
INLINE double get_word(int n) const;
|
||||||
INLINE void set_word(int n, double value);
|
INLINE void set_word(int n, double value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void set_default_value(double default_value);
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "configVariableDouble.I"
|
#include "configVariableDouble.I"
|
||||||
|
@ -26,7 +26,11 @@ template<class EnumType>
|
|||||||
INLINE ConfigVariableEnum<EnumType>::
|
INLINE ConfigVariableEnum<EnumType>::
|
||||||
ConfigVariableEnum(const string &name, EnumType default_value,
|
ConfigVariableEnum(const string &name, EnumType default_value,
|
||||||
const string &description, int flags) :
|
const string &description, int flags) :
|
||||||
|
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||||
ConfigVariable(name, ConfigVariableCore::VT_enum, description, flags),
|
ConfigVariable(name, ConfigVariableCore::VT_enum, description, flags),
|
||||||
|
#else
|
||||||
|
ConfigVariable(name, ConfigVariableCore::VT_enum, string(), flags),
|
||||||
|
#endif
|
||||||
_value_seq(-1),
|
_value_seq(-1),
|
||||||
_value(default_value),
|
_value(default_value),
|
||||||
_got_default_value(true),
|
_got_default_value(true),
|
||||||
|
@ -38,8 +38,9 @@
|
|||||||
template<class EnumType>
|
template<class EnumType>
|
||||||
class ConfigVariableEnum : public ConfigVariable {
|
class ConfigVariableEnum : public ConfigVariable {
|
||||||
public:
|
public:
|
||||||
ConfigVariableEnum(const string &name, EnumType default_value,
|
INLINE ConfigVariableEnum(const string &name, EnumType default_value,
|
||||||
const string &description = string(), int flags = 0);
|
const string &description = string(),
|
||||||
|
int flags = 0);
|
||||||
INLINE ~ConfigVariableEnum();
|
INLINE ~ConfigVariableEnum();
|
||||||
|
|
||||||
INLINE void operator = (EnumType value);
|
INLINE void operator = (EnumType value);
|
||||||
|
@ -39,7 +39,11 @@ ConfigVariableFilename(const string &name) :
|
|||||||
INLINE ConfigVariableFilename::
|
INLINE ConfigVariableFilename::
|
||||||
ConfigVariableFilename(const string &name, const Filename &default_value,
|
ConfigVariableFilename(const string &name, const Filename &default_value,
|
||||||
const string &description, int flags) :
|
const string &description, int flags) :
|
||||||
|
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||||
ConfigVariable(name, VT_filename, description, flags)
|
ConfigVariable(name, VT_filename, description, flags)
|
||||||
|
#else
|
||||||
|
ConfigVariable(name, VT_filename, string(), flags)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
_core->set_default_value(default_value);
|
_core->set_default_value(default_value);
|
||||||
_core->set_used();
|
_core->set_used();
|
||||||
|
@ -29,6 +29,24 @@ ConfigVariableInt(const string &name) :
|
|||||||
_core->set_used();
|
_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 =
|
// Function: ConfigVariableInt::operator =
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -19,18 +19,14 @@
|
|||||||
#include "configVariableInt.h"
|
#include "configVariableInt.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ConfigVariableInt::Constructor
|
// Function: ConfigVariableInt::set_default_value
|
||||||
// Access: Published
|
// Access: Private
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ConfigVariableInt::
|
void ConfigVariableInt::
|
||||||
ConfigVariableInt(const string &name, int default_value,
|
set_default_value(int default_value) {
|
||||||
const string &description, int flags) :
|
|
||||||
ConfigVariable(name, ConfigVariableCore::VT_int, description, flags)
|
|
||||||
{
|
|
||||||
ostringstream strm;
|
ostringstream strm;
|
||||||
strm << default_value;
|
strm << default_value;
|
||||||
|
|
||||||
_core->set_default_value(strm.str());
|
_core->set_default_value(strm.str());
|
||||||
_core->set_used();
|
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,9 @@
|
|||||||
class EXPCL_DTOOLCONFIG ConfigVariableInt : public ConfigVariable {
|
class EXPCL_DTOOLCONFIG ConfigVariableInt : public ConfigVariable {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE ConfigVariableInt(const string &name);
|
INLINE ConfigVariableInt(const string &name);
|
||||||
ConfigVariableInt(const string &name, int default_value,
|
INLINE ConfigVariableInt(const string &name, int default_value,
|
||||||
const string &description = string(), int flags = 0);
|
const string &description = string(),
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
INLINE void operator = (int value);
|
INLINE void operator = (int value);
|
||||||
INLINE operator int () const;
|
INLINE operator int () const;
|
||||||
@ -45,6 +46,9 @@ PUBLISHED:
|
|||||||
|
|
||||||
INLINE int get_word(int n) const;
|
INLINE int get_word(int n) const;
|
||||||
INLINE void set_word(int n, int value);
|
INLINE void set_word(int n, int value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void set_default_value(int default_value);
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "configVariableInt.I"
|
#include "configVariableInt.I"
|
||||||
|
@ -26,6 +26,29 @@ INLINE ConfigVariableList::
|
|||||||
~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
|
// Function: ConfigVariableList::get_num_values
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -18,25 +18,6 @@
|
|||||||
|
|
||||||
#include "configVariableList.h"
|
#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
|
// Function: ConfigVariableList::output
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -38,8 +38,9 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_DTOOLCONFIG ConfigVariableList : public ConfigVariableBase {
|
class EXPCL_DTOOLCONFIG ConfigVariableList : public ConfigVariableBase {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
ConfigVariableList(const string &name,
|
INLINE ConfigVariableList(const string &name,
|
||||||
const string &description = string(), int flags = 0);
|
const string &description = string(),
|
||||||
|
int flags = 0);
|
||||||
INLINE ~ConfigVariableList();
|
INLINE ~ConfigVariableList();
|
||||||
|
|
||||||
INLINE int get_num_values() const;
|
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
|
// Function: ConfigVariableSearchPath::Destructor
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -19,27 +19,6 @@
|
|||||||
#include "configVariableSearchPath.h"
|
#include "configVariableSearchPath.h"
|
||||||
#include "executionEnvironment.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
|
// Function: ConfigVariableSearchPath::get_value
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -45,8 +45,9 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_DTOOLCONFIG ConfigVariableSearchPath : public ConfigVariableBase {
|
class EXPCL_DTOOLCONFIG ConfigVariableSearchPath : public ConfigVariableBase {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
ConfigVariableSearchPath(const string &name,
|
INLINE ConfigVariableSearchPath(const string &name,
|
||||||
const string &description = string(), int flags = 0);
|
const string &description = string(),
|
||||||
|
int flags = 0);
|
||||||
INLINE ~ConfigVariableSearchPath();
|
INLINE ~ConfigVariableSearchPath();
|
||||||
|
|
||||||
INLINE operator const DSearchPath & () const;
|
INLINE operator const DSearchPath & () const;
|
||||||
|
@ -37,7 +37,11 @@ ConfigVariableString(const string &name) :
|
|||||||
INLINE ConfigVariableString::
|
INLINE ConfigVariableString::
|
||||||
ConfigVariableString(const string &name, const string &default_value,
|
ConfigVariableString(const string &name, const string &default_value,
|
||||||
const string &description, int flags) :
|
const string &description, int flags) :
|
||||||
|
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||||
ConfigVariable(name, VT_string, description, flags)
|
ConfigVariable(name, VT_string, description, flags)
|
||||||
|
#else
|
||||||
|
ConfigVariable(name, VT_string, string(), flags)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
_core->set_default_value(default_value);
|
_core->set_default_value(default_value);
|
||||||
_core->set_used();
|
_core->set_used();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user