pass
class Function(Item):
- def __init__(self, name, global_signature, env_signature):
+ def __init__(self, name):
super(Function, self).__init__(name)
- self.global_signature = global_signature
- self.env_signature = env_signature
+ self.arguments = []
class Tool(Item):
def __init__(self, name):
self.body.append(data)
class Arguments:
- def __init__(self, body=None):
+ def __init__(self, signature, body=None):
if not body:
body = []
self.body = body
+ self.signature = signature
def __str__(self):
s = ''.join(self.body).strip()
result = []
try:
function = self.functions[name]
except KeyError:
- function = Function(name,
- attrs.get('global', "1"),
- attrs.get('env', "1"))
+ function = Function(name)
self.functions[name] = function
self.begin_xxx(function)
def end_scons_function(self):
self.end_xxx()
def start_arguments(self, attrs):
- arguments = Arguments()
- self.current_object.arguments = arguments
+ arguments = Arguments(attrs.get('signature', "both"))
+ self.current_object.arguments.append(arguments)
self.begin_xxx(arguments)
self.begin_collecting(arguments)
def end_arguments(self):
return ['\n', "'\\" + '"'*69 + '\n']
def initial_chunks(self):
try:
- x = self.arguments
+ arguments = self.arguments
except AttributeError:
- x = '()'
+ arguments = ['()']
result = []
- if self.global_signature != "0":
- result.append('.TP\n.RI %s%s\n' % (self.name, x))
- if self.env_signature != "0":
- result.append('.TP\n.IR env .%s%s\n' % (self.name, x))
+ for arg in arguments:
+ try:
+ signature = arg.signature
+ except AttributeError:
+ signature = "both"
+ if signature in ('both', 'global'):
+ result.append('.TP\n.RI %s%s\n' % (self.name, arg))
+ if signature in ('both', 'env'):
+ result.append('.TP\n.IR env .%s%s\n' % (self.name, arg))
return result
class Tool(Proxy):