formatting changes.

This commit is contained in:
Dave Schuyler 2003-09-23 01:41:20 +00:00
parent 0b4d42f01c
commit f37d7a2179
12 changed files with 77 additions and 89 deletions

View File

@ -17,57 +17,57 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE void ConfigTable::ConfigDbgDefault(void) { INLINE void ConfigTable::ConfigDbgDefault() {
// this should not be called if CONFIG_CONFIG=:configdbg=1 // this should not be called if CONFIG_CONFIG=:configdbg=1
configdbg = false; configdbg = false;
microconfig_cat->set_severity(NS_info); microconfig_cat->set_severity(NS_info);
dconfig_cat->set_severity(NS_info); dconfig_cat->set_severity(NS_info);
} }
INLINE void ConfigTable::ReadArgsDefault(void) { INLINE void ConfigTable::ReadArgsDefault() {
readargs = true; readargs = true;
} }
INLINE void ConfigTable::ReadEnvsDefault(void) { INLINE void ConfigTable::ReadEnvsDefault() {
readenvs = true; readenvs = true;
} }
INLINE void ConfigTable::PathSepDefault(void) { INLINE void ConfigTable::PathSepDefault() {
pathsep = ": "; pathsep = ": ";
} }
INLINE void ConfigTable::FileSepDefault(void) { INLINE void ConfigTable::FileSepDefault() {
filesep = "/"; filesep = "/";
} }
INLINE void ConfigTable::ConfigNameDefault(void) { INLINE void ConfigTable::ConfigNameDefault() {
configname = "Configrc"; configname = "Configrc";
} }
INLINE void ConfigTable::ConfigSuffixDefault(void) { INLINE void ConfigTable::ConfigSuffixDefault() {
configsuffix = ""; configsuffix = "";
} }
INLINE void ConfigTable::ConfigArgsDefault(void) { INLINE void ConfigTable::ConfigArgsDefault() {
configargs = ""; configargs = "";
} }
INLINE void ConfigTable::ConfigPathDefault(void) { INLINE void ConfigTable::ConfigPathDefault() {
configpath = "CFG_PATH"; configpath = "CFG_PATH";
} }
INLINE void ConfigTable::ConfigCmtDefault(void) { INLINE void ConfigTable::ConfigCmtDefault() {
configcmt = "#"; configcmt = "#";
} }
INLINE void ConfigTable::ArgSuffixDefault(void) { INLINE void ConfigTable::ArgSuffixDefault() {
argsuffix = "_ARGS"; argsuffix = "_ARGS";
} }
INLINE void ConfigTable::CommandStubDefault(void) { INLINE void ConfigTable::CommandStubDefault() {
commandstub = "CONFIG"; commandstub = "CONFIG";
} }
INLINE ConfigString ConfigTable::GetConfigPath(void) const { INLINE ConfigString ConfigTable::GetConfigPath() const {
return configpath; return configpath;
} }

View File

@ -67,15 +67,13 @@ void ConfigTable::DeComment(ConfigString& S) {
} }
} }
bool ConfigTable::IsComment(const ConfigString& S) bool ConfigTable::IsComment(const ConfigString& S) {
{
// Returns true if the line begins with the comment delimiter, // Returns true if the line begins with the comment delimiter,
// whether or not the delimiter is followed by whitespace. // whether or not the delimiter is followed by whitespace.
return (S.substr(0, configcmt.length()) == configcmt); return (S.substr(0, configcmt.length()) == configcmt);
} }
void ConfigTable::UpCase(ConfigString& S) void ConfigTable::UpCase(ConfigString& S) {
{
for (ConfigString::iterator i=S.begin(); i!=S.end(); ++i) for (ConfigString::iterator i=S.begin(); i!=S.end(); ++i)
(*i) = toupper(*i); (*i) = toupper(*i);
} }
@ -93,8 +91,7 @@ ConfigString ConfigTable::PopNextWord(ConfigString& S) {
return ret; return ret;
} }
void ConfigTable::ParseConfigFile(istream& is, const ConfigString& Filename) void ConfigTable::ParseConfigFile(istream& is, const ConfigString& Filename) {
{
ConfigString line; ConfigString line;
while (!is.eof() && !is.fail()) { while (!is.eof() && !is.fail()) {
@ -133,7 +130,7 @@ void ConfigTable::ParseConfigFile(istream& is, const ConfigString& Filename)
} }
} }
void ConfigTable::ReadConfigFile(void) { void ConfigTable::ReadConfigFile() {
// The configpath variable lists the environment variables that // The configpath variable lists the environment variables that
// themselves should be considered to contain search paths for // themselves should be considered to contain search paths for
// Configrc files. This is one level of indirection from the // Configrc files. This is one level of indirection from the
@ -284,8 +281,7 @@ void ConfigTable::ParseCommandEnv(ConfigString& S, const ConfigString& sym)
} }
} }
void ConfigTable::ParseArgs(void) void ConfigTable::ParseArgs() {
{
int n = 0; int n = 0;
int num_args = ExecutionEnvironment::get_num_args(); int num_args = ExecutionEnvironment::get_num_args();
@ -336,8 +332,7 @@ void ConfigTable::ParseArgs(void)
} }
} }
void ConfigTable::MicroConfig(void) void ConfigTable::MicroConfig() {
{
/* /*
#ifndef NDEBUG #ifndef NDEBUG
NotifySeverity mcs = microconfig_cat->get_severity(); NotifySeverity mcs = microconfig_cat->get_severity();
@ -356,8 +351,9 @@ void ConfigTable::MicroConfig(void)
#endif * NDEBUG * #endif * NDEBUG *
*/ */
string cc = ExecutionEnvironment::get_environment_variable("CONFIG_CONFIG"); string cc = ExecutionEnvironment::get_environment_variable("CONFIG_CONFIG");
if (microconfig_cat->is_spam()) if (microconfig_cat->is_spam()) {
microconfig_cat->spam() << "CONFIG_CONFIG = '" << cc << "'" << endl; microconfig_cat->spam() << "CONFIG_CONFIG = '" << cc << "'" << endl;
}
bool cdbg = false; bool cdbg = false;
bool psep = false; bool psep = false;
bool fsep = false; bool fsep = false;
@ -375,9 +371,10 @@ void ConfigTable::MicroConfig(void)
if (configconfig.length() > 1) { if (configconfig.length() > 1) {
ConfigString assign = "="; ConfigString assign = "=";
ConfigString sep = configconfig.substr(0, 1); ConfigString sep = configconfig.substr(0, 1);
if (microconfig_cat->is_spam()) if (microconfig_cat->is_spam()) {
microconfig_cat->spam() << "separator character is: '" << sep microconfig_cat->spam() << "separator character is: '" << sep
<< "'" << endl; << "'" << endl;
}
typedef std::vector<ConfigString> strvec; typedef std::vector<ConfigString> strvec;
strvec sv; strvec sv;
size_t q = 1; size_t q = 1;
@ -616,7 +613,7 @@ void ConfigTable::MicroConfig(void)
} }
} }
void ConfigTable::GetData(void) { void ConfigTable::GetData() {
MicroConfig(); MicroConfig();
#ifndef DISABLE_CONFIG #ifndef DISABLE_CONFIG
ReadConfigFile(); ReadConfigFile();
@ -644,7 +641,7 @@ void ConfigTable::GetData(void) {
#endif // DISABLE_CONFIG #endif // DISABLE_CONFIG
} }
ConfigTable* ConfigTable::Instance(void) { ConfigTable* ConfigTable::Instance() {
if (_instance == (ConfigTable*)0L) { if (_instance == (ConfigTable*)0L) {
_instance = new ConfigTable; _instance = new ConfigTable;
_instance->GetData(); _instance->GetData();
@ -654,7 +651,7 @@ ConfigTable* ConfigTable::Instance(void) {
return _instance; return _instance;
} }
bool ConfigTable::AmInitializing(void) { bool ConfigTable::AmInitializing() {
return _initializing; return _initializing;
} }
@ -663,10 +660,11 @@ bool ConfigTable::TrueOrFalse(const ConfigString& in, bool def) {
ConfigString S = in; ConfigString S = in;
UpCase(S); UpCase(S);
if (S[0] == '#') { if (S[0] == '#') {
if (S[1] == 'F') if (S[1] == 'F') {
ret = false; ret = false;
else if (S[1] == 'T') } else if (S[1] == 'T') {
ret = true; ret = true;
}
} else if (S == "0") { } else if (S == "0") {
ret = false; ret = false;
} else if (S == "1") { } else if (S == "1") {

View File

@ -62,35 +62,35 @@ class EXPCL_DTOOLCONFIG ConfigTable {
ConfigString NextWord(const ConfigString& S); ConfigString NextWord(const ConfigString& S);
ConfigString PopNextWord(ConfigString& S); ConfigString PopNextWord(ConfigString& S);
void ParseConfigFile(istream&, const ConfigString&); void ParseConfigFile(istream&, const ConfigString&);
void ReadConfigFile(void); void ReadConfigFile();
void ParseCommandEnv(ConfigString&, const ConfigString&); void ParseCommandEnv(ConfigString&, const ConfigString&);
void ParseArgs(void); void ParseArgs();
INLINE void ConfigDbgDefault(void); INLINE void ConfigDbgDefault();
INLINE void ReadArgsDefault(void); INLINE void ReadArgsDefault();
INLINE void ReadEnvsDefault(void); INLINE void ReadEnvsDefault();
INLINE void PathSepDefault(void); INLINE void PathSepDefault();
INLINE void FileSepDefault(void); INLINE void FileSepDefault();
INLINE void ConfigNameDefault(void); INLINE void ConfigNameDefault();
INLINE void ConfigSuffixDefault(void); INLINE void ConfigSuffixDefault();
INLINE void ConfigArgsDefault(void); INLINE void ConfigArgsDefault();
INLINE void ConfigPathDefault(void); INLINE void ConfigPathDefault();
INLINE void ConfigCmtDefault(void); INLINE void ConfigCmtDefault();
INLINE void ArgSuffixDefault(void); INLINE void ArgSuffixDefault();
INLINE void CommandStubDefault(void); INLINE void CommandStubDefault();
void MicroConfig(void); void MicroConfig();
void GetData(void); void GetData();
protected: protected:
ConfigTable(void) : _initializing(true) {} ConfigTable() : _initializing(true) {}
public: public:
static ConfigTable* Instance(void); static ConfigTable* Instance();
bool AmInitializing(void); bool AmInitializing();
static bool TrueOrFalse(const ConfigString& in, bool def = false); static bool TrueOrFalse(const ConfigString& in, bool def = false);
bool Defined(const ConfigString& sym, const ConfigString qual=""); bool Defined(const ConfigString& sym, const ConfigString qual="");
SymEnt Get(const ConfigString& sym, const ConfigString qual = ""); SymEnt Get(const ConfigString& sym, const ConfigString qual = "");
const Symbol& GetSym(const ConfigString& sym, const Symbol& GetSym(const ConfigString& sym,
const ConfigString qual = ""); const ConfigString qual = "");
INLINE ConfigString GetConfigPath(void) const; INLINE ConfigString GetConfigPath() const;
INLINE bool IsConfigDbg(void) { return configdbg; }; INLINE bool IsConfigDbg() { return configdbg; };
}; };
#include "configTable.I" #include "configTable.I"

View File

@ -19,7 +19,7 @@
#ifndef CONFIG_NOTIFY_H #ifndef CONFIG_NOTIFY_H
#define CONFIG_NOTIFY_H #define CONFIG_NOTIFY_H
#include <dtoolbase.h> #include "dtoolbase.h"
#include "dconfig.h" #include "dconfig.h"
ConfigureDecl(config_notify, EXPCL_DTOOLCONFIG, EXPTP_DTOOLCONFIG); ConfigureDecl(config_notify, EXPCL_DTOOLCONFIG, EXPTP_DTOOLCONFIG);

View File

@ -19,7 +19,7 @@
#ifndef DCONFIG_H #ifndef DCONFIG_H
#define DCONFIG_H #define DCONFIG_H
#include <dtoolbase.h> #include "dtoolbase.h"
#include "config_setup.h" #include "config_setup.h"
#include "config_dconfig.h" #include "config_dconfig.h"
@ -64,15 +64,15 @@ EXPCL_DTOOLCONFIG extern int total_num_get;
template <class GetConfig> template <class GetConfig>
class Config { class Config {
protected: protected:
static void ConfigFunc(void); static void ConfigFunc();
static void Flag(bool); static void Flag(bool);
public: public:
Config(void); Config();
~Config(void); ~Config();
static bool AmInitializing(void); static bool AmInitializing();
static ConfigString Name(void); static ConfigString Name();
static bool Flag(void); static bool Flag();
static void Init(void); static void Init();
static bool Defined(const ConfigString& sym); static bool Defined(const ConfigString& sym);
static ConfigString Get(const ConfigString sym); static ConfigString Get(const ConfigString sym);
static ConfigTable::Symbol& GetAll(const ConfigString, static ConfigTable::Symbol& GetAll(const ConfigString,
@ -89,14 +89,12 @@ class Config {
// Implementation follows // Implementation follows
template<class GetConfig> template<class GetConfig>
void Config<GetConfig>::ConfigFunc(void) void Config<GetConfig>::ConfigFunc() {
{
GetConfig::config_func(); GetConfig::config_func();
} }
template<class GetConfig> template<class GetConfig>
bool Config<GetConfig>::AmInitializing(void) bool Config<GetConfig>::AmInitializing() {
{
ConfigTable* tab = ConfigTable::Instance(); ConfigTable* tab = ConfigTable::Instance();
if (tab == (ConfigTable *)0L) if (tab == (ConfigTable *)0L)
return Flag(); return Flag();
@ -104,26 +102,22 @@ bool Config<GetConfig>::AmInitializing(void)
} }
template<class GetConfig> template<class GetConfig>
ConfigString Config<GetConfig>::Name(void) ConfigString Config<GetConfig>::Name() {
{
return GetConfig::get_name(); return GetConfig::get_name();
} }
template<class GetConfig> template<class GetConfig>
bool Config<GetConfig>::Flag(void) bool Config<GetConfig>::Flag() {
{
return GetConfig::_flag; return GetConfig::_flag;
} }
template<class GetConfig> template<class GetConfig>
void Config<GetConfig>::Flag(bool f) void Config<GetConfig>::Flag(bool f) {
{
GetConfig::_flag = f; GetConfig::_flag = f;
} }
template<class GetConfig> template<class GetConfig>
void Config<GetConfig>::Init(void) void Config<GetConfig>::Init() {
{
if (Flag()) if (Flag())
return; return;
total_time_config_init -= clock(); total_time_config_init -= clock();
@ -161,14 +155,12 @@ void Config<GetConfig>::Init(void)
} }
template<class GetConfig> template<class GetConfig>
Config<GetConfig>::Config(void) Config<GetConfig>::Config() {
{
Init(); Init();
} }
template<class GetConfig> template<class GetConfig>
Config<GetConfig>::~Config(void) Config<GetConfig>::~Config() {
{
} }
template<class GetConfig> template<class GetConfig>

View File

@ -19,7 +19,7 @@
#ifndef __EXPAND_H__ #ifndef __EXPAND_H__
#define __EXPAND_H__ #define __EXPAND_H__
#include <dtoolbase.h> #include "dtoolbase.h"
#include "pfstream.h" #include "pfstream.h"
#include "config_setup.h" #include "config_setup.h"
@ -41,7 +41,7 @@ class Base_Expander {
INLINE ConfigString Env(ConfigString S); INLINE ConfigString Env(ConfigString S);
istream& CopyStreamToString(istream& is, ConfigString& S); istream& CopyStreamToString(istream& is, ConfigString& S);
INLINE bool isUser(ConfigString S); INLINE bool isUser(ConfigString S);
INLINE ConfigString GetMyDir(void); INLINE ConfigString GetMyDir();
INLINE ConfigString GetUserDir(ConfigString S); INLINE ConfigString GetUserDir(ConfigString S);
ConfigString Expand(ConfigString S); ConfigString Expand(ConfigString S);
Base_Expander() {} Base_Expander() {}
@ -49,7 +49,7 @@ class Base_Expander {
Base_Expander(ConfigString S) : _result(Base_Expander::Expand(S)) {} Base_Expander(ConfigString S) : _result(Base_Expander::Expand(S)) {}
Base_Expander(const Base_Expander& c) : _result(c._result) {} Base_Expander(const Base_Expander& c) : _result(c._result) {}
~Base_Expander() {} ~Base_Expander() {}
INLINE ConfigString operator()(void); INLINE ConfigString operator()();
INLINE ConfigString operator()(ConfigString); INLINE ConfigString operator()(ConfigString);
INLINE operator ConfigString(); INLINE operator ConfigString();
}; };

View File

@ -50,7 +50,6 @@ NotifyCategory(const string &fullname, const string &basename,
if (_fullname.empty()) { if (_fullname.empty()) {
config_name = "notify-level"; config_name = "notify-level";
} else if (!_basename.empty()) { } else if (!_basename.empty()) {
config_name = "notify-level-" + _basename; config_name = "notify-level-" + _basename;
} }
@ -76,7 +75,6 @@ NotifyCategory(const string &fullname, const string &basename,
// parent's. // parent's.
if (_parent != (NotifyCategory *)NULL) { if (_parent != (NotifyCategory *)NULL) {
_severity = _parent->_severity; _severity = _parent->_severity;
} else { } else {
// Unless, of course, we're the root. // Unless, of course, we're the root.
_severity = NS_info; _severity = NS_info;

View File

@ -19,7 +19,7 @@
#ifndef NOTIFYSEVERITY_H #ifndef NOTIFYSEVERITY_H
#define NOTIFYSEVERITY_H #define NOTIFYSEVERITY_H
#include <dtoolbase.h> #include "dtoolbase.h"
BEGIN_PUBLISH BEGIN_PUBLISH
enum NotifySeverity { enum NotifySeverity {

View File

@ -31,7 +31,7 @@
#include "virtualFileMountSystem.h" #include "virtualFileMountSystem.h"
#include "virtualFileSimple.h" #include "virtualFileSimple.h"
#include <dconfig.h> #include "dconfig.h"
ConfigureDef(config_express); ConfigureDef(config_express);
NotifyCategoryDef(express, ""); NotifyCategoryDef(express, "");

View File

@ -20,7 +20,7 @@
#include "config_express.h" #include "config_express.h"
#include <executionEnvironment.h> #include "executionEnvironment.h"
#include "get_config_path.h" #include "get_config_path.h"

View File

@ -185,10 +185,10 @@ child_integrate(Physical *physical,
accel_vec*=viscosityDamper; accel_vec*=viscosityDamper;
// x = x + v * t + 0.5 * a * t * t
pos += vel_vec * dt + 0.5 * accel_vec * dt * dt;
// v = v + a * t // v = v + a * t
vel_vec += accel_vec * dt; vel_vec += accel_vec * dt;
// x = x + v * t + 0.5 * a * t * t
pos += vel_vec * dt + 0.5 * accel_vec * dt * dt;
#endif //] #endif //]
// and store them back. // and store them back.

View File

@ -35,7 +35,7 @@
#include "mouseButton.h" #include "mouseButton.h"
#include "get_config_path.h" #include "get_config_path.h"
#include <dconfig.h> #include "dconfig.h"
ConfigureDef(config_util); ConfigureDef(config_util);
NotifyCategoryDef(util, ""); NotifyCategoryDef(util, "");