summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/minimaws/minimaws.py
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-08-03 23:38:22 +1000
committer Vas Crabb <vas@vastheman.com>2017-08-03 23:38:22 +1000
commit8eb07ffe97cec831711b9bbd2c5bdc97a14a5b52 (patch)
tree2b7f3e229952b2aaacaf9bdc85185604cf3584b3 /scripts/minimaws/minimaws.py
parent224cfaeb6a3ceac946a0bf6321a822e161c494c6 (diff)
minimaws: add machine feature status flags and slot card selection with live update
Diffstat (limited to 'scripts/minimaws/minimaws.py')
-rwxr-xr-xscripts/minimaws/minimaws.py74
1 files changed, 72 insertions, 2 deletions
diff --git a/scripts/minimaws/minimaws.py b/scripts/minimaws/minimaws.py
index 12ddc865b56..6f9fc938123 100755
--- a/scripts/minimaws/minimaws.py
+++ b/scripts/minimaws/minimaws.py
@@ -2,6 +2,78 @@
##
## license:BSD-3-Clause
## copyright-holders:Vas Crabb
+##
+## Demonstrates use of MAME's XML system information output
+##
+## This script requires Python 2.7 or Python 3, and ## SQLite 3.6.19 at
+## the very least. Help is provided for all command-line options (use
+## -h or --help).
+##
+## Before you can use the scripts, you need to load MAME system
+## information into a database. This currently requires a few manual
+## steps, and you need to start with a completely clean database:
+##
+## $ rm minimaws.sqlite3
+## $ sqlite3 minimaws.sqlite3 < schema.sql
+## $ python minimaws.py load --executable path/to/mame
+##
+## (The script uses the name "minimaws.sqlite3" for the database by
+## default, but you can override this with the --database option.)
+##
+## After you've loaded the database, you can use query commands. Most
+## of the query commands behave similarly to MAME's auxiliary verbs but
+## case-sensitive and with better globbing (output not shown for
+## brevity):
+##
+## $ python minimaws.py listfull "unkch*"
+## $ python minimaws.py listclones "unkch*"
+## $ python minimaws.py listbrothers superx
+##
+## One more sophisticated query command is provided that MAME has no
+## equivalent for. The listaffected command shows all runnable machines
+## that reference devices defined in specified source files:
+##
+## $ python minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/cpu/mcs40/mcs40.cpp
+##
+## This script can also run a local web server allowing you to explore
+## systems, devices and source files:
+##
+## $ python minimaws.py serve
+##
+## The default TCP port is 8080 but if desired, this can be changed with
+## the --port option. The web service is implemented using WSGI, so it
+## can be run in a web server if desired (e.g. using Apache mod_wsgi).
+## It uses get queries and provides cacheable reponses, so it should
+## work behind a caching proxy (e.g. squid or nginx). Although the
+## service is written to avoid SQL injected and directory traversal
+## attacks, and it avoids common sources of security issues, it has not
+## been audited for vulnerabilities and is not recommended for use on
+## public web sites.
+##
+## To use the web service, you need to know the short name of a device/
+## system, or the name of a source file containing a system:
+##
+## http://localhost:8080/machine/intlc440
+## http://localhost:8080/machine/a2mouse
+## http://localhost:8080/sourcefile/src/devices/cpu/m68000/m68kcpu.cpp
+##
+## You can also start with a list of all source files containing machine
+## definitions, but this is quite a large page and may perform poorly:
+##
+## http://localhost:8080/sourcefile/
+##
+## One feature that may be of iterest to front-end authors or users of
+## computer emulation is the ability to show available slot options and
+## update live as changes are made. This can be seen in action on
+## computer systems:
+##
+## http://localhost:8080/machine/ibm5150
+## http://localhost:8080/machine/apple2e
+## http://localhost:8080/machine/ti82
+##
+## On any of these, and many other systems, you can select slot options
+## and see dependent slots update. Required command-line arguments to
+## produce the selected configuration are also displayed.
import lib.auxverbs
import lib.lxparse
@@ -55,5 +127,3 @@ if __name__ == '__main__':
lib.wsgiserve.run_server(options)
elif options.command == 'load':
lib.lxparse.load_info(options)
- else:
- print('%s' % (options, ))