3. Janet Print + Prin

<<static_funcdefs>>=
static Janet cfun_io_print(int32_t argc, Janet *argv);
static Janet cfun_io_prin(int32_t argc, Janet *argv);
<<functions>>=
static Janet cfun_io_print(int32_t argc, Janet *argv)
{
    int32_t len;
    int32_t i;
    weewiki_d *ww;

    ww = weewiki_get();
    for (i = 0; i < argc; ++i) {
        const uint8_t *vstr = janet_to_string(argv[i]);
        len = janet_string_length(vstr);
        weewiki_print(ww, (const char *)vstr, len);
    }
    weewiki_print(ww, "\n", 1);
    return janet_wrap_nil();
}

static Janet cfun_io_prin(int32_t argc, Janet *argv)
{
    int32_t len;
    int32_t i;
    weewiki_d *ww;

    ww = weewiki_get();
    for (i = 0; i < argc; ++i) {
        const uint8_t *vstr = janet_to_string(argv[i]);
        len = janet_string_length(vstr);
        weewiki_print(ww, (const char *)vstr, len);
    }
    return janet_wrap_nil();
}



prev | home | next