@@ -37,6 +37,7 @@ from docutils.parsers.rst import directives
import sphinx
from sphinx import addnodes
+from sphinx.locale import _
from sphinx.domains.c import c_funcptr_sig_re, c_sig_re
from sphinx.domains.c import CObject as Base_CObject
from sphinx.domains.c import CDomain as Base_CDomain
@@ -66,6 +67,8 @@ class CObject(Base_CObject):
"name" : directives.unchanged
}
+ is_function_like_macro = False
+
def handle_func_like_macro(self, sig, signode):
u"""Handles signatures of function-like macros.
@@ -104,6 +107,7 @@ class CObject(Base_CObject):
param += nodes.emphasis(argname, argname)
paramlist += param
+ self.is_function_like_macro = True
return fullname
def handle_signature(self, sig, signode):
@@ -151,6 +155,12 @@ class CObject(Base_CObject):
self.indexnode['entries'].append(
('single', indextext, targetname, '', None))
+ def get_index_text(self, name):
+ if self.is_function_like_macro:
+ return _('%s (C macro)') % name
+ else:
+ return super(CObject, self).get_index_text(name)
+
class CDomain(Base_CDomain):
"""C language domain."""