def replaceMacrosWithValues(s, macroDict):
	"""
	Given a string, s, which might contain one or more macros of the form
	"$(P)", and given a dictionary of macro name/value pairs (e.g.,
	macroDict["P"]=="xxx:") return s with macros replaced by their corresponding
	values.  Also return a string indicating whether any macros were not found.
	"""
	#print "replaceMacrosWithValues: s = '%s'" % (s)

	status = ""
	startIx = 0
	value = None
	while startIx <= len(s)-4:
		#print "replaceMacrosWithValues: looking for '$(' in '%s'" % (s[startIx:])
		Ix = s[startIx:].find("$(")
		if (Ix == -1): break
		macroIx = startIx + Ix + 2
		#print "replaceMacrosWithValues: looking for ')' in '%s'" % (s[macroIx:])
		endIx = s[macroIx:].find(")")
		if (endIx == -1): break
		macro = s[macroIx:macroIx+endIx]
		startIx = macroIx+endIx+1
		if macro in macroDict.keys():
			value = macroDict[macro]
			s = s[:macroIx-2] + value + s[macroIx+endIx+1:]
			startIx = s.find("$(")
		else:
			startIx = macroIx+endIx+1
			status = "notFound"
	return (s, status)