add string?

This commit is contained in:
Yuichi Nishiwaki 2013-11-17 17:42:52 +09:00
parent 70357d7b7b
commit 5ffb4eb6c9
2 changed files with 18 additions and 0 deletions

View File

@ -18,6 +18,7 @@ void pic_init_blob(pic_state *);
void pic_init_cont(pic_state *);
void pic_init_char(pic_state *);
void pic_init_error(pic_state *);
void pic_init_str(pic_state *);
void
pic_load_stdlib(pic_state *pic)
@ -85,6 +86,7 @@ pic_init_core(pic_state *pic)
pic_init_cont(pic); DONE;
pic_init_char(pic); DONE;
pic_init_error(pic); DONE;
pic_init_str(pic); DONE;
pic_load_stdlib(pic); DONE;
}

View File

@ -22,3 +22,19 @@ pic_str_new_cstr(pic_state *pic, const char *cstr)
len = strlen(cstr);
return pic_str_new(pic, cstr, len);
}
static pic_value
pic_str_string_p(pic_state *pic)
{
pic_value v;
pic_get_args(pic, "o", &v);
return pic_bool_value(pic_str_p(v));
}
void
pic_init_str(pic_state *pic)
{
pic_defun(pic, "string?", pic_str_string_p);
}