annotate docs/make_hp_files.py @ 2798:b70d93f8d7ce lwtools-port

Updated coco1/modules/makefile and coco3/modules/makefile to help resolve issues with i(x) and s(x) descriptors. Updated level1/coco1/modules/makefile & level2/coco3/modules/makefile so that correct values would be sent to assembler when building superdesc.asm for s(x).dd and i(x).dd descriptors.
author drencor-xeen
date Mon, 28 Jan 2013 16:13:05 -0600
parents 57b5e715a417
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
993
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
1 #!/usr/bin/env python
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
2 # This script is an attempt to build help-files from Docbook sources
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
3 # (It is not finished)
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
4 # You call it as:
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
5 # ./make_hp_files.py os9guide/os9guide.docbook
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
6 # ./make_hp_files.py ccguide/ccguide.docbook
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
7 #
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
8 # It requires:
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
9 # Python 2.0 or later
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
10 #
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
11 # Author: Soren Roug
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
12 #
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
13 from sys import argv
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
14 import string
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
15 from xml.sax import make_parser,handler
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
16 import sys
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
17 #from types import *
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
18
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
19 class HandleParsing(handler.ContentHandler):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
20 """Parse a Docbook file"""
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
21
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
22 def __init__(self):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
23 self.__data = ''
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
24
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
25 def printdata(self):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
26 print self.__data
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
27 self.__data = ''
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
28
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
29 #<funcsynopsis>
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
30 #<funcprototype>
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
31 #<funcdef>char *<function>mktemp</function></funcdef>
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
32 # <paramdef>char *<parameter>name</parameter></paramdef>
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
33 #</funcprototype>
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
34
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
35 def startElement(self, tag, attrs):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
36 if tag == 'refname':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
37 self.__data = '@'
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
38
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
39 elif tag == 'funcprototype':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
40 self.__data = ''
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
41
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
42 elif tag == 'cmdsynopsis':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
43 self.__data = 'Syntax: '
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
44
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
45 elif tag == 'arg':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
46 self.optional = 0
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
47 if attrs.has_key('choice') and attrs['choice'] == "opt":
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
48 self.optional = 1
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
49 self.__data += '['
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
50
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
51 elif tag == 'replaceable':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
52 self.__data += '<'
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
53 elif tag in ('parameter','paramdef','funcdef','function',
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
54 'command','option'):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
55 pass
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
56 else:
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
57 self.__data = ''
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
58
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
59 def endElement(self, tag):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
60 if tag == 'funcdef':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
61 self.__data += '()\n'
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
62
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
63 elif tag == 'paramdef':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
64 self.__data += ';\n'
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
65
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
66 elif tag == 'funcprototype':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
67 self.printdata()
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
68
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
69 elif tag == 'refname':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
70 self.printdata()
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
71
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
72 elif tag == 'refpurpose':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
73 self.purpose = self.__data
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
74
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
75 elif tag == 'refentry':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
76 print "Usage: %s" % self.purpose
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
77
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
78 elif tag == 'arg':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
79 if self.optional == 1:
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
80 self.__data += ']'
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
81 self.optional = 0
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
82
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
83 elif tag == 'cmdsynopsis':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
84 self.printdata()
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
85
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
86 elif tag == 'replaceable':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
87 self.__data += '>'
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
88
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
89 def characters(self, text):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
90 if not text == '\n':
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
91 self.__data += text
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
92
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
93 # def handle_charref(self,ref):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
94 # self.handle_data('&#' + ref + ';')
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
95
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
96 # def unknown_entityref(self,ref):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
97 # self.handle_data('&' + ref + ';')
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
98
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
99 # def syntax_error(self,message):
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
100 # pass
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
101
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
102 #-----------
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
103 parser = make_parser()
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
104 chandler = HandleParsing()
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
105 parser.setContentHandler(chandler)
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
106
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
107 for file in argv[1:]:
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
108 f = open(file)
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
109 if not f:
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
110 raise IOError, "Failure in open %s" % file
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
111 parser.parse(f)
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
112 f.close()
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
113
57b5e715a417 The make_hp_files.py is a script to extract help (.HP) files from refentries
roug
parents:
diff changeset
114