foreach $i (@g_EnumFunc)
{
	$i =~ s/\s//g;
	$XXX{$i} = "1";
}

$dd_fin = "../DynamicDraw/${g_FileName}.h";
$dd_fout = "${g_FileName}.h";

$l_DefMode = "0";
$l_DefFunc = "";
$l_DefFuncX = "";
$l_bIsRawMode = "0";

open(DD_FIN, "${dd_fin}") || die "Cannot open ${dd_fin}\n";
open(DD_FOUT, ">${dd_fout}") || die "Cannot open ${dd_fout}\n";

print DD_FOUT "#ifndef __${g_FileName}_h\n";
print DD_FOUT "#define __${g_FileName}_h\n\n";

foreach $i (@g_IncludeH)
{
	print DD_FOUT "#include $i\n";
}

WID:while (<DD_FIN>)
{
	if (/<EXPORT TO SERVER>/)
	#----- _xZkqqHx_jAiCiCoKjHkMiClFiDiCiBfLiDgIiKeKiOgO_xHqqkZx_ <EXPORT TO SDK>_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		$l_bIsRawMode = "1";
		next WID;
	}
	elsif (/<\/EXPORT TO SERVER>/)
	#----- _xZkqqHx_jAiCiCoKjHkMiClFiDiCiBfLiDgIiPeJjHlJ_xHqqkZx_ <\/EXPORT TO SDK>_xZkqqHx_iCmMiPoKiNiH_xHqqkZx_ -----
	{
		$l_bIsRawMode = "0";
		next WID;
	}
	elsif ($l_bIsRawMode eq "1")
	#----- _xZkqqHx_jAiCiCoKjHkMiClFiDiCiBfLiDgI_xHqqkZx_ <EXPORT TO SDK>_xZkqqHx_jCiGiCmMiPoKiNiH_xHqqkZx_ -----
	{
		print DD_FOUT;
		next WID;
	}

	if ($l_DefMode eq "0")
	{
		if (/^\w/)
		{
			$l_DefMode = "1";
		}
	}
	if ($l_DefMode eq "1")
	{
		if (/;/)
		{
			$l_DefMode = "2";
		}
	}

	if ($l_DefMode eq "1")
	{
		$l_DefFunc .= $_;
		$l_ = $_;
		$l_ =~ s/\/\/.*$//;
		$l_ =~ s/=[^\,\)]+//g;
		$l_DefFuncX .= $l_;
	} elsif ($l_DefMode eq "2")
	{
		$l_DefFunc .= $_;
		$l_ = $_;
		$l_ =~ s/\/\/.*$//;
		$l_ =~ s/=[^\,\)]+//g;
		$l_DefFuncX .= $l_;

		$l_DefFuncX =~ s/\s+/ /g;
		$l_DefFuncX =~ s/^[^\(]+\s+([^\s]+\s*\(.*\))[^\)]*$/$1/;
		$l_DefFuncX =~ s/\s//g;

		if ($XXX{$l_DefFuncX} eq "1")
		{
			print DD_FOUT $l_DefFunc;
		}
		$l_DefFuncX = "";
		$l_DefFunc = "";
	}

	if ($l_DefMode eq "2")
	{
		$l_DefMode = "0";
	}
}

print DD_FOUT "\n#endif//__${g_FileName}_h\n";

close DD_FIN;
close DD_FOUT;

print "OK\n";

