Utility library for providing native functionality to the Squirrel environment.
src/make_binders.py@0:a9a5c12f2d30, 2014-12-16 (annotated)
- Committer:
- jhnwkmn
- Date:
- Tue Dec 16 08:15:55 2014 +0000
- Revision:
- 0:a9a5c12f2d30
Initial import of sqbind 0.99
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jhnwkmn | 0:a9a5c12f2d30 | 1 | # python sure is better for this kind of stuff |
jhnwkmn | 0:a9a5c12f2d30 | 2 | |
jhnwkmn | 0:a9a5c12f2d30 | 3 | versions=7 |
jhnwkmn | 0:a9a5c12f2d30 | 4 | |
jhnwkmn | 0:a9a5c12f2d30 | 5 | f=file("template.txt") |
jhnwkmn | 0:a9a5c12f2d30 | 6 | code=f.read() |
jhnwkmn | 0:a9a5c12f2d30 | 7 | |
jhnwkmn | 0:a9a5c12f2d30 | 8 | |
jhnwkmn | 0:a9a5c12f2d30 | 9 | # make the version version first |
jhnwkmn | 0:a9a5c12f2d30 | 10 | |
jhnwkmn | 0:a9a5c12f2d30 | 11 | version=code |
jhnwkmn | 0:a9a5c12f2d30 | 12 | version=version.replace(",$class","") |
jhnwkmn | 0:a9a5c12f2d30 | 13 | version=version.replace("$class,","") |
jhnwkmn | 0:a9a5c12f2d30 | 14 | version=version.replace("$class","") |
jhnwkmn | 0:a9a5c12f2d30 | 15 | version=version.replace("$count","0") |
jhnwkmn | 0:a9a5c12f2d30 | 16 | version=version.replace("$params","") |
jhnwkmn | 0:a9a5c12f2d30 | 17 | version=version.replace(",$paramnames","") |
jhnwkmn | 0:a9a5c12f2d30 | 18 | version=version.replace("$paramnames,","") |
jhnwkmn | 0:a9a5c12f2d30 | 19 | version=version.replace("$paramnames","") |
jhnwkmn | 0:a9a5c12f2d30 | 20 | version=version.replace("$arguments","") |
jhnwkmn | 0:a9a5c12f2d30 | 21 | version=version.replace("template<>",""); |
jhnwkmn | 0:a9a5c12f2d30 | 22 | version=version.replace("<>",""); |
jhnwkmn | 0:a9a5c12f2d30 | 23 | |
jhnwkmn | 0:a9a5c12f2d30 | 24 | print("/////////////////////") |
jhnwkmn | 0:a9a5c12f2d30 | 25 | print("// SqBind 0 arguments ") |
jhnwkmn | 0:a9a5c12f2d30 | 26 | print("/////////////////////") |
jhnwkmn | 0:a9a5c12f2d30 | 27 | |
jhnwkmn | 0:a9a5c12f2d30 | 28 | print(version) |
jhnwkmn | 0:a9a5c12f2d30 | 29 | |
jhnwkmn | 0:a9a5c12f2d30 | 30 | for n in range(1,versions): |
jhnwkmn | 0:a9a5c12f2d30 | 31 | |
jhnwkmn | 0:a9a5c12f2d30 | 32 | classes="" |
jhnwkmn | 0:a9a5c12f2d30 | 33 | params="" |
jhnwkmn | 0:a9a5c12f2d30 | 34 | paramnames="" |
jhnwkmn | 0:a9a5c12f2d30 | 35 | arguments="" |
jhnwkmn | 0:a9a5c12f2d30 | 36 | |
jhnwkmn | 0:a9a5c12f2d30 | 37 | for i in range(1,n+1): |
jhnwkmn | 0:a9a5c12f2d30 | 38 | cm="" |
jhnwkmn | 0:a9a5c12f2d30 | 39 | pt="" |
jhnwkmn | 0:a9a5c12f2d30 | 40 | if(i>1): |
jhnwkmn | 0:a9a5c12f2d30 | 41 | cm=", " |
jhnwkmn | 0:a9a5c12f2d30 | 42 | pt="\t" |
jhnwkmn | 0:a9a5c12f2d30 | 43 | |
jhnwkmn | 0:a9a5c12f2d30 | 44 | classes+=cm+"class P"+str(i) |
jhnwkmn | 0:a9a5c12f2d30 | 45 | params+=pt+"SqCParam<P"+str(i)+"> p"+str(i)+";\n" |
jhnwkmn | 0:a9a5c12f2d30 | 46 | paramnames+=cm+"P"+str(i) |
jhnwkmn | 0:a9a5c12f2d30 | 47 | arguments+=cm+"p"+str(i)+".getter.get(v,"+str(i+1)+")" |
jhnwkmn | 0:a9a5c12f2d30 | 48 | |
jhnwkmn | 0:a9a5c12f2d30 | 49 | count=str(n) |
jhnwkmn | 0:a9a5c12f2d30 | 50 | |
jhnwkmn | 0:a9a5c12f2d30 | 51 | version=code |
jhnwkmn | 0:a9a5c12f2d30 | 52 | version=version.replace("$class",classes) |
jhnwkmn | 0:a9a5c12f2d30 | 53 | version=version.replace("$count",count) |
jhnwkmn | 0:a9a5c12f2d30 | 54 | version=version.replace("$params",params) |
jhnwkmn | 0:a9a5c12f2d30 | 55 | version=version.replace("$paramnames",paramnames) |
jhnwkmn | 0:a9a5c12f2d30 | 56 | version=version.replace("$arguments",arguments) |
jhnwkmn | 0:a9a5c12f2d30 | 57 | |
jhnwkmn | 0:a9a5c12f2d30 | 58 | print("/////////////////////") |
jhnwkmn | 0:a9a5c12f2d30 | 59 | print("// SqBind "+str(i)+" arguments ") |
jhnwkmn | 0:a9a5c12f2d30 | 60 | print("/////////////////////") |
jhnwkmn | 0:a9a5c12f2d30 | 61 | |
jhnwkmn | 0:a9a5c12f2d30 | 62 | print(version) |
jhnwkmn | 0:a9a5c12f2d30 | 63 | |
jhnwkmn | 0:a9a5c12f2d30 | 64 |