X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler.lisp;h=5dd008450f4cee085234367a209f1b967d2b55cb;hb=928c6f695253c9f03ff440d18338efb8eea9b2f0;hp=aca3a2be3905c9cb3f6041d6c5d54b1d2efc9713;hpb=72a15805ea06efb88cf7d1dd5958617349aaf8f5;p=jscl.git diff --git a/src/compiler.lisp b/src/compiler.lisp index aca3a2b..5dd0084 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -1431,12 +1431,6 @@ "var x = " x ";" *newline* "return (typeof(" x ") == \"string\") && x.length == 1;"))) -(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()")) @@ -1447,14 +1441,11 @@ (js!bool (js!selfcall "var x = " x ";" *newline* - "return typeof(x) == 'object' && 'length' in x && x.type == 'character';"))) + "return typeof(x) == 'object' && 'length' in x && x.stringp == 1;"))) (define-builtin string-upcase (x) (code "make_lisp_string(xstring(" x ").toUpperCase())")) -(define-builtin string-length (x) - (code x ".length")) - (define-raw-builtin slice (vector a &optional b) (js!selfcall "var vector = " (ls-compile vector) ";" *newline* @@ -1469,7 +1460,7 @@ (define-builtin concat-two (string1 string2) (js!selfcall "var r = " string1 ".concat(" string2 ");" *newline* - "r.type = 'character';" + "r.stringp = 1;" "return r;" *newline*)) (define-raw-builtin funcall (func &rest args) @@ -1580,40 +1571,6 @@ "return x[i] = " value ";" *newline*)) -;;; FIXME: should take optional min-extension. -;;; FIXME: should use fill-pointer instead of the absolute end of array -(define-builtin vector-push-extend (new vector) - (js!selfcall - "var v = " vector ";" *newline* - "v.push(" new ");" *newline* - "return v;")) - -(define-builtin aref (array n) - (js!selfcall - "var x = " "(" array ")[" n "];" *newline* - "if (x === undefined) throw 'Out of range';" *newline* - "return x;" *newline*)) - -(define-builtin aset (array n value) - (js!selfcall - "var x = " array ";" *newline* - "var i = " n ";" *newline* - "if (i < 0 || i >= x.length) throw 'Out of range';" *newline* - "return x[i] = " value ";" *newline*)) - -(define-builtin afind (value array) - (js!selfcall - "var v = " value ";" *newline* - "var x = " array ";" *newline* - "return x.indexOf(v);" *newline*)) - -(define-builtin aresize (array new-size) - (js!selfcall - "var x = " array ";" *newline* - "var n = " new-size ";" *newline* - "return x.length = n;" *newline*)) - - (define-builtin get-internal-real-time () "(new Date()).getTime()")