Utility library for providing native functionality to the Squirrel environment.
Diff: src/make_binders.py
- Revision:
- 0:a9a5c12f2d30
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/make_binders.py Tue Dec 16 08:15:55 2014 +0000 @@ -0,0 +1,64 @@ +# python sure is better for this kind of stuff + +versions=7 + +f=file("template.txt") +code=f.read() + + +# make the version version first + +version=code +version=version.replace(",$class","") +version=version.replace("$class,","") +version=version.replace("$class","") +version=version.replace("$count","0") +version=version.replace("$params","") +version=version.replace(",$paramnames","") +version=version.replace("$paramnames,","") +version=version.replace("$paramnames","") +version=version.replace("$arguments","") +version=version.replace("template<>",""); +version=version.replace("<>",""); + +print("/////////////////////") +print("// SqBind 0 arguments ") +print("/////////////////////") + +print(version) + +for n in range(1,versions): + + classes="" + params="" + paramnames="" + arguments="" + + for i in range(1,n+1): + cm="" + pt="" + if(i>1): + cm=", " + pt="\t" + + classes+=cm+"class P"+str(i) + params+=pt+"SqCParam<P"+str(i)+"> p"+str(i)+";\n" + paramnames+=cm+"P"+str(i) + arguments+=cm+"p"+str(i)+".getter.get(v,"+str(i+1)+")" + + count=str(n) + + version=code + version=version.replace("$class",classes) + version=version.replace("$count",count) + version=version.replace("$params",params) + version=version.replace("$paramnames",paramnames) + version=version.replace("$arguments",arguments) + + print("/////////////////////") + print("// SqBind "+str(i)+" arguments ") + print("/////////////////////") + + print(version) + +