def getPattern(reqFile):
	"""
	Search through an autosave-request file for macros (e.g., "$(P)").
	Return a list of the variable names found.
	"""

	pattern = []
	file = open(reqFile, "r")
	#print "getPattern: file='%s'" % reqFile
	for rawLine in file:
		startIx = 0
		while startIx < len(rawLine)-4:
			Ix = rawLine[startIx:].find("$(")
			if (Ix == -1): break
			macroIx = startIx + Ix + 2
			Ix = rawLine[macroIx:].find(")")
			if (Ix == -1): break
			macro = rawLine[macroIx:macroIx+Ix]
			startIx = macroIx+Ix+1
			if not macro in pattern: pattern.append(macro)
			#print "getPattern: rawLine='%s' macro='%s' startIx=%d" % (rawLine, macro, startIx)
	#print "getPattern: reqFile='%s', pattern=%s" % (reqFile, pattern)
	return pattern