From 6698db48d94cbe0b9a83ff754a92d3a92ff59978 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 16 Nov 2004 18:40:03 +0000 Subject: [PATCH] allow embedded comments --- dtool/src/prc/configPage.cxx | 13 ++++++++++--- panda/src/doc/howto.use_config.txt | 6 ++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dtool/src/prc/configPage.cxx b/dtool/src/prc/configPage.cxx index e0c1668d65..b8acfa879a 100644 --- a/dtool/src/prc/configPage.cxx +++ b/dtool/src/prc/configPage.cxx @@ -401,9 +401,16 @@ read_prc_line(const string &line) { } size_t value_begin = p; - // The value extends from here to the end of the line, so trim - // whitespace backwards off from the end of the line. - p = line.length(); + // Is there an embedded comment on this line? + p = line.find(" #", value_begin); + if (p == string::npos) { + // No, the value extends all the way to the end of the line. + p = line.length(); + } + + // The value extends from here to the end of the line (or to the + // start of the embedded comment), so trim whitespace backwards off + // from there. while (p > value_begin && isspace((unsigned char)line[p - 1])) { p--; } diff --git a/panda/src/doc/howto.use_config.txt b/panda/src/doc/howto.use_config.txt index 48f963fdbf..e56ad0607d 100644 --- a/panda/src/doc/howto.use_config.txt +++ b/panda/src/doc/howto.use_config.txt @@ -44,8 +44,10 @@ This specifies that the variable "load-display" should have the value "pandagl". Comments may also appear in the file; they are introduced by a leading -hash mark (#). A comment must be on a line by itself; you may not -place a comment on the same line with a variable definition. +hash mark (#). A comment may be on a line by itself, or it may be on +the same line following a variable definition; if it is on the same +line as a variable definition, the hash mark must be preceded by at +least one space to separate it from the definition. The legal values that you may specify for any particular variable