annotate Meerwald/bruyn_common.c @ 16:4987db85cfae

fix another scanf() warning
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Mon, 30 Jun 2008 21:03:40 +0200
parents be303a3f5ea8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
1 #include "bruyn_common.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
2
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
3 gray lookup_pattern(int pattern, int c, int r) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
4 #define A CATEGORY_A
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
5 #define B CATEGORY_B
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
6
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
7 gray pattern1[4][4] =
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
8 {{A, A, B, B},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
9 {A, A, B, B},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
10 {B, B, A, A},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
11 {B, B, A, A}};
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
12
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
13 gray pattern2[8][8] =
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
14 {{B, B, B, B, A, A, A, A},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
15 {B, B, B, B, A, A, A, A},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
16 {B, B, B, B, A, A, A, A},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
17 {B, B, B, B, A, A, A, A},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
18 {A, A, A, A, B, B, B, B},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
19 {A, A, A, A, B, B, B, B},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
20 {A, A, A, A, B, B, B, B},
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
21 {A, A, A, A, B, B, B, B}};
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
22
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
23 gray pattern3[2][2] =
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
24 {{A, B}, {B, A}};
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
25
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
26 #undef A
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
27 #undef B
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
28
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
29 switch (pattern) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
30 case 1:
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
31 return pattern1[r % 4][c % 4];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
32 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
33 case 2:
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
34 return pattern2[r % 8][c % 8];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
35 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
36 case 3:
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
37 return pattern3[r % 2][c % 2];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
38 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
39 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
40
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
41 return CATEGORY_VOID;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
42 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
43
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
44

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.