ref: b826c4691da8620276b4f9574d90374ff85f9793
parent: 502ff6a666729f7b854e9c406030af24bb16d55c
author: Simon Howard <[email protected]>
date: Tue Dec 26 13:01:25 EST 2006
Remove command line options from README; move to autogenerated CMDLINE file. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 812
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,6 +31,7 @@
$(CODEBLOCKS_FILES) \
$(DATA_FILES) \
config.h \
+ CMDLINE \
HACKING \
TODO \
BUGS
@@ -39,4 +40,7 @@
docdir=$(prefix)/share/doc/@PACKAGE@
SUBDIRS=textscreen src man setup
+
+CMDLINE : src/
+ ./man/docgen -p $? > $@
--- a/README
+++ b/README
@@ -25,42 +25,8 @@
== Command-line options ==
-In addition to the normal Doom command-line options, a number of extra
-options are supported.
-
- -1 Sets screenmultiply to 1 (see above)
-
- -2 Sets screenmultiply to 2 (see above), doubling up
- the screen by 2x.
-
- -extraconfig <file> Specifies a configuration file to use for
- Chocolate Doom-specific settings (the default
- is 'chocolate-doom.cfg')
-
- -fullscreen Runs the game fullscreen.
-
- -nofullscreen Runs the game in a window,
- -window
-
- -gameversion <ver> Emulates a specific release of Doom 1.9. Valid
- values are "1.9", "ultimate" and "final".
-
- -grabmouse Grabs the mouse during play (see above)
-
- -nograbmouse Does not grab the mouse during play (see above)
-
- -iwad <file> Specifies an IWAD file to use.
-
- -longtics When recording demos, records in the the modified
- "Doom v1.91" format to avoid losing turning
- resolution.
-
- -merge <file> Loads a PWAD but simulates merging it into the main
- IWAD (see below)
-
- -novert Turns on novert (see above)
-
- -nonovert Turns off novert (see above)
+For a complete list of command-line options, see the CMDLINE
+file.
== Playing TCs ==
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,10 +1,10 @@
-MANPAGE_GEN_FILES=header footer
+MANPAGE_GEN_FILES=header footer docgen
man_MANS=chocolate-doom.6
-EXTRA_DIST = $(man_MANS) $(MANPAGE_GEN_FILES)
+EXTRA_DIST = $(man_MANS) $(MANPAGE_GEN_FILES)
-chocolate-doom.6: $(MANPAGE_GEN_FILES)
- ./docgen -m > $@
+chocolate-doom.6: ../src $(MANPAGE_GEN_FILES)
+ ./docgen -m $? > $@
--- a/man/docgen
+++ b/man/docgen
@@ -28,6 +28,38 @@
def add_param(self, param):
self.params.append(param)
+ # Find the maximum width of a parameter in this category
+
+ def paramtext_width(self):
+ w = 0
+
+ for p in self.params:
+ pw = len(p.name) + 5
+
+ if p.args:
+ pw += len(p.args)
+
+ if pw > w:
+ w = pw
+
+ return w
+
+ # Plain text output
+
+ def plaintext_output(self):
+ result = "=== %s ===\n\n" % self.description
+
+ self.params.sort()
+
+ w = self.paramtext_width()
+
+ for p in self.params:
+ result += p.plaintext_output(w)
+
+ result = result.rstrip() + "\n"
+
+ return result
+
def manpage_output(self):
result = ".SH " + self.description.upper() + "\n"
@@ -130,6 +162,45 @@
return result
+ def plaintext_output(self, w):
+
+ # Build the first line, with the argument on
+
+ line = " " + self.name
+ if self.args:
+ line += " " + self.args
+
+ # pad up to the plaintext width
+
+ line += " " * (w - len(line))
+
+ # Build the description text
+
+ description = self.text
+
+ if self.platform:
+ description += " (%s only)" % self.platform
+
+ # Build the complete text for the argument
+ # Split the description into words and add a word at a time
+
+ result = ""
+ for word in re.split('\s+', description):
+
+ # Break onto the next line?
+
+ if len(line) + len(word) + 1 > 75:
+ result += line + "\n"
+ line = " " * w
+
+ # Add another word
+
+ line += word + " "
+
+ result += line + "\n\n"
+
+ return result
+
def process_file(file):
f = open(file)
@@ -177,10 +248,10 @@
finally:
f.close()
-def process_files():
+def process_files(dir):
# Process all C source files.
- files = glob.glob("../src/*.c")
+ files = glob.glob(dir + "/*.c")
for file in files:
process_file(file)
@@ -195,9 +266,9 @@
finally:
f.close()
-def manpage_output():
+def manpage_output(dir):
- process_files()
+ process_files(dir)
print_file_contents("header")
@@ -209,8 +280,8 @@
print_file_contents("footer")
-def wiki_output():
- process_files()
+def wiki_output(dir):
+ process_files(dir)
print categories[None].wiki_output()
@@ -218,10 +289,28 @@
if c != None:
print categories[c].wiki_output()
-if len(sys.argv) > 1 and sys.argv[1] == "-m":
- manpage_output()
-elif len(sys.argv) > 1 and sys.argv[1] == "-w":
- wiki_output()
+def plaintext_output(dir):
+ process_files(dir)
+
+ print "== Command line parameters =="
+ print "This is a list of the command line parameters supported by "
+ print "Chocolate Doom. A number of additional parameters are supported "
+ print "in addition to those present in Vanilla Doom. "
+
+ print categories[None].plaintext_output()
+
+ for c in categories:
+ if c != None:
+ print categories[c].plaintext_output()
+
+if len(sys.argv) > 2 and sys.argv[1] == "-m":
+ manpage_output(sys.argv[2])
+elif len(sys.argv) > 2 and sys.argv[1] == "-w":
+ wiki_output(sys.argv[2])
+elif len(sys.argv) > 2 and sys.argv[1] == "-p":
+ plaintext_output(sys.argv[2])
else:
- print "%s [ -m | -w ]" % sys.argv[0]
+ print "%s [ -m | -w | -p ] <directory>" % sys.argv[0]