since pic_string is a first-class value, move it to value.h
This commit is contained in:
parent
f5154625ba
commit
114d6b708b
|
@ -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
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
1
src/gc.c
1
src/gc.c
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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)
|
||||||
|
|
1
src/vm.c
1
src/vm.c
|
@ -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)])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue