Example #1
0
def main():

    print "mkdocs.py $Revision: 1.10 $\n"

    fmap = {}
    for file in ClassToHeaderMap.values():
        if type(file) == type([]): continue
        fmap[file] = 0
    filelist = fmap.keys()
    filelist.sort()

    #-------------------------------------------------
    # Loop over header files to be scanned
    #-------------------------------------------------

    # Make sure html and txt directories exist

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

    count = 0
    for index, filename in enumerate(filelist):

        # Create full pathname to header

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

        # Scan header and parse it for classes

        record, items = parseHeader(file)
        if record == '': continue
        records = splitHeader(record)
        if len(records) == 0: continue

        # Now strip away path up to "/src/" in pathname of header

        header = file
        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, '/', '.')

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

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

        names = []
        for irecord, (record, group, start, end) in enumerate(records):

            # Get actual record from items map

            key = strip(record)
            if items.has_key(key):
                record = items[key]
                if type(record) == type(()):
                    record, extraRecord = record
            record = stripBlanklines(record)

            if group == "namespace":
                name = strip(namespaceName(record))
                if name != '': names.append(name)

            elif group == "endnamespace":
                if len(names) > 0: names.pop()

            elif group in ["endclass", "endstructclass"]:

                fullname = joinfields(names, "::")

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

                # Get methods and/or datamembers and write them out

                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)
                names.pop()

            elif group in ["class", "structclass"]:
                classname, basenames, template = getClassname(record)
                names.append(classname)

    # Create index.html

    print "\ncreating html/index.html.."
    os.system("mkindex.py")
    print "\n\tmkdocs.py is done!\n"
Example #2
0
def main():

    print "mkclassmap.py\n"

    subpackagelist = SUBPACKAGELIST
    filelist = []
    if Update:
        for subpackage in subpackagelist:
            print "scan package: %s" % subpackage
            file = "%s/interface/*.h" % subpackage
            hlist = glob(file)
            hlist.sort()
            filelist += hlist
    else:

        for subpackage in subpackagelist:
            package, subpkg = split(subpackage, '/')
            if subpkg == "*":
                cmd = "%s%s" % (BASE, subpackage)
                subsystems = filter(lambda x: os.path.isdir(x), glob(cmd))
                if len(subsystems) == 0:
                    cmd = "%s%s" % (PKGBASE, subpackage)
                    subsystems = filter(lambda x: os.path.isdir(x), glob(cmd))

                subsystems = map(lambda x: split(x, '/').pop(), subsystems)
            else:
                subsystems = [split(subpackage, '/').pop()]

            for subsystem in subsystems:
                if skipsubsystem.match(subsystem) != None: continue

                dirpath = "%s%s/%s" % (PKGBASE, package, subsystem)
                if not os.path.exists(dirpath):
                    dirpath = "%s%s/%s" % (LOCALBASE, package, subsystem)
                    if not os.path.exists(dirpath):
                        "** directory %s not found" % dirpath
                        continue
                print "scan package: %s/%s" % (package, subsystem)
                file = "%s/interface/*.h" % dirpath
                hlist = glob(file)
                hlist.sort()
                filelist += hlist

    # Filter headers
    filelist = filter(lambda x: skipheader.search(x) == None, filelist)
    print
    print "scan %d headers for potentially useful classes" % len(filelist)

    #-------------------------------------------------
    # Loop over header files to be scanned
    #-------------------------------------------------
    cmap = {}
    count = 0
    for index, file in enumerate(filelist):
        if not os.path.exists(file):
            print "** file %s not found" % file
            continue

        file = os.path.abspath(file)
        if index % 100 == 0: print index

        # Scan header and parse it for classes

        record, items = parseHeader(file)

        if record == '':
            print "** failed on %s" % file
            continue
        records = splitHeader(record)
        if len(records) == 0: continue

        # Now strip away path up to "/src/" in pathname of header

        header = file
        k = rfind(header, "/src/")  # search from right
        if k > 0: header = header[k + 5:]

        cache = []
        names = []
        for irecord, (record, group, start, end) in enumerate(records):
            #print "GROUP(%s)" % group

            # Get actual record from items map

            key = strip(record)
            if items.has_key(key):
                record = items[key]
                if type(record) == type(()):
                    record, extraRecord = record
            record = stripBlanklines(record)

            if group == "namespace":
                name = strip(namespaceName(record))
                if name != '': names.append(name)

            elif group == "endnamespace":
                if len(names) > 0: names.pop()

            elif group in ["endclass", "endstructclass"]:

                fullname = joinfields(names, "::")

                # Check for uninstantiated templates and
                # create keys

                if find(fullname, '<') > -1:
                    tplate = True
                    fullkey = split(fullname, '<')[0]
                else:
                    tplate = False
                    fullkey = fullname

                cache.append((fullkey, header))

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

                # remember to reset
                names.pop()

            elif group in ["class", "structclass"]:
                classname, basenames, template = getClassname(record)
                names.append(classname)

        # Update map

        for fullkey, header in cache:
            if Update:
                addToMap(fullkey, header, ClassToHeaderMap)
            else:
                addToMap(fullkey, header, cmap)

    # Write out class to header map

    if Update:
        print "updating classmap.py..."
        hmap = ClassToHeaderMap
    else:
        print "creating classmap.py..."
        hmap = cmap

## 	# define lib areas

## 	LOCALLIBAREA = "%s/lib/%s/" % (LOCALBASE[:-5], SCRAM_ARCH)
## 	LIBAREA = "%s/lib/%s/" % (BASE[:-5], SCRAM_ARCH)

    getmodule = re.compile('(?<=src/).*(?=/interface)')
    ## 	librecs = []
    recs = []
    keys = hmap.keys()
    keys.sort()
    for key in keys:
        key = fixName(key)  # remove unnecessary spaces

        value = hmap[key]
        if type(value) == type(""):
            recs.append("'%s': '%s'" % (key, value))
        else:
            recs.append("'%s': %s" % (key, value))

## 		# find the shared library in which the class typeinfo resides

## 		module = split(value,'/interface/')[0]
## 		library = "lib%s" % replace(module, '/', '')

## 		found = False
## 		filename = "%s%s.so" % (LOCALLIBAREA, library)

## 		if not os.path.exists(filename):
## 			filename = "%s%s.so" % (LIBAREA, library)
## 			if not os.path.exists(filename):
## 				print "\twarning: library %s not found"
## 				continue

# add lib to list
## 		librecs.append("'%s': '%s'" % (key, library))

    record = joinfields(recs, ',\n')
    outfile = CLASSMAPFILE
    out = open(outfile, 'w')
    out.write('# Created: %s\n' % ctime(time()))
    out.write('# Version: %s\n' % VERSION)
    out.write("ClassToHeaderMap = {\\\n")
    out.write(record + '\n')
    out.write("}\n\n")

    ## 	record = joinfields(librecs,',\n')
    ## 	out.write("ClassToLibraryMap = {\\\n")
    ## 	out.write(record+'\n')
    ## 	out.write("}\n")
    out.close()
Example #3
0
def main():

	print "mkreflex.py\n"
	
	fmap = {}
	for file in ClassToHeaderMap.values():
		if type(file) == type([]):
			for f in file:
				if headers.findall(f) != []:
					fmap[f] = 0
		else:
			if headers.findall(file) != []:
				fmap[file] = 0
	filelist = fmap.keys()
	filelist.sort()

	xmlrec = ''
	hdrrec = ''
	count = 0
	for index, filename in enumerate(filelist):

		# Create full pathname to header

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

		# Scan header and parse it for classes
		
		record, items = parseHeader(file)
		
		if record == '': continue
		records = splitHeader(record)
		if len(records) == 0: continue

		# Now strip away path up to "/src/" in pathname of header
		
		header = file		
		k = rfind(header, "/src/") # search from right
		if k > 0: header = header[k+5:]

		##D
		print "\n%s" % header
		hdrrec += '#include "%s"\n' % header

		filestem = replace(header, 'interface/', '')
		filestem = split(filestem, '.h')[0]
		filestem = replace(filestem, '/', '.')

		# Initialize map to contain info about classes, methods & datamembers
		
		db = {'version':  VERSION,
			  'filestem': filestem,
			  'header':   header}

		names = []
		for irecord, (record, group, start, end) in enumerate(records):

			# Get actual record from items map

			key = strip(record)
			if items.has_key(key):
				record = items[key]
				if type(record) == type(()):
					record, extraRecord = record
			record = stripBlanklines(record)
			
			if group == "namespace":
				name = strip(namespaceName(record))
				if name != '': names.append(name)

			elif group == "endnamespace":
				if len(names) > 0: names.pop()
				
			elif group in ["endclass", "endstructclass"]:
				
				fullname = joinfields(names, "::")

				# For now ignore templates
				if find(fullname, '<') > -1:
					pass
				else:
					###D
					print "\t%s" % fullname

					xmlrec += '   <class name="%s"/>\n' % fullname
					
				if len(names) > 0: names.pop()
				
			elif group in ["class", "structclass"]:
				classname, basenames, template = getClassname(record)
				names.append(classname)


	record = '''#ifndef ANALYSISDATAFORMATS_H
#define ANALYSISDATAFORMATS_H
	
%s
#endif
	''' % hdrrec

	open("analysisDataFormats.h", "w").write(record)	
	open("analysisDataFormats.xml", "w").write(xmlrec)
Example #4
0
def main():
	
	print "mkclassmap.py\n"

	subpackagelist = SUBPACKAGELIST
	filelist = []
	if Update:
		for subpackage in subpackagelist:
			print "scan package: %s" % subpackage
			file = "%s/interface/*.h" % subpackage
			hlist = glob(file)
			hlist.sort()
			filelist += hlist
	else:

		for subpackage in subpackagelist:
			package, subpkg = split(subpackage,'/')
			if subpkg == "*":
				cmd = "%s%s" % (BASE, subpackage)
				subsystems = filter(lambda x: os.path.isdir(x), glob(cmd))
				if len(subsystems) == 0:
					cmd = "%s%s" % (PKGBASE, subpackage)
					subsystems = filter(lambda x: os.path.isdir(x), glob(cmd))
					
				subsystems = map(lambda x: split(x, '/').pop(), subsystems)
			else:
				subsystems = [split(subpackage, '/').pop()]

			for subsystem in subsystems:
				if skipsubsystem.match(subsystem) != None: continue
				
				dirpath = "%s%s/%s" % (PKGBASE, package, subsystem)
				if not os.path.exists(dirpath):
					dirpath = "%s%s/%s" % (LOCALBASE, package, subsystem)
					if not os.path.exists(dirpath):
						"** directory %s not found" % dirpath
						continue
				print "scan package: %s/%s" % (package, subsystem)
				file = "%s/interface/*.h" % dirpath
				hlist = glob(file)
				hlist.sort()
				filelist += hlist

		
	# Filter headers
	filelist = filter(lambda x: skipheader.search(x) == None, filelist)
	print
	print "scan %d headers for potentially useful classes" % len(filelist)
	
	#-------------------------------------------------
	# Loop over header files to be scanned
	#-------------------------------------------------
	cmap = {}
	count = 0
	for index, file in enumerate(filelist):
		if not os.path.exists(file):
			print "** file %s not found" % file
			continue

		file = os.path.abspath(file)
		if index % 100 == 0: print index

		# Scan header and parse it for classes

		record, items = parseHeader(file)
	
		if record == '':
			print "** failed on %s" % file
			continue
		records = splitHeader(record)
		if len(records) == 0: continue

		# Now strip away path up to "/src/" in pathname of header
		
		header = file
		k = rfind(header, "/src/") # search from right
		if k > 0: header = header[k+5:]

		cache = []
		names = []
		for irecord, (record, group, start, end) in enumerate(records):
			#print "GROUP(%s)" % group
			
			# Get actual record from items map

			key = strip(record)
			if items.has_key(key):
				record = items[key]
				if type(record) == type(()):
					record, extraRecord = record
			record = stripBlanklines(record)
			
			if group == "namespace":
				name = strip(namespaceName(record))
				if name != '': names.append(name)

			elif group == "endnamespace":
				if len(names) > 0: names.pop()
				
			elif group in ["endclass", "endstructclass"]:
				
				fullname = joinfields(names, "::")

				# Check for uninstantiated templates and
				# create keys

				if find(fullname, '<') > -1:
					tplate = True
					fullkey = split(fullname, '<')[0]
				else:
					tplate = False
					fullkey = fullname					

				cache.append((fullkey, header))

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

				# remember to reset
				names.pop()
				
			elif group in ["class", "structclass"]:
				classname, basenames, template = getClassname(record)
				names.append(classname)

		# Update map
		
		for fullkey, header in cache:
			if Update:
				addToMap(fullkey, header, ClassToHeaderMap)
			else:
				addToMap(fullkey, header, cmap)

	
	# Write out class to header map

	if Update:
		print "updating classmap.py..."
		hmap = ClassToHeaderMap
	else:
		print "creating classmap.py..."
		hmap = cmap


		
## 	# define lib areas

## 	LOCALLIBAREA = "%s/lib/%s/" % (LOCALBASE[:-5], SCRAM_ARCH)
## 	LIBAREA = "%s/lib/%s/" % (BASE[:-5], SCRAM_ARCH)

	getmodule = re.compile('(?<=src/).*(?=/interface)')
## 	librecs = []
	recs = []
	keys = hmap.keys()
	keys.sort()
	for key in keys:
		key = fixName(key) # remove unnecessary spaces
		
		value = hmap[key]
		if type(value) == type(""):
			recs.append("'%s': '%s'" % (key, value))
		else:
			recs.append("'%s': %s"   % (key, value))

## 		# find the shared library in which the class typeinfo resides

## 		module = split(value,'/interface/')[0]
## 		library = "lib%s" % replace(module, '/', '')

## 		found = False
## 		filename = "%s%s.so" % (LOCALLIBAREA, library)
		
## 		if not os.path.exists(filename):
## 			filename = "%s%s.so" % (LIBAREA, library)
## 			if not os.path.exists(filename):
## 				print "\twarning: library %s not found"
## 				continue

		# add lib to list
## 		librecs.append("'%s': '%s'" % (key, library))

	record = joinfields(recs,',\n')		
	outfile = CLASSMAPFILE
	out = open(outfile,'w')
	out.write('# Created: %s\n' % ctime(time()))
	out.write('# Version: %s\n' % VERSION)
	out.write("ClassToHeaderMap = {\\\n")
	out.write(record+'\n')
	out.write("}\n\n")

## 	record = joinfields(librecs,',\n')
## 	out.write("ClassToLibraryMap = {\\\n")
## 	out.write(record+'\n')
## 	out.write("}\n")
	out.close()
Example #5
0
def main():

	print "mkdocs.py $Revision: 1.10 $\n"
	
	fmap = {}
	for file in ClassToHeaderMap.values():
		if type(file) == type([]): continue
		fmap[file] = 0
	filelist = fmap.keys()
	filelist.sort()

	#-------------------------------------------------
	# Loop over header files to be scanned
	#-------------------------------------------------

	# Make sure html and txt directories exist
	
	os.system("mkdir -p html; mkdir -p txt")
	
	count = 0
	for index, filename in enumerate(filelist):

		# Create full pathname to header

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

		# Scan header and parse it for classes
		
		record, items = parseHeader(file)
		if record == '': continue
		records = splitHeader(record)
		if len(records) == 0: continue

		# Now strip away path up to "/src/" in pathname of header
		
		header = file
		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, '/', '.')

		# Initialize map to contain info about classes, methods & datamembers
		
		db = {'version':  VERSION,
			  'filestem': filestem,
			  'header':   header}

		names = []
		for irecord, (record, group, start, end) in enumerate(records):

			# Get actual record from items map

			key = strip(record)
			if items.has_key(key):
				record = items[key]
				if type(record) == type(()):
					record, extraRecord = record
			record = stripBlanklines(record)
			
			if group == "namespace":
				name = strip(namespaceName(record))
				if name != '': names.append(name)

			elif group == "endnamespace":
				if len(names) > 0: names.pop()
				
			elif group in ["endclass", "endstructclass"]:
				
				fullname = joinfields(names, "::")

				# For now ignore templates
				if find(fullname, '<') > -1: continue
				
				# Get methods and/or datamembers and write them out
				
				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)
				names.pop()
				
			elif group in ["class", "structclass"]:
				classname, basenames, template = getClassname(record)
				names.append(classname)

	# Create index.html

	print "\ncreating html/index.html.."
	os.system("mkindex.py")
	print "\n\tmkdocs.py is done!\n"
Example #6
0
def main():
	
	print "mkclassmap.py $Revision: 1.6 $\n"

	subpackagelist = SUBPACKAGELIST
	filelist = []
	if Update:
		for subpackage in subpackagelist:
			print "scan sub-package: %s" % subpackage
			file = "%s/interface/*.h" % subpackage
			hlist = glob(file)
			hlist.sort()
			filelist += hlist
	else:

		for subpackage in subpackagelist:
			package, subpkg = split(subpackage,'/')
			if subpkg == "*":

				cmd = "%s%s" % (LOCALBASE, subpackage)
				subsystems = filter(lambda x: os.path.isdir(x), glob(cmd))
				if len(subsystems) == 0:
					cmd = "%s%s" % (PKGBASE, subpackage)
					subsystems = filter(lambda x: os.path.isdir(x), glob(cmd))
					
				subsystems = map(lambda x: split(x, '/').pop(), subsystems)
			else:
				subsystems = [split(subpackage, '/').pop()]

			for subsystem in subsystems:
				if skipsubsystem.match(subsystem) != None: continue
				
				dirpath = "%s%s/%s" % (PKGBASE, package, subsystem)
				if not os.path.exists(dirpath):
					dirpath = "%s%s/%s" % (LOCALBASE, package, subsystem)
					if not os.path.exists(dirpath):
						"** directory %s not found" % dirpath
						continue
				print "scan sub-package: %s/%s" % (package, subsystem)
				file = "%s/interface/*.h" % dirpath
				hlist = glob(file)
				hlist.sort()
				filelist += hlist

	# Filter headers
	filelist = filter(lambda x: skipheader.search(x) == None, filelist)
	
	#-------------------------------------------------
	# Loop over header files to be scanned
	#-------------------------------------------------
	cmap = {}
	count = 0
	for index, file in enumerate(filelist):
		if not os.path.exists(file):
			print "** file %s not found" % file
			continue
		
		file = os.path.abspath(file)
		
		# Scan header and parse it for classes
		
		record, items = parseHeader(file)
		if record == '': continue
		records = splitHeader(record)
		if len(records) == 0: continue

		# Now strip away path up to "/src/" in pathname of header
		
		header = file
		k = rfind(header, "/src/") # search from right
		if k > 0: header = header[k+5:]
		
		names = []
		for irecord, (record, group, start, end) in enumerate(records):

			# Get actual record from items map

			key = strip(record)
			if items.has_key(key):
				record = items[key]
				if type(record) == type(()):
					record, extraRecord = record
			record = stripBlanklines(record)
			
			if group == "namespace":
				name = strip(namespaceName(record))
				if name != '': names.append(name)

			elif group == "endnamespace":
				if len(names) > 0: names.pop()
				
			elif group in ["endclass", "endstructclass"]:
				
				fullname = joinfields(names, "::")

				# Check for uninstantiated templates and
				# create keys

				if find(fullname, '<') > -1:
					tplate = True
					fullkey = split(fullname, '<')[0]
				else:
					tplate = False
					fullkey = fullname					
				key = stripnamespace.sub("", fullkey)
				
				if Update:
					addToMap(fullkey, key, header, ClassToHeaderMap)
				else:
					addToMap(fullkey, key, header, cmap)

				count += 1
				print "%5d\t%s" % (count, fullkey)
								
				names.pop()
				
			elif group in ["class", "structclass"]:
				classname, basenames, template = getClassname(record)
				names.append(classname)

	# Write out class to header map

	if Update:
		print "updating classmap.py..."
		hmap = ClassToHeaderMap
	else:
		print "creating classmap.py..."
		hmap = cmap

	recs = []
	keys = hmap.keys()
	keys.sort()
	for key in keys:
		value = hmap[key]
		if type(value) == type(""):
			recs.append("'%s': '%s'" % (key, value))
		else:
			recs.append("'%s': %s"   % (key, value))

	record = joinfields(recs,',\n')		
	outfile = CLASSMAPFILE
	out = open(outfile,'w')
	out.write('# Created: %s\n' % ctime(time()))
	out.write('# Version: %s\n' % VERSION)
	out.write('#$Revision: 1.6 $\n')
	out.write("ClassToHeaderMap = {\\\n")
	out.write(record+'\n')
	out.write("}\n")