reg -> weak

This commit is contained in:
Yuichi Nishiwaki
2016-02-10 21:50:39 +09:00
parent 7b86c6d34e
commit b577b2d453
11 changed files with 130 additions and 130 deletions
+3 -3
View File
@@ -106,8 +106,8 @@ struct pic_state {
khash_t(s) oblist; /* string to symbol */
int ucnt;
struct pic_reg *globals;
struct pic_reg *macros;
struct pic_weak *globals;
struct pic_weak *macros;
pic_value libs;
struct pic_list ireps; /* chain */
@@ -246,7 +246,7 @@ pic_value pic_fdisplay(pic_state *, pic_value, xFILE *);
#include "picrin/string.h"
#include "picrin/symbol.h"
#include "picrin/vector.h"
#include "picrin/reg.h"
#include "picrin/weak.h"
#if defined(__cplusplus)
}
-34
View File
@@ -1,34 +0,0 @@
/**
* See Copyright Notice in picrin.h
*/
#ifndef PICRIN_REG_H
#define PICRIN_REG_H
#if defined(__cplusplus)
extern "C" {
#endif
KHASH_DECLARE(reg, void *, pic_value)
struct pic_reg {
PIC_OBJECT_HEADER
khash_t(reg) hash;
struct pic_reg *prev; /* for GC */
};
#define pic_reg_p(v) (pic_type(v) == PIC_TT_REG)
#define pic_reg_ptr(v) ((struct pic_reg *)pic_ptr(v))
struct pic_reg *pic_make_reg(pic_state *);
pic_value pic_reg_ref(pic_state *, struct pic_reg *, void *);
void pic_reg_set(pic_state *, struct pic_reg *, void *, pic_value);
void pic_reg_del(pic_state *, struct pic_reg *, void *);
bool pic_reg_has(pic_state *, struct pic_reg *, void *);
#if defined(__cplusplus)
}
#endif
#endif
+3 -3
View File
@@ -154,7 +154,7 @@ enum pic_tt {
PIC_TT_LIB,
PIC_TT_DATA,
PIC_TT_DICT,
PIC_TT_REG,
PIC_TT_WEAK,
PIC_TT_RECORD,
PIC_TT_CXT,
PIC_TT_CP
@@ -308,8 +308,8 @@ pic_type_repr(enum pic_tt tt)
return "data";
case PIC_TT_DICT:
return "dict";
case PIC_TT_REG:
return "reg";
case PIC_TT_WEAK:
return "weak";
case PIC_TT_RECORD:
return "record";
case PIC_TT_CP:
+34
View File
@@ -0,0 +1,34 @@
/**
* See Copyright Notice in picrin.h
*/
#ifndef PICRIN_WEAK_H
#define PICRIN_WEAK_H
#if defined(__cplusplus)
extern "C" {
#endif
KHASH_DECLARE(weak, void *, pic_value)
struct pic_weak {
PIC_OBJECT_HEADER
khash_t(weak) hash;
struct pic_weak *prev; /* for GC */
};
#define pic_weak_p(v) (pic_type(v) == PIC_TT_WEAK)
#define pic_weak_ptr(v) ((struct pic_weak *)pic_ptr(v))
struct pic_weak *pic_make_weak(pic_state *);
pic_value pic_weak_ref(pic_state *, struct pic_weak *, void *);
void pic_weak_set(pic_state *, struct pic_weak *, void *, pic_value);
void pic_weak_del(pic_state *, struct pic_weak *, void *);
bool pic_weak_has(pic_state *, struct pic_weak *, void *);
#if defined(__cplusplus)
}
#endif
#endif