2013-10-20 04:26:18 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "picrin.h"
|
|
|
|
|
2013-10-20 05:17:12 -04:00
|
|
|
void
|
|
|
|
pic_error(pic_state *pic, const char *msg)
|
|
|
|
{
|
|
|
|
pic->errmsg = msg;
|
|
|
|
if (! pic->jmp) {
|
|
|
|
puts(msg);
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
longjmp(*pic->jmp, 1);
|
|
|
|
}
|
|
|
|
|
2013-11-17 03:23:13 -05:00
|
|
|
void
|
|
|
|
pic_errorf(pic_state *pic, const char *msg, size_t n, ...)
|
|
|
|
{
|
|
|
|
pic_error(pic, msg);
|
|
|
|
}
|
|
|
|
|
2013-10-20 04:26:18 -04:00
|
|
|
void
|
2013-10-20 04:41:48 -04:00
|
|
|
pic_abort(pic_state *pic, const char *msg)
|
2013-10-20 04:26:18 -04:00
|
|
|
{
|
2013-10-20 04:41:48 -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);
|
|
|
|
}
|