remove proc.h

This commit is contained in:
Yuichi Nishiwaki 2016-02-19 00:56:56 +09:00
parent 8979b65b0c
commit 18b873f723
8 changed files with 48 additions and 58 deletions

View File

@ -276,8 +276,8 @@ pic_callcc_callcc(pic_state *pic)
}
}
#define pic_redefun(pic, lib, name, func) \
pic_set(pic, lib, name, pic_obj_value(pic_make_proc(pic, func, 0, NULL)))
#define pic_redefun(pic, lib, name, func) \
pic_set(pic, lib, name, pic_obj_value(pic_lambda(pic, func, 0)))
void
pic_init_callcc(pic_state *pic)

View File

@ -392,7 +392,7 @@ pic_init_srfi_106(pic_state *pic)
{
pic_deflibrary(pic, "srfi.106");
#define pic_defun_(pic, name, f) pic_define(pic, "srfi.106", name, pic_obj_value(pic_make_proc(pic, f, 0, NULL)))
#define pic_defun_(pic, name, f) pic_define(pic, "srfi.106", name, pic_obj_value(pic_lambda(pic, f, 0)))
#define pic_define_(pic, name, v) pic_define(pic, "srfi.106", name, v)
pic_defun_(pic, "socket?", pic_socket_socket_p);

View File

@ -3,6 +3,7 @@
*/
#include "picrin.h"
#include "picrin/object.h"
struct pic_string *
pic_get_backtrace(pic_state *pic)

View File

@ -3,6 +3,7 @@
*/
#include "picrin.h"
#include "picrin/object.h"
void
pic_panic(pic_state PIC_UNUSED(*pic), const char *msg)

View File

@ -264,7 +264,6 @@ int pic_str_hash(pic_state *, struct pic_string *);
#include "picrin/macro.h"
#include "picrin/pair.h"
#include "picrin/port.h"
#include "picrin/proc.h"
#include "picrin/record.h"
#include "picrin/symbol.h"

View File

@ -80,6 +80,48 @@ struct pic_data {
#define pic_data_ptr(o) ((struct pic_data *)pic_obj_ptr(o))
/* context */
struct pic_context {
PIC_OBJECT_HEADER
pic_value *regs;
int regc;
struct pic_context *up;
pic_value storage[1];
};
#define pic_context_ptr(o) ((struct pic_context *)pic_obj_ptr(o))
/* procedure */
struct pic_proc {
PIC_OBJECT_HEADER
enum {
PIC_PROC_TAG_IREP,
PIC_PROC_TAG_FUNC
} tag;
union {
struct {
pic_func_t func;
int localc;
} f;
struct {
struct pic_irep *irep;
struct pic_context *cxt;
} i;
} u;
pic_value locals[1];
};
#define pic_proc_ptr(o) ((struct pic_proc *)pic_obj_ptr(o))
#define pic_proc_func_p(proc) ((proc)->tag == PIC_PROC_TAG_FUNC)
#define pic_proc_irep_p(proc) ((proc)->tag == PIC_PROC_TAG_IREP)
struct pic_proc *pic_make_proc(pic_state *, pic_func_t, int, pic_value *);
struct pic_proc *pic_make_proc_irep(pic_state *, struct pic_irep *, struct pic_context *);
#if defined(__cplusplus)
}
#endif

View File

@ -1,54 +0,0 @@
/**
* See Copyright Notice in picrin.h
*/
#ifndef PICRIN_PROC_H
#define PICRIN_PROC_H
#if defined(__cplusplus)
extern "C" {
#endif
struct pic_context {
PIC_OBJECT_HEADER
pic_value *regs;
int regc;
struct pic_context *up;
pic_value storage[1];
};
struct pic_proc {
PIC_OBJECT_HEADER
enum {
PIC_PROC_TAG_IREP,
PIC_PROC_TAG_FUNC
} tag;
union {
struct {
pic_func_t func;
int localc;
} f;
struct {
struct pic_irep *irep;
struct pic_context *cxt;
} i;
} u;
pic_value locals[1];
};
#define pic_proc_func_p(proc) ((proc)->tag == PIC_PROC_TAG_FUNC)
#define pic_proc_irep_p(proc) ((proc)->tag == PIC_PROC_TAG_IREP)
#define pic_proc_ptr(o) ((struct pic_proc *)pic_obj_ptr(o))
#define pic_context_p(o) (pic_type(pic, o) == PIC_TYPE_CXT)
#define pic_context_ptr(o) ((struct pic_context *)pic_obj_ptr(o))
struct pic_proc *pic_make_proc(pic_state *, pic_func_t, int, pic_value *);
struct pic_proc *pic_make_proc_irep(pic_state *, struct pic_irep *, struct pic_context *);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -3,6 +3,7 @@
*/
#include "picrin.h"
#include "picrin/object.h"
KHASH_DEFINE(env, pic_id *, pic_sym *, kh_ptr_hash_func, kh_ptr_hash_equal)