# Path: waflib/TaskGen.py
# def extension(*k):
# 	"""
# 	Decorator that registers a task generator method which will be invoked during
# 	the processing of source files for the extension given::
# 
# 		from waflib import Task
# 		class mytask(Task):
# 			run_str = 'cp ${SRC} ${TGT}'
# 		@extension('.moo')
# 		def create_maa_file(self, node):
# 			self.create_task('mytask', node, node.change_ext('.maa'))
# 		def build(bld):
# 			bld(source='foo.moo')
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for x in k:
# 			task_gen.mappings[x] = func
# 		return func
# 	return deco
# 
# Path: waflib/Tools/c_preproc.py
# class PreprocError(Errors.WafError):
# class c_parser(object):
# FILE_CACHE_SIZE = 100000
# LINE_CACHE_SIZE = 100000
# POPFILE = '-'
# NUM   = 'i'
# OP    = 'O'
# IDENT = 'T'
# STR   = 's'
# CHAR  = 'c'
# def repl(m):
# def reduce_nums(val_1, val_2, val_op):
# def get_num(lst):
# def get_term(lst):
# def reduce_eval(lst):
# def stringize(lst):
# def paste_tokens(t1, t2):
# def reduce_tokens(lst, defs, ban=[]):
# def eval_macro(lst, defs):
# def extract_macro(txt):
# def extract_include(txt, defs):
# def parse_char(txt):
# def tokenize(s):
# def tokenize_private(s):
# def format_defines(lst):
# 	def __init__(self, nodepaths=None, defines=None):
# 	def cached_find_resource(self, node, filename):
# 	def tryfind(self, filename, kind='"', env=None):
# 	def filter_comments(self, node):
# 	def parse_lines(self, node):
# 	def addlines(self, node):
# 	def start(self, node, env):
# 	def define_name(self, line):
# def scan(task):


import re
from waflib import Task
from waflib.TaskGen import extension
from waflib.Tools import c_preproc

@extension('.rc')
def rc_file(self, node):
	"""
	Binds the .rc extension to a winrc task
	"""
	obj_ext = '.rc.o'
	if self.env.WINRC_TGT_F == '/fo':
		obj_ext = '.res'
	rctask = self.create_task('winrc', node, node.change_ext(obj_ext))
	try:
		self.compiled_tasks.append(rctask)
	except AttributeError:
		self.compiled_tasks = [rctask]

re_lines = re.compile(
	r'(?:^[ \t]*(#|%:)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef|pragma)[ \t]*(.*?)\s*$)|'\
	r'(?:^\w+[ \t]*(ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)[ \t]*(.*?)\s*$)',
	re.IGNORECASE | re.MULTILINE)

class rc_parser(c_preproc.c_parser):
	"""
	Calculates dependencies in .rc files
	"""
	def filter_comments(self, node):
		"""
		Overrides :py:meth:`waflib.Tools.c_preproc.c_parser.filter_comments`
		"""
		code = node.read()
		if c_preproc.use_trigraphs:

# Path: waflib/TaskGen.py
# def extension(*k):
# 	"""
# 	Decorator that registers a task generator method which will be invoked during
# 	the processing of source files for the extension given::
# 
# 		from waflib import Task
# 		class mytask(Task):
# 			run_str = 'cp ${SRC} ${TGT}'
# 		@extension('.moo')
# 		def create_maa_file(self, node):
# 			self.create_task('mytask', node, node.change_ext('.maa'))
# 		def build(bld):
# 			bld(source='foo.moo')
# 	"""
# 	def deco(func):
# 		setattr(task_gen, func.__name__, func)
# 		for x in k:
# 			task_gen.mappings[x] = func
# 		return func
# 	return deco
# 
# Path: waflib/Tools/c_preproc.py
# class PreprocError(Errors.WafError):
# class c_parser(object):
# FILE_CACHE_SIZE = 100000
# LINE_CACHE_SIZE = 100000
# POPFILE = '-'
# NUM   = 'i'
# OP    = 'O'
# IDENT = 'T'
# STR   = 's'
# CHAR  = 'c'
# def repl(m):
# def reduce_nums(val_1, val_2, val_op):
# def get_num(lst):
# def get_term(lst):
# def reduce_eval(lst):
# def stringize(lst):
# def paste_tokens(t1, t2):
# def reduce_tokens(lst, defs, ban=[]):
# def eval_macro(lst, defs):
# def extract_macro(txt):
# def extract_include(txt, defs):
# def parse_char(txt):
# def tokenize(s):
# def tokenize_private(s):
# def format_defines(lst):
# 	def __init__(self, nodepaths=None, defines=None):
# 	def cached_find_resource(self, node, filename):
# 	def tryfind(self, filename, kind='"', env=None):
# 	def filter_comments(self, node):
# 	def parse_lines(self, node):
# 	def addlines(self, node):
# 	def start(self, node, env):
# 	def define_name(self, line):
# def scan(task):


# Path: waflib/Tools/winres.py
import re
from waflib import Task
from waflib.TaskGen import extension
from waflib.Tools import c_preproc


@extension('.rc')
def rc_file(self, node):
	"""
	Binds the .rc extension to a winrc task
	"""
	obj_ext = '.rc.o'
	if self.env.WINRC_TGT_F == '/fo':
		obj_ext = '.res'
	rctask = self.create_task('winrc', node, node.change_ext(obj_ext))
	try:
		self.compiled_tasks.append(rctask)
	except AttributeError:
		self.compiled_tasks = [rctask]

re_lines = re.compile(
	r'(?:^[ \t]*(#|%:)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef|pragma)[ \t]*(.*?)\s*$)|'\
	r'(?:^\w+[ \t]*(ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)[ \t]*(.*?)\s*$)',
	re.IGNORECASE | re.MULTILINE)

class rc_parser(c_preproc.c_parser):
	"""
	Calculates dependencies in .rc files
	"""
	def filter_comments(self, node):
		"""
		Overrides :py:meth:`waflib.Tools.c_preproc.c_parser.filter_comments`
		"""
		code = node.read()
		if c_preproc.use_trigraphs:

			for (a, b) in c_preproc.trig_def: