rename Configrc to Config.prc

This commit is contained in:
David Rose 2004-06-10 18:54:04 +00:00
parent 2522d77d95
commit ae9ef03e9b
22 changed files with 210 additions and 179 deletions

View File

@ -1,5 +1,5 @@
#define INSTALL_CONFIG \
Configrc.direct
_direct.prc
#if $[CTPROJS]
// These files only matter to ctattach users.

View File

@ -1,6 +1,10 @@
model-path $DMODELS
sound-path $DMODELS
# Define a new egg object type. See the comments in _panda.prc about this.
egg-object-type-direct-widget <Scalar> collide-mask { 0x80000000 } <Collide> { Polyset descend }
# Define a new cull bin that will render on top of everything else.
cull-bin gui-popup 60 unsorted

View File

@ -73,7 +73,7 @@ clear() {
// Function: DCFile::read_all
// Access: Published
// Description: This special method reads all of the .dc files named
// by the "dc-file" Configrc variable, and loads them
// by the "dc-file" config.prc variable, and loads them
// into the DCFile namespace.
////////////////////////////////////////////////////////////////////
bool DCFile::
@ -82,7 +82,7 @@ read_all() {
config_express.GetAll("dc-file", dc_files);
if (dc_files.empty()) {
cerr << "No files specified via dc-file Configrc variable!\n";
cerr << "No files specified via dc-file Config.prc variable!\n";
return false;
}

View File

@ -269,9 +269,9 @@ class ShowBase(DirectObject.DirectObject):
import Transitions
self.transitions = Transitions.Transitions(self.loader)
# Start Tk and DIRECT if specified by Configrc
# Start Tk and DIRECT if specified by Config.prc
fTk = self.config.GetBool('want-tk', 0)
# Start DIRECT if specified in Configrc or in cluster mode
# Start DIRECT if specified in Config.prc or in cluster mode
fDirect = (self.config.GetBool('want-directtools', 0) or
(base.config.GetString("cluster-mode", '') != ''))
# Set fWantTk to 0 to avoid starting Tk with this call
@ -324,7 +324,11 @@ class ShowBase(DirectObject.DirectObject):
selection.printPipeTypes()
self.pipe = selection.makeDefaultPipe()
if not self.pipe:
self.notify.error("No graphics pipe is available! Check your Configrc!")
self.notify.error(
"No graphics pipe is available!\n"
"Your Config.prc file must name at least one valid panda display\n"
"library via load-display or aux-display.")
self.notify.info("Default graphics pipe is %s (%s)." % (self.pipe.getInterfaceName(), self.pipe.getType().getName()))
self.pipeList.append(self.pipe)
@ -939,7 +943,7 @@ class ShowBase(DirectObject.DirectObject):
return Task.cont
def createStats(self):
# You must specify a pstats-host in your configrc
# You must specify a pstats-host in your Config.prc
# The default is localhost
if self.wantStats:
PStatClient.connect()

View File

@ -432,9 +432,6 @@ After installing panda, you are almost ready to run the program
"pview," which is a basic model viewer program that demonstrates some
Panda functionality. Successfully running pview proves that Panda is
installed and configured correctly (at least as a C++ library).
However, you must set up a Configrc file to set your runtime
configuration options before you can run Panda and open up a graphics
window. See HOW TO RUN PANDA, below.
If you wish, you may also build direct. You only need to build this
if you intend to use the Python interfaces.
@ -631,9 +628,6 @@ After installing panda, you are almost ready to run the program
"pview," which is a basic model viewer program that demonstrates some
Panda functionality. Successfully running pview proves that Panda is
now installed and configured correctly (at least as a C++ library).
However, you must set up a Configrc file to set your runtime
configuration options before you can run Panda and open up a graphics
window. See HOW TO RUN PANDA, below.
If you wish, you may also build direct. You only need to build this
if you intend to use the Python interfaces.
@ -664,68 +658,67 @@ to type rehash first if you use csh):
pview
The first time you run pview, if you have not yet created a Configrc
file, you should see something like this:
Known pipe types:
No interactive pipe is available! Check your Configrc!
If you get instead an error about some shared library or libraries not
being found, check that your LD_LIBRARY_PATH setting (on Unix) or your
PATH (on Windows) includes the directory in which all of the Panda
If you get an error about some shared library or libraries not being
found, check that your LD_LIBRARY_PATH setting (on Unix) or your PATH
(on Windows) includes the directory in which all of the Panda
libraries have been installed. (This is normally $INSTALL_DIR/lib, or
whatever you set INSTALL_DIR to followed by "lib". On Unix, this
defaults to /usr/local/panda/lib. If you have redefined
INSTALL_LIB_DIR in your Config.pp, for instance to define Panda as a
native Python module, you should use that directory instead.)
If you do get the above error message, you will need to create a
Configrc file to indicate some run-time parameters. This is different
from the Config.pp file you created above, which is only used by
ppremake to define compile-time parameters; the Configrc file is read
every time Panda is started and it defines parameters that control
run-time behavior.
If all goes well, pview should open up a window with a blue triangle.
You can use the mouse to move the triangle around. You can also pass
on the command line the name of an egg or bam file, if you have one
(look in the models directory for some sample egg files), and pview
will load up and display the model.
Create a file called Configrc in the $INSTALL_DIR/etc directory. By
convention, your custom Configrc file should not have any extension,
not even the extension ".txt"; this differentiates it from the
standard Configrc files which are also installed into the
$INSTALL_DIR/etc file (and having no extension causes your file to be
sorted to the top of the list, so that your personal settings will
override those in the other files).
For now, add just the line:
There are several files in the $INSTALL_DIR/etc directory with the
filename extension .prc; these are Panda Runtime Configuration files.
These are different from the Config.pp file, which controls the way
Panda is compiled and is only used at build time. The prc files are
read in every time Panda is started and control the way Panda behaves
at runtime.
load-display pandagl
The system-defined prc files begin with the underscore character, so
that they sort to the top of the list and are read first (and so that
you may define one or more additional files that are read afterwards
and that will therefore override the values specified in these system
files).
Or, if you are on Windows and prefer to use DirectX instead of OpenGL,
add instead the line:
We suggest creating a file in $INSTALL_DIR/etc called Config.prc,
where you will put your own custom configuration options. For
instance, if you want to run using OpenGL instead of the Windows
default of DirectX9, you can add the line:
load-display pandadx8
load-display pandagl
Later you may add additional lines here to control the default
behavior of Panda in other ways. See the file Configrc in this
directory for more examples.
to your Config.prc file. If you choose not to do this at this time,
you can just leave this file empty for now; we do recommend creating
at least an empty Config.prc file as a placeholder into which you can
add your custom configuration options later.
Now try to run pview again. If all goes well, it should open up a
window with a blue triangle. You can use the mouse to move the
triangle around. You can also pass the name of an egg file, if you
have one (look in the models directory for some sample egg files), on
the command line, and pview will load up and display the egg file.
The complete list of available configuration options is very large and
is not fully documented; but there are other documents that list
several particularly useful config variables. These are sometimes
referred to as "Configrc" variables because an older Panda convention
named this file Configrc instead of Config.prc.
If you want to load the Configrc from other than the compiled-in
default directory, set the environment variable:
If you want to load Config.prc from other than the compiled-in default
directory of $INSTALL_DIR/etc, set the environment variable:
CONFIGRC_DIR=/my/home/directory
export CONFIGRC_DIR
PRC_DIR=/my/home/directory
export PRC_DIR
Where /my/home/directory is the name of your home directory (or
wherever you put the Configrc file). Note that if you redefine
CONFIGRC_DIR, you will no longer automatically load the standard
Configrc files that were installed into $INSTALL_DIR/etc. It is
possible to configure Panda to search for Configrc files in more than
one directory, but that's a little more complicated and is outside the
scope of this document.
wherever you put the Config.prc file). Note that if you redefine
PRC_DIR, you will no longer automatically load the standard prc files
that were installed into $INSTALL_DIR/etc (so you should consider
copying these files into the same directory). It is possible to
configure Panda to search for prc files in more than one directory,
but that's a little more complicated and is outside the scope of this
document.
@ -833,7 +826,7 @@ defined appropriately once you have become root.
Testing the Python interface
Assuming that you have already set up your Configrc file and tested
Assuming that you have already set up your Config.prc file and tested
that pview works, as described above in HOW TO RUN PANDA, you should
now be ready to try to run Panda from within Python. Start up a
Python shell and type the following command:

View File

@ -104,14 +104,16 @@
// #define INSTALL_LIB_DIR /usr/lib/python2.2/site-packages
// The Configrc file is used by Panda for runtime configuration.
// Panda will load up all files named Configrc* (with any and every
// extension) in the directory specified by the CONFIGRC_DIR
// environment variable, or in the directory named here if that
// environment variable is undefined. By default, we specify the
// install/etc dir, which is where the system-provided Configrc files
// get copied to.
#defer DEFAULT_CONFIGRC_DIR $[INSTALL_DIR]/etc
// The PRC files are used by Panda for runtime configuration. Panda
// will load up all files named *.prc in the directory specified by
// the PRC_DIR environment variable, or in the directory named here if
// that environment variable is undefined. Config files are loaded up
// in alphabetical order (sorted by ASCII value), and the
// alphabetically last files have precedence.
// By default, we specify the install/etc dir, which is where the
// system-provided PRC files get copied to.
#defer DEFAULT_PRC_DIR $[INSTALL_DIR]/etc
// What level of compiler optimization/debug symbols should we build?
@ -459,9 +461,9 @@
// specify one. Define it empty not to do this, saving a few
// kilobytes on the generated library. Sorry, you can't pick a
// particular font to be the default; it's hardcoded in the source
// (although you can use the text-default-font Configrc variable to
// specify a particular font file to load as the default, overriding
// the compiled-in font).
// (although you can use the text-default-font prc variable to specify
// a particular font file to load as the default, overriding the
// compiled-in font).
#define COMPILE_IN_DEFAULT_FONT 1
// Is Maya installed? This matters only to programs in PANDATOOL.

View File

@ -185,9 +185,9 @@ $[cdefine LINK_IN_GL]
$[cdefine LINK_IN_PHYSICS]
/* The compiled-in default directory to look for the Configrc file, in
the absence of the CONFIGRC_DIR environment variable set, and in
the absence of the PRC_DIR environment variable set, and in
the absence of anything specified via the configpath directive. */
# define DEFAULT_CONFIGRC_DIR "$[DEFAULT_CONFIGRC_DIR]"
# define DEFAULT_PRC_DIR "$[DEFAULT_PRC_DIR]"

View File

@ -8,7 +8,9 @@
#define SOURCES \
configTable.I configTable.h \
config_dconfig.h config_notify.h config_setup.h \
dconfig.I dconfig.h notify.I \
dconfig.I dconfig.h \
globPattern.I globPattern.h \
notify.I \
notify.h notifyCategory.I \
notifyCategory.h notifyCategoryProxy.I notifyCategoryProxy.h \
notifySeverity.h serialization.I serialization.h \
@ -16,12 +18,15 @@
#define INCLUDED_SOURCES \
configTable.cxx config_dconfig.cxx dconfig.cxx \
config_notify.cxx notify.cxx notifyCategory.cxx \
config_notify.cxx \
globPattern.cxx \
notify.cxx notifyCategory.cxx \
notifySeverity.cxx symbolEnt.cxx
#define INSTALL_HEADERS \
configTable.I configTable.h config_dconfig.h config_setup.h \
dconfig.I dconfig.h \
dconfig.I dconfig.h \
globPattern.I globPattern.h \
notify.I notify.h notifyCategory.I \
notifyCategory.h notifyCategoryProxy.I notifyCategoryProxy.h \
notifySeverity.h serialization.I serialization.h symbolEnt.I \

View File

@ -45,11 +45,8 @@ INLINE void ConfigTable::FileSepDefault() {
}
INLINE void ConfigTable::ConfigNameDefault() {
configname = "Configrc";
}
INLINE void ConfigTable::ConfigSuffixDefault() {
configsuffix = "*";
configname.push_back(GlobPattern("Configrc"));
configname.push_back(GlobPattern("*.prc"));
}
INLINE void ConfigTable::ConfigArgsDefault() {

View File

@ -156,7 +156,7 @@ void ConfigTable::ReadConfigFile() {
size_t p = 0;
while (p < path.length()) {
size_t q = path.find_first_of(" :", p);
size_t q = path.find_first_of(pathsep, p);
if (q == string::npos) {
config_search.append_directory(Filename::from_os_specific(path.substr(p)));
break;
@ -179,47 +179,37 @@ void ConfigTable::ReadConfigFile() {
DSearchPath::Results config_files;
if (!configsuffix.empty()) {
if (configsuffix == "*") {
// A configsuffix of "*" is a special case: this means to find
// all files that begin with configname. We don't do full
// globbing, though. We also make a special case for files
// ending in ~, which we always ignore (these are usually just
// backup files).
if (microconfig_cat->is_spam())
microconfig_cat->spam() << "searching for files matching: "
<< (configname + configsuffix) << endl;
for (int di = 0; di < config_search.get_num_directories(); di++) {
const Filename &directory = config_search.get_directory(di);
if (directory.is_directory()) {
vector_string files;
directory.scan_directory(files);
// Scan the files in reverse order to match Configrc overwrite
// rules, so that the alphabetically earliest file has
// precedence.
for (vector_string::reverse_iterator fi = files.rbegin();
fi != files.rend();
++fi) {
if ((*fi).substr(0, configname.length()) == configname &&
(*fi).substr((*fi).length() - 1) != string("~")) {
Filename file(directory, (*fi));
config_files.add_file(file);
}
}
if (microconfig_cat->is_spam()) {
microconfig_cat->spam() << "searching for files matching:\n";
for (Globs::const_iterator gi = configname.begin();
gi != configname.end();
++gi) {
microconfig_cat->spam() << " " << (*gi) << endl;
}
}
for (int di = 0; di < config_search.get_num_directories(); di++) {
const Filename &directory = config_search.get_directory(di);
if (directory.is_directory()) {
vector_string files;
directory.scan_directory(files);
// Scan the files in alphabetical order, so that the
// alphabetically last file has precedence.
for (vector_string::iterator fi = files.begin();
fi != files.end();
++fi) {
bool matches = false;
for (Globs::const_iterator gi = configname.begin();
gi != configname.end() && !matches;
++gi) {
matches = (*gi).matches(*fi);
}
if (matches) {
Filename file(directory, (*fi));
config_files.add_file(file);
}
}
} else {
if (microconfig_cat->is_spam())
microconfig_cat->spam() << "aggregate config name is: "
<< (configname + configsuffix) << endl;
config_search.find_all_files(configname + configsuffix, config_files);
}
} else {
if (microconfig_cat->is_spam())
microconfig_cat->spam() << "searching for '" << configname << "'"
<< endl;
config_search.find_all_files(configname, config_files);
}
if (microconfig_cat->is_spam())
@ -375,11 +365,11 @@ void ConfigTable::ParseArgs() {
}
void ConfigTable::ConfigDirDefault() {
// The configdir default comes from $CONFIGRC_DIR, or from the
// compiled in DEFAULT_CONFIGRC_DIR if that's unspecified.
configdir = ExecutionEnvironment::get_environment_variable("CONFIGRC_DIR");
// The configdir default comes from $PRC_DIR, or from the
// compiled in DEFAULT_PRC_DIR if that's unspecified.
configdir = ExecutionEnvironment::get_environment_variable("PRC_DIR");
if (configdir.empty()) {
configdir = DEFAULT_CONFIGRC_DIR;
configdir = DEFAULT_PRC_DIR;
}
}
@ -410,7 +400,6 @@ void ConfigTable::MicroConfig() {
bool psep = false;
bool fsep = false;
bool cname = false;
bool csuff = false;
bool cargs = false;
bool cpath = false;
bool cdir = false;
@ -478,22 +467,12 @@ void ConfigTable::MicroConfig() {
<< "setting the file separator to '" << filesep << "'"
<< endl;
} else if (tok == "configname") {
configname = rest;
cname = true;
if (microconfig_cat->is_spam())
microconfig_cat->spam()
<< "got a microconfig configname directive, "
<< "setting the configfile name to '" << configname
<< "'" << endl;
} else if (tok == "configsuffix") {
configsuffix = rest;
csuff = true;
if (microconfig_cat->is_spam())
microconfig_cat->spam()
<< "got a microconfig configsuffix directive, "
<< "setting the config file suffix to '"
<< configsuffix << "'"
<< endl;
configname.push_back(GlobPattern(rest));
cname = true;
if (microconfig_cat->is_spam())
microconfig_cat->spam()
<< "got a microconfig configname directive, "
<< "adding configname '" << rest << "'" << endl;
} else if (tok == "configargs") {
configargs = rest;
cargs = true;
@ -631,15 +610,7 @@ void ConfigTable::MicroConfig() {
ConfigNameDefault();
if (microconfig_cat->is_spam())
microconfig_cat->spam() << "no microconfig for configname, "
<< "setting to default '" << configname
<< "'" << endl;
}
if (!csuff) {
ConfigSuffixDefault();
if (microconfig_cat->is_spam())
microconfig_cat->spam() << "no microconfig for configsuffix, "
<< "setting to default '" << configsuffix
<< "'" << endl;
<< "setting to default" << endl;
}
if (!cargs) {
ConfigArgsDefault();

View File

@ -24,9 +24,10 @@
#include "config_setup.h"
#include "config_dconfig.h"
#include "symbolEnt.h"
#include "globPattern.h"
#include <vector>
#include <map>
#include "pvector.h"
#include "pmap.h"
namespace Config {
@ -39,8 +40,10 @@ public:
typedef vector_SymbolEnt Symbol;
private:
typedef std::map<ConfigString, Symbol> SymbolTable;
typedef std::map<ConfigString, SymbolTable> TableMap;
typedef pmap<ConfigString, Symbol> SymbolTable;
typedef pmap<ConfigString, SymbolTable> TableMap;
typedef pvector<GlobPattern> Globs;
SymbolTable unqualified;
TableMap qualified;
bool _initializing;
@ -50,8 +53,7 @@ private:
bool readenvs;
ConfigString pathsep;
ConfigString filesep;
ConfigString configname;
ConfigString configsuffix;
Globs configname;
ConfigString configargs;
ConfigString configpath;
ConfigString configdir;
@ -76,7 +78,6 @@ private:
INLINE void PathSepDefault();
INLINE void FileSepDefault();
INLINE void ConfigNameDefault();
INLINE void ConfigSuffixDefault();
INLINE void ConfigArgsDefault();
INLINE void ConfigPathDefault();
void ConfigDirDefault();

View File

@ -1,9 +1,10 @@
#include"config_dconfig.cxx"
#include"config_notify.cxx"
#include"dconfig.cxx"
#include"configTable.cxx"
#include"notify.cxx"
#include"notifyCategory.cxx"
#include"notifySeverity.cxx"
#include"symbolEnt.cxx"
#include "config_dconfig.cxx"
#include "config_notify.cxx"
#include "dconfig.cxx"
#include "globPattern.cxx"
#include "configTable.cxx"
#include "notify.cxx"
#include "notifyCategory.cxx"
#include "notifySeverity.cxx"
#include "symbolEnt.cxx"

View File

@ -19,7 +19,7 @@
#ifndef GLOBPATTERN_H
#define GLOBPATTERN_H
#include "pandabase.h"
#include "dtoolbase.h"
#include "filename.h"
#include "vector_string.h"
@ -38,7 +38,7 @@
// example, to scan a directory for all files matching a
// particular pattern.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS GlobPattern {
class EXPCL_DTOOL GlobPattern {
public:
INLINE GlobPattern(const string &pattern = string());
INLINE GlobPattern(const GlobPattern &copy);

View File

@ -1,5 +0,0 @@
# Let's set up a default window size of 800x600. The user can
# override this with a local ~/Configrc.
win-width 800
win-height 600

View File

@ -1,6 +1,6 @@
#define INSTALL_CONFIG \
panda.emacs panda.emacs.Xdefaults Configrc.panda
panda.emacs panda.emacs.Xdefaults _panda.prc
#if $[CTPROJS]
@ -8,3 +8,5 @@
#define INSTALL_CONFIG $[INSTALL_CONFIG] panda.init
#endif
#include $[THISDIRPREFIX]_panda.prc.pp

View File

@ -0,0 +1,58 @@
//
// _panda.prc.pp
//
// This file defines the script to auto-generate _panda.prc at
// ppremake time. This is intended to fill in some of the default
// parameters, in particular the default display types.
//
#output _panda.prc
# Let's set up a default window size of 800x600. The user can
# override this in his or her personal prc file.
win-width 800
win-height 600
# Define the display types that have been compiled in. Panda will
# pick one of these by going through the list in this order until one
# is found that works, unless the user specifically requests a
# particular display type with the load-display directive.
#if $[HAVE_DX]
aux-display pandadx9
#endif
#if $[HAVE_GL]
aux-display pandagl
#endif
#if $[HAVE_DX]
aux-display pandadx8
aux-display pandadx7
#endif
# The egg loader is handy to have available by default. This allows
# clients to load egg files. (The bam loader is built-in so bam files
# are always loadable).
# By qualifying with the extension "egg", we indicate the egg loader
# should be made available only if you explicitly name a file with an
# .egg extension.
# Also see ptloader, which is built as part of pandatool; it allows
# files of more exotic types (like .flt, .mb, .lwo, and .dxf) to be
# loaded directly into Panda.
load-file-type egg pandaegg
# The following lines define some handy object types to use within the
# egg syntax. This remaps <ObjectType> { name } into whatever egg
# syntax is given by egg-object-type-name, which makes a handy
# abbreviation for modeling packages (like Maya) to insert
# sophisticated egg syntax into the generated egg file, using a single
# object type string.
egg-object-type-portal <Scalar> portal { 1 }
egg-object-type-polylight <Scalar> polylight { 1 }
#end _panda.prc

View File

@ -146,7 +146,7 @@ SOURCE TREE AND INSTALL TREE HIERARCHY
/usr/local/panda or something else. (On a Windows environment the
directory name /usr/local/panda may be inappropriate. It is up to
the user to specify a suitable directory name. We suggest
C:\panda.)
C:\Panda3d.)
Once dtool has been built and installed, the next step is to cd to
the panda package, ppremake, and 'make' followed by 'make install',
@ -161,7 +161,7 @@ AN ALTERNATIVE INSTALL TREE PHILOSOPHY
the outside developer who is primarily interested in taking the
whole body of code as a complete piece, but we have different needs
for our own in-house development. It is convenient to be able to
treat the individual packages separately; our in-house 'attach'
treat the individual packages separately; our in-house 'ctattach'
scripts (not included with the distribution) allow us to use one of
several automatically-built trees for development, or upon need, to
switch on-the-fly to using our own personally built tree.

View File

@ -25,7 +25,6 @@
dcast.T dcast.h \
error_utils.h \
get_config_path.h \
globPattern.I globPattern.h \
hashGeneratorBase.I hashGeneratorBase.h \
hashVal.I hashVal.h indent.I indent.h \
indirectLess.I indirectLess.h \
@ -82,7 +81,6 @@
datagramIterator.cxx \
datagramSink.cxx dcast.cxx error_utils.cxx \
get_config_path.cxx \
globPattern.cxx \
hashGeneratorBase.cxx hashVal.cxx indent.cxx \
memoryInfo.cxx memoryUsage.cxx memoryUsagePointerCounts.cxx \
memoryUsagePointers.cxx multifile.cxx \
@ -128,7 +126,6 @@
datagramIterator.I datagramIterator.h \
datagramSink.I datagramSink.h dcast.T dcast.h \
error_utils.h get_config_path.h \
globPattern.I globPattern.h \
hashGeneratorBase.I \
hashGeneratorBase.h hashVal.I hashVal.h \
indent.I indent.h \

View File

@ -15,7 +15,6 @@
#include "dcast.cxx"
#include "error_utils.cxx"
#include "get_config_path.cxx"
#include "globPattern.cxx"
#include "hashGeneratorBase.cxx"
#include "hashVal.cxx"
#include "indent.cxx"

View File

@ -750,7 +750,9 @@ make_default_pipe() {
_default_pipe = selection->make_default_pipe();
if (_default_pipe == (GraphicsPipe*)NULL) {
nout << "No graphics pipe is available! Check your Configrc!\n";
nout << "No graphics pipe is available!\n"
<< "Your Config.prc file must name at least one valid panda display\n"
<< "library via load-display or aux-display.\n";
}
}