def complete(self): for i in range(len(self.args)): arg = self.args[i] if (arg.__class__.__name__ == 'str'): type = arg name = "a%d" % (i+1,) attr = {} # hack to remove class #if type[0:5] == "class": type = type[6:] self.args[i] = (TypeMap.getTypename(type), name, attr) elif (arg.__class__.__name__ == 'tuple'): if (len(arg) > 3): print "Error" if (len(arg) == 0): print "Error" if (len(arg) == 1): type = arg[0] name = "a%d" % (i+1,) attr = {} # hack to remove class #if type[0:5] == "class": type = type[6:] self.args[i] = (TypeMap.getTypename(type), name, attr) elif len(arg) == 2: type = arg[0] if arg[1].__class__.__name__ == 'str': name = arg[1] attr = {} elif arg[1].__class__.__name__ == 'dict': name = "a%d" % (i+1,) attr =arg[1] # hack to remove class #if type[0:5] == "class": type = type[6:] self.args[i] = (TypeMap.getTypename(type), name, attr) else: # len = 3 self.args[i] = (TypeMap.getTypename(self.args[i][0]), self.args[i][1], self.args[i][2]) self.ndefaults = 0 for i in range(len(self.args)): arg = self.args[i] if arg[2].has_key('default'): self.ndefaults = self.ndefaults+1 elif self.ndefaults != 0: # arg wo default following args with default print "Error: argument ", i+1, " of ", self.name, "must have a default value" import sys sys.exit(1)
def __init__(self, retval, args= [], flags = None): self.retval = TypeMap.getTypename(retval) self.args = ArgList() for a in args: self.args.add(a) self.args.complete() self.ownresult = 0 self.protected = 0 self.private = 0 self.virtual = 0 self.const = 0 self.static = 0 self.abstract = 0 self.isimpl = 0 self.doc = None if flags: if 'c' in flags: self.const = 1 if 'p' in flags: self.protected = 1 if 'P' in flags: self.private = 1 if 'v' in flags: self.virtual = 1 if 's' in flags: self.static = 1 if 'a' in flags: self.abstract = 1 if 'i' in flags: self.isimpl = 1 self.implementation = ""
for arg,val in options: if arg == '-h' or arg == '--help': print_help(); sys.exit (0) if arg == '-v' or arg == '--version': print_help (false); sys.exit (0) if arg == '--aida-debug': config['pass-exceptions'] = 1 if arg == '-o': config['output'] = val if arg == '-I': config['includedirs'] += [ val ] if arg == '--insertions': config['insertions'] += [ val ] if arg == '--inclusions': config['inclusions'] += [ val ] if arg == '--skip-skels': config['skip-skels'] += [ val ] if arg == '-G': config['backend-options'] += [ val ] if arg == '-x': module_import (val) if arg == '--bse-extensions': config['bse-extensions'] = True if arg == '--cc-intern-file': import TypeMap data = open (val).read() s = TypeMap.cquote (data) print '// This file is generated by aidacc. DO NOT EDIT.' print 'static const char intern_%s[] =' % re.sub (r'[^a-zA-Z0-9_]', '_', val) print ' ' + re.sub ('\n', '\n ', s) + ";" sys.exit (0) if arg == '--list-formats': print "\nAvailable Output Formats:" b = __Aida__.list_backends() for bname in b: bedoc = __Aida__.backends[bname][1] bedoc = re.sub ('\n\s*\n', '\n', bedoc) # remove empty lines bedoc = re.compile (r'^', re.MULTILINE).sub (' ', bedoc) # indent print " %s" % bname if bedoc: print bedoc.rstrip() print
if arg == '-v' or arg == '--version': print_help(false) sys.exit(0) if arg == '--aida-debug': config['pass-exceptions'] = 1 if arg == '-o': config['output'] = val if arg == '-I': config['includedirs'] += [val] if arg == '--insertions': config['insertions'] += [val] if arg == '--inclusions': config['inclusions'] += [val] if arg == '--skip-skels': config['skip-skels'] += [val] if arg == '-G': config['backend-options'] += [val] if arg == '-x': module_import(val) if arg == '--bse-extensions': config['bse-extensions'] = True if arg == '--cc-intern-file': import TypeMap data = open(val).read() s = TypeMap.cquote(data) print '// This file is generated by aidacc. DO NOT EDIT.' print 'static const char intern_%s[] =' % re.sub( r'[^a-zA-Z0-9_]', '_', val) print ' ' + re.sub('\n', '\n ', s) + ";" sys.exit(0) if arg == '--list-formats': print "\nAvailable Output Formats:" b = __Aida__.list_backends() for bname in b: bedoc = __Aida__.backends[bname][1] bedoc = re.sub('\n\s*\n', '\n', bedoc) # remove empty lines bedoc = re.compile(r'^', re.MULTILINE).sub(' ', bedoc) # indent print " %s" % bname if bedoc:
def addStaticMember(self, name, type): self.staticmembers[name] = Member(name, TypeMap.getTypename(type))