zscript-doc/tools/treegen.rb

58 lines
1.1 KiB
Ruby
Raw Normal View History

2018-12-29 17:56:29 -08:00
#!/usr/bin/env ruby
## Distributed under the CC0 public domain license.
2019-01-08 13:44:31 -08:00
## By Alison Sanderson. Attribution is encouraged, though not required.
2018-12-29 17:56:29 -08:00
## <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
## TreeGen: Generates the glossary files for classes.
2019-08-12 19:19:01 -07:00
## Example usage:
## tools/treegen.rb \
2019-08-12 19:19:01 -07:00
## '/mnt/g/Archive/gzdoom-g4.1.0/wadsrc/static/zscript/**/*.zs' \
## 4.1.0
2018-12-29 17:56:29 -08:00
require "./tools/zsclasstree.rb"
FILES = ARGV.shift
VERSION = ARGV.shift
2018-12-29 17:56:29 -08:00
siphon = ClassSiphon.new FILES
2018-12-29 17:56:29 -08:00
file = open "glossary-Classes.md", "wb"
file.puts <<_end_
2018-12-29 17:56:29 -08:00
# Classes
Here is a full tree of all classes in ZScript as of GZDoom #{VERSION}. There
are #{siphon.classes.count + 1} classes total.
2018-12-29 17:56:29 -08:00
```
Object
_end_
siphon.print_classes file
2018-12-29 17:56:29 -08:00
file.puts <<_end_
2018-12-29 17:56:29 -08:00
```
<!-- EOF -->
_end_
file = open "glossary-Structures.md", "wb"
file.puts <<_end_
2018-12-29 17:56:29 -08:00
# Structures
Here is a full list of all structures in ZScript as of GZDoom #{VERSION}.
There are #{siphon.structs.count} structures total. Note that some of these
are merely implementation details and should not be used in code.
2018-12-29 17:56:29 -08:00
```
Struct
_end_
siphon.print_structs file
2018-12-29 17:56:29 -08:00
file.puts <<_end_
2018-12-29 17:56:29 -08:00
```
<!-- EOF -->
_end_
## EOF