Rename string.split into string-split

By analogy to SRFI 140. TODO: Think about character delimiter.
This commit is contained in:
Lassi Kortela 2019-08-28 16:18:37 +03:00
parent 0763a5df44
commit b7db5bb755
3 changed files with 6 additions and 5 deletions

View File

@ -58,6 +58,7 @@ static struct builtin_procedure builtin_procedures[] = {
{ "string?", fl_stringp, SRFI_13 | R7RS_BASE | UP_2019 }, { "string?", fl_stringp, SRFI_13 | R7RS_BASE | UP_2019 },
{ "string-reverse", fl_string_reverse, SRFI_13 | UP_2019 }, { "string-reverse", fl_string_reverse, SRFI_13 | UP_2019 },
{ "string-split", builtin_string_split, UP_2019 },
{ "substring", fl_string_sub, R7RS_BASE | UP_2019 }, { "substring", fl_string_sub, R7RS_BASE | UP_2019 },
{ "environment-stack", builtin_environment_stack, UP_2019 }, { "environment-stack", builtin_environment_stack, UP_2019 },

View File

@ -1004,6 +1004,7 @@ value_t builtin_set_environment_variable(value_t *args, uint32_t nargs);
value_t fl_stringp(value_t *args, uint32_t nargs); value_t fl_stringp(value_t *args, uint32_t nargs);
value_t fl_string_reverse(value_t *args, uint32_t nargs); value_t fl_string_reverse(value_t *args, uint32_t nargs);
value_t builtin_string_split(value_t *args, uint32_t nargs);
value_t fl_string_sub(value_t *args, uint32_t nargs); value_t fl_string_sub(value_t *args, uint32_t nargs);
// util.c // util.c

View File

@ -162,16 +162,16 @@ value_t fl_string(value_t *args, uint32_t nargs)
return outp; return outp;
} }
value_t fl_string_split(value_t *args, uint32_t nargs) value_t builtin_string_split(value_t *args, uint32_t nargs)
{ {
char *s; char *s;
char *delim; char *delim;
size_t len, dlen, ssz, tokend, tokstart, i, junk; size_t len, dlen, ssz, tokend, tokstart, i, junk;
value_t first, c, last; value_t first, c, last;
argcount("string.split", nargs, 2); argcount("string-split", nargs, 2);
s = tostring(args[0], "string.split"); s = tostring(args[0], "string-split");
delim = tostring(args[1], "string.split"); delim = tostring(args[1], "string-split");
len = cv_len((struct cvalue *)ptr(args[0])); len = cv_len((struct cvalue *)ptr(args[0]));
dlen = cv_len((struct cvalue *)ptr(args[1])); dlen = cv_len((struct cvalue *)ptr(args[1]));
tokend = tokstart = i = 0; tokend = tokstart = i = 0;
@ -497,7 +497,6 @@ static struct builtinspec stringfunc_info[] = {
{ "string?", fl_stringp }, { "string?", fl_stringp },
{ "string.count", fl_string_count }, { "string.count", fl_string_count },
{ "string.width", fl_string_width }, { "string.width", fl_string_width },
{ "string.split", fl_string_split },
{ "string.sub", fl_string_sub }, { "string.sub", fl_string_sub },
{ "string.find", fl_string_find }, { "string.find", fl_string_find },
{ "string.char", fl_string_char }, { "string.char", fl_string_char },