don't include picrin/state.h by default
This commit is contained in:
parent
10aae770c9
commit
317369a914
|
@ -1,5 +1,6 @@
|
|||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
struct pic_fullcont {
|
||||
jmp_buf jmp;
|
||||
|
|
|
@ -53,7 +53,7 @@ EOL
|
|||
pic_catch {
|
||||
/* error! */
|
||||
xfputs(pic, "fatal error: failure in loading $dirname/$basename\\n", xstderr);
|
||||
pic_raise(pic, pic->err);
|
||||
pic_raise(pic, pic_err(pic));
|
||||
}
|
||||
EOL
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
struct pic_cont {
|
||||
PIC_JMPBUF *jmp;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
pic_value
|
||||
pic_get_backtrace(pic_state *pic)
|
||||
|
@ -36,16 +37,18 @@ pic_get_backtrace(pic_state *pic)
|
|||
void
|
||||
pic_print_backtrace(pic_state *pic, xFILE *file)
|
||||
{
|
||||
assert(! pic_invalid_p(pic, pic->err));
|
||||
pic_value err = pic_err(pic);
|
||||
|
||||
if (! pic_error_p(pic, pic->err)) {
|
||||
assert(! pic_invalid_p(pic, err));
|
||||
|
||||
if (! pic_error_p(pic, err)) {
|
||||
xfprintf(pic, file, "raise: ");
|
||||
pic_fwrite(pic, pic->err, file);
|
||||
pic_fwrite(pic, err, file);
|
||||
} else {
|
||||
struct pic_error *e;
|
||||
pic_value elem, it;
|
||||
|
||||
e = pic_error_ptr(pic, pic->err);
|
||||
e = pic_error_ptr(pic, err);
|
||||
if (! pic_eq_p(pic, pic_obj_value(e->type), pic_intern_lit(pic, ""))) {
|
||||
pic_fwrite(pic, pic_obj_value(e->type), file);
|
||||
xfprintf(pic, file, " ");
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
void
|
||||
pic_panic(pic_state PIC_UNUSED(*pic), const char *msg)
|
||||
|
@ -98,6 +99,12 @@ pic_pop_handler(pic_state *pic)
|
|||
return pic_obj_value(*--pic->xp);
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_err(pic_state *pic)
|
||||
{
|
||||
return pic->err;
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_make_error(pic_state *pic, const char *type, const char *msg, pic_value irrs)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/opcode.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
static pic_value
|
||||
optimize_beta(pic_state *pic, pic_value expr)
|
||||
|
@ -891,7 +892,7 @@ pic_eval(pic_state *pic, pic_value program, const char *lib)
|
|||
}
|
||||
pic_catch {
|
||||
pic_in_library(pic, prev_lib);
|
||||
pic_raise(pic, pic->err);
|
||||
pic_raise(pic, pic_err(pic));
|
||||
}
|
||||
pic_in_library(pic, prev_lib);
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
/**
|
||||
* See Copyright Notice in picrin.h
|
||||
*/
|
||||
|
||||
#include "picrin.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
#ifndef EOF
|
||||
# define EOF (-1)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
enum {
|
||||
WHITE = 0,
|
||||
|
|
|
@ -98,7 +98,6 @@ void pic_export(pic_state *, pic_value sym);
|
|||
|
||||
PIC_NORETURN void pic_panic(pic_state *, const char *msg);
|
||||
PIC_NORETURN void pic_errorf(pic_state *, const char *fmt, ...);
|
||||
PIC_NORETURN void pic_error(pic_state *, const char *type, const char *msg, pic_value irrs);
|
||||
PIC_NORETURN void pic_raise(pic_state *, pic_value v);
|
||||
|
||||
pic_value pic_lambda(pic_state *, pic_func_t f, int n, ...);
|
||||
|
@ -296,8 +295,6 @@ int xvfprintf(pic_state *, xFILE *fp, const char *fmt, va_list);
|
|||
/* extra stuff */
|
||||
|
||||
|
||||
#include "picrin/state.h"
|
||||
|
||||
void *pic_default_allocf(void *, void *, size_t);
|
||||
|
||||
#define pic_assert_type(pic, v, type) \
|
||||
|
@ -355,6 +352,8 @@ void pic_exit_point(pic_state *);
|
|||
|
||||
/* do not return from try block! */
|
||||
|
||||
pic_value pic_err(pic_state *);
|
||||
|
||||
#define pic_try \
|
||||
pic_try_(PIC_GENSYM(cont), PIC_GENSYM(handler))
|
||||
#define pic_catch \
|
||||
|
@ -376,6 +375,8 @@ void pic_exit_point(pic_state *);
|
|||
if (0) \
|
||||
label:
|
||||
|
||||
PIC_NORETURN void pic_error(pic_state *, const char *type, const char *msg, pic_value irrs);
|
||||
|
||||
#define pic_for_each(var, list, it) \
|
||||
for (it = (list); ! pic_nil_p(pic, it); it = pic_cdr(pic, it)) \
|
||||
if ((var = pic_car(pic, it)), true)
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "picrin/khash.h"
|
||||
|
||||
typedef struct pic_identifier pic_id;
|
||||
typedef pic_id pic_sym;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
KHASH_DEFINE(ltable, const char *, struct pic_lib, kh_str_hash_func, kh_str_cmp_func)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ pic_load_cstr(pic_state *pic, const char *str)
|
|||
}
|
||||
pic_catch {
|
||||
pic_close_port(pic, port);
|
||||
pic_raise(pic, pic->err);
|
||||
pic_raise(pic, pic_err(pic));
|
||||
}
|
||||
|
||||
pic_close_port(pic, port);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
KHASH_DEFINE(env, pic_id *, pic_sym *, kh_ptr_hash_func, kh_ptr_hash_equal)
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/file.h"
|
||||
|
||||
#undef EOF
|
||||
#define EOF (-1)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/opcode.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
#undef EOF
|
||||
#define EOF (-1)
|
||||
|
@ -852,7 +853,7 @@ pic_read_cstr(pic_state *pic, const char *str)
|
|||
}
|
||||
pic_catch {
|
||||
pic_close_port(pic, port);
|
||||
pic_raise(pic, pic->err);
|
||||
pic_raise(pic, pic_err(pic));
|
||||
}
|
||||
|
||||
pic_close_port(pic, port);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
static void
|
||||
pic_init_features(pic_state *pic)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
#define kh_pic_str_hash(a) (pic_str_hash(pic, pic_obj_value(a)))
|
||||
#define kh_pic_str_cmp(a, b) (pic_str_cmp(pic, pic_obj_value(a), pic_obj_value(b)) == 0)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
static pic_value
|
||||
var_get(pic_state *pic, pic_value var)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "picrin.h"
|
||||
#include "picrin/object.h"
|
||||
#include "picrin/state.h"
|
||||
|
||||
KHASH_DECLARE(l, void *, int)
|
||||
KHASH_DECLARE(v, void *, int)
|
||||
|
|
Loading…
Reference in New Issue