From: David Vázquez Date: Tue, 4 Jun 2013 02:01:03 +0000 (+0100) Subject: Merge branch 'master' into arrays X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=9b7eba02ada6840ce6b7cd272e6d3b9bc521180b;p=jscl.git Merge branch 'master' into arrays Conflicts: jscl.lisp src/prelude.js --- 9b7eba02ada6840ce6b7cd272e6d3b9bc521180b diff --cc jscl.lisp index 8cc5f71,c975422..4b2ac4a --- a/jscl.lisp +++ b/jscl.lisp @@@ -26,9 -26,7 +26,10 @@@ '(("boot" :target) ("compat" :host) ("utils" :both) + ("numbers" :target) ++ ("char" :target) ("list" :target) + ("array" :target) ("string" :target) ("sequence" :target) ("print" :target) diff --cc src/compiler.lisp index 40a5b2b,e2f9fca..1fb6305 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@@ -1188,13 -1188,19 +1188,13 @@@ (js!bool (js!selfcall "var x = " x ";" *newline* - "return (typeof(" x ") == \"string\") && x.length == 1;"))) + "return (typeof(" x ") == \"string\") && (x.length == 1 || x.length == 2);"))) -(define-builtin char-to-string (x) - (js!selfcall - "var r = [" x "];" *newline* - "r.type = 'character';" - "return r")) - (define-builtin char-upcase (x) - (code x ".toUpperCase()")) + (code "safe_char_upcase(" x ")")) (define-builtin char-downcase (x) - (code x ".toLowerCase()")) + (code "safe_char_downcase(" x ")")) (define-builtin stringp (x) (js!bool diff --cc src/prelude.js index 433462b,162058e..c40d0fa --- a/src/prelude.js +++ b/src/prelude.js @@@ -54,8 -58,8 +58,8 @@@ function codepoints(string) // Create and return a lisp string for the Javascript string STRING. function make_lisp_string (string){ - var array = string.split(""); - array.stringp = 1; + var array = codepoints(string); - array.type = 'character' ++ array.stringp = 1 return array; }