aboutsummaryrefslogtreecommitdiff
path: root/cube.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-04-13 15:57:23 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-04-13 15:57:23 +0200
commita4598b740fe4b8350b7d09a575c793113c8fde2b (patch)
tree157cdb108564389ecdf1badae2501f890fc2a126 /cube.c
parent3ab2f98170908277f70191846e84e5dde185a056 (diff)
downloadcubecore-a4598b740fe4b8350b7d09a575c793113c8fde2b.tar.gz
cubecore-a4598b740fe4b8350b7d09a575c793113c8fde2b.zip
Some renaming, moved stuff around
Diffstat (limited to 'cube.c')
-rw-r--r--cube.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/cube.c b/cube.c
index f04d27d..ba65580 100644
--- a/cube.c
+++ b/cube.c
@@ -35,12 +35,12 @@ _static uint8_t readco(char *);
35_static uint8_t readcp(char *); 35_static uint8_t readcp(char *);
36_static uint8_t readeo(char *); 36_static uint8_t readeo(char *);
37_static uint8_t readep(char *); 37_static uint8_t readep(char *);
38_static cube_t readcube_H48(char *); 38_static cube_t read_H48(char *);
39_static uint8_t readpiece_LST(char **); 39_static uint8_t readpiece_LST(char **);
40_static cube_t readcube_LST(char *); 40_static cube_t read_LST(char *);
41_static int writepiece_LST(uint8_t, char *); 41_static int writepiece_LST(uint8_t, char *);
42_static void writecube_H48(cube_t, char *); 42_static void write_H48(cube_t, char *);
43_static void writecube_LST(cube_t, char *); 43_static void write_LST(cube_t, char *);
44_static uint8_t readmove(char); 44_static uint8_t readmove(char);
45_static uint8_t readmodifier(char); 45_static uint8_t readmodifier(char);
46_static uint8_t readtrans(char *); 46_static uint8_t readtrans(char *);
@@ -322,14 +322,14 @@ cube_coord_eo(cube_t c)
322} 322}
323 323
324cube_t 324cube_t
325readcube(char *format, char *buf) 325cube_read(char *format, char *buf)
326{ 326{
327 cube_t cube; 327 cube_t cube;
328 328
329 if (!strcmp(format, "H48")) { 329 if (!strcmp(format, "H48")) {
330 cube = readcube_H48(buf); 330 cube = read_H48(buf);
331 } else if (!strcmp(format, "LST")) { 331 } else if (!strcmp(format, "LST")) {
332 cube = readcube_LST(buf); 332 cube = read_LST(buf);
333 } else { 333 } else {
334 DBG_LOG("Cannot read cube in the given format\n"); 334 DBG_LOG("Cannot read cube in the given format\n");
335 cube = zero; 335 cube = zero;
@@ -339,29 +339,29 @@ readcube(char *format, char *buf)
339} 339}
340 340
341void 341void
342writecube(char *format, cube_t cube, char *buf) 342cube_write(char *format, cube_t cube, char *buf)
343{ 343{
344 char *errormsg; 344 char *errormsg;
345 size_t len; 345 size_t len;
346 346
347 if (!cube_consistent(cube)) { 347 if (!cube_consistent(cube)) {
348 errormsg = "ERROR: cannot write inconsistent cube"; 348 errormsg = "ERROR: cannot write inconsistent cube";
349 goto writecube_error; 349 goto write_error;
350 } 350 }
351 351
352 if (!strcmp(format, "H48")) { 352 if (!strcmp(format, "H48")) {
353 writecube_H48(cube, buf); 353 write_H48(cube, buf);
354 } else if (!strcmp(format, "LST")) { 354 } else if (!strcmp(format, "LST")) {
355 writecube_LST(cube, buf); 355 write_LST(cube, buf);
356 } else { 356 } else {
357 errormsg = "ERROR: cannot write cube in the given format"; 357 errormsg = "ERROR: cannot write cube in the given format";
358 goto writecube_error; 358 goto write_error;
359 } 359 }
360 360
361 return; 361 return;
362 362
363writecube_error: 363write_error:
364 DBG_LOG("writecube error, see stdout for details\n"); 364 DBG_LOG("cube_write error, see stdout for details\n");
365 len = strlen(errormsg); 365 len = strlen(errormsg);
366 memcpy(buf, errormsg, len); 366 memcpy(buf, errormsg, len);
367 buf[len] = '\n'; 367 buf[len] = '\n';
@@ -435,7 +435,7 @@ readep(char *str)
435} 435}
436 436
437_static cube_t 437_static cube_t
438readcube_H48(char *buf) 438read_H48(char *buf)
439{ 439{
440 int i; 440 int i;
441 uint8_t piece, orient; 441 uint8_t piece, orient;
@@ -488,7 +488,7 @@ readpiece_LST(char **b)
488} 488}
489 489
490_static cube_t 490_static cube_t
491readcube_LST(char *buf) 491read_LST(char *buf)
492{ 492{
493 int i; 493 int i;
494 cube_t ret = {0}; 494 cube_t ret = {0};
@@ -526,7 +526,7 @@ writepiece_LST(uint8_t piece, char *buf)
526} 526}
527 527
528_static void 528_static void
529writecube_H48(cube_t cube, char *buf) 529write_H48(cube_t cube, char *buf)
530{ 530{
531 uint8_t piece, perm, orient; 531 uint8_t piece, perm, orient;
532 int i; 532 int i;
@@ -555,7 +555,7 @@ writecube_H48(cube_t cube, char *buf)
555} 555}
556 556
557_static void 557_static void
558writecube_LST(cube_t cube, char *buf) 558write_LST(cube_t cube, char *buf)
559{ 559{
560 int i, ptr; 560 int i, ptr;
561 uint8_t piece; 561 uint8_t piece;

Generated with cgit - Back to sebastiano.tronto.net