generated man pages: use xorg footer and no hard coded extension
The section number is no longer hard-coded The left footer is now "X Version 11". The center footer is the package name with the version, "libxcb 1.9" The three values above are provided through xorg-macros. They are passed-in to the python c_client code. Example of footer (last line, above dotted line) [...] AUTHOR Generated from xproto.xml. Contact xcb@lists.freedesktop.org for cor‐ rections and improvements. X Version 11 libxcb 1.9 xcb_send_event(3) ------------------------------------------------------------------------------ Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
This commit is contained in:
parent
e4061b8f00
commit
d7eb0bdf3b
|
@ -249,6 +249,8 @@ BUILT_SOURCES = $(EXTSOURCES) $(BUILT_MAN_PAGES)
|
||||||
CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) $(BUILT_MAN_PAGES)
|
CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) $(BUILT_MAN_PAGES)
|
||||||
|
|
||||||
$(EXTSOURCES): c_client.py $(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
|
$(EXTSOURCES): c_client.py $(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
|
||||||
$(PYTHON) $(srcdir)/c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
|
$(AM_V_GEN)$(PYTHON) $(srcdir)/c_client.py -c "$(PACKAGE_STRING)" -l "$(XORG_MAN_PAGE)" \
|
||||||
|
-s "$(LIB_MAN_SUFFIX)" -p $(XCBPROTO_XCBPYTHONDIR) \
|
||||||
|
$(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
|
||||||
|
|
||||||
$(BUILT_MAN_PAGES): $(EXTSOURCES)
|
$(BUILT_MAN_PAGES): $(EXTSOURCES)
|
||||||
|
|
|
@ -2344,18 +2344,18 @@ def _man_request(self, name, cookie_type, void, aux):
|
||||||
func_name = self.c_request_name if not aux else self.c_aux_name
|
func_name = self.c_request_name if not aux else self.c_aux_name
|
||||||
|
|
||||||
def create_link(linkname):
|
def create_link(linkname):
|
||||||
name = 'man/%s.3' % linkname
|
name = 'man/%s.%s' % (linkname, section)
|
||||||
if manpaths:
|
if manpaths:
|
||||||
sys.stdout.write(name)
|
sys.stdout.write(name)
|
||||||
f = open(name, 'w')
|
f = open(name, 'w')
|
||||||
f.write('.so man3/%s.3' % func_name)
|
f.write('.so man%s/%s.%s' % (section, func_name, section))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if manpaths:
|
if manpaths:
|
||||||
sys.stdout.write('man/%s.3 ' % func_name)
|
sys.stdout.write('man/%s.%s ' % (func_name, section))
|
||||||
# Our CWD is src/, so this will end up in src/man/
|
# Our CWD is src/, so this will end up in src/man/
|
||||||
f = open('man/%s.3' % func_name, 'w')
|
f = open('man/%s.%s' % (func_name, section), 'w')
|
||||||
f.write('.TH %s 3 %s "XCB" "XCB Requests"\n' % (func_name, today))
|
f.write('.TH %s %s "%s" "%s" "XCB Requests"\n' % (func_name, section, center_footer, left_footer))
|
||||||
# Left-adjust instead of adjusting to both sides
|
# Left-adjust instead of adjusting to both sides
|
||||||
f.write('.ad l\n')
|
f.write('.ad l\n')
|
||||||
f.write('.SH NAME\n')
|
f.write('.SH NAME\n')
|
||||||
|
@ -2680,14 +2680,14 @@ def _man_request(self, name, cookie_type, void, aux):
|
||||||
'have to be handled in the event loop.\n\nIf you want to '
|
'have to be handled in the event loop.\n\nIf you want to '
|
||||||
'handle errors directly with \\fIxcb_request_check\\fP '
|
'handle errors directly with \\fIxcb_request_check\\fP '
|
||||||
'instead, use \\fI%s_checked\\fP. See '
|
'instead, use \\fI%s_checked\\fP. See '
|
||||||
'\\fBxcb-requests(3)\\fP for details.\n') % (base_func_name))
|
'\\fBxcb-requests(%s)\\fP for details.\n') % (base_func_name, section))
|
||||||
else:
|
else:
|
||||||
f.write(('Returns an \\fI%s\\fP. Errors have to be handled when '
|
f.write(('Returns an \\fI%s\\fP. Errors have to be handled when '
|
||||||
'calling the reply function \\fI%s\\fP.\n\nIf you want to '
|
'calling the reply function \\fI%s\\fP.\n\nIf you want to '
|
||||||
'handle errors in the event loop instead, use '
|
'handle errors in the event loop instead, use '
|
||||||
'\\fI%s_unchecked\\fP. See \\fBxcb-requests(3)\\fP for '
|
'\\fI%s_unchecked\\fP. See \\fBxcb-requests(%s)\\fP for '
|
||||||
'details.\n') %
|
'details.\n') %
|
||||||
(cookie_type, self.c_reply_name, base_func_name))
|
(cookie_type, self.c_reply_name, base_func_name, section))
|
||||||
f.write('.SH ERRORS\n')
|
f.write('.SH ERRORS\n')
|
||||||
if hasattr(self, "doc") and self.doc:
|
if hasattr(self, "doc") and self.doc:
|
||||||
for errtype, errtext in self.doc.errors.items():
|
for errtype, errtext in self.doc.errors.items():
|
||||||
|
@ -2705,18 +2705,18 @@ def _man_request(self, name, cookie_type, void, aux):
|
||||||
f.write('.fi\n')
|
f.write('.fi\n')
|
||||||
f.write('.SH SEE ALSO\n')
|
f.write('.SH SEE ALSO\n')
|
||||||
if hasattr(self, "doc") and self.doc:
|
if hasattr(self, "doc") and self.doc:
|
||||||
see = ['.BR %s (3)' % 'xcb-requests']
|
see = ['.BR %s (%s)' % ('xcb-requests', section)]
|
||||||
if self.doc.example:
|
if self.doc.example:
|
||||||
see.append('.BR %s (3)' % 'xcb-examples')
|
see.append('.BR %s (%s)' % ('xcb-examples', section))
|
||||||
for seename, seetype in self.doc.see.items():
|
for seename, seetype in self.doc.see.items():
|
||||||
if seetype == 'program':
|
if seetype == 'program':
|
||||||
see.append('.BR %s (1)' % seename)
|
see.append('.BR %s (1)' % seename)
|
||||||
elif seetype == 'event':
|
elif seetype == 'event':
|
||||||
see.append('.BR %s (3)' % _t(('xcb', seename, 'event')))
|
see.append('.BR %s (%s)' % (_t(('xcb', seename, 'event')), section))
|
||||||
elif seetype == 'request':
|
elif seetype == 'request':
|
||||||
see.append('.BR %s (3)' % _n(('xcb', seename)))
|
see.append('.BR %s (%s)' % (_n(('xcb', seename)), section))
|
||||||
elif seetype == 'function':
|
elif seetype == 'function':
|
||||||
see.append('.BR %s (3)' % seename)
|
see.append('.BR %s (%s)' % (seename, section))
|
||||||
else:
|
else:
|
||||||
see.append('TODO: %s (type %s)' % (seename, seetype))
|
see.append('TODO: %s (type %s)' % (seename, seetype))
|
||||||
f.write(',\n'.join(see) + '\n')
|
f.write(',\n'.join(see) + '\n')
|
||||||
|
@ -2726,10 +2726,10 @@ def _man_request(self, name, cookie_type, void, aux):
|
||||||
|
|
||||||
def _man_event(self, name):
|
def _man_event(self, name):
|
||||||
if manpaths:
|
if manpaths:
|
||||||
sys.stdout.write('man/%s.3 ' % self.c_type)
|
sys.stdout.write('man/%s.%s ' % (self.c_type, section))
|
||||||
# Our CWD is src/, so this will end up in src/man/
|
# Our CWD is src/, so this will end up in src/man/
|
||||||
f = open('man/%s.3' % self.c_type, 'w')
|
f = open('man/%s.%s' % (self.c_type, section), 'w')
|
||||||
f.write('.TH %s 3 %s "XCB" "XCB Events"\n' % (self.c_type, today))
|
f.write('.TH %s %s "%s" "%s" "XCB Events"\n' % (self.c_type, section, center_footer, left_footer))
|
||||||
# Left-adjust instead of adjusting to both sides
|
# Left-adjust instead of adjusting to both sides
|
||||||
f.write('.ad l\n')
|
f.write('.ad l\n')
|
||||||
f.write('.SH NAME\n')
|
f.write('.SH NAME\n')
|
||||||
|
@ -2835,18 +2835,18 @@ def _man_event(self, name):
|
||||||
f.write('.fi\n')
|
f.write('.fi\n')
|
||||||
f.write('.SH SEE ALSO\n')
|
f.write('.SH SEE ALSO\n')
|
||||||
if hasattr(self, "doc") and self.doc:
|
if hasattr(self, "doc") and self.doc:
|
||||||
see = ['.BR %s (3)' % 'xcb_generic_event_t']
|
see = ['.BR %s (%s)' % ('xcb_generic_event_t', section)]
|
||||||
if self.doc.example:
|
if self.doc.example:
|
||||||
see.append('.BR %s (3)' % 'xcb-examples')
|
see.append('.BR %s (%s)' % ('xcb-examples', section))
|
||||||
for seename, seetype in self.doc.see.items():
|
for seename, seetype in self.doc.see.items():
|
||||||
if seetype == 'program':
|
if seetype == 'program':
|
||||||
see.append('.BR %s (1)' % seename)
|
see.append('.BR %s (1)' % seename)
|
||||||
elif seetype == 'event':
|
elif seetype == 'event':
|
||||||
see.append('.BR %s (3)' % _t(('xcb', seename, 'event')))
|
see.append('.BR %s (%s)' % (_t(('xcb', seename, 'event')), section))
|
||||||
elif seetype == 'request':
|
elif seetype == 'request':
|
||||||
see.append('.BR %s (3)' % _n(('xcb', seename)))
|
see.append('.BR %s (%s)' % (_n(('xcb', seename)), section))
|
||||||
elif seetype == 'function':
|
elif seetype == 'function':
|
||||||
see.append('.BR %s (3)' % seename)
|
see.append('.BR %s (%s)' % (seename, section))
|
||||||
else:
|
else:
|
||||||
see.append('TODO: %s (type %s)' % (seename, seetype))
|
see.append('TODO: %s (type %s)' % (seename, seetype))
|
||||||
f.write(',\n'.join(see) + '\n')
|
f.write(',\n'.join(see) + '\n')
|
||||||
|
@ -2978,13 +2978,19 @@ output = {'open' : c_open,
|
||||||
|
|
||||||
# Check for the argument that specifies path to the xcbgen python package.
|
# Check for the argument that specifies path to the xcbgen python package.
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'p:m')
|
opts, args = getopt.getopt(sys.argv[1:], 'c:l:s:p:m')
|
||||||
except getopt.GetoptError as err:
|
except getopt.GetoptError as err:
|
||||||
print(err)
|
print(err)
|
||||||
print('Usage: c_client.py [-p path] file.xml')
|
print('Usage: c_client.py -c center_footer -l left_footer -s section [-p path] file.xml')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for (opt, arg) in opts:
|
for (opt, arg) in opts:
|
||||||
|
if opt == '-c':
|
||||||
|
center_footer=arg
|
||||||
|
if opt == '-l':
|
||||||
|
left_footer=arg
|
||||||
|
if opt == '-s':
|
||||||
|
section=arg
|
||||||
if opt == '-p':
|
if opt == '-p':
|
||||||
sys.path.insert(1, arg)
|
sys.path.insert(1, arg)
|
||||||
elif opt == '-m':
|
elif opt == '-m':
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
*.3
|
*.[0-9]
|
||||||
|
*.[0-9]x
|
||||||
|
|
Loading…
Reference in New Issue