diff options
Diffstat (limited to 'cube.c')
| -rw-r--r-- | cube.c | 36 |
1 files changed, 18 insertions, 18 deletions
| @@ -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 | ||
| 324 | cube_t | 324 | cube_t |
| 325 | readcube(char *format, char *buf) | 325 | cube_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 | ||
| 341 | void | 341 | void |
| 342 | writecube(char *format, cube_t cube, char *buf) | 342 | cube_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 | ||
| 363 | writecube_error: | 363 | write_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 |
| 438 | readcube_H48(char *buf) | 438 | read_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 |
| 491 | readcube_LST(char *buf) | 491 | read_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 |
| 529 | writecube_H48(cube_t cube, char *buf) | 529 | write_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 |
| 558 | writecube_LST(cube_t cube, char *buf) | 558 | write_LST(cube_t cube, char *buf) |
| 559 | { | 559 | { |
| 560 | int i, ptr; | 560 | int i, ptr; |
| 561 | uint8_t piece; | 561 | uint8_t piece; |
