INNER CODE UNIT · Python

find_function_prototype

tanersener/mobile-ffmpeg · src/libsndfile/make_lite.py:21

def find_function_prototype (source, proto_name):
	proto_re = "(^[a-zA-Z_ \t]+\s+%s[^a-zA-Z0-9_]\s*\([^\)]+\)\s+;\n)" % (proto_name)
	proto_result = re.search (proto_re, source, re.MULTILINE | re.DOTALL)
	if not proto_result:
		return None
	proto_text = proto_result.groups ()[0]
	return proto_text

def find_function_definition (source, func_name):
	func_re = "(\n[a-zA-Z_ \t]+\n%s[^a-zA-Z0-9_].* /\* %s \*/\n)" % (func_name, func_name)
	func_result = re.search (func_re, source, re.MULTILINE | re.DOTALL)
	if not func_result:
		sys.exit (1)
		return None
	func_text = func_result.groups ()[0]

	# Now to check that we only have one enclosing function.
	func_count = count_enclosed_functions (func_text)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…