add string type

This commit is contained in:
Yuichi Nishiwaki
2013-10-21 08:48:55 +09:00
parent cefa9a9885
commit 5e43fe58fe
6 changed files with 60 additions and 12 deletions
-2
View File
@@ -1,8 +1,6 @@
#ifndef PORT_H__
#define PORT_H__
#include "picrin.h"
enum pic_port_flag {
PIC_PORT_IN,
PIC_PORT_OUT,
+14
View File
@@ -0,0 +1,14 @@
#ifndef STRING_H__
#define STRING_H__
struct pic_string {
PIC_OBJECT_HEADER
const char *str;
size_t len;
};
#define pic_str_ptr(v) ((struct pic_string *)v.u.data)
pic_value pic_str_new_cstr(pic_state *, const char *);
#endif
+2 -1
View File
@@ -28,7 +28,8 @@ enum pic_tt {
PIC_TT_PAIR,
PIC_TT_SYMBOL,
PIC_TT_PROC,
PIC_TT_PORT
PIC_TT_PORT,
PIC_TT_STRING
};
#define PIC_OBJECT_HEADER \