Beispiel #1
0
		nspace = doublecolon.sub("", nspacewithcolon)
		tab = ' '*4
		
	name  = namespace.sub("",classtype) + postfix      # remove namespace
	bname = doublecolon.sub("", classtype) + postfix   # remove "::"
	filename = doublecolon.sub("", bname)
	if nspacewithcolon != "":
		fullname = nspacewithcolon + name
	else:
		fullname = name

	# ----------------------------------------------------------------
	# Get class methods
	# ----------------------------------------------------------------
	db = {}
	classMethods(classtype, db)
	#db['baseclassnames'] = []
	#classDataMembers(classtype, db)

	# sort methods
	meths = {}
	for method, value in db['methods'].items():
		nom, clname, rtype, fullrtype, signature, methodcall, simpleArgs=value
		meths[lower(signature)] = (method, rtype,
					   fullrtype,
					   signature, methodcall, 
					   clname, simpleArgs)
	sigs = meths.keys()
	sigs.sort()

	methods = ''
Beispiel #2
0
def main():

    print "mkvomit.py\n"

    # read classlist.txt
    filename = '%sPhysicsTools/TheNtupleMaker/plugins/classlist.txt' % LOCALBASE
    classlist = map(strip, open(filename).readlines())

    clist = []
    for name in classlist:
        t = split(name)
        name = joinfields(t[1:], ' ')
        headers = findHeaders(name)
        if len(headers) == 0: continue

        clist.append((name, headers[0]))
    clist.sort()
    classlist = clist

    #-------------------------------------------------
    # Loop over classes to be scanned
    #-------------------------------------------------

    # Make sure html and txt directories exist

    os.system("mkdir -p html; mkdir -p txt")

    count = 0
    for index, (classname, header) in enumerate(classlist):

        # Create full pathname to header

        file = LOCALBASE + header
        if not os.path.exists(file):
            file = BASE + header
            if not os.path.exists(file):
                print "** file %s not found" % file
                continue

        file = os.path.abspath(file)
        header = file
        fullname = classname

        # For now ignore templates
        if find(fullname, '<') > -1: continue

        # Get methods and/or datamembers and write them out

        # Initialize map to contain info about classes, methods & datamembers

        k = rfind(header, "/src/")  # search from right
        if k > 0: header = header[k + 5:]
        filestem = replace(header, 'interface/', '')
        filestem = split(filestem, '.h')[0]
        filestem = replace(filestem, '/', '.')

        db = {'version': VERSION, 'filestem': filestem, 'header': header}

        db['scopes'] = {}
        db['methods'] = {}
        db['datamembers'] = {}
        db['classname'] = fullname
        db['classlist'] = []
        db['baseclassnames'] = []
        db['signature'] = {}

        classMethods(fullname, db)
        db['baseclassnames'] = []
        classDataMembers(fullname, db)

        nmeth = len(db['methods'])
        ndata = len(db['datamembers'])

        if nmeth > 0 or ndata > 0:

            count += 1
            print "%5d\t%s" % (count, fullname)

            cname = split(fullname, '::').pop()
            methfilename = "txt/%s.%s.txt" % (filestem, cname)

            out = open(methfilename, 'w')
            printHeader(db, out)
            printMethods(db, out)
            printDataMembers(db, out)
            out.close()

            writeHTML(db, methfilename)
        else:
            print "*** no methods found for %s" % fullname

    # Create index.html
    print "\ncreating html/index.html.."
    os.system("mkindex.py")
    print "\n\tmkvomit.py is done!\n"
Beispiel #3
0
def main():

    print "mkvomit.py\n"

    # read classlist.txt
    filename='%sPhysicsTools/TheNtupleMaker/plugins/classlist.txt' % \
        LOCALBASE
    classlist = map(strip, open(filename).readlines())

    clist = []
    for name in classlist:
        t = split(name)
        if len(t) < 3:
            print "** the format of plugins/classlist.txt is out of date"
            print "** run scripts/initTNM.py to update it"
            sys.exit()
        elif len(t) == 3:
            pkg, name, ctype = t
        else:
            pkg   = t[0]
            name  = joinfields(t[1:-1], ' ')
            ctype = t[-1]

        headers = findHeaders(name)
        if len(headers) == 0: continue

        clist.append((name, headers[0]))
    clist.sort()
    classlist = clist

    #-------------------------------------------------
    # Loop over classes to be scanned
    #-------------------------------------------------

    # Make sure html and txt directories exist

    os.system("mkdir -p html; mkdir -p txt")

    count = 0
    for index, (classname, header) in enumerate(classlist):

        # Create full pathname to header

        file = LOCALBASE + header
        if not os.path.exists(file):
            file = BASE + header
            if not os.path.exists(file):
                print "** file %s not found" % file
                continue

        file = os.path.abspath(file)
        header = file		
        fullname = classname

        # For now ignore templates
        if find(fullname, '<') > -1: continue

        # Get methods and/or datamembers and write them out

        # Initialize map to contain info about classes, 
        # methods & datamembers

        k = rfind(header, "/src/") # search from right
        if k > 0: header = header[k+5:]
        filestem = replace(header, 'interface/', '')
        filestem = split(filestem, '.h')[0]
        filestem = replace(filestem, '/', '.')

        db = {'version':  VERSION,
              'filestem': filestem,
              'header':   header}

        db['scopes'] = {}
        db['methods'] = {}
        db['datamembers'] = {}
        db['classname'] = fullname
        db['classlist'] = []
        db['baseclassnames'] = []
        db['signature'] = {}

        classMethods(fullname, db)
        db['baseclassnames'] = []
        classDataMembers(fullname, db)

        nmeth = len(db['methods'])
        ndata = len(db['datamembers'])

        if nmeth > 0 or ndata > 0:

            count += 1
            print "%5d\t%s" % (count, fullname)

            cname  = split(fullname,'::').pop()
            methfilename = "txt/%s.%s.txt" % (filestem, cname)

            out = open(methfilename, 'w')
            printHeader(db, out)
            printMethods(db, out)
            printDataMembers(db, out)
            out.close()

            writeHTML(db, methfilename)
        else:
            print "*** no methods found for %s" % fullname

    # Create index.html
    print "\ncreating html/index.html.."
    os.system("mkindex.py")
    print "\n\tmkvomit.py is done!\n"