Merge branch 'master' into arrays
authorDavid Vázquez <davazp@gmail.com>
Tue, 4 Jun 2013 02:01:03 +0000 (03:01 +0100)
committerDavid Vázquez <davazp@gmail.com>
Tue, 4 Jun 2013 02:01:03 +0000 (03:01 +0100)
Conflicts:
jscl.lisp
src/prelude.js

1  2 
jscl.lisp
src/compiler.lisp
src/prelude.js

diff --cc jscl.lisp
+++ b/jscl.lisp
    '(("boot"             :target)
      ("compat"           :host)
      ("utils"            :both)
 +    ("numbers"          :target)
++    ("char"             :target)
      ("list"             :target)
 +    ("array"            :target)
      ("string"           :target)
      ("sequence"         :target)
      ("print"            :target)
    (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
@@@ -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;
  }