diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-06-16 10:58:54 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-06-16 10:58:54 +0200 |
| commit | 02ce9adf6a9168ec66c322ce9e5a5cb9fe1e60a5 (patch) | |
| tree | d3385b1a1c915a74c373434032f0fe26e843854f /src | |
| parent | c04a283a7ab97903683f5f7268068aef69f5bddf (diff) | |
| download | nissy-core-02ce9adf6a9168ec66c322ce9e5a5cb9fe1e60a5.tar.gz nissy-core-02ce9adf6a9168ec66c322ce9e5a5cb9fe1e60a5.zip | |
Added rudimentary shell to run commands (ugly)
Diffstat (limited to 'src')
| -rw-r--r-- | src/cube.h | 24 | ||||
| -rw-r--r-- | src/cube_public.h | 20 |
2 files changed, 22 insertions, 22 deletions
| @@ -4,47 +4,47 @@ number in case of error, unless otherwise specified. See (TODO: | |||
| 4 | documentation) for details. | 4 | documentation) for details. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | int nissy_compose( | 7 | int64_t nissy_compose( |
| 8 | const char cube[static 22], | 8 | const char cube[static 22], |
| 9 | const char permutation[static 22], | 9 | const char permutation[static 22], |
| 10 | char result[static 22] | 10 | char result[static 22] |
| 11 | ); | 11 | ); |
| 12 | 12 | ||
| 13 | int nissy_inverse( | 13 | int64_t nissy_inverse( |
| 14 | const char cube[static 22], | 14 | const char cube[static 22], |
| 15 | char result[static 22] | 15 | char result[static 22] |
| 16 | ); | 16 | ); |
| 17 | 17 | ||
| 18 | int nissy_applyoves( | 18 | int64_t nissy_applymoves( |
| 19 | const char cube[static 22], | 19 | const char cube[static 22], |
| 20 | const char *moves, | 20 | const char *moves, |
| 21 | char result[static 22] | 21 | char result[static 22] |
| 22 | ); | 22 | ); |
| 23 | 23 | ||
| 24 | int nissy_applytrans( | 24 | int64_t nissy_applytrans( |
| 25 | const char cube[static 22], | 25 | const char cube[static 22], |
| 26 | const char *transformation, | 26 | const char *transformation, |
| 27 | char result[static 22] | 27 | char result[static 22] |
| 28 | ); | 28 | ); |
| 29 | 29 | ||
| 30 | int nissy_frommoves( | 30 | int64_t nissy_frommoves( |
| 31 | const char *moves, | 31 | const char *moves, |
| 32 | char result[static 22] | 32 | char result[static 22] |
| 33 | ); | 33 | ); |
| 34 | 34 | ||
| 35 | int nissy_readcube( | 35 | int64_t nissy_readcube( |
| 36 | const char *format, | 36 | const char *format, |
| 37 | const char *cube_string, | 37 | const char *cube_string, |
| 38 | char result[static 22] | 38 | char result[static 22] |
| 39 | ); | 39 | ); |
| 40 | 40 | ||
| 41 | int nissy_writecube( | 41 | int64_t nissy_writecube( |
| 42 | const char *format, | 42 | const char *format, |
| 43 | const char cube[static 22], | 43 | const char cube[static 22], |
| 44 | char *result | 44 | char *result |
| 45 | ); | 45 | ); |
| 46 | 46 | ||
| 47 | int nissy_convertcube( | 47 | int64_t nissy_convertcube( |
| 48 | const char *format_in, | 48 | const char *format_in, |
| 49 | const char *format_out, | 49 | const char *format_out, |
| 50 | const char *cube_string, | 50 | const char *cube_string, |
| @@ -58,13 +58,13 @@ slightly larger than the actual table size. | |||
| 58 | */ | 58 | */ |
| 59 | int64_t nissy_datasize( | 59 | int64_t nissy_datasize( |
| 60 | const char *solver, | 60 | const char *solver, |
| 61 | const char *options | 61 | const char *options /* TODO: remove options, use only solver name */ |
| 62 | ); | 62 | ); |
| 63 | 63 | ||
| 64 | /* Returns the number of bytes written, or -1 in case of error */ | 64 | /* Returns the number of bytes written, or -1 in case of error */ |
| 65 | int64_t nissy_gendata( | 65 | int64_t nissy_gendata( |
| 66 | const char *solver, | 66 | const char *solver, |
| 67 | const char *options, | 67 | const char *options, /* TODO: remove options, use only solver name */ |
| 68 | void *generated_data | 68 | void *generated_data |
| 69 | ); | 69 | ); |
| 70 | 70 | ||
| @@ -72,8 +72,8 @@ int64_t nissy_gendata( | |||
| 72 | int64_t nissy_solve( | 72 | int64_t nissy_solve( |
| 73 | const char cube[static 22], | 73 | const char cube[static 22], |
| 74 | const char *solver, | 74 | const char *solver, |
| 75 | const char *options, | 75 | const char *options, /* TODO: remove options, use only solver name */ |
| 76 | const char *nisstype, | 76 | const char *nisstype, /* TODO: remove, use flags */ |
| 77 | int8_t minmoves, | 77 | int8_t minmoves, |
| 78 | int8_t maxmoves, | 78 | int8_t maxmoves, |
| 79 | int64_t maxsolutions, | 79 | int64_t maxsolutions, |
diff --git a/src/cube_public.h b/src/cube_public.h index 01b6dac..65d5d54 100644 --- a/src/cube_public.h +++ b/src/cube_public.h | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | #include "cube.h" | 1 | #include "cube.h" |
| 2 | 2 | ||
| 3 | int write_result(cube_t, char [static 22]); | 3 | _static int64_t write_result(cube_t, char [static 22]); |
| 4 | 4 | ||
| 5 | int | 5 | _static int64_t |
| 6 | write_result(cube_t cube, char result[static 22]) | 6 | write_result(cube_t cube, char result[static 22]) |
| 7 | { | 7 | { |
| 8 | if (!isconsistent(cube)) { | 8 | if (!isconsistent(cube)) { |
| @@ -15,7 +15,7 @@ write_result(cube_t cube, char result[static 22]) | |||
| 15 | return issolvable(cube) ? 0 : 1; | 15 | return issolvable(cube) ? 0 : 1; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | int | 18 | int64_t |
| 19 | nissy_compose( | 19 | nissy_compose( |
| 20 | const char cube[static 22], | 20 | const char cube[static 22], |
| 21 | const char permutation[static 22], | 21 | const char permutation[static 22], |
| @@ -31,7 +31,7 @@ nissy_compose( | |||
| 31 | return write_result(res, result); | 31 | return write_result(res, result); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | int | 34 | int64_t |
| 35 | nissy_inverse( | 35 | nissy_inverse( |
| 36 | const char cube[static 22], | 36 | const char cube[static 22], |
| 37 | char result[static 22] | 37 | char result[static 22] |
| @@ -45,7 +45,7 @@ nissy_inverse( | |||
| 45 | return write_result(res, result); | 45 | return write_result(res, result); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | int | 48 | int64_t |
| 49 | nissy_applymoves( | 49 | nissy_applymoves( |
| 50 | const char cube[static 22], | 50 | const char cube[static 22], |
| 51 | const char *moves, | 51 | const char *moves, |
| @@ -60,7 +60,7 @@ nissy_applymoves( | |||
| 60 | return write_result(res, result); | 60 | return write_result(res, result); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | int | 63 | int64_t |
| 64 | nissy_applytrans( | 64 | nissy_applytrans( |
| 65 | const char cube[static 22], | 65 | const char cube[static 22], |
| 66 | const char *transformation, | 66 | const char *transformation, |
| @@ -75,7 +75,7 @@ nissy_applytrans( | |||
| 75 | return write_result(res, result); | 75 | return write_result(res, result); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | int | 78 | int64_t |
| 79 | nissy_frommoves( | 79 | nissy_frommoves( |
| 80 | const char *moves, | 80 | const char *moves, |
| 81 | char result[static 22] | 81 | char result[static 22] |
| @@ -88,7 +88,7 @@ nissy_frommoves( | |||
| 88 | return write_result(res, result); | 88 | return write_result(res, result); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | int | 91 | int64_t |
| 92 | nissy_readcube( | 92 | nissy_readcube( |
| 93 | const char *format, | 93 | const char *format, |
| 94 | const char *cube_string, | 94 | const char *cube_string, |
| @@ -102,7 +102,7 @@ nissy_readcube( | |||
| 102 | return write_result(res, result); | 102 | return write_result(res, result); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | int | 105 | int64_t |
| 106 | nissy_convertcube( | 106 | nissy_convertcube( |
| 107 | const char *format_in, | 107 | const char *format_in, |
| 108 | const char *format_out, | 108 | const char *format_out, |
| @@ -118,7 +118,7 @@ nissy_convertcube( | |||
| 118 | return isconsistent(c) ? 0 : 2; | 118 | return isconsistent(c) ? 0 : 2; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | int | 121 | int64_t |
| 122 | nissy_writecube( | 122 | nissy_writecube( |
| 123 | const char *format, | 123 | const char *format, |
| 124 | const char cube[static 22], | 124 | const char cube[static 22], |
