Changeset - 7c7da424b6e4
[Not reviewed]
0 1 0
HanzZ - 13 years ago 2012-04-10 10:20:40
hanzz.k@gmail.com
fixed include
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/gen_dynamic_purple.py
Show inline comments
 
import sys
 
import os
 

	
 
methods = []
 
definitions = []
 

	
 
if len(sys.argv) != 2:
 
	print "Usage:", sys.argv[0], "<path_to_libpurple_dir>"
 
	print "Usage:", sys.argv[0], "<path_to_libpurple_dir_containing_libpurple_headers>"
 
	sys.exit(1)
 

	
 

	
 
def handle_file(cpp):
 
	global methods
 

	
 
	new_file = ""
 
	f = open(cpp, "r")
 
	for line in f.readlines():
 
		new_line = ""
 
		index = 0
 
		while index < len(line):
 
			new_line += line[index]
 
			if line[index:].startswith("purple_") or line[index:].startswith("wpurple_"):
 
				if line[index:].find("=") != -1 and line[index:].find("=") < line[index:].find("("):
 
					index += 1
 
					continue
 
				if line[index-1] == "_" or line[index:].find("(") == -1:
 
					index += 1
 
					continue
 
				m = line[index:line[index:].find("(")+index]
 
				new_line += m[1:] + "_wrapped("
 
				index += len(m)
 
				if not m in methods and len(m) != 0:
 
					methods += [m + "("]
 
			index += 1
 
		new_file += new_line
 
	f.close()
 
	return new_file
 

	
 
def handle_header(header, method):
 
	global definitions
 

	
 
	f = open(os.path.join(sys.argv[1], header), "r")
 

	
 
	lines = f.readlines()
 
	for i in range(len(lines)):
 
		line = lines[i]
 
		if line.find(method) != -1:
 
			m = line[:-1]
 
			l = unicode(m).strip()
 
			if l.endswith(")"):
 
				continue
 

	
 
			index = i;
 
			while not m.endswith(";"):
 
				index += 1
 
				m += " " + lines[index][:-1].lstrip()
0 comments (0 inline, 0 general)