#define MAXSTRINGLEN ( 1024 ) /* chop string to list of single character strings */ static fe_Object* chop(fe_Context *ctx, fe_Object *args) { char buf[MAXSTRINGLEN]; int len = fe_tostring(ctx, fe_nextarg(ctx, &args), buf, sizeof(buf)); int gc = fe_savegc(ctx); args = fe_bool(ctx, 0); while (len > 0) { buf[len--] = '\0'; args = fe_cons(ctx, fe_string(ctx, buf + len), args); fe_restoregc(ctx, gc); fe_pushgc(ctx, args); } return args; } /* pack list of strings to single string */ static fe_Object* pack(fe_Context *ctx, fe_Object *args) { char buf[MAXSTRINGLEN], *ptr = buf; for (args = fe_nextarg(ctx, &args); !fe_isnil(ctx, args);) { ptr += fe_tostring(ctx, fe_nextarg(ctx, &args), ptr, buf + sizeof(buf) - ptr); } return fe_string(ctx, buf); }