import frams
import sys

frams.init(*(sys.argv[1:]))

def printSingleProperty(v,p):
	print('  %s "%s" type="%s" flags=%d group=%d help="%s"' % (v._propId(p),v._propName(p),v._propType(p),v._propFlags(p),v._propGroup(p),v._propHelp(p)))


def printFramsProperties(v):
	N=v._propCount()
	G=v._groupCount()
	if G<2:
		
		#no groups, simply iterate all props
		
		print("'%s' has %d properties" % (v._class(),v._propCount()))
		for p in range(v._propCount()):
			printSingleProperty(v,p)
		
	else:
		
		#iterate through groups and iterate all props in a group.
		#why the distinction?
		#first, just to show there are two ways. there is always at least one
		#group so you can always get all props by iterating the group.
		#second, groups actually do not exist as collections. iterating in
		#groups works by checking all properties on each iteration and
		#testing which one is the m-th property of the group.
		#these inefficient _memberCount() and _groupMember() are provided
		#for the sake of completeness but don't use them without good reason ;-)
		
		print("'%s' has %d properties in %d group(s)" % (v._class(),v._propCount(),v._groupCount()))
		for g in range(G):
			print('\n=========== Group #%d: %s ==========' % (g,v._groupName(g)))
			for m in range(v._memberCount(g)):
				p=v._groupMember(g,m)
				printSingleProperty(v,p)
			print('========================\n')




printFramsProperties(frams.World)
		
printFramsProperties(frams.GenePools[0].add('X'))
