0
|
1 #!/usr/bin/python
|
|
2 #
|
|
3 # Copyright (c) 2007,2010 Daniel Adler <dadler@uni-goettingen.de>,
|
|
4 # Tassilo Philipp <tphilipp@potion-studios.com>
|
|
5 #
|
|
6 # Permission to use, copy, modify, and distribute this software for any
|
|
7 # purpose with or without fee is hereby granted, provided that the above
|
|
8 # copyright notice and this permission notice appear in all copies.
|
|
9 #
|
|
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
17 #
|
|
18
|
|
19 import sys
|
|
20
|
|
21 # parameters
|
|
22
|
|
23 nargs = 10
|
|
24
|
|
25 types = ["DCdouble","DCfloat"]
|
|
26 typeSigs = ["d" ,"f" ]
|
|
27
|
|
28 # generator
|
|
29
|
|
30 ntypes = len(types)
|
|
31
|
|
32 sys.stderr.write("/* auto generated by mkcase (on stderr) */\n");
|
|
33 sys.stderr.write("".join(["#define NARGS ",str(nargs),"\n"]))
|
|
34 sys.stderr.write("".join(["#define NTYPES ",str(ntypes),"\n"]))
|
|
35
|
|
36 def powerfact(x, n):
|
|
37 if n==0:
|
|
38 return 0
|
|
39 else:
|
|
40 return x**n+powerfact(x,n-1)
|
|
41
|
|
42 x = 0
|
|
43 end = powerfact(ntypes,nargs)+1
|
|
44
|
|
45 sys.stdout.write("/* auto generated by mkcase.py (on stdout) */\n");
|
|
46
|
|
47 while x < end:
|
|
48 args = [str(x)]
|
|
49 sig = ["f_"]
|
|
50 pos = 0
|
|
51 y = x
|
|
52 while y > 0:
|
|
53 s = (y-1) % ntypes
|
|
54 y = (y-1) / ntypes
|
|
55 args += [ types [s] ]
|
|
56 sig += [ typeSigs[s] ]
|
|
57 pos += 1
|
|
58 sig = "".join(sig)
|
|
59 args += [ sig ]
|
|
60 args = ",".join(args)
|
|
61 sys.stdout.write( "".join(["VF",str(pos),"(",args,")\n"]) )
|
|
62 x += 1
|
|
63
|