aboutsummaryrefslogtreecommitdiff
path: root/src/nissy.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-10-13 15:37:02 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-10-13 15:37:02 +0200
commit7dbd34574f629cacf3b89292d2a06ad0ae612f26 (patch)
treee1832627d897eed10e3e300853f667aa00bcb635 /src/nissy.c
parentee129a671620de49a5477b1e84bfcd110c522831 (diff)
downloadnissy-core-7dbd34574f629cacf3b89292d2a06ad0ae612f26.tar.gz
nissy-core-7dbd34574f629cacf3b89292d2a06ad0ae612f26.zip
Removed nissy_explainerror and moved datainfo to tools
Diffstat (limited to 'src/nissy.c')
-rw-r--r--src/nissy.c144
1 files changed, 0 insertions, 144 deletions
diff --git a/src/nissy.c b/src/nissy.c
index d5d0270..6b083e0 100644
--- a/src/nissy.c
+++ b/src/nissy.c
@@ -571,149 +571,5 @@ nissy_setlogger(
571) 571)
572{ 572{
573 nissy_log = log; 573 nissy_log = log;
574
575 if (log == NULL)
576 return NISSY_WARNING_NULL_CALLBACK;
577
578 return NISSY_OK; 574 return NISSY_OK;
579} 575}
580
581int64_t
582nissy_explainerror(
583 int64_t error_code,
584 void (*write)(const char *, ...)
585)
586{
587 if (write == NULL)
588 return NISSY_WARNING_NULL_CALLBACK;
589
590 switch (error_code) {
591 case NISSY_OK:
592 write(
593 "The value %" PRId64 " denotes a success.\n"
594 "If returned by solve, it means that no solutions has "
595 "been found.\n", NISSY_OK
596 );
597 return NISSY_OK;
598 case NISSY_WARNING_UNSOLVABLE:
599 write(
600 "The value %" PRId64 " is a warning. It means that the "
601 "operation was completed succesfully, but the resulting "
602 "cube is in an unsolvable state. This could be intended, "
603 "for example if the user has provided an unsolvable cube "
604 "as input.\n", NISSY_WARNING_UNSOLVABLE
605 );
606 return NISSY_OK;
607 case NISSY_WARNING_NULL_CALLBACK:
608 write(
609 "The value %" PRId64 " is a warning. It means that the "
610 "provided pointer to a writer function is NULL.\n"
611 "If returned by nissy_setlogger, it means that any future "
612 "log messages will not be printed.\n",
613 NISSY_WARNING_NULL_CALLBACK
614 );
615 return NISSY_OK;
616 case NISSY_ERROR_INVALID_CUBE:
617 write(
618 "The value %" PRId64 " means that the provided cube is "
619 "invalid. It could be written in an unknown format, or "
620 "in a format different from what specified, or simply "
621 "ill-formed.\n", NISSY_ERROR_INVALID_CUBE
622 );
623 return NISSY_OK;
624 case NISSY_ERROR_UNSOLVABLE_CUBE:
625 write(
626 "The value %" PRId64 " means that the provided cube is "
627 "in an unsolvable state.\n", NISSY_ERROR_INVALID_CUBE
628 );
629 return NISSY_OK;
630 case NISSY_ERROR_INVALID_MOVES:
631 write(
632 "The value %" PRId64 " means that the given moves are "
633 "invalid.\n", NISSY_ERROR_INVALID_MOVES
634 );
635 return NISSY_OK;
636 case NISSY_ERROR_INVALID_TRANS:
637 write(
638 "The value %" PRId64 " means that the given transformation "
639 "is invalid.\n", NISSY_ERROR_INVALID_TRANS
640 );
641 return NISSY_OK;
642 case NISSY_ERROR_INVALID_FORMAT:
643 write(
644 "The value %" PRId64 " means that the given format is not "
645 "known.\n", NISSY_ERROR_INVALID_FORMAT
646 );
647 return NISSY_OK;
648 case NISSY_ERROR_INVALID_SOLVER:
649 write(
650 "The value %" PRId64 " means that the given solver is not "
651 "known.\n", NISSY_ERROR_INVALID_SOLVER
652 );
653 return NISSY_OK;
654 case NISSY_ERROR_NULL_POINTER:
655 write(
656 "The value %" PRId64 " means that one of the provided "
657 "pointer arguments is NULL. For example, it may be "
658 "returned by solve when called with a solver that "
659 "requires some pre-computed data, but the provided data "
660 "is NULL.\n", NISSY_ERROR_NULL_POINTER
661 );
662 return NISSY_OK;
663 case NISSY_ERROR_BUFFER_SIZE:
664 write(
665 "The value %" PRId64 " means that one of the buffers "
666 "provided is too small. For example, it could be too "
667 "small to hold the result or too small to hold the data "
668 "generated by gendata.\n", NISSY_ERROR_BUFFER_SIZE
669 );
670 return NISSY_OK;
671 case NISSY_ERROR_DATA:
672 write(
673 "The value %" PRId64 " means that the provided data is "
674 "invalid. For example, it may be returned by solve when "
675 "called with incompatible solver and data arguments.\n",
676 NISSY_ERROR_DATA
677 );
678 return NISSY_OK;
679 case NISSY_ERROR_OPTIONS:
680 write(
681 "The value %" PRId64 " means that one or more of the "
682 "given options are invalid. For example, it may be "
683 "returned by solve when called with a negative maximum "
684 "number of solutions.\n", NISSY_ERROR_OPTIONS
685 );
686 return NISSY_OK;
687 case NISSY_ERROR_INVALID_CODE:
688 write(
689 "The value %" PRId64 " means that the given error code "
690 "is not known. It may be returned by explainerror.\n",
691 NISSY_ERROR_INVALID_CODE
692 );
693 return NISSY_OK;
694 case NISSY_ERROR_UNKNOWN:
695 write(
696 "The value %" PRId64 " denotes an unexpected error. It "
697 "probably means that there some bug in this library.\n"
698 "If you can, report any error of this kind to "
699 "sebastiano@tronto.net. Thanks!\n", NISSY_ERROR_UNKNOWN
700 );
701 return NISSY_OK;
702 default:
703 break;
704 }
705
706 if (error_code > 0) {
707 write(
708 "A positive return values does not denote an error\n"
709 "If returned by gendata or datasize, it denotes the size "
710 "of the data, in bytes\n"
711 "If returned by solve, it denotes the number of solutions "
712 "found.\n"
713 );
714 return NISSY_OK;
715 } else {
716 write("Unknown error code %" PRId64 "\n", error_code);
717 return NISSY_ERROR_INVALID_CODE;
718 }
719}

Generated with cgit - Back to sebastiano.tronto.net