utils.c 712 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Part of Scheme 48 1.9. See file COPYING for notices and license.
  3. *
  4. * Authors: David Frese, Marcus Crestani, Robert Ransom
  5. */
  6. #include "utils.h"
  7. #include "gc_config.h"
  8. #include <stdarg.h>
  9. #include <stdlib.h>
  10. #include <assert.h>
  11. void s48_gc_error(const char* message, ...) {
  12. va_list args;
  13. va_start(args, message);
  14. fprintf(stderr, "gc: ");
  15. vfprintf(stderr, message, args);
  16. fprintf(stderr, "\n");
  17. va_end(args);
  18. abort();
  19. exit(-1);
  20. }
  21. #if (BIBOP_LOG)
  22. void s48_bibop_log(const char* message, ...) {
  23. FILE* prot;
  24. va_list args;
  25. prot = fopen("BIBOP_LOG", "a");
  26. va_start(args, message);
  27. vfprintf(prot, message, args);
  28. fprintf(prot, "\n");
  29. va_end(args);
  30. fclose(prot);
  31. }
  32. #endif