Lines Matching +full:c +full:- +full:version +full:- +full:name
1 # -*- coding: utf-8; mode: python -*-
7 Replacement for the sphinx c-domain.
9 :copyright: Copyright (C) 2016 Markus Heiser
10 :license: GPL Version 2, June 1991 see Linux/COPYING for details.
14 * Moved the *duplicate C object description* warnings for function
18 * Add option 'name' to the "c:function:" directive. With option 'name' the
19 ref-name of a function can be modified. E.g.::
21 .. c:function:: int ioctl( int fd, int request )
22 :name: VIDIOC_LOG_STATUS
24 The func-name (e.g. ioctl) remains in the output but the ref-name changed
27 * :c:func:`VIDIOC_LOG_STATUS` or
30 * Handle signatures of function-like macros well. Don't try to deduce
31 arguments types of function-like macros.
40 from sphinx.domains.c import c_funcptr_sig_re, c_sig_re
41 from sphinx.domains.c import CObject as Base_CObject
42 from sphinx.domains.c import CDomain as Base_CDomain
48 # Get Sphinx version
51 # Namespace to be prepended to the full name
55 # Handle trivial newer c domain tags that are part of Sphinx 3.1 c domain tags
56 # - Store the namespace if ".. c:namespace::" tag is found
58 RE_namespace = re.compile(r'^\s*..\s*c:namespace::\s*(\S+)\s*$')
68 # Handle c:macro for function-style declaration
70 RE_macro = re.compile(r'^\s*..\s*c:macro::\s*(\S+)\s+(\S.*)\s*$')
72 return ".. c:function:: " + match.group(1) + ' ' + match.group(2)
75 # Handle newer c domain tags that are evaluated as .. c:type: for
76 # backward-compatibility with Sphinx < 3.0
78 RE_ctype = re.compile(r'^\s*..\s*c:(struct|union|enum|enumerator|alias)::\s*(.*)$')
81 return ".. c:type:: " + match.group(2)
84 # Handle newer c domain tags that are evaluated as :c:type: for
85 # backward-compatibility with Sphinx < 3.0
87 RE_ctype_refs = re.compile(r':c:(var|struct|union|enum|enumerator)::`([^\`]+)`')
89 return ":c:type:`" + match.group(2) + '`'
92 # Simply convert :c:expr: and :c:texpr: into a literal block.
94 RE_expr = re.compile(r':c:(expr|texpr):`([^\`]+)`')
99 # Parse Sphinx 3.x C markups, replacing them by backward-compatible ones
128 # Handle easy Sphinx 3.1+ simple new tags: :c:expr and .. c:namespace::
129 app.connect('source-read', c_markups)
133 version = __version__,
141 Description of a C language object.
144 "name" : directives.unchanged
148 u"""Handles signatures of function-like macros.
151 function-like macro, the name of the macro is returned. Otherwise
177 # This is a function-like macro, its arguments are typeless!
184 # separate by non-breaking space in the output
194 """Transform a C signature into RST nodes."""
202 if "name" in self.options:
204 fullname = self.options["name"]
206 # FIXME: handle :name: value of other declaration types?
214 def add_target_and_index(self, name, sig, signode): argument
215 # for C API items we add a prefix since names are usually not qualified
216 # by a module name and so easily clash with e.g. section titles
217 targetname = 'c.' + name
223 inv = self.env.domaindata['c']['objects']
224 if (name in inv and self.env.config.nitpicky):
226 if ('c:func', name) not in self.env.config.nitpick_ignore:
228 'duplicate C object description of %s, ' % name +
229 'other instance in ' + self.env.doc2path(inv[name][0]),
231 inv[name] = (self.env.docname, self.objtype)
233 indextext = self.get_index_text(name)
240 """C language domain."""
241 name = 'c' variable in CDomain
242 label = 'C'