Commit 53286c097018f3e13c5511c1931370ade7a1c493

Werner Lemberg 2008-01-18T05:14:13

more formatting and whitespace

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
diff --git a/src/tools/docmaker/content.py b/src/tools/docmaker/content.py
index 3f2b4de..d751c21 100644
--- a/src/tools/docmaker/content.py
+++ b/src/tools/docmaker/content.py
@@ -48,8 +48,8 @@ re_identifier = re.compile( r'(\w*)' )
 class DocCode:
 
     def  __init__( self, margin, lines ):
-        self.lines  = []
-        self.words  = None
+        self.lines = []
+        self.words = None
 
         # remove margin spaces
         for l in lines:
@@ -220,7 +220,7 @@ class DocField:
 
 # this regular expression is used to detect field definitions
 #
-re_field  = re.compile( r"\s*(\w*|\w(\w|\.)*\w)\s*::" )
+re_field = re.compile( r"\s*(\w*|\w(\w|\.)*\w)\s*::" )
 
 
 
@@ -473,12 +473,12 @@ class DocBlock:
     def  __init__( self, source, follow, processor ):
         processor.reset()
 
-        self.source    = source
-        self.code      = []
-        self.type      = "ERRTYPE"
-        self.name      = "ERRNAME"
-        self.section   = processor.section
-        self.markups   = processor.process_content( source.content )
+        self.source  = source
+        self.code    = []
+        self.type    = "ERRTYPE"
+        self.name    = "ERRNAME"
+        self.section = processor.section
+        self.markups = processor.process_content( source.content )
 
         # compute block type from first markup tag
         try:
diff --git a/src/tools/docmaker/docbeauty.py b/src/tools/docmaker/docbeauty.py
index 55c4329..0e58f66 100644
--- a/src/tools/docmaker/docbeauty.py
+++ b/src/tools/docmaker/docbeauty.py
@@ -1,23 +1,24 @@
 #!/usr/bin/env python
 #
-#  DocBeauty (c) 2003, 2004 David Turner <david@freetype.org>
+#  DocBeauty (c) 2003, 2004, 2008 David Turner <david@freetype.org>
 #
 # This program is used to beautify the documentation comments used
 # in the FreeType 2 public headers.
 #
 
-from sources   import *
-from content   import *
-from utils     import *
+from sources import *
+from content import *
+from utils   import *
 
 import utils
 
 import sys, os, time, string, getopt
 
+
 content_processor = ContentProcessor()
 
 
-def beautify_block( block ):
+def  beautify_block( block ):
     if block.content:
         content_processor.reset()
 
@@ -30,7 +31,7 @@ def beautify_block( block ):
             first = 0
 
         # now beautify the documentation "borders" themselves
-        lines = [ " /*************************************************************************" ]
+        lines = [" /*************************************************************************"]
         for l in text:
             lines.append( "  *" + l )
         lines.append( "  */" )
@@ -38,9 +39,9 @@ def beautify_block( block ):
         block.lines = lines
 
 
-def usage():
+def  usage():
     print "\nDocBeauty 0.1 Usage information\n"
-    print "  docbeauty [options] file1 [ file2 ... ]\n"
+    print "  docbeauty [options] file1 [file2 ...]\n"
     print "using the following options:\n"
     print "  -h : print this page"
     print "  -b : backup original files with the 'orig' extension"
@@ -48,7 +49,7 @@ def usage():
     print "  --backup : same as -b"
 
 
-def main( argv ):
+def  main( argv ):
     """main program loop"""
 
     global output_dir
@@ -56,7 +57,7 @@ def main( argv ):
     try:
         opts, args = getopt.getopt( sys.argv[1:],
                                     "hb",
-                                    [ "help", "backup" ] )
+                                    ["help", "backup"] )
 
     except getopt.GetoptError:
         usage()
@@ -80,7 +81,7 @@ def main( argv ):
             do_backup = 1
 
     # create context and processor
-    source_processor  = SourceProcessor()
+    source_processor = SourceProcessor()
 
     # retrieve the list of files to process
     file_list = make_file_list( args )
@@ -100,6 +101,7 @@ def main( argv ):
         except:
             ok = 0
 
+
 # if called from the command line
 #
 if __name__ == '__main__':
diff --git a/src/tools/docmaker/docmaker.py b/src/tools/docmaker/docmaker.py
index d34b6e8..906ba88 100644
--- a/src/tools/docmaker/docmaker.py
+++ b/src/tools/docmaker/docmaker.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-#  DocMaker (c) 2002, 2004 David Turner <david@freetype.org>
+#  DocMaker (c) 2002, 2004, 2008 David Turner <david@freetype.org>
 #
 # This program is a re-write of the original DocMaker took used
 # to generate the API Reference of the FreeType font engine
@@ -24,9 +24,9 @@ import utils
 import sys, os, time, string, glob, getopt
 
 
-def usage():
+def  usage():
     print "\nDocMaker Usage information\n"
-    print "  docmaker [options] file1 [ file2 ... ]\n"
+    print "  docmaker [options] file1 [file2 ...]\n"
     print "using the following options:\n"
     print "  -h : print this page"
     print "  -t : set project title, as in '-t \"My Project\"'"
@@ -38,7 +38,7 @@ def usage():
     print "  --prefix : same as -p, as in '--prefix=ft2'"
 
 
-def main( argv ):
+def  main( argv ):
     """main program loop"""
 
     global output_dir
@@ -46,7 +46,7 @@ def main( argv ):
     try:
         opts, args = getopt.getopt( sys.argv[1:],
                                     "ht:o:p:",
-                                    [ "help", "title=", "output=", "prefix=" ] )
+                                    ["help", "title=", "output=", "prefix="] )
 
     except getopt.GetoptError:
         usage()
@@ -76,7 +76,7 @@ def main( argv ):
         if opt[0] in ( "-p", "--prefix" ):
             project_prefix = opt[1]
 
-    check_output( )
+    check_output()
 
     # create context and processor
     source_processor  = SourceProcessor()
diff --git a/src/tools/docmaker/formatter.py b/src/tools/docmaker/formatter.py
index 363410e..8796bb2 100644
--- a/src/tools/docmaker/formatter.py
+++ b/src/tools/docmaker/formatter.py
@@ -1,4 +1,4 @@
-#  Formatter (c) 2002, 2004, 2007 David Turner <david@freetype.org>
+#  Formatter (c) 2002, 2004, 2007, 2008 David Turner <david@freetype.org>
 #
 
 from sources import *
@@ -16,8 +16,7 @@ from utils   import *
 
 class Formatter:
 
-    def __init__( self, processor ):
-
+    def  __init__( self, processor ):
         self.processor   = processor
         self.identifiers = {}
         self.chapters    = processor.chapters
@@ -25,8 +24,9 @@ class Formatter:
         self.block_index = []
 
         # store all blocks in a dictionary
-        self.blocks      = []
+        self.blocks = []
         for section in self.sections:
+            self.add_identifier( section.name, section );
             for block in section.blocks.values():
                 self.add_identifier( block.name, block )
 
@@ -36,26 +36,22 @@ class Formatter:
                         for field in markup.fields:
                             self.add_identifier( field.name, block )
 
-
         self.block_index = self.identifiers.keys()
         self.block_index.sort( index_sort )
 
-
-    def add_identifier( self, name, block ):
+    def  add_identifier( self, name, block ):
         if self.identifiers.has_key( name ):
-            # duplicate name !!
+            # duplicate name!
             sys.stderr.write( \
                "WARNING: duplicate definition for '" + name + "' in " + \
                block.location() + ", previous definition in " +         \
-               self.identifiers[ name ].location() + "\n" )
+               self.identifiers[name].location() + "\n" )
         else:
             self.identifiers[name] = block
 
-
     #
     #  Formatting the table of contents
     #
-
     def  toc_enter( self ):
         pass
 
@@ -78,7 +74,6 @@ class Formatter:
         pass
 
     def  toc_dump( self, toc_filename = None, index_filename = None ):
-
         output = None
         if toc_filename:
             output = open_output( toc_filename )
@@ -93,7 +88,7 @@ class Formatter:
                 self.toc_section_enter( section )
                 self.toc_section_exit( section )
 
-            self.toc_chapter_exit ( chap )
+            self.toc_chapter_exit( chap )
 
         self.toc_index( index_filename )
 
@@ -105,7 +100,6 @@ class Formatter:
     #
     #  Formatting the index
     #
-
     def  index_enter( self ):
         pass
 
@@ -119,7 +113,6 @@ class Formatter:
         pass
 
     def  index_dump( self, index_filename = None ):
-
         output = None
         if index_filename:
             output = open_output( index_filename )
@@ -128,7 +121,7 @@ class Formatter:
 
         for name in self.block_index:
             self.index_name_enter( name )
-            self.index_name_exit ( name )
+            self.index_name_exit( name )
 
         self.index_exit()
 
@@ -162,7 +155,6 @@ class Formatter:
     def  section_exit( self, section ):
         pass
 
-
     def  section_dump( self, section, section_filename = None ):
 
         output = None
@@ -172,33 +164,27 @@ class Formatter:
         self.section_enter( section )
 
         for name in section.block_names:
-            block = self.identifiers[ name ]
+            block = self.identifiers[name]
             self.block_enter( block )
 
-            for markup in block.markups[1:]:   # always ignore first markup !!
+            for markup in block.markups[1:]:   # always ignore first markup!
                 self.markup_enter( markup, block )
 
                 for field in markup.fields:
                     self.field_enter( field, markup, block )
-
-                    self.field_exit ( field, markup, block )
+                    self.field_exit( field, markup, block )
 
                 self.markup_exit( markup, block )
 
             self.block_exit( block )
 
-        self.section_exit ( section )
+        self.section_exit( section )
 
         if output:
             close_output( output )
 
-
-    def section_dump_all( self ):
+    def  section_dump_all( self ):
         for section in self.sections:
             self.section_dump( section )
 
-    #
-    #  Formatting a block
-    #
-
 # eof
diff --git a/src/tools/docmaker/sources.py b/src/tools/docmaker/sources.py
index 09ff7f9..08f3b14 100644
--- a/src/tools/docmaker/sources.py
+++ b/src/tools/docmaker/sources.py
@@ -1,4 +1,4 @@
-#  Sources (c) 2002, 2003, 2004, 2006, 2007
+#  Sources (c) 2002, 2003, 2004, 2006, 2007, 2008
 #    David Turner <david@freetype.org>
 #
 #
@@ -18,10 +18,8 @@
 # the classes and methods found here only deal with text parsing
 # and basic documentation block extraction
 #
-import fileinput, re, sys, os, string
-
-
 
+import fileinput, re, sys, os, string
 
 
 
@@ -38,7 +36,7 @@ import fileinput, re, sys, os, string
 ##
 class SourceBlockFormat:
 
-    def __init__( self, id, start, column, end ):
+    def  __init__( self, id, start, column, end ):
         """create a block pattern, used to recognize special documentation blocks"""
 
         self.id     = id
@@ -76,6 +74,7 @@ column = r'''
 
 re_source_block_format1 = SourceBlockFormat( 1, start, column, start )
 
+
 #
 # format 2 documentation comment blocks look like the following:
 #
@@ -107,11 +106,12 @@ end = r'''
 
 re_source_block_format2 = SourceBlockFormat( 2, start, column, end )
 
+
 #
 # the list of supported documentation block formats, we could add new ones
 # relatively easily
 #
-re_source_block_formats = [ re_source_block_format1, re_source_block_format2 ]
+re_source_block_formats = [re_source_block_format1, re_source_block_format2]
 
 
 #
@@ -128,7 +128,7 @@ re_markup_tag2 = re.compile( r'''\s*@(\w*):''' )  # @xxxx: format
 # the list of supported markup tags, we could add new ones relatively
 # easily
 #
-re_markup_tags = [ re_markup_tag1, re_markup_tag2 ]
+re_markup_tags = [re_markup_tag1, re_markup_tag2]
 
 #
 # used to detect a cross-reference, after markup tags have been stripped
@@ -175,6 +175,7 @@ re_source_keywords = re.compile( '''\\b ( typedef   |
                                           \#else    |
                                           \#endif   ) \\b''', re.VERBOSE )
 
+
 ################################################################
 ##
 ##  SOURCE BLOCK CLASS
@@ -199,7 +200,7 @@ re_source_keywords = re.compile( '''\\b ( typedef   |
 ##                     markup tag)
 ##
 class SourceBlock:
-    def __init__( self, processor, filename, lineno, lines ):
+    def  __init__( self, processor, filename, lineno, lines ):
         self.processor = processor
         self.filename  = filename
         self.lineno    = lineno
@@ -218,24 +219,23 @@ class SourceBlock:
         for line0 in self.lines:
             m = self.format.column.match( line0 )
             if m:
-                lines.append( m.group(1) )
+                lines.append( m.group( 1 ) )
 
         # now, look for a markup tag
         for l in lines:
-            l = string.strip(l)
-            if len(l) > 0:
+            l = string.strip( l )
+            if len( l ) > 0:
                 for tag in re_markup_tags:
                     if tag.match( l ):
                         self.content = lines
                 return
 
-    def location( self ):
-        return "(" + self.filename + ":" + repr(self.lineno) + ")"
+    def  location( self ):
+        return "(" + self.filename + ":" + repr( self.lineno ) + ")"
 
 
     # debugging only - not used in normal operations
-    def dump( self ):
-
+    def  dump( self ):
         if self.content:
             print "{{{content start---"
             for l in self.content:
@@ -245,12 +245,13 @@ class SourceBlock:
 
         fmt = ""
         if self.format:
-            fmt = repr(self.format.id) + " "
+            fmt = repr( self.format.id ) + " "
 
         for line in self.lines:
             print line
 
 
+
 ################################################################
 ##
 ##  SOURCE PROCESSOR CLASS
@@ -281,7 +282,6 @@ class SourceProcessor:
         self.blocks = []
         self.format = None
 
-
     def  parse_file( self, filename ):
         """parse a C source file, and adds its blocks to the processor's list"""
 
@@ -290,12 +290,11 @@ class SourceProcessor:
         self.filename = filename
 
         fileinput.close()
-        self.format    = None
-        self.lineno    = 0
-        self.lines     = []
+        self.format = None
+        self.lineno = 0
+        self.lines  = []
 
         for line in fileinput.input( filename ):
-
             # strip trailing newlines, important on Windows machines !!
             if  line[-1] == '\012':
                 line = line[0:-1]
@@ -325,9 +324,7 @@ class SourceProcessor:
         # record the last lines
         self.add_block_lines()
 
-
-
-    def process_normal_line( self, line ):
+    def  process_normal_line( self, line ):
         """process a normal line and check if it's the start of a new block"""
         for f in re_source_block_formats:
           if f.start.match( line ):
@@ -337,9 +334,7 @@ class SourceProcessor:
 
         self.lines.append( line )
 
-
-
-    def add_block_lines( self ):
+    def  add_block_lines( self ):
         """add the current accumulated lines, and create a new block"""
         if self.lines != []:
             block = SourceBlock( self, self.filename, self.lineno, self.lines )
@@ -348,9 +343,8 @@ class SourceProcessor:
             self.format = None
             self.lines  = []
 
-
     # debugging only, not used in normal operations
-    def dump( self ):
+    def  dump( self ):
         """print all blocks in a processor"""
         for b in self.blocks:
             b.dump()
diff --git a/src/tools/docmaker/tohtml.py b/src/tools/docmaker/tohtml.py
index 5e9ae18..af63f79 100644
--- a/src/tools/docmaker/tohtml.py
+++ b/src/tools/docmaker/tohtml.py
@@ -1,4 +1,4 @@
-#  ToHTML (c) 2002, 2003, 2005, 2006, 2007
+#  ToHTML (c) 2002, 2003, 2005, 2006, 2007, 2008
 #    David Turner <david@freetype.org>
 
 from sources import *
@@ -7,6 +7,7 @@ from formatter import *
 
 import time
 
+
 # The following defines the HTML header used by all generated pages.
 #
 html_header_1 = """\
@@ -51,7 +52,6 @@ html_header_3=""" API Reference</h1></center>
 """
 
 
-
 # The HTML footer used by all generated pages.
 #
 html_footer = """\
@@ -131,10 +131,11 @@ keyword_suffix = '</span>'
 section_synopsis_header = '<h2>Synopsis</h2>'
 section_synopsis_footer = ''
 
+
 # Translate a single line of source to HTML.  This will convert
 # a "<" into "&lt.", ">" into "&gt.", etc.
 #
-def html_quote( line ):
+def  html_quote( line ):
     result = string.replace( line,   "&", "&amp;" )
     result = string.replace( result, "<", "&lt;" )
     result = string.replace( result, ">", "&gt;" )
@@ -143,11 +144,11 @@ def html_quote( line ):
 
 # same as 'html_quote', but ignores left and right brackets
 #
-def html_quote0( line ):
+def  html_quote0( line ):
     return string.replace( line, "&", "&amp;" )
 
 
-def dump_html_code( lines, prefix = "" ):
+def  dump_html_code( lines, prefix = "" ):
     # clean the last empty lines
     #
     l = len( self.lines )
@@ -159,15 +160,14 @@ def dump_html_code( lines, prefix = "" ):
     #
     print prefix + code_header,
     for line in self.lines[0 : l+1]:
-        print '\n' + prefix + html_quote(line),
+        print '\n' + prefix + html_quote( line ),
     print prefix + code_footer,
 
 
 
-class HtmlFormatter(Formatter):
-
-    def __init__( self, processor, project_title, file_prefix ):
+class HtmlFormatter( Formatter ):
 
+    def  __init__( self, processor, project_title, file_prefix ):
         Formatter.__init__( self, processor )
 
         global html_header_1, html_header_2, html_header_3, html_footer
@@ -191,11 +191,9 @@ class HtmlFormatter(Formatter):
     def  make_section_url( self, section ):
         return self.file_prefix + section.name + ".html"
 
-
     def  make_block_url( self, block ):
         return self.make_section_url( block.section ) + "#" + block.name
 
-
     def  make_html_words( self, words ):
         """ convert a series of simple words into some HTML text """
         line = ""
@@ -206,7 +204,6 @@ class HtmlFormatter(Formatter):
 
         return line
 
-
     def  make_html_word( self, word ):
         """analyze a simple word to detect cross-references and styling"""
         # look for cross-references
@@ -214,8 +211,8 @@ class HtmlFormatter(Formatter):
         m = re_crossref.match( word )
         if m:
             try:
-                name = m.group(1)
-                rest = m.group(2)
+                name = m.group( 1 )
+                rest = m.group( 2 )
                 block = self.identifiers[name]
                 url   = self.make_block_url( block )
                 return '<a href="' + url + '">' + name + '</a>' + rest
@@ -228,18 +225,17 @@ class HtmlFormatter(Formatter):
         # look for italics and bolds
         m = re_italic.match( word )
         if m:
-            name = m.group(1)
-            rest = m.group(3)
+            name = m.group( 1 )
+            rest = m.group( 3 )
             return '<i>' + name + '</i>' + rest
 
         m = re_bold.match( word )
         if m:
-            name = m.group(1)
-            rest = m.group(3)
+            name = m.group( 1 )
+            rest = m.group( 3 )
             return '<b>' + name + '</b>' + rest
 
-        return html_quote(word)
-
+        return html_quote( word )
 
     def  make_html_para( self, words ):
         """ convert a paragraph's words into tagged HTML text, handle xrefs """
@@ -255,7 +251,6 @@ class HtmlFormatter(Formatter):
 
         return para_header + line + para_footer
 
-
     def  make_html_code( self, lines ):
         """ convert a code sequence to HTML """
         line = code_header + '\n'
@@ -264,7 +259,6 @@ class HtmlFormatter(Formatter):
 
         return line + code_footer
 
-
     def  make_html_items( self, items ):
         """ convert a field's content into some valid HTML """
         lines = []
@@ -276,12 +270,10 @@ class HtmlFormatter(Formatter):
 
         return string.join( lines, '\n' )
 
-
     def  print_html_items( self, items ):
         print self.make_html_items( items )
 
-
-    def print_html_field( self, field ):
+    def  print_html_field( self, field ):
         if field.name:
             print "<table><tr valign=top><td><p><b>"+field.name+"</b></p></td><td>"
 
@@ -290,44 +282,42 @@ class HtmlFormatter(Formatter):
         if field.name:
             print "</td></tr></table>"
 
-
-    def html_source_quote( self, line, block_name = None ):
+    def  html_source_quote( self, line, block_name = None ):
         result = ""
         while line:
             m = re_source_crossref.match( line )
             if m:
-                name   = m.group(2)
-                prefix = html_quote( m.group(1) )
-                length = len( m.group(0) )
+                name   = m.group( 2 )
+                prefix = html_quote( m.group( 1 ) )
+                length = len( m.group( 0 ) )
 
                 if name == block_name:
                     # this is the current block name, if any
                     result = result + prefix + '<b>' + name + '</b>'
 
-                elif re_source_keywords.match(name):
+                elif re_source_keywords.match( name ):
                     # this is a C keyword
                     result = result + prefix + keyword_prefix + name + keyword_suffix
 
-                elif self.identifiers.has_key(name):
+                elif self.identifiers.has_key( name ):
                     # this is a known identifier
                     block = self.identifiers[name]
                     result = result + prefix + '<a href="' + \
-                             self.make_block_url(block) + '">' + name + '</a>'
+                             self.make_block_url( block ) + '">' + name + '</a>'
                 else:
-                    result = result + html_quote(line[:length])
+                    result = result + html_quote( line[:length] )
 
                 line = line[length:]
             else:
-                result = result + html_quote(line)
+                result = result + html_quote( line )
                 line   = []
 
         return result
 
-
-    def print_html_field_list( self, fields ):
+    def  print_html_field_list( self, fields ):
         print "<table cellpadding=3 border=0>"
         for field in fields:
-            if len(field.name) > 22:
+            if len( field.name ) > 22:
               print "<tr valign=top><td colspan=0><b>"+field.name+"</b></td></tr>"
               print "<tr valign=top><td></td><td>"
             else:
@@ -337,8 +327,7 @@ class HtmlFormatter(Formatter):
             print "</td></tr>"
         print "</table>"
 
-
-    def print_html_markup( self, markup ):
+    def  print_html_markup( self, markup ):
         table_fields = []
         for field in markup.fields:
             if field.name:
@@ -361,7 +350,6 @@ class HtmlFormatter(Formatter):
     #
     #  Formatting the index
     #
-
     def  index_enter( self ):
         print self.html_header
         self.index_items = {}
@@ -372,15 +360,14 @@ class HtmlFormatter(Formatter):
         self.index_items[name] = url
 
     def  index_exit( self ):
-
         # block_index already contains the sorted list of index names
         count = len( self.block_index )
-        rows  = (count + self.columns - 1) / self.columns
+        rows  = ( count + self.columns - 1 ) / self.columns
 
         print "<table align=center border=0 cellpadding=0 cellspacing=0>"
-        for r in range(rows):
+        for r in range( rows ):
             line = "<tr>"
-            for c in range(self.columns):
+            for c in range( self.columns ):
                 i = r + c*rows
                 if i < count:
                     bname = self.block_index[r + c * rows]
@@ -400,7 +387,6 @@ class HtmlFormatter(Formatter):
         self.index_items = {}
 
     def  index_dump( self, index_filename = None ):
-
         if index_filename == None:
             index_filename = self.file_prefix + "index.html"
 
@@ -414,7 +400,7 @@ class HtmlFormatter(Formatter):
         print "<center><h1>Table of Contents</h1></center>"
 
     def  toc_chapter_enter( self, chapter ):
-        print  chapter_header + string.join(chapter.title) + chapter_inter
+        print  chapter_header + string.join( chapter.title ) + chapter_inter
         print "<table cellpadding=5>"
 
     def  toc_section_enter( self, section ):
@@ -461,7 +447,7 @@ class HtmlFormatter(Formatter):
             if len( b.name ) > maxwidth:
                 maxwidth = len( b.name )
 
-        width  = 70  # XXX magic number
+        width = 70  # XXX magic number
         if maxwidth <> 0:
             # print section synopsis
             print section_synopsis_header
@@ -508,7 +494,6 @@ class HtmlFormatter(Formatter):
                 print self.html_source_quote( l, block.name )
             print source_footer
 
-
     def  markup_enter( self, markup, block ):
         if markup.tag == "description":
             print description_header
@@ -528,12 +513,10 @@ class HtmlFormatter(Formatter):
               block_footer_middle + self.file_prefix + "toc.html" + \
               block_footer_end
 
-
     def  section_exit( self, section ):
         print html_footer
 
-
-    def section_dump_all( self ):
+    def  section_dump_all( self ):
         for section in self.sections:
             self.section_dump( section, self.file_prefix + section.name + '.html' )
 
diff --git a/src/tools/docmaker/utils.py b/src/tools/docmaker/utils.py
index e751c56..adafa4f 100644
--- a/src/tools/docmaker/utils.py
+++ b/src/tools/docmaker/utils.py
@@ -1,4 +1,4 @@
-#  Utils (c) 2002, 2004, 2007  David Turner <david@freetype.org>
+#  Utils (c) 2002, 2004, 2007, 2008  David Turner <david@freetype.org>
 #
 
 import string, sys, os, glob
@@ -11,7 +11,7 @@ output_dir = None
 # This function is used to sort the index.  It is a simple lexicographical
 # sort, except that it places capital letters before lowercase ones.
 #
-def index_sort( s1, s2 ):
+def  index_sort( s1, s2 ):
     if not s1:
         return -1
 
@@ -41,9 +41,10 @@ def index_sort( s1, s2 ):
 
     return 0
 
+
 # Sort input_list, placing the elements of order_list in front.
 #
-def sort_order_list( input_list, order_list ):
+def  sort_order_list( input_list, order_list ):
     new_list = order_list[:]
     for id in input_list:
         if not id in order_list:
@@ -51,12 +52,11 @@ def sort_order_list( input_list, order_list ):
     return new_list
 
 
-
 # Open the standard output to a given project documentation file.  Use
 # "output_dir" to determine the filename location if necessary and save the
 # old stdout in a tuple that is returned by this function.
 #
-def open_output( filename ):
+def  open_output( filename ):
     global output_dir
 
     if output_dir and output_dir != "":
@@ -71,14 +71,14 @@ def open_output( filename ):
 
 # Close the output that was returned by "close_output".
 #
-def close_output( output ):
+def  close_output( output ):
     output[0].close()
     sys.stdout = output[1]
 
 
 # Check output directory.
 #
-def check_output( ):
+def  check_output():
     global output_dir
     if output_dir:
         if output_dir != "":
@@ -89,7 +89,8 @@ def check_output( ):
         else:
             output_dir = None
 
-def file_exists( pathname ):
+
+def  file_exists( pathname ):
     """checks that a given file exists"""
     result = 1
     try:
@@ -102,7 +103,7 @@ def file_exists( pathname ):
     return result
 
 
-def make_file_list( args = None ):
+def  make_file_list( args = None ):
     """builds a list of input files from command-line arguments"""
 
     file_list = []