X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler.lisp;h=5dd008450f4cee085234367a209f1b967d2b55cb;hb=928c6f695253c9f03ff440d18338efb8eea9b2f0;hp=7fffe4268efef737ba3022817a2b365462828d1f;hpb=bdc0646398f2719675159778dcb77924fc94374b;p=jscl.git diff --git a/src/compiler.lisp b/src/compiler.lisp index 7fffe42..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,27 +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 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()")