since pic_string is a first-class value, move it to value.h

This commit is contained in:
Yuichi Nishiwaki 2013-10-21 17:38:05 +09:00
parent f5154625ba
commit 114d6b708b
6 changed files with 7 additions and 16 deletions

View File

@ -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

View File

@ -50,12 +50,19 @@ struct pic_symbol {
char *name; char *name;
}; };
struct pic_string {
PIC_OBJECT_HEADER
char *str;
size_t len;
};
struct pic_proc; struct pic_proc;
struct pic_port; struct pic_port;
#define pic_obj_ptr(o) ((struct pic_object *)o.u.data) #define pic_obj_ptr(o) ((struct pic_object *)o.u.data)
#define pic_pair_ptr(o) ((struct pic_pair *)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_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); enum pic_tt pic_type(pic_value);

View File

@ -4,7 +4,6 @@
#include "picrin/gc.h" #include "picrin/gc.h"
#include "picrin/irep.h" #include "picrin/irep.h"
#include "picrin/proc.h" #include "picrin/proc.h"
#include "picrin/string.h"
#include "picrin/symbol.h" #include "picrin/symbol.h"
#if GC_DEBUG #if GC_DEBUG

View File

@ -4,7 +4,6 @@
#include "picrin.h" #include "picrin.h"
#include "picrin/proc.h" #include "picrin/proc.h"
#include "picrin/port.h" #include "picrin/port.h"
#include "picrin/string.h"
static void write_pair(pic_state *pic, struct pic_pair *pair); static void write_pair(pic_state *pic, struct pic_pair *pair);
static void write_str(pic_state *pic, struct pic_string *str); static void write_str(pic_state *pic, struct pic_string *str);

View File

@ -1,7 +1,6 @@
#include <string.h> #include <string.h>
#include "picrin.h" #include "picrin.h"
#include "picrin/string.h"
pic_value pic_value
pic_str_new(pic_state *pic, const char *cstr, size_t len) pic_str_new(pic_state *pic, const char *cstr, size_t len)

View File

@ -5,7 +5,6 @@
#include "picrin/pair.h" #include "picrin/pair.h"
#include "picrin/proc.h" #include "picrin/proc.h"
#include "picrin/irep.h" #include "picrin/irep.h"
#include "picrin/string.h"
#define GET_OPERAND(pic,n) ((pic)->sp[-1-(n)]) #define GET_OPERAND(pic,n) ((pic)->sp[-1-(n)])