Browse Source

organize into folders (why didn't i think of this sooner?)

Alison Watson 3 months ago
parent
commit
94e70bd557
80 changed files with 227 additions and 220 deletions
  1. 63
    63
      api.md
  2. 0
    0
      api/actor/State.md
  3. 0
    0
      api/base/Array.md
  4. 0
    0
      api/base/CVar.md
  5. 0
    0
      api/base/Color.md
  6. 0
    0
      api/base/FixedArray.md
  7. 0
    0
      api/base/Object.md
  8. 0
    0
      api/base/String.md
  9. 0
    0
      api/base/StringTable.md
  10. 0
    0
      api/base/Thinker.md
  11. 0
    0
      api/base/Vector.md
  12. 0
    0
      api/drawing/BrokenLines.md
  13. 0
    0
      api/drawing/Console.md
  14. 0
    0
      api/drawing/Font.md
  15. 0
    0
      api/drawing/GIFont.md
  16. 0
    0
      api/drawing/Screen.md
  17. 0
    0
      api/drawing/Shape2D.md
  18. 0
    0
      api/drawing/TexMan.md
  19. 0
    0
      api/drawing/TextureID.md
  20. 0
    0
      api/events/ConsoleEvent.md
  21. 0
    0
      api/events/EventHandler.md
  22. 0
    0
      api/events/RenderEvent.md
  23. 0
    0
      api/events/ReplaceEvent.md
  24. 0
    0
      api/events/StaticEventHandler.md
  25. 0
    0
      api/files/Wads.md
  26. 0
    0
      api/global/data/Client.md
  27. 0
    0
      api/global/data/Constants.md
  28. 0
    0
      api/global/data/Game.md
  29. 0
    0
      api/global/data/Information.md
  30. 0
    0
      api/global/data/Player.md
  31. 0
    0
      api/global/func/Classes.md
  32. 0
    0
      api/global/func/Game.md
  33. 0
    0
      api/global/func/Math.md
  34. 0
    0
      api/global/func/Random.md
  35. 0
    0
      api/global/func/Sound.md
  36. 0
    0
      api/global/func/System.md
  37. 0
    0
      api/global/type/DehInfo.md
  38. 0
    0
      api/global/type/FOptionMenuSettings.md
  39. 0
    0
      api/global/type/GameInfoStruct.md
  40. 0
    0
      api/global/type/LevelLocals.md
  41. 0
    0
      api/inter/InterBackground.md
  42. 0
    0
      api/inter/PatchInfo.md
  43. 0
    0
      api/inter/StatusScreen.md
  44. 0
    0
      api/inter/WBPlayerStruct.md
  45. 0
    0
      api/inter/WBStartStruct.md
  46. 0
    0
      api/level/F3DFloor.md
  47. 0
    0
      api/level/FColorMap.md
  48. 0
    0
      api/level/Line.md
  49. 0
    0
      api/level/LineIdIterator.md
  50. 0
    0
      api/level/SecPlane.md
  51. 0
    0
      api/level/SecSpecial.md
  52. 0
    0
      api/level/Sector.md
  53. 0
    0
      api/level/SectorEffect.md
  54. 0
    0
      api/level/SectorTagIterator.md
  55. 0
    0
      api/level/Side.md
  56. 0
    0
      api/level/Vertex.md
  57. 0
    0
      api/player/PlayerClass.md
  58. 0
    0
      api/player/PlayerSkin.md
  59. 0
    0
      api/player/Team.md
  60. 0
    0
      api/sound/SeqNode.md
  61. 0
    0
      api/weapon/PSprite.md
  62. 5
    5
      glossary.md
  63. 0
    0
      glossary/Classes.md
  64. 0
    0
      glossary/Concepts.md
  65. 0
    0
      glossary/Structures.md
  66. 0
    0
      glossary/Style.md
  67. 0
    0
      glossary/Versions.md
  68. 9
    9
      language.md
  69. 0
    0
      language/Classes.md
  70. 0
    0
      language/Constants.md
  71. 0
    0
      language/Enumerations.md
  72. 0
    0
      language/Expressions.md
  73. 0
    0
      language/Members.md
  74. 0
    0
      language/Methods.md
  75. 0
    0
      language/Statements.md
  76. 0
    0
      language/Structures.md
  77. 0
    0
      language/Types.md
  78. 42
    35
      tools/tocgen.rb
  79. 17
    17
      tools/treegen.rb
  80. 91
    91
      tools/zsclasstree.rb

+ 63
- 63
api.md View File

@@ -26,7 +26,7 @@ modder rather than for the engine.
26 26
 
27 27
 <!-- inter-toc actor -->
28 28
 
29
-* [State](api-actor-State.md)
29
+* [State](api/actor/State.md)
30 30
 
31 31
 <!-- end -->
32 32
 
@@ -36,15 +36,15 @@ TODO
36 36
 
37 37
 <!-- inter-toc base -->
38 38
 
39
-* [Array](api-base-Array.md)
40
-* [Color](api-base-Color.md)
41
-* [CVar](api-base-CVar.md)
42
-* [FixedArray](api-base-FixedArray.md)
43
-* [Object](api-base-Object.md)
44
-* [String](api-base-String.md)
45
-* [StringTable](api-base-StringTable.md)
46
-* [Thinker](api-base-Thinker.md)
47
-* [Vector](api-base-Vector.md)
39
+* [Array](api/base/Array.md)
40
+* [CVar](api/base/CVar.md)
41
+* [Color](api/base/Color.md)
42
+* [FixedArray](api/base/FixedArray.md)
43
+* [Object](api/base/Object.md)
44
+* [StringTable](api/base/StringTable.md)
45
+* [String](api/base/String.md)
46
+* [Thinker](api/base/Thinker.md)
47
+* [Vector](api/base/Vector.md)
48 48
 
49 49
 <!-- end -->
50 50
 
@@ -54,14 +54,14 @@ TODO
54 54
 
55 55
 <!-- inter-toc drawing -->
56 56
 
57
-* [BrokenLines](api-drawing-BrokenLines.md)
58
-* [Console](api-drawing-Console.md)
59
-* [Font](api-drawing-Font.md)
60
-* [GIFont](api-drawing-GIFont.md)
61
-* [Screen](api-drawing-Screen.md)
62
-* [Shape2D](api-drawing-Shape2D.md)
63
-* [TexMan](api-drawing-TexMan.md)
64
-* [TextureID](api-drawing-TextureID.md)
57
+* [BrokenLines](api/drawing/BrokenLines.md)
58
+* [Console](api/drawing/Console.md)
59
+* [Font](api/drawing/Font.md)
60
+* [GIFont](api/drawing/GIFont.md)
61
+* [Screen](api/drawing/Screen.md)
62
+* [Shape2D](api/drawing/Shape2D.md)
63
+* [TexMan](api/drawing/TexMan.md)
64
+* [TextureID](api/drawing/TextureID.md)
65 65
 
66 66
 <!-- end -->
67 67
 
@@ -71,11 +71,11 @@ TODO
71 71
 
72 72
 <!-- inter-toc events -->
73 73
 
74
-* [ConsoleEvent](api-events-ConsoleEvent.md)
75
-* [EventHandler](api-events-EventHandler.md)
76
-* [RenderEvent](api-events-RenderEvent.md)
77
-* [ReplaceEvent](api-events-ReplaceEvent.md)
78
-* [StaticEventHandler](api-events-StaticEventHandler.md)
74
+* [ConsoleEvent](api/events/ConsoleEvent.md)
75
+* [EventHandler](api/events/EventHandler.md)
76
+* [RenderEvent](api/events/RenderEvent.md)
77
+* [ReplaceEvent](api/events/ReplaceEvent.md)
78
+* [StaticEventHandler](api/events/StaticEventHandler.md)
79 79
 
80 80
 <!-- end -->
81 81
 
@@ -85,7 +85,7 @@ TODO
85 85
 
86 86
 <!-- inter-toc files -->
87 87
 
88
-* [Wads](api-files-Wads.md)
88
+* [Wads](api/files/Wads.md)
89 89
 
90 90
 <!-- end -->
91 91
 
@@ -95,11 +95,11 @@ TODO
95 95
 
96 96
 <!-- inter-toc inter -->
97 97
 
98
-* [InterBackground](api-inter-InterBackground.md)
99
-* [PatchInfo](api-inter-PatchInfo.md)
100
-* [StatusScreen](api-inter-StatusScreen.md)
101
-* [WBPlayerStruct](api-inter-WBPlayerStruct.md)
102
-* [WBStartStruct](api-inter-WBStartStruct.md)
98
+* [InterBackground](api/inter/InterBackground.md)
99
+* [PatchInfo](api/inter/PatchInfo.md)
100
+* [StatusScreen](api/inter/StatusScreen.md)
101
+* [WBPlayerStruct](api/inter/WBPlayerStruct.md)
102
+* [WBStartStruct](api/inter/WBStartStruct.md)
103 103
 
104 104
 <!-- end -->
105 105
 
@@ -115,17 +115,17 @@ for [statistics drivers][1].
115 115
 
116 116
 <!-- inter-toc level -->
117 117
 
118
-* [F3DFloor](api-level-F3DFloor.md)
119
-* [FColorMap](api-level-FColorMap.md)
120
-* [Line](api-level-Line.md)
121
-* [LineIdIterator](api-level-LineIdIterator.md)
122
-* [SecPlane](api-level-SecPlane.md)
123
-* [SecSpecial](api-level-SecSpecial.md)
124
-* [Sector](api-level-Sector.md)
125
-* [SectorEffect](api-level-SectorEffect.md)
126
-* [SectorTagIterator](api-level-SectorTagIterator.md)
127
-* [Side](api-level-Side.md)
128
-* [Vertex](api-level-Vertex.md)
118
+* [F3DFloor](api/level/F3DFloor.md)
119
+* [FColorMap](api/level/FColorMap.md)
120
+* [LineIdIterator](api/level/LineIdIterator.md)
121
+* [Line](api/level/Line.md)
122
+* [SecPlane](api/level/SecPlane.md)
123
+* [SecSpecial](api/level/SecSpecial.md)
124
+* [SectorEffect](api/level/SectorEffect.md)
125
+* [SectorTagIterator](api/level/SectorTagIterator.md)
126
+* [Sector](api/level/Sector.md)
127
+* [Side](api/level/Side.md)
128
+* [Vertex](api/level/Vertex.md)
129 129
 
130 130
 <!-- end -->
131 131
 
@@ -135,9 +135,9 @@ TODO
135 135
 
136 136
 <!-- inter-toc player -->
137 137
 
138
-* [PlayerClass](api-player-PlayerClass.md)
139
-* [PlayerSkin](api-player-PlayerSkin.md)
140
-* [Team](api-player-Team.md)
138
+* [PlayerClass](api/player/PlayerClass.md)
139
+* [PlayerSkin](api/player/PlayerSkin.md)
140
+* [Team](api/player/Team.md)
141 141
 
142 142
 <!-- end -->
143 143
 
@@ -147,7 +147,7 @@ TODO
147 147
 
148 148
 <!-- inter-toc sound -->
149 149
 
150
-* [SeqNode](api-sound-SeqNode.md)
150
+* [SeqNode](api/sound/SeqNode.md)
151 151
 
152 152
 <!-- end -->
153 153
 
@@ -157,7 +157,7 @@ TODO
157 157
 
158 158
 <!-- inter-toc wep -->
159 159
 
160
-* [PSprite](api-wep-PSprite.md)
160
+
161 161
 
162 162
 <!-- end -->
163 163
 
@@ -165,39 +165,39 @@ TODO
165 165
 
166 166
 # Global Objects
167 167
 
168
-<!-- inter-toc global-data -->
168
+<!-- inter-toc global/data -->
169 169
 
170
-* [Client](api-global-data-Client.md)
171
-* [Constants](api-global-data-Constants.md)
172
-* [Game](api-global-data-Game.md)
173
-* [Information](api-global-data-Information.md)
174
-* [Player](api-global-data-Player.md)
170
+* [Client](api/global/data/Client.md)
171
+* [Constants](api/global/data/Constants.md)
172
+* [Game](api/global/data/Game.md)
173
+* [Information](api/global/data/Information.md)
174
+* [Player](api/global/data/Player.md)
175 175
 
176 176
 <!-- end -->
177 177
 
178 178
 These variables are accessible in any context and are not bound by any specific
179 179
 object. Generally these mirror global information within the engine itself.
180 180
 
181
-<!-- inter-toc global-func -->
181
+<!-- inter-toc global/func -->
182 182
 
183
-* [Classes](api-global-func-Classes.md)
184
-* [Game](api-global-func-Game.md)
185
-* [Math](api-global-func-Math.md)
186
-* [Random](api-global-func-Random.md)
187
-* [Sound](api-global-func-Sound.md)
188
-* [System](api-global-func-System.md)
183
+* [Classes](api/global/func/Classes.md)
184
+* [Game](api/global/func/Game.md)
185
+* [Math](api/global/func/Math.md)
186
+* [Random](api/global/func/Random.md)
187
+* [Sound](api/global/func/Sound.md)
188
+* [System](api/global/func/System.md)
189 189
 
190 190
 <!-- end -->
191 191
 
192 192
 These functions are accessible in any context and are not bound by any specific
193 193
 object. Generally these are utility functions.
194 194
 
195
-<!-- inter-toc global-type -->
195
+<!-- inter-toc global/type -->
196 196
 
197
-* [DehInfo](api-global-type-DehInfo.md)
198
-* [FOptionMenuSettings](api-global-type-FOptionMenuSettings.md)
199
-* [GameInfoStruct](api-global-type-GameInfoStruct.md)
200
-* [LevelLocals](api-global-type-LevelLocals.md)
197
+* [DehInfo](api/global/type/DehInfo.md)
198
+* [FOptionMenuSettings](api/global/type/FOptionMenuSettings.md)
199
+* [GameInfoStruct](api/global/type/GameInfoStruct.md)
200
+* [LevelLocals](api/global/type/LevelLocals.md)
201 201
 
202 202
 <!-- end -->
203 203
 

api-actor-State.md → api/actor/State.md View File


api-base-Array.md → api/base/Array.md View File


api-base-CVar.md → api/base/CVar.md View File


api-base-Color.md → api/base/Color.md View File


api-base-FixedArray.md → api/base/FixedArray.md View File


api-base-Object.md → api/base/Object.md View File


api-base-String.md → api/base/String.md View File


api-base-StringTable.md → api/base/StringTable.md View File


api-base-Thinker.md → api/base/Thinker.md View File


api-base-Vector.md → api/base/Vector.md View File


api-drawing-BrokenLines.md → api/drawing/BrokenLines.md View File


api-drawing-Console.md → api/drawing/Console.md View File


api-drawing-Font.md → api/drawing/Font.md View File


api-drawing-GIFont.md → api/drawing/GIFont.md View File


api-drawing-Screen.md → api/drawing/Screen.md View File


api-drawing-Shape2D.md → api/drawing/Shape2D.md View File


api-drawing-TexMan.md → api/drawing/TexMan.md View File


api-drawing-TextureID.md → api/drawing/TextureID.md View File


api-events-ConsoleEvent.md → api/events/ConsoleEvent.md View File


api-events-EventHandler.md → api/events/EventHandler.md View File


api-events-RenderEvent.md → api/events/RenderEvent.md View File


api-events-ReplaceEvent.md → api/events/ReplaceEvent.md View File


api-events-StaticEventHandler.md → api/events/StaticEventHandler.md View File


api-files-Wads.md → api/files/Wads.md View File


api-global-data-Client.md → api/global/data/Client.md View File


api-global-data-Constants.md → api/global/data/Constants.md View File


api-global-data-Game.md → api/global/data/Game.md View File


api-global-data-Information.md → api/global/data/Information.md View File


api-global-data-Player.md → api/global/data/Player.md View File


api-global-func-Classes.md → api/global/func/Classes.md View File


api-global-func-Game.md → api/global/func/Game.md View File


api-global-func-Math.md → api/global/func/Math.md View File


api-global-func-Random.md → api/global/func/Random.md View File


api-global-func-Sound.md → api/global/func/Sound.md View File


api-global-func-System.md → api/global/func/System.md View File


api-global-type-DehInfo.md → api/global/type/DehInfo.md View File


api-global-type-FOptionMenuSettings.md → api/global/type/FOptionMenuSettings.md View File


api-global-type-GameInfoStruct.md → api/global/type/GameInfoStruct.md View File


api-global-type-LevelLocals.md → api/global/type/LevelLocals.md View File


api-inter-InterBackground.md → api/inter/InterBackground.md View File


api-inter-PatchInfo.md → api/inter/PatchInfo.md View File


api-inter-StatusScreen.md → api/inter/StatusScreen.md View File


api-inter-WBPlayerStruct.md → api/inter/WBPlayerStruct.md View File


api-inter-WBStartStruct.md → api/inter/WBStartStruct.md View File


api-level-F3DFloor.md → api/level/F3DFloor.md View File


api-level-FColorMap.md → api/level/FColorMap.md View File


api-level-Line.md → api/level/Line.md View File


api-level-LineIdIterator.md → api/level/LineIdIterator.md View File


api-level-SecPlane.md → api/level/SecPlane.md View File


api-level-SecSpecial.md → api/level/SecSpecial.md View File


api-level-Sector.md → api/level/Sector.md View File


api-level-SectorEffect.md → api/level/SectorEffect.md View File


api-level-SectorTagIterator.md → api/level/SectorTagIterator.md View File


api-level-Side.md → api/level/Side.md View File


api-level-Vertex.md → api/level/Vertex.md View File


api-player-PlayerClass.md → api/player/PlayerClass.md View File


api-player-PlayerSkin.md → api/player/PlayerSkin.md View File


api-player-Team.md → api/player/Team.md View File


api-sound-SeqNode.md → api/sound/SeqNode.md View File


api-wep-PSprite.md → api/weapon/PSprite.md View File


+ 5
- 5
glossary.md View File

@@ -2,11 +2,11 @@
2 2
 
3 3
 <!-- inter-toc -->
4 4
 
5
-* [Classes](glossary-Classes.md)
6
-* [Concepts](glossary-Concepts.md)
7
-* [Structures](glossary-Structures.md)
8
-* [Style](glossary-Style.md)
9
-* [Versions](glossary-Versions.md)
5
+* [Classes](glossary/Classes.md)
6
+* [Concepts](glossary/Concepts.md)
7
+* [Structures](glossary/Structures.md)
8
+* [Style](glossary/Style.md)
9
+* [Versions](glossary/Versions.md)
10 10
 
11 11
 <!-- end -->
12 12
 

glossary-Classes.md → glossary/Classes.md View File


glossary-Concepts.md → glossary/Concepts.md View File


glossary-Structures.md → glossary/Structures.md View File


glossary-Style.md → glossary/Style.md View File


glossary-Versions.md → glossary/Versions.md View File


lang.md → language.md View File

@@ -127,15 +127,15 @@ Finally, here is a table of contents for each language element:
127 127
 
128 128
 <!-- inter-toc -->
129 129
 
130
-* [Classes](lang-Classes.md)
131
-* [Constants](lang-Constants.md)
132
-* [Enumerations](lang-Enumerations.md)
133
-* [Expressions](lang-Expressions.md)
134
-* [Members](lang-Members.md)
135
-* [Methods](lang-Methods.md)
136
-* [Statements](lang-Statements.md)
137
-* [Structures](lang-Structures.md)
138
-* [Types](lang-Types.md)
130
+* [Classes](language/Classes.md)
131
+* [Constants](language/Constants.md)
132
+* [Enumerations](language/Enumerations.md)
133
+* [Expressions](language/Expressions.md)
134
+* [Members](language/Members.md)
135
+* [Methods](language/Methods.md)
136
+* [Statements](language/Statements.md)
137
+* [Structures](language/Structures.md)
138
+* [Types](language/Types.md)
139 139
 
140 140
 <!-- end -->
141 141
 

lang-Classes.md → language/Classes.md View File


lang-Constants.md → language/Constants.md View File


lang-Enumerations.md → language/Enumerations.md View File


lang-Expressions.md → language/Expressions.md View File


lang-Members.md → language/Members.md View File


lang-Methods.md → language/Methods.md View File


lang-Statements.md → language/Statements.md View File


lang-Structures.md → language/Structures.md View File


lang-Types.md → language/Types.md View File


+ 42
- 35
tools/tocgen.rb View File

@@ -3,55 +3,62 @@
3 3
 ## By Alison Sanderson. Attribution is encouraged, though not required.
4 4
 ## <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
5 5
 ## TOCGen: Generates inter-file TOCs.
6
+## Example usage:
7
+## tools/tocgen.rb
6 8
 
7
-$d = Dir["*.md"]
9
+def emit_filtered_file_toc file_matcher
10
+	links = []
11
+	files = ALL_MD_FILES.map do |p| p.match file_matcher end.compact
8 12
 
9
-def filter_emit r
10
-   res = []
11
-   for m in $d.map{|p| p.match r}.compact
12
-      res << "* [#{m[1]}](#{m[0]})"
13
-   end
14
-   res.join ?\n
13
+	for md_file in files
14
+		links << "* [#{md_file[1]}](#{md_file[0]})"
15
+	end
16
+
17
+	links.sort.join ?\n
15 18
 end
16 19
 
17
-def find_toc_areas f
18
-   re = /^(<!-- inter-toc\s*([^\s]+)\s*-->)(?:.|\n)*?(<!-- end -->)/i
19
-   f.to_enum(:scan, re).map{$~}
20
+TOC_REGEX = /^(<!-- inter-toc\s*([^\s]+)?\s*-->)(?:.|\n)*?(<!-- end -->)/i
21
+def find_inter_toc_areas file
22
+	file.to_enum(:scan, TOC_REGEX).map do $~ end
20 23
 end
21 24
 
22
-def filter_toc_areas f
23
-   o = String.new
24
-   lof = 0
25
-   for area in find_toc_areas f
26
-      of = area.offset 0
27
-      o << f[lof...of[0]]
28
-      o << area[1]
29
-      o << "\n\n"
30
-      o << filter_emit(yield area[2])
31
-      o << "\n\n"
32
-      o << area[3]
33
-      lof = of[1]
34
-   end
35
-   o << f[lof..-1]
36
-   o
25
+def filter_toc_areas file
26
+	content = ""
27
+	last_offset = 0
28
+
29
+	for area in find_inter_toc_areas file
30
+		offset = area.offset 0
31
+		content << file[last_offset...offset[0]]
32
+		content << area[1]
33
+		content << "\n\n"
34
+		content << emit_filtered_file_toc(yield area[2])
35
+		content << "\n\n"
36
+		content << area[3]
37
+		last_offset = offset[1]
38
+	end
39
+
40
+	content << file[last_offset..-1]
41
+	content
37 42
 end
38 43
 
39
-def rewrite fnam
40
-   f = File.read fnam
41
-   o = yield f
42
-   File.write fnam, o
44
+def rewrite filename
45
+	file = File.read filename
46
+	output = yield file
47
+	File.write filename, output
43 48
 end
44 49
 
45
-rewrite "api.md" do |f|
46
-   filter_toc_areas f do |a| /api-#{a}-(\w+).md/ end
50
+ALL_MD_FILES = Dir["{api,glossary,language}/**/*.md"]
51
+
52
+rewrite "api.md" do |file|
53
+	filter_toc_areas file do |folder| /api\/#{folder}\/(\w+).md/ end
47 54
 end
48 55
 
49
-rewrite "glossary.md" do |f|
50
-   filter_toc_areas f do |a| /glossary-(\w+).md/ end
56
+rewrite "glossary.md" do |file|
57
+	filter_toc_areas file do |_| /glossary\/(\w+).md/ end
51 58
 end
52 59
 
53
-rewrite "lang.md" do |f|
54
-   filter_toc_areas f do |a| /lang-(\w+).md/ end
60
+rewrite "language.md" do |file|
61
+	filter_toc_areas file do |_| /language\/(\w+).md/ end
55 62
 end
56 63
 
57 64
 ## EOF

+ 17
- 17
tools/treegen.rb View File

@@ -4,51 +4,51 @@
4 4
 ## <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
5 5
 ## TreeGen: Generates the glossary files for classes.
6 6
 ## Example usage:
7
-## tools/treegen.rb  \
7
+## tools/treegen.rb \
8 8
 ## '/mnt/g/Archive/gzdoom-g4.1.0/wadsrc/static/zscript/**/*.zs' \
9 9
 ## 4.1.0
10 10
 
11 11
 require "./tools/zsclasstree.rb"
12 12
 
13
-DIR = ARGV.shift
14
-VER = ARGV.shift
13
+FILES = ARGV.shift
14
+VERSION = ARGV.shift
15 15
 
16
-si = ClassSiphon.new DIR
16
+siphon = ClassSiphon.new FILES
17 17
 
18
-f = open "glossary-Classes.md", "wb"
19
-f.puts <<_end_
18
+file = open "glossary-Classes.md", "wb"
19
+file.puts <<_end_
20 20
 # Classes
21 21
 
22
-Here is a full tree of all classes in ZScript as of GZDoom #{VER}. There are
23
-#{si.classes.count + 1} classes total.
22
+Here is a full tree of all classes in ZScript as of GZDoom #{VERSION}. There
23
+are #{siphon.classes.count + 1} classes total.
24 24
 
25 25
 ```
26 26
 Object
27 27
 _end_
28 28
 
29
-si.print_classes f
29
+siphon.print_classes file
30 30
 
31
-f.puts <<_end_
31
+file.puts <<_end_
32 32
 ```
33 33
 
34 34
 <!-- EOF -->
35 35
 _end_
36 36
 
37
-f = open "glossary-Structures.md", "wb"
38
-f.puts <<_end_
37
+file = open "glossary-Structures.md", "wb"
38
+file.puts <<_end_
39 39
 # Structures
40 40
 
41
-Here is a full list of all structures in ZScript as of GZDoom #{VER}. There are
42
-#{si.structs.count} structures total. Note that some of these are merely
43
-implementation details and should not be used in code.
41
+Here is a full list of all structures in ZScript as of GZDoom #{VERSION}.
42
+There are #{siphon.structs.count} structures total. Note that some of these
43
+are merely implementation details and should not be used in code.
44 44
 
45 45
 ```
46 46
 Struct
47 47
 _end_
48 48
 
49
-si.print_structs f
49
+siphon.print_structs file
50 50
 
51
-f.puts <<_end_
51
+file.puts <<_end_
52 52
 ```
53 53
 
54 54
 <!-- EOF -->

+ 91
- 91
tools/zsclasstree.rb View File

@@ -11,101 +11,101 @@
11 11
 require 'set'
12 12
 
13 13
 class ClassSiphon
14
-   attr_reader :structs, :classes, :clstree, :strtree, :caps
15
-
16
-   def initialize dirs
17
-      @subcls  = {}
18
-      @classes = Set[]
19
-      @structs = Set[]
20
-      @caps    = {}
21
-
22
-      Dir.glob dirs do |f| proc_file File.read f end
23
-
24
-      @clstree = make_tree "OBJECT", @subcls["OBJECT"]
25
-      @strtree = @structs.map {|type| [type, nil]}
26
-
27
-      @classes.freeze
28
-      @structs.freeze
29
-      @clstree.freeze
30
-      @strtree.freeze
31
-      @caps.freeze
32
-   end
33
-
34
-   def print_classes out, filter = []
35
-      print_tree out, filter, "OBJECT", clstree
36
-   end
37
-
38
-   def print_structs out, filter = []
39
-      print_tree out, filter, "STRUCT", strtree
40
-   end
41
-
42
-   private
43
-   def add_class m
44
-      ctype =  m[0]             .strip
45
-      cbase = (m[1] or "Object").strip
46
-      type = ctype.upcase
47
-      base = cbase.upcase
48
-      @caps[type] = ctype
49
-      @caps[base] = cbase
50
-
51
-      if base != type
52
-         if @subcls[base]
53
-            @subcls[base] << type
54
-         else
55
-            @subcls[base] = [type]
56
-         end
57
-         raise "duplicate class #{type}" if @classes === type
58
-         @classes << type
59
-      end
60
-   end
61
-
62
-   def add_struct m
63
-      ctype = m[0]
64
-      type = ctype.upcase
65
-      @caps[type] = ctype
66
-      @structs << type
67
-   end
68
-
69
-   def proc_file f
70
-      f.gsub! /\/\*(?!\*\/)+\*\//m, ""
71
-      f.gsub! /\/\/.+/, ""
72
-      f.scan(/^class\s*(\w*)[\s\w]+(?::\s+(\w*))?/).each {|m| add_class  m}
73
-      f.scan(/^struct\s*(\w*)/)                    .each {|m| add_struct m}
74
-   end
75
-
76
-   # work our way down the subclasses recursively, making them into a tree structure
77
-   def make_tree bcl, subs
78
-      return nil unless subs
79
-      node = {}
80
-      subs.each do |cl| node[cl] = make_tree cl, @subcls[cl] end
81
-      node
82
-   end
83
-
84
-   def print_tree out, filter, base, tree, tab = ""
85
-      return if !tree or filter.include? base
86
-
87
-      tree = tree.map do |type, base| [type, base] end
88
-      tree.sort!
89
-
90
-      for type, base in tree
91
-         last = type == tree[-1][0]
92
-         sep = last ? "└ " : "├ "
93
-         nxt = last ? "  " : "│ "
94
-
95
-         out.puts tab + sep + @caps[type]
96
-
97
-         print_tree out, filter, type, base, tab + nxt
98
-      end
99
-   end
14
+	attr_reader :structs, :classes, :clstree, :strtree, :caps
15
+
16
+	def initialize dirs
17
+		@subcls  = {}
18
+		@classes = Set[]
19
+		@structs = Set[]
20
+		@caps    = {}
21
+
22
+		Dir.glob dirs do |f| proc_file File.read f end
23
+
24
+		@clstree = make_tree "OBJECT", @subcls["OBJECT"]
25
+		@strtree = @structs.map {|type| [type, nil]}
26
+
27
+		@classes.freeze
28
+		@structs.freeze
29
+		@clstree.freeze
30
+		@strtree.freeze
31
+		@caps.freeze
32
+	end
33
+
34
+	def print_classes out, filter = []
35
+		print_tree out, filter, "OBJECT", clstree
36
+	end
37
+
38
+	def print_structs out, filter = []
39
+		print_tree out, filter, "STRUCT", strtree
40
+	end
41
+
42
+	private
43
+	def add_class m
44
+		ctype =  m[0]             .strip
45
+		cbase = (m[1] or "Object").strip
46
+		type = ctype.upcase
47
+		base = cbase.upcase
48
+		@caps[type] = ctype
49
+		@caps[base] = cbase
50
+
51
+		if base != type
52
+			if @subcls[base]
53
+				@subcls[base] << type
54
+			else
55
+				@subcls[base] = [type]
56
+			end
57
+			raise "duplicate class #{type}" if @classes === type
58
+			@classes << type
59
+		end
60
+	end
61
+
62
+	def add_struct m
63
+		ctype = m[0]
64
+		type = ctype.upcase
65
+		@caps[type] = ctype
66
+		@structs << type
67
+	end
68
+
69
+	def proc_file f
70
+		f.gsub! /\/\*(?!\*\/)+\*\//m, ""
71
+		f.gsub! /\/\/.+/, ""
72
+		f.scan(/^class\s*(\w*)[\s\w]+(?::\s+(\w*))?/).each {|m| add_class  m}
73
+		f.scan(/^struct\s*(\w*)/)                    .each {|m| add_struct m}
74
+	end
75
+
76
+	# work our way down the subclasses recursively, making them into a tree structure
77
+	def make_tree bcl, subs
78
+		return nil unless subs
79
+		node = {}
80
+		subs.each do |cl| node[cl] = make_tree cl, @subcls[cl] end
81
+		node
82
+	end
83
+
84
+	def print_tree out, filter, base, tree, tab = ""
85
+		return if !tree or filter.include? base
86
+
87
+		tree = tree.map do |type, base| [type, base] end
88
+		tree.sort!
89
+
90
+		for type, base in tree
91
+			last = type == tree[-1][0]
92
+			sep = last ? "└ " : "├ "
93
+			nxt = last ? "  " : "│ "
94
+
95
+			out.puts tab + sep + @caps[type]
96
+
97
+			print_tree out, filter, type, base, tab + nxt
98
+		end
99
+	end
100 100
 end
101 101
 
102 102
 if __FILE__ == $0
103
-   in_dirs = ARGV.shift
104
-   filters = ARGV
103
+	in_dirs = ARGV.shift
104
+	filters = ARGV
105 105
 
106
-   si = ClassSiphon.new in_dirs
107
-   puts "Object"; si.print_classes STDOUT, filters
108
-   puts "Struct"; si.print_structs STDOUT, filters
106
+	si = ClassSiphon.new in_dirs
107
+	puts "Object"; si.print_classes STDOUT, filters
108
+	puts "Struct"; si.print_structs STDOUT, filters
109 109
 end
110 110
 
111 111
 ## EOF

Loading…
Cancel
Save