picrin/src/error.c

29 lines
378 B
C
Raw Normal View History

2013-10-20 04:26:18 -04:00
#include <stdlib.h>
#include <stdio.h>
#include "picrin.h"
void
pic_error(pic_state *pic, const char *msg)
{
pic->errmsg = msg;
if (! pic->jmp) {
puts(msg);
abort();
}
longjmp(*pic->jmp, 1);
}
2013-10-20 04:26:18 -04:00
void
pic_abort(pic_state *pic, const char *msg)
2013-10-20 04:26:18 -04:00
{
puts(msg);
2013-10-20 04:26:18 -04:00
abort();
}
2013-10-24 09:29:40 -04:00
void
pic_warn(pic_state *pic, const char *msg)
{
fprintf(stderr, "warn: %s\n", msg);
}