From 114d6b708b2ef6344d878b42220a44dcc7e004cd Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 21 Oct 2013 17:38:05 +0900 Subject: [PATCH] since pic_string is a first-class value, move it to value.h --- include/picrin/string.h | 12 ------------ include/picrin/value.h | 7 +++++++ src/gc.c | 1 - src/port.c | 1 - src/string.c | 1 - src/vm.c | 1 - 6 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 include/picrin/string.h diff --git a/include/picrin/string.h b/include/picrin/string.h deleted file mode 100644 index fa64b6de..00000000 --- a/include/picrin/string.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef STRING_H__ -#define STRING_H__ - -struct pic_string { - PIC_OBJECT_HEADER - char *str; - size_t len; -}; - -#define pic_str_ptr(v) ((struct pic_string *)v.u.data) - -#endif diff --git a/include/picrin/value.h b/include/picrin/value.h index 212466e0..2dcf3673 100644 --- a/include/picrin/value.h +++ b/include/picrin/value.h @@ -50,12 +50,19 @@ struct pic_symbol { char *name; }; +struct pic_string { + PIC_OBJECT_HEADER + char *str; + size_t len; +}; + struct pic_proc; struct pic_port; #define pic_obj_ptr(o) ((struct pic_object *)o.u.data) #define pic_pair_ptr(o) ((struct pic_pair *)o.u.data) #define pic_symbol_ptr(o) ((struct pic_symbol *)o.u.data) +#define pic_str_ptr(v) ((struct pic_string *)v.u.data) enum pic_tt pic_type(pic_value); diff --git a/src/gc.c b/src/gc.c index c977a91c..6a59179a 100644 --- a/src/gc.c +++ b/src/gc.c @@ -4,7 +4,6 @@ #include "picrin/gc.h" #include "picrin/irep.h" #include "picrin/proc.h" -#include "picrin/string.h" #include "picrin/symbol.h" #if GC_DEBUG diff --git a/src/port.c b/src/port.c index d6de83d6..e41edbf0 100644 --- a/src/port.c +++ b/src/port.c @@ -4,7 +4,6 @@ #include "picrin.h" #include "picrin/proc.h" #include "picrin/port.h" -#include "picrin/string.h" static void write_pair(pic_state *pic, struct pic_pair *pair); static void write_str(pic_state *pic, struct pic_string *str); diff --git a/src/string.c b/src/string.c index 896ebf12..09806b25 100644 --- a/src/string.c +++ b/src/string.c @@ -1,7 +1,6 @@ #include #include "picrin.h" -#include "picrin/string.h" pic_value pic_str_new(pic_state *pic, const char *cstr, size_t len) diff --git a/src/vm.c b/src/vm.c index 30d64f79..046c3624 100644 --- a/src/vm.c +++ b/src/vm.c @@ -5,7 +5,6 @@ #include "picrin/pair.h" #include "picrin/proc.h" #include "picrin/irep.h" -#include "picrin/string.h" #define GET_OPERAND(pic,n) ((pic)->sp[-1-(n)])