2010-01-17 04:24:36 +00:00
|
|
|
from util import hook
|
|
|
|
from pycparser.cdecl import explain_c_declaration
|
|
|
|
|
2010-03-01 02:32:41 +00:00
|
|
|
|
2010-01-19 05:14:49 +00:00
|
|
|
@hook.command
|
2010-01-17 04:24:36 +00:00
|
|
|
def explain(inp):
|
|
|
|
".explain <c expression> -- gives an explanation of C expression"
|
|
|
|
if not inp:
|
|
|
|
return explain.__doc__
|
|
|
|
|
|
|
|
inp = inp.encode('utf8', 'ignore')
|
|
|
|
|
2010-03-01 02:32:41 +00:00
|
|
|
try:
|
2010-01-17 23:07:08 +00:00
|
|
|
return explain_c_declaration(inp)
|
2010-01-17 04:24:36 +00:00
|
|
|
except Exception, e:
|
|
|
|
return 'error: %s' % e
|