diff --git a/src/init.c b/src/init.c index 20a44e39..19f72790 100644 --- a/src/init.c +++ b/src/init.c @@ -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; } diff --git a/src/string.c b/src/string.c index 9f0ce59a..6ca24534 100644 --- a/src/string.c +++ b/src/string.c @@ -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); +}