diff options
-rw-r--r-- | combi.c | 16 | ||||
-rw-r--r-- | eval.c | 30 | ||||
-rw-r--r-- | eval.h | 2 | ||||
-rw-r--r-- | filter.c | 2 | ||||
-rw-r--r-- | lib.c | 24 | ||||
-rw-r--r-- | lib.h | 8 | ||||
-rw-r--r-- | parser.y | 2 | ||||
-rw-r--r-- | txr.1 | 27 |
8 files changed, 69 insertions, 42 deletions
@@ -164,7 +164,7 @@ static val perm_list(val p, val k) if (k == zero || (!k && !p)) { return cons(nil, nil); } else { - val state = perm_init_common(vector_list(p), k); + val state = perm_init_common(vec_list(p), k); if (!state) return nil; return generate(func_f0(state, perm_while_fun), @@ -193,7 +193,7 @@ static val perm_str(val p, val k) if (k == zero) { return cons(string(L""), nil); } else { - val state = perm_init_common(vector_list(list_str(p)), k); + val state = perm_init_common(vec_list(list_str(p)), k); if (!state) return nil; return generate(func_f0(state, perm_while_fun), @@ -268,12 +268,12 @@ static val rperm_list(val list, val k) static val rperm_vec_gen_fun(val env) { val list = rperm_gen_fun(env); - return vector_list(list); + return vec_list(list); } static val rperm_vec(val ve, val k) { - val list = list_vector(ve); + val list = list_vec(ve); val vec = vector(k, list); val env = cons(list, vec); return generate(func_f0(env, rperm_while_fun), @@ -400,7 +400,7 @@ static val comb_vec_gen_fun(val state) static val comb_vec(val vec, val k) { - val state = nreverse(k_conses(list_vector(vec), k)); + val state = nreverse(k_conses(list_vec(vec), k)); return generate(func_f0(state, comb_while_fun), func_f0(state, comb_vec_gen_fun)); } @@ -537,7 +537,7 @@ static val rcomb_list_gen_fun(val state) static val rcomb_list(val list, val k) { - val state = nreverse(list_vector(vector(k, list))); + val state = nreverse(list_vec(vector(k, list))); return generate(func_f0(state, rcomb_while_fun), func_f0(state, rcomb_list_gen_fun)); } @@ -557,7 +557,7 @@ static val rcomb_vec_gen_fun(val state) static val rcomb_vec(val vec, val k) { - val state = nreverse(list_vector(vector(k, list_vector(vec)))); + val state = nreverse(list_vec(vector(k, list_vec(vec)))); return generate(func_f0(state, rcomb_while_fun), func_f0(state, rcomb_vec_gen_fun)); } @@ -579,7 +579,7 @@ static val rcomb_str_gen_fun(val state) static val rcomb_str(val str, val k) { - val state = nreverse(list_vector(vector(k, list_str(str)))); + val state = nreverse(list_vec(vector(k, list_str(str)))); return generate(func_f0(state, rcomb_while_fun), func_f0(state, rcomb_str_gen_fun)); } @@ -92,7 +92,7 @@ val promise_s, promise_forced_s, promise_inprogress_s, force_s; val op_s, ap_s, identity_s, apf_s, ipf_s; val ret_s, aret_s; val hash_lit_s, hash_construct_s, struct_lit_s, qref_s; -val vector_lit_s, vector_list_s; +val vector_lit_s, vec_list_s; val macro_time_s, with_saved_vars_s, macrolet_s; val defsymacro_s, symacrolet_s, prof_s; val fbind_s, lbind_s, flet_s, labels_s; @@ -2284,7 +2284,7 @@ static val expand_qquote(val qquoted_form, val menv, return rlcp(list(hash_construct_s, args, pairs, nao), qquoted_form); } else if (sym == vector_lit_s) { val args = expand_qquote(second(qquoted_form), menv, qq, unq, spl); - return rlcp(list(vector_list_s, args, nao), qquoted_form); + return rlcp(list(vec_list_s, args, nao), qquoted_form); } else { val f = sym; val r = cdr(qquoted_form); @@ -4185,7 +4185,7 @@ void eval_init(void) struct_lit_s = intern(lit("struct-lit"), system_package); qref_s = intern(lit("qref"), user_package); vector_lit_s = intern(lit("vector-lit"), system_package); - vector_list_s = intern(lit("vector-list"), user_package); + vec_list_s = intern(lit("vec-list"), user_package); macro_time_s = intern(lit("macro-time"), user_package); macrolet_s = intern(lit("macrolet"), user_package); symacrolet_s = intern(lit("symacrolet"), user_package); @@ -4673,8 +4673,16 @@ void eval_init(void) reg_fun(intern(lit("chr-isxdigit"), user_package), func_n1(chr_isxdigit)); reg_fun(intern(lit("chr-toupper"), user_package), func_n1(chr_toupper)); reg_fun(intern(lit("chr-tolower"), user_package), func_n1(chr_tolower)); - reg_fun(intern(lit("num-chr"), user_package), func_n1(num_chr)); - reg_fun(intern(lit("chr-num"), user_package), func_n1(chr_num)); + { + val fun = func_n1(int_chr); + reg_fun(intern(lit("num-chr"), user_package), fun); /* OBS */ + reg_fun(intern(lit("int-chr"), user_package), fun); + } + { + val fun = func_n1(chr_int); + reg_fun(intern(lit("chr-num"), user_package), fun); /* OBS */ + reg_fun(intern(lit("chr-int"), user_package), fun); + } reg_fun(intern(lit("chr-str"), user_package), func_n2(chr_str)); reg_fun(intern(lit("chr-str-set"), user_package), func_n3(chr_str_set)); reg_fun(intern(lit("span-str"), user_package), func_n2(span_str)); @@ -4701,8 +4709,16 @@ void eval_init(void) reg_fun(intern(lit("vec-push"), user_package), func_n2(vec_push)); reg_fun(intern(lit("length-vec"), user_package), func_n1(length_vec)); reg_fun(intern(lit("size-vec"), user_package), func_n1(size_vec)); - reg_fun(vector_list_s, func_n1(vector_list)); - reg_fun(intern(lit("list-vector"), user_package), func_n1(list_vector)); + { + val fun = func_n1(vec_list); + reg_fun(intern(lit("vector-list"), user_package), fun); /* OBS */ + reg_fun(vec_list_s, fun); + } + { + val fun = func_n1(list_vec); + reg_fun(intern(lit("list-vector"), user_package), fun); /* OBS */ + reg_fun(intern(lit("list-vec"), user_package), fun); + } reg_fun(intern(lit("copy-vec"), user_package), func_n1(copy_vec)); reg_fun(intern(lit("sub-vec"), user_package), func_n3o(sub_vec, 1)); reg_fun(intern(lit("replace-vec"), user_package), func_n4o(replace_vec, 2)); @@ -24,7 +24,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -extern val dwim_s, lambda_s, vector_lit_s, vector_list_s, list_s; +extern val dwim_s, lambda_s, vector_lit_s, vec_list_s, list_s; extern val hash_lit_s, hash_construct_s, struct_lit_s, qref_s; extern val eval_error_s; extern val last_form_evaled, last_form_expanded; @@ -625,7 +625,7 @@ val url_encode(val str, val space_plus) else if (is_url_reserved(c)) format(out, lit("%~1X~1X"), num_fast(c >> 4), num_fast(c & 0xf), nao); else - put_char(chr_num(ch), out); + put_char(chr_int(ch), out); } return get_string_from_stream(out); @@ -621,7 +621,7 @@ val make_like(val list, val thatobj) if (list != thatobj) { switch (type(thatobj)) { case VEC: - return vector_list(list); + return vec_list(list); case STR: case LIT: case LSTR: @@ -663,7 +663,7 @@ val tolist(val seq) { switch (type(seq)) { case VEC: - return list_vector(seq); + return list_vec(seq); case STR: case LIT: case LSTR: @@ -916,7 +916,7 @@ val replace_list(val list, val items, val from, val to) val len = nil; if (vectorp(items)) - items = list_vector(items); + items = list_vec(items); else if (stringp(items)) items = list_str(items); else if (!listp(items)) @@ -986,7 +986,7 @@ val replace_list(val list, val items, val from, val to) if (!to || (len && ge(to, len))) { if (from && zerop(from)) { - return (listp(items)) ? items : list_vector(items); + return (listp(items)) ? items : list_vec(items); } else { val iter, i; list_collect_decl (out, ptail); @@ -998,7 +998,7 @@ val replace_list(val list, val items, val from, val to) } ptail = list_collect_nconc(ptail, if3(listp(items), - items, list_vector(items))); + items, list_vec(items))); return out; } } else { @@ -1013,7 +1013,7 @@ val replace_list(val list, val items, val from, val to) } ptail = list_collect_nconc(ptail, append2(if3(listp(items), items, - list_vector(items)), + list_vec(items)), iter)); return out; } @@ -3736,12 +3736,12 @@ val chr_tolower(val ch) return chr(towlower(c_chr(ch))); } -val num_chr(val ch) +val int_chr(val ch) { return num_fast(c_chr(ch)); } -val chr_num(val num) +val chr_int(val num) { cnum n = c_num(num); if (n < 0 || n > 0x10FFFF) @@ -5368,7 +5368,7 @@ val vectorv(struct args *args) return vec; } -val vector_list(val list) +val vec_list(val list) { val vec = vector(zero, nil); @@ -5381,7 +5381,7 @@ val vector_list(val list) return vec; } -val list_vector(val vec) +val list_vec(val vec) { list_collect_decl (list, ptail); int i, len; @@ -6191,7 +6191,7 @@ val interpose(val sep, val seq) case LSTR: return cat_str(interpose(sep, tolist(seq)), nil); case VEC: - return vector_list(interpose(sep, tolist(seq))); + return vec_list(interpose(sep, tolist(seq))); default: type_mismatch(lit("interpose: ~s is not a sequence"), seq, nao); } @@ -6334,7 +6334,7 @@ val shuffle(val seq) case LCONS: if (cdr(seq)) { - val v = shuffle(vector_list(seq)); + val v = shuffle(vec_list(seq)); val i, l; for (l = seq, i = zero; l; i = succ(i), l = cdr(l)) @@ -705,8 +705,8 @@ val chr_isupper(val ch); val chr_isxdigit(val ch); val chr_toupper(val ch); val chr_tolower(val ch); -val num_chr(val ch); -val chr_num(val num); +val int_chr(val ch); +val chr_int(val num); val chr_str(val str, val index); val chr_str_set(val str, val index, val chr); val span_str(val str, val set); @@ -812,8 +812,8 @@ val vec_push(val vec, val item); val length_vec(val vec); val size_vec(val vec); val vectorv(struct args *); -val vector_list(val list); -val list_vector(val vector); +val vec_list(val list); +val list_vec(val vector); val copy_vec(val vec); val sub_vec(val vec_in, val from, val to); val replace_vec(val vec_in, val items, val from, val to); @@ -714,7 +714,7 @@ vector : '#' list { if (unquotes_occur($2, 0)) $$ = rlcp(cons(vector_lit_s, cons($2, nil)), $2); else - $$ = rlcp(vector_list($2), $2); } + $$ = rlcp(vec_list($2), $2); } ; hash : HASH_H list { if (unquotes_occur($2, 0)) @@ -17031,10 +17031,10 @@ returns the lower case equivalent character. If it is some other character, then it just returns .metn char . -.coNP Functions @ num-chr and @ chr-num +.coNP Functions @ int-chr and @ chr-int .synb -.mets (num-chr << char ) -.mets (chr-num << num ) +.mets (int-chr << char ) +.mets (chr-int << num ) .syne .desc The argument @@ -17053,6 +17053,11 @@ to The argument is taken to be a Unicode code point value and the corresponding character object is returned. +Note: these functions are also known by the obsolescent names +.code num-chr +and +.codn chr-num . + .coNP Accessor @ chr-str .synb .mets (chr-str < str << idx ) @@ -17711,25 +17716,31 @@ The of the vector can be extended up to this size without any memory allocation operations having to be performed. -.coNP Function @ vector-list +.coNP Function @ vec-list .synb -.mets (vector-list << list ) +.mets (vec-list << list ) .syne .desc This function returns a vector which contains all of the same elements and in the same order as list .metn list . -.coNP Function @ list-vector +Note: this function is also known by the obsolescent name +.codn vector-list . + +.coNP Function @ list-vec .synb -.mets (list-vector << vec ) +.mets (list-vec << vec ) .syne .desc The -.code list-vector +.code list-vec function returns a list of the elements of vector .metn vec . +Note: this function is also known by the obsolescent name +.codn list-vector . + .coNP Function @ copy-vec .synb .mets (copy-vec << vec ) |