Example #1
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"
Example #2
0
tname = {}
for classname in wclasses:

	# Find singletons and collections

	# Get actual name of classes
	fullname = getFullname(classname)
	fullname = fixName(fullname)
	
	# Skip a bunch of complicated stuff...

	if skipme.match(fullname) != None:
		continue

	# Keep classes for which a header can be identified
	headers = findHeaders(fullname)
	if len(headers) == 0:
		#print "** could not identify header for class (%s)" % fullname
		continue
	
	# Make sure that containers supersede singletons in the
	# following sense:
	# vector<A> is kept but not A if both are present

	# Since classname may be a vector, check it first before the fullname
	yes, name = isVector(classname)
	if not yes:
		yes, name = isVector(fullname)
	if yes:
		# add to map
		ctype = 'collection'
Example #3
0
    sys.exit(0)
#------------------------------------------------------------------------------
cnames = map(exclass, map(strip, open("plugins/classlist.txt").readlines()))
names = {'time': ctime()}

# Split across several plugin files
npmax = 1 + len(cnames) / NPLUGINS
np = 0
nplugin = 0  # plugin file number

outrecs = []
hdrs = {}
pkgs = {}
count = 0
for index, (ctype, name) in enumerate(cnames):
    headers = findHeaders(name)
    if len(headers) == 0:
        print "** could not identify header for class (%s)" % name
        continue

    for header in headers:
        # note package and header
        pkg = split(split(header, "/interface")[0], '/src/')[-1]
        pkgs[pkg] = 1
        hdrs[header] = 1
        #print "\t%s" % header

    bname = simplify.sub("", name)
    bname = strip(stripme.sub("", bname))

    names['buffername'] = bname
Example #4
0
    # Find singletons and collections

    # Get actual name of classes
    fullname = getFullname(classname)
    fullname = fixName(fullname)

    # Skip a bunch of complicated stuff...

    if skipme.match(fullname) != None:
        continue
    if skipmore(fullname):
        continue

    # Keep classes for which a header can be identified
    headers = findHeaders(fullname)
    if len(headers) == 0:
        #print "** could not identify header for class (%s)" % fullname
        continue
    pkg = split(split(headers[0], "/interface")[0], '/src/')[-1]

    # Make sure that containers supersede singletons in the
    # following sense:
    # vector<A> is kept but not A if both are present

    # Since classname may be a vector, check it first before the fullname
    yes, name = isVector(classname)

    no = not yes
    if no:
        yes, name = isVector(fullname)
Example #5
0
cnames = map(exclass,
			 map(strip,
				 open("plugins/classlist.txt").readlines()))
names  = {'time': ctime()}

# Split across several plugin files
npmax = 1 + len(cnames)/NPLUGINS
np = 0
nplugin = 0 # plugin file number

outrecs = []
hdrs  = {}
pkgs  = {}
count = 0
for index, (ctype, name) in enumerate(cnames):
	headers = findHeaders(name)
	if len(headers) == 0:
		print "** could not identify header for class (%s)" % name
		continue
	
	for header in headers:
		# note package and header
		pkg = split(split(header, "/interface")[0], '/src/')[-1]
		pkgs[pkg] = 1
		hdrs[header] = 1
		#print "\t%s" % header

	bname = simplify.sub("", name)
	bname = strip(stripme.sub("", bname))

	names['buffername'] = bname
Example #6
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"