first commit in a series to change property functions into D style

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1454 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
trass3r 2010-03-13 01:56:39 +00:00
parent 809b09292f
commit 1c72b919e7
5 changed files with 443 additions and 460 deletions

View file

@ -47,7 +47,7 @@ string loadFromSharedLib(string fname)
}
//used to mixin code function
string loadFromSharedLib2(S...)(string lib, string object, S fnames)
string loadFromSharedLib2(S...)(string lib, string className, S fnames)
{
string res = `static this()
{
@ -60,14 +60,27 @@ string loadFromSharedLib2(S...)(string lib, string object, S fnames)
foreach(fname; fnames)
{
res ~= "\t" ~ object ~ "_" ~ fname ~ " = " ~ "cast(typeof(" ~ object ~ "_" ~ fname ~ ")) dll.getSymbol(\"" ~ object ~ "_" ~ fname ~ "\");\n";
res ~= "\t" ~ className ~ "_" ~ fname ~ " = " ~ "cast(typeof(" ~ className ~ "_" ~ fname ~ ")) dll.getSymbol(\"" ~ className ~ "_" ~ fname ~ "\");\n";
}
return res ~ "}\n";
}
string loadDerivedFromSharedLib(string base, string fname, string derived)
string loadDerivedFromSharedLib(S...)(string lib, string baseClass, string derivedClass, S fnames)
{
return base ~ "_" ~ fname ~ " = " ~ "cast(typeof(" ~ base ~ "_" ~ fname ~ ")) dll.getSymbol(\"" ~ derived ~ "_" ~ fname ~ "\");";
string res = `static this()
{
debug
DllLoader dll = DllLoader.load("` ~ lib ~ `-d");
else
DllLoader dll = DllLoader.load("` ~ lib ~ `");
`;
foreach(fname; fnames)
{
res ~= "\t" ~ baseClass ~ "_" ~ fname ~ " = " ~ "cast(typeof(" ~ baseClass ~ "_" ~ fname ~ ")) dll.getSymbol(\"" ~ derivedClass ~ "_" ~ fname ~ "\");";
}
return res ~ "}\n";
}
/**