diff --git a/doc/todo b/doc/todo index 34b2110282eaf..1a2019236ec59 100644 --- a/doc/todo +++ b/doc/todo @@ -749,6 +749,15 @@ and emit a type check if we inline ------------------------------------------------------------------------------- +table updates +most general form is h[k] = f(get(h, k, default)) + +more efficient implementation would be: +i = findref(h,k) +putref(h,i,f(getref(h,i,default))) + +------------------------------------------------------------------------------- + issues 4/16/11 clone(Array{Any,1}) matches both diff --git a/src/ast.c b/src/ast.c index 1452eb31b20a2..071d4b529290e 100644 --- a/src/ast.c +++ b/src/ast.c @@ -69,7 +69,7 @@ value_t fl_invoke_julia_macro(value_t *args, uint32_t nargs) JL_GC_POP(); ios_printf(jl_current_output_stream(), "\n"); jl_show(jl_exception_in_transit); - ios_printf(jl_current_output_stream(), "\n"); + //ios_printf(jl_current_output_stream(), "\n"); return fl_cons(symbol("error"), FL_NIL); } // protect result from GC, otherwise it could be freed during future diff --git a/src/flisp/string.c b/src/flisp/string.c index 7859d959fb912..76a80170add7e 100644 --- a/src/flisp/string.c +++ b/src/flisp/string.c @@ -386,6 +386,14 @@ value_t fl_stringtonumber(value_t *args, uint32_t nargs) return n; } +value_t fl_string_isutf8(value_t *args, u_int32_t nargs) +{ + argcount("string.isutf8", nargs, 1); + char *s = tostring(args[0], "string.isutf8"); + size_t len = cv_len((cvalue_t*)ptr(args[0])); + return u8_isvalid(s, len) ? FL_T : FL_F; +} + static builtinspec_t stringfunc_info[] = { { "string", fl_string }, { "string?", fl_stringp }, @@ -400,6 +408,7 @@ static builtinspec_t stringfunc_info[] = { { "string.reverse", fl_string_reverse }, { "string.encode", fl_string_encode }, { "string.decode", fl_string_decode }, + { "string.isutf8", fl_string_isutf8 }, { "char.upcase", fl_char_upcase }, { "char.downcase", fl_char_downcase }, diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 17a08c1724e7c..99894caa8bf2e 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -1017,7 +1017,10 @@ (let ((ps (parse-string-literal s))) (if (cdr ps) `(macrocall str ,(car ps)) - (unescape-string (car ps))))) + (let ((str (unescape-string (car ps)))) + (if (not (string.isutf8 str)) + (error "invalid utf-8 sequence")) + str)))) ;; macro call ((eqv? t #\@)