-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
69 lines (55 loc) · 1.46 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
_/_/_/ _/_/_/ _/_/_/_/_/
_/ _/ _/
_/ _/ _/
_/ _/ _/
_/_/_/ _/_/_/ _/
Fast and efficient Python based templating
language designed for generating source code.
Usage: cct [-E] [-ilevel] [-Idir(s)] [-v] [-o outfile] file.c.t
-E stops at first phase, leaves python script
-i sets indenntation depth, default is 4
-I adds include search pats
-o sets output file name
-v sets verbose mode
-h prints help
Some example inputs:
To generate a table of prime numbers
--------------------------------------------
#ifndef PRIMES_H
#define PRIMES_H
@ from math import sqrt
@ max_prime = 1000
unsigned int primes[] = {
2,
@ for i in range(3, max_prime+1,2):
@ is_prime = True
@ for j in range(3, int(sqrt(i))):
@ if i % j == 0:
@ is_prime = False
@ break
@ if is_prime:
{{ i }},
@ end
@ end
};
#endif /* PRIMES_H */
-------------------------------------------
To generate simple box image filter
-------------------------------------------
@ def sum(arr):
{{ arr }}_out[x][y] = 0;
@ for i in ['- 1', '+ 0', '+ 1']:
@ for j in ['- 1', '+ 0', '+ 1']:
{{ arr }}_out[x][y] += {{ arr }}[x {{ i }}][y {{ j }}];
@ end
@ end
{{ arr }}_out[x][y] /= 9;
@ end
for (x = 1; x < w - 1; x++) {
for (y = 1; y < h - 1; y++) {
{@ sum('R') @}
{@ sum('G') @}
{@ sum('B') @}
}
}
-------------------------------------------