diff options
Diffstat (limited to 'src/cube_public.h')
| -rw-r--r-- | src/cube_public.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/cube_public.h b/src/cube_public.h index fe003c9..b537019 100644 --- a/src/cube_public.h +++ b/src/cube_public.h | |||
| @@ -2,6 +2,16 @@ | |||
| 2 | 2 | ||
| 3 | _static int64_t write_result(cube_t, char [static 22]); | 3 | _static int64_t write_result(cube_t, char [static 22]); |
| 4 | 4 | ||
| 5 | /* TODO: add option to get DR, maybe C-only, E-only, eo... */ | ||
| 6 | #define GETCUBE_OPTIONS(S, F) { .option = S, .fix = F } | ||
| 7 | struct { | ||
| 8 | char *option; | ||
| 9 | void (*fix)(int64_t *, int64_t *, int64_t *, int64_t *); | ||
| 10 | } getcube_options[] = { | ||
| 11 | GETCUBE_OPTIONS("fix", getcube_fix), | ||
| 12 | GETCUBE_OPTIONS(NULL, NULL) | ||
| 13 | }; | ||
| 14 | |||
| 5 | _static int64_t | 15 | _static int64_t |
| 6 | write_result(cube_t cube, char result[static 22]) | 16 | write_result(cube_t cube, char result[static 22]) |
| 7 | { | 17 | { |
| @@ -105,15 +115,25 @@ nissy_convert( | |||
| 105 | } | 115 | } |
| 106 | 116 | ||
| 107 | int64_t | 117 | int64_t |
| 108 | nissy_gencube( | 118 | nissy_getcube( |
| 109 | uint8_t id[16], | 119 | int64_t ep, |
| 120 | int64_t eo, | ||
| 121 | int64_t cp, | ||
| 122 | int64_t co, | ||
| 110 | const char *options, | 123 | const char *options, |
| 111 | char result[static 22] | 124 | char result[static 22] |
| 112 | ) | 125 | ) |
| 113 | { | 126 | { |
| 114 | /* TODO: compute cube from id % (number of positions) */ | 127 | int i; |
| 115 | /* options can be used for generating e.g. DR-state cube */ | 128 | cube_t c; |
| 116 | return -1; | 129 | |
| 130 | for (i = 0; getcube_options[i].option != NULL; i++) | ||
| 131 | if (!strcmp(options, getcube_options[i].option)) | ||
| 132 | getcube_options[i].fix(&ep, &eo, &cp, &co); | ||
| 133 | |||
| 134 | c = getcube(ep, eo, cp, co); | ||
| 135 | |||
| 136 | return write_result(c, result); | ||
| 117 | } | 137 | } |
| 118 | 138 | ||
| 119 | int64_t | 139 | int64_t |
